diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Protocol/Protocol_1_11.cpp | 12 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 32 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 7 |
3 files changed, 15 insertions, 36 deletions
diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp index 7a9a53e6f..2ccc4483a 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -609,10 +609,6 @@ void cProtocol_1_11_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) void cProtocol_1_11_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) const { - a_Writer.AddInt("x", a_BlockEntity.GetPosX()); - a_Writer.AddInt("y", a_BlockEntity.GetPosY()); - a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); - switch (a_BlockEntity.GetBlockType()) { case E_BLOCK_BED: @@ -621,7 +617,6 @@ void cProtocol_1_11_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockE a_Writer.AddInt("color", BedEntity.GetColor()); // New: multicoloured beds break; } - case E_BLOCK_MOB_SPAWNER: { auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity); @@ -631,9 +626,12 @@ void cProtocol_1_11_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockE a_Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay()); break; } - - default: Super::WriteBlockEntity(a_Writer, a_BlockEntity); + default: return Super::WriteBlockEntity(a_Writer, a_BlockEntity); } + + a_Writer.AddInt("x", a_BlockEntity.GetPosX()); + a_Writer.AddInt("y", a_BlockEntity.GetPosY()); + a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); } diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index a00ce20c9..755bcb969 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -3089,10 +3089,6 @@ void cProtocol_1_8_0::SendPacket(cPacketizer & a_Pkt) void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) const { - a_Writer.AddInt("x", a_BlockEntity.GetPosX()); - a_Writer.AddInt("y", a_BlockEntity.GetPosY()); - a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); - switch (a_BlockEntity.GetBlockType()) { case E_BLOCK_WALL_BANNER: @@ -3102,16 +3098,12 @@ void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEn a_Writer.AddInt("Base", static_cast<Int32>(BannerEntity.GetBaseColor())); break; } - case E_BLOCK_BEACON: + case E_BLOCK_CHEST: { - auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity); - a_Writer.AddInt("Primary", BeaconEntity.GetPrimaryEffect()); - a_Writer.AddInt("Secondary", BeaconEntity.GetSecondaryEffect()); - a_Writer.AddInt("Levels", BeaconEntity.GetBeaconLevel()); + // Nothing! break; } - case E_BLOCK_COMMAND_BLOCK: { auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity); @@ -3128,23 +3120,12 @@ void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEn } break; } - case E_BLOCK_ENCHANTMENT_TABLE: - { - auto & EnchantingTableEntity = static_cast<const cEnchantingTableEntity &>(a_BlockEntity); - if (!EnchantingTableEntity.GetCustomName().empty()) - { - a_Writer.AddString("CustomName", EnchantingTableEntity.GetCustomName()); - } - break; - } - case E_BLOCK_END_PORTAL: { // Nothing! break; } - case E_BLOCK_HEAD: { auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity); @@ -3166,7 +3147,6 @@ void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEn a_Writer.EndCompound(); break; } - case E_BLOCK_FLOWER_POT: { auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity); @@ -3174,7 +3154,6 @@ void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEn a_Writer.AddInt("Data", static_cast<Int32>(FlowerPotEntity.GetItem().m_ItemDamage)); break; } - case E_BLOCK_MOB_SPAWNER: { auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity); @@ -3182,12 +3161,15 @@ void cProtocol_1_8_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEn a_Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay()); break; } - default: { - break; + return; } } + + a_Writer.AddInt("x", a_BlockEntity.GetPosX()); + a_Writer.AddInt("y", a_BlockEntity.GetPosY()); + a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); } diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index a36e3f53d..d7488a3a6 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -1482,13 +1482,12 @@ void cProtocol_1_9_0::SendEntitySpawn(const cEntity & a_Entity, const UInt8 a_Ob void cProtocol_1_9_0::WriteBlockEntity(cFastNBTWriter & a_Writer, const cBlockEntity & a_BlockEntity) const { - a_Writer.AddInt("x", a_BlockEntity.GetPosX()); - a_Writer.AddInt("y", a_BlockEntity.GetPosY()); - a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); - if (a_BlockEntity.GetBlockType() == E_BLOCK_MOB_SPAWNER) { auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity); + a_Writer.AddInt("x", a_BlockEntity.GetPosX()); + a_Writer.AddInt("y", a_BlockEntity.GetPosY()); + a_Writer.AddInt("z", a_BlockEntity.GetPosZ()); a_Writer.BeginCompound("SpawnData"); // New: SpawnData compound a_Writer.AddString("id", cMonster::MobTypeToVanillaName(MobSpawnerEntity.GetEntity())); a_Writer.EndCompound(); |