diff options
author | Mat <mail@mathias.is> | 2020-03-29 17:54:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 17:54:37 +0200 |
commit | 31ace87d285d14f8799bc45ab5c812822854d0dd (patch) | |
tree | ee891fd5ec2b9d391f803e3d9dfed541df53179d /src/Protocol/Protocol_1_8.cpp | |
parent | Fix build on Clang (diff) | |
download | cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar.gz cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar.bz2 cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar.lz cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar.xz cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.tar.zst cuberite-31ace87d285d14f8799bc45ab5c812822854d0dd.zip |
Diffstat (limited to 'src/Protocol/Protocol_1_8.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 4d70eadfa..d381f0a42 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -23,6 +23,7 @@ Implements the 1.8 protocol classes: #include "../CompositeChat.h" #include "../Statistics.h" #include "../UUID.h" +#include "../World.h" #include "../WorldStorage/FastNBT.h" #include "../WorldStorage/EnchantmentSerializer.h" @@ -1347,7 +1348,7 @@ void cProtocol_1_8_0::SendSpawnMob(const cMonster & a_Mob) cPacketizer Pkt(*this, pktSpawnMob); Pkt.WriteVarInt32(a_Mob.GetUniqueID()); - Pkt.WriteBEUInt8(static_cast<Byte>(a_Mob.GetMobType())); + Pkt.WriteBEUInt8(static_cast<Byte>(GetProtocolMobType(a_Mob.GetMobType()))); Vector3d LastSentPos = a_Mob.GetLastSentPos(); Pkt.WriteFPInt(LastSentPos.x); Pkt.WriteFPInt(LastSentPos.y); @@ -1827,6 +1828,51 @@ int cProtocol_1_8_0::GetParticleID(const AString & a_ParticleName) +UInt32 cProtocol_1_8_0::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 52; + case mtBat: return 65; + case mtBlaze: return 61; + case mtCaveSpider: return 59; + case mtChicken: return 93; + case mtCow: return 92; + case mtCreeper: return 50; + case mtEnderDragon: return 63; + case mtEnderman: return 58; + case mtGhast: return 56; + case mtGiant: return 53; + case mtGuardian: return 68; + case mtHorse: return 100; + case mtIronGolem: return 99; + case mtMagmaCube: return 62; + case mtMooshroom: return 96; + case mtOcelot: return 98; + case mtPig: return 90; + case mtRabbit: return 101; + case mtSheep: return 91; + case mtSilverfish: return 60; + case mtSkeleton: return 51; + case mtSlime: return 55; + case mtSnowGolem: return 97; + case mtSpider: return 52; + case mtSquid: return 94; + case mtVillager: return 120; + case mtWitch: return 66; + case mtWither: return 64; + case mtWolf: return 95; + case mtZombie: return 54; + case mtZombiePigman: return 57; + } + UNREACHABLE("Unsupported mob type"); +} + + + + + void cProtocol_1_8_0::FixItemFramePositions(int a_ObjectData, double & a_PosX, double & a_PosZ, double & a_Yaw) { switch (a_ObjectData) |