summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
author12xx12 <12xx12100@gmail.com>2020-09-17 16:16:20 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-20 02:40:20 +0200
commitf8de67aace4e65ff4c34a1f46f6d8b258b6839aa (patch)
tree51f60dd89e5abb7bcf14e11f087ef2d49c1fa096 /src/Protocol
parentFixed missing case: in entity damaging crashin the server (#4899) (diff)
downloadcuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar.gz
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar.bz2
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar.lz
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar.xz
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.tar.zst
cuberite-f8de67aace4e65ff4c34a1f46f6d8b258b6839aa.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol_1_13.cpp26
-rw-r--r--src/Protocol/Protocol_1_8.cpp40
2 files changed, 49 insertions, 17 deletions
diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp
index 9a7202f02..0259565f5 100644
--- a/src/Protocol/Protocol_1_13.cpp
+++ b/src/Protocol/Protocol_1_13.cpp
@@ -205,18 +205,22 @@ void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
Byte Action = 0;
switch (a_BlockEntity.GetBlockType())
{
- case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
- case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
- case E_BLOCK_BEACON: Action = 3; break; // Update beacon entity
- case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
- // case E_BLOCK_CONDUIT: Action = 5; break; // Update Conduit entity
+ case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
+ case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
+ case E_BLOCK_BEACON: Action = 3; break; // Update beacon entity
+ case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
+ // case E_BLOCK_CONDUIT: Action = 5; break; // Update Conduit entity
case E_BLOCK_STANDING_BANNER:
- case E_BLOCK_WALL_BANNER: Action = 6; break; // Update banner entity
- // case Structure Block: Action = 7; break; // Update Structure tile entity
- case E_BLOCK_END_GATEWAY: Action = 8; break; // Update destination for a end gateway entity
- case E_BLOCK_SIGN_POST: Action = 9; break; // Update sign entity
- // case E_BLOCK_SHULKER_BOX:Action = 10; break; // sets shulker box - not used just here if anyone is confused from reading the protocol wiki
- case E_BLOCK_BED: Action = 11; break; // Update bed color
+ case E_BLOCK_WALL_BANNER: Action = 6; break; // Update banner entity
+ // case Structure Block: Action = 7; break; // Update Structure tile entity
+ case E_BLOCK_END_GATEWAY: Action = 8; break; // Update destination for a end gateway entity
+ case E_BLOCK_SIGN_POST: Action = 9; break; // Update sign entity
+ // case E_BLOCK_SHULKER_BOX: Action = 10; break; // sets shulker box - not used just here if anyone is confused from reading the protocol wiki
+ case E_BLOCK_BED: Action = 11; break; // Update bed color
+
+ case E_BLOCK_ENCHANTMENT_TABLE: Action = 0; break; // The ones with a action of 0 is just a workaround to send the block entities to a client.
+ case E_BLOCK_END_PORTAL: Action = 0; break; // Todo: 18.09.2020 - remove this when block entities are transmitted in the ChunkData packet - 12xx12
+
default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break;
}
Pkt.WriteBEUInt8(Action);
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index 1c98d83f3..c6b21fc3d 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -43,6 +43,7 @@ Implements the 1.8 protocol classes:
#include "../BlockEntities/BeaconEntity.h"
#include "../BlockEntities/CommandBlockEntity.h"
+#include "../BlockEntities/EnchantingTableEntity.h"
#include "../BlockEntities/MobHeadEntity.h"
#include "../BlockEntities/MobSpawnerEntity.h"
#include "../BlockEntities/FlowerPotEntity.h"
@@ -1529,12 +1530,16 @@ void cProtocol_1_8_0::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
Byte Action = 0;
switch (a_BlockEntity.GetBlockType())
{
- case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
- case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
- case E_BLOCK_BEACON: Action = 3; break; // Update beacon entity
- case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
- case E_BLOCK_FLOWER_POT: Action = 5; break; // Update flower pot
- case E_BLOCK_BED: Action = 11; break; // Update bed color
+ case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
+ case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
+ case E_BLOCK_BEACON: Action = 3; break; // Update beacon entity
+ case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
+ case E_BLOCK_FLOWER_POT: Action = 5; break; // Update flower pot
+ case E_BLOCK_BED: Action = 11; break; // Update bed color
+
+ case E_BLOCK_ENCHANTMENT_TABLE: Action = 0; break; // The ones with a action of 0 is just a workaround to send the block entities to a client.
+ case E_BLOCK_END_PORTAL: Action = 0; break; // Todo: 18.09.2020 - remove this when block entities are transmitted in the ChunkData packet - 12xx12
+
default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break;
}
Pkt.WriteBEUInt8(Action);
@@ -3395,6 +3400,29 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
break;
}
+ case E_BLOCK_ENCHANTMENT_TABLE:
+ {
+ auto & EnchantingTableEntity = static_cast<const cEnchantingTableEntity &>(a_BlockEntity);
+ Writer.AddInt("x", EnchantingTableEntity.GetPosX());
+ Writer.AddInt("y", EnchantingTableEntity.GetPosY());
+ Writer.AddInt("z", EnchantingTableEntity.GetPosZ());
+ if (!EnchantingTableEntity.GetCustomName().empty())
+ {
+ Writer.AddString("CustomName", EnchantingTableEntity.GetCustomName());
+ }
+ Writer.AddString("id", "EnchantingTable");
+ break;
+ }
+
+ case E_BLOCK_END_PORTAL:
+ {
+ Writer.AddInt("x", a_BlockEntity.GetPosX());
+ Writer.AddInt("y", a_BlockEntity.GetPosY());
+ Writer.AddInt("z", a_BlockEntity.GetPosZ());
+ Writer.AddString("id", "EndPortal");
+ break;
+ }
+
case E_BLOCK_HEAD:
{
auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);