diff options
author | peterbell10 <peterbell10@live.co.uk> | 2018-05-02 09:50:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 09:50:36 +0200 |
commit | a4dbb5c58270959884c17d720185da06464fa256 (patch) | |
tree | 2b4e81410e90e059f51726e6c9a01c03fcbfb98d /src/Protocol/Protocol_1_10.cpp | |
parent | tolua++ bindings use nullptr. (#4219) (diff) | |
download | cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.gz cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.bz2 cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.lz cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.xz cuberite-a4dbb5c58270959884c17d720185da06464fa256.tar.zst cuberite-a4dbb5c58270959884c17d720185da06464fa256.zip |
Diffstat (limited to 'src/Protocol/Protocol_1_10.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_10.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp index a16ad3143..d260feca8 100644 --- a/src/Protocol/Protocol_1_10.cpp +++ b/src/Protocol/Protocol_1_10.cpp @@ -398,7 +398,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & { case cEntity::etPlayer: { - auto & Player = reinterpret_cast<const cPlayer &>(a_Entity); + auto & Player = static_cast<const cPlayer &>(a_Entity); // TODO Set player custom name to their name. // Then it's possible to move the custom name of mobs to the entities @@ -424,7 +424,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & { a_Pkt.WriteBEUInt8(ITEM_ITEM); a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM); - WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem()); + WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem()); break; } case cEntity::etMinecart: @@ -433,7 +433,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); // The following expression makes Minecarts shake more with less health or higher damage taken - auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity); + auto & Minecart = static_cast<const cMinecart &>(a_Entity); auto maxHealth = a_Entity.GetMaxHealth(); auto curHealth = a_Entity.GetHealth(); a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4)); @@ -448,7 +448,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & if (Minecart.GetPayload() == cMinecart::mpNone) { - auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart); + auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart); const cItem & MinecartContent = RideableMinecart.GetContent(); if (!MinecartContent.IsEmpty()) { @@ -471,35 +471,35 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & { a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); - a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled()); + a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled()); } break; } // case etMinecart case cEntity::etProjectile: { - auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity); + auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity); switch (Projectile.GetProjectileKind()) { case cProjectileEntity::pkArrow: { a_Pkt.WriteBEUInt8(ARROW_CRITICAL); a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE); - a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0); + a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0); break; } case cProjectileEntity::pkFirework: { a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM); - WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem()); + WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem()); break; } case cProjectileEntity::pkSplashPotion: { a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM); - WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem()); + WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem()); } default: { @@ -511,13 +511,13 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & case cEntity::etMonster: { - WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity)); + WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity)); break; } case cEntity::etBoat: { - auto & Boat = reinterpret_cast<const cBoat &>(a_Entity); + auto & Boat = static_cast<const cBoat &>(a_Entity); a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME); a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT); @@ -548,7 +548,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & case cEntity::etItemFrame: { - auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity); + auto & Frame = static_cast<const cItemFrame &>(a_Entity); a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM); a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM); WriteItem(a_Pkt, Frame.GetItem()); @@ -577,7 +577,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity { case E_BLOCK_BEACON: { - auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity); + auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity); Writer.AddInt("x", BeaconEntity.GetPosX()); Writer.AddInt("y", BeaconEntity.GetPosY()); Writer.AddInt("z", BeaconEntity.GetPosZ()); @@ -590,7 +590,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity case E_BLOCK_COMMAND_BLOCK: { - auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity); + auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity); Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult()); Writer.AddInt("x", CommandBlockEntity.GetPosX()); @@ -611,7 +611,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity case E_BLOCK_HEAD: { - auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity); + auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity); Writer.AddInt("x", MobHeadEntity.GetPosX()); Writer.AddInt("y", MobHeadEntity.GetPosY()); Writer.AddInt("z", MobHeadEntity.GetPosZ()); @@ -637,7 +637,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity case E_BLOCK_FLOWER_POT: { - auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity); + auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity); Writer.AddInt("x", FlowerPotEntity.GetPosX()); Writer.AddInt("y", FlowerPotEntity.GetPosY()); Writer.AddInt("z", FlowerPotEntity.GetPosZ()); @@ -649,7 +649,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity case E_BLOCK_MOB_SPAWNER: { - auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity); + auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity); Writer.AddInt("x", MobSpawnerEntity.GetPosX()); Writer.AddInt("y", MobSpawnerEntity.GetPosY()); Writer.AddInt("z", MobSpawnerEntity.GetPosZ()); @@ -700,7 +700,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ { case mtBat: { - auto & Bat = reinterpret_cast<const cBat &>(a_Mob); + auto & Bat = static_cast<const cBat &>(a_Mob); a_Pkt.WriteBEUInt8(BAT_HANGING); a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE); a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0); @@ -709,7 +709,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtChicken: { - auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob); + auto & Chicken = static_cast<const cChicken &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); @@ -719,7 +719,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtCow: { - auto & Cow = reinterpret_cast<const cCow &>(a_Mob); + auto & Cow = static_cast<const cCow &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); @@ -729,7 +729,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtCreeper: { - auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob); + auto & Creeper = static_cast<const cCreeper &>(a_Mob); a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing") a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1)); @@ -746,7 +746,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtEnderman: { - auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob); + auto & Enderman = static_cast<const cEnderman &>(a_Mob); a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK); a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID); UInt32 Carried = 0; @@ -762,7 +762,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtGhast: { - auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob); + auto & Ghast = static_cast<const cGhast &>(a_Mob); a_Pkt.WriteBEUInt8(GHAST_ATTACKING); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Ghast.IsCharging()); @@ -771,7 +771,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtHorse: { - auto & Horse = reinterpret_cast<const cHorse &>(a_Mob); + auto & Horse = static_cast<const cHorse &>(a_Mob); Int8 Flags = 0; if (Horse.IsTame()) { @@ -824,7 +824,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtMagmaCube: { - auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob); + auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob); a_Pkt.WriteBEUInt8(SLIME_SIZE); a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize())); @@ -833,7 +833,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtOcelot: { - auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob); + auto & Ocelot = static_cast<const cOcelot &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); @@ -843,7 +843,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtPig: { - auto & Pig = reinterpret_cast<const cPig &>(a_Mob); + auto & Pig = static_cast<const cPig &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); @@ -858,7 +858,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtRabbit: { - auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob); + auto & Rabbit = static_cast<const cRabbit &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Rabbit.IsBaby()); @@ -871,7 +871,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtSheep: { - auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob); + auto & Sheep = static_cast<const cSheep &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); @@ -891,7 +891,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtSkeleton: { - auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob); + auto & Skeleton = static_cast<const cSkeleton &>(a_Mob); a_Pkt.WriteBEUInt8(SKELETON_TYPE); a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0); @@ -900,7 +900,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtSlime: { - auto & Slime = reinterpret_cast<const cSlime &>(a_Mob); + auto & Slime = static_cast<const cSlime &>(a_Mob); a_Pkt.WriteBEUInt8(SLIME_SIZE); a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize())); @@ -909,7 +909,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtVillager: { - auto & Villager = reinterpret_cast<const cVillager &>(a_Mob); + auto & Villager = static_cast<const cVillager &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Villager.IsBaby()); @@ -922,7 +922,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtWitch: { - auto & Witch = reinterpret_cast<const cWitch &>(a_Mob); + auto & Witch = static_cast<const cWitch &>(a_Mob); a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Witch.IsAngry()); @@ -931,7 +931,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtWither: { - auto & Wither = reinterpret_cast<const cWither &>(a_Mob); + auto & Wither = static_cast<const cWither &>(a_Mob); a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER); a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT); a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks()); @@ -942,7 +942,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtWolf: { - auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob); + auto & Wolf = static_cast<const cWolf &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Wolf.IsBaby()); @@ -980,7 +980,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtZombie: { - auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob); + auto & Zombie = static_cast<const cZombie &>(a_Mob); a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(Zombie.IsBaby()); @@ -997,7 +997,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_ case mtZombiePigman: { - auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob); + auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob); a_Pkt.WriteBEUInt8(AGEABLE_BABY); a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); a_Pkt.WriteBool(ZombiePigman.IsBaby()); |