From 31ace87d285d14f8799bc45ab5c812822854d0dd Mon Sep 17 00:00:00 2001 From: Mat Date: Sun, 29 Mar 2020 18:54:37 +0300 Subject: Add protocol mob ID remapping (#4538) --- src/Protocol/Protocol_1_13.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/Protocol/Protocol_1_13.cpp') diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp index f058e8d59..5aa23e763 100644 --- a/src/Protocol/Protocol_1_13.cpp +++ b/src/Protocol/Protocol_1_13.cpp @@ -26,6 +26,7 @@ Implements the 1.13 protocol classes: #include "../ClientHandle.h" #include "../Root.h" #include "../Server.h" +#include "../World.h" #include "../Bindings/PluginManager.h" @@ -395,6 +396,51 @@ void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) +UInt32 cProtocol_1_13::GetProtocolMobType(eMonsterType a_MobType) +{ + switch (a_MobType) + { + // Map invalid type to Giant for easy debugging (if this ever spawns, something has gone very wrong) + case mtInvalidType: return 27; + case mtBat: return 3; + case mtBlaze: return 4; + case mtCaveSpider: return 6; + case mtChicken: return 7; + case mtCow: return 9; + case mtCreeper: return 10; + case mtEnderDragon: return 17; + case mtEnderman: return 18; + case mtGhast: return 26; + case mtGiant: return 27; + case mtGuardian: return 28; + case mtHorse: return 29; + case mtIronGolem: return 80; + case mtMagmaCube: return 38; + case mtMooshroom: return 47; + case mtOcelot: return 48; + case mtPig: return 51; + case mtRabbit: return 56; + case mtSheep: return 58; + case mtSilverfish: return 61; + case mtSkeleton: return 62; + case mtSlime: return 64; + case mtSnowGolem: return 66; + case mtSpider: return 69; + case mtSquid: return 70; + case mtVillager: return 79; + case mtWitch: return 82; + case mtWither: return 83; + case mtWolf: return 86; + case mtZombie: return 87; + case mtZombiePigman: return 53; + } + UNREACHABLE("Unsupported mob type"); +} + + + + + bool cProtocol_1_13::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) { HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt16, Int16, ItemType); -- cgit v1.2.3