From f8de67aace4e65ff4c34a1f46f6d8b258b6839aa Mon Sep 17 00:00:00 2001 From: 12xx12 <12xx12100@gmail.com> Date: Thu, 17 Sep 2020 16:16:20 +0200 Subject: Added end portal and enchanting table block entities --- src/Protocol/Protocol_1_8.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'src/Protocol/Protocol_1_8.cpp') 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(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(a_BlockEntity); -- cgit v1.2.3