diff options
Diffstat (limited to '')
-rw-r--r-- | src/Entities/ArrowEntity.cpp | 11 | ||||
-rw-r--r-- | src/Entities/ArrowEntity.h | 1 | ||||
-rw-r--r-- | src/Entities/Boat.cpp | 2 | ||||
-rw-r--r-- | src/Entities/EnderCrystal.cpp | 2 | ||||
-rw-r--r-- | src/Entities/FallingBlock.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Floater.cpp | 4 | ||||
-rw-r--r-- | src/Entities/ItemFrame.cpp | 6 | ||||
-rw-r--r-- | src/Entities/LeashKnot.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Minecart.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Pickup.cpp | 3 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 5 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.h | 27 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.cpp | 15 | ||||
-rw-r--r-- | src/Entities/SplashPotionEntity.h | 2 | ||||
-rw-r--r-- | src/Entities/TNTEntity.cpp | 4 |
15 files changed, 26 insertions, 62 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp index e0d1cebc1..17c915742 100644 --- a/src/Entities/ArrowEntity.cpp +++ b/src/Entities/ArrowEntity.cpp @@ -3,7 +3,6 @@ #include "Player.h" #include "ArrowEntity.h" #include "../Chunk.h" -#include "../ClientHandle.h" @@ -161,16 +160,6 @@ void cArrowEntity::CollectedBy(cPlayer & a_Dest) -void cArrowEntity::SpawnOn(cClientHandle & a_Client) -{ - a_Client.SendSpawnObject(*this, m_ProjectileKind, static_cast<int>(m_CreatorData.m_UniqueID + 1)); - a_Client.SendEntityMetadata(*this); -} - - - - - void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { Super::Tick(a_Dt, a_Chunk); diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h index 8576ca002..474932514 100644 --- a/src/Entities/ArrowEntity.h +++ b/src/Entities/ArrowEntity.h @@ -108,7 +108,6 @@ protected: virtual void OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace) override; virtual void OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos) override; virtual void CollectedBy(cPlayer & a_Player) override; - virtual void SpawnOn(cClientHandle & a_Client) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; }; // tolua_export diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp index d5ccd7359..872b7e4d4 100644 --- a/src/Entities/Boat.cpp +++ b/src/Entities/Boat.cpp @@ -33,7 +33,7 @@ cBoat::cBoat(Vector3d a_Pos, eMaterial a_Material) : void cBoat::SpawnOn(cClientHandle & a_ClientHandle) { - a_ClientHandle.SendSpawnVehicle(*this, 1); + a_ClientHandle.SendSpawnEntity(*this); } diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp index 11273f818..4f2bd857f 100644 --- a/src/Entities/EnderCrystal.cpp +++ b/src/Entities/EnderCrystal.cpp @@ -22,7 +22,7 @@ cEnderCrystal::cEnderCrystal(Vector3d a_Pos): void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle) { - a_ClientHandle.SendSpawnObject(*this, 51, 0); + a_ClientHandle.SendSpawnEntity(*this); } diff --git a/src/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp index ed0661dae..dd3ba59cc 100644 --- a/src/Entities/FallingBlock.cpp +++ b/src/Entities/FallingBlock.cpp @@ -26,7 +26,7 @@ cFallingBlock::cFallingBlock(Vector3d a_Position, BLOCKTYPE a_BlockType, NIBBLET void cFallingBlock::SpawnOn(cClientHandle & a_ClientHandle) { - a_ClientHandle.SendSpawnFallingBlock(*this); + a_ClientHandle.SendSpawnEntity(*this); } diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index 3982a1ca5..bd1e7a637 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -92,7 +92,7 @@ cFloater::cFloater(Vector3d a_Pos, Vector3d a_Speed, UInt32 a_PlayerID, int a_Co void cFloater::SpawnOn(cClientHandle & a_Client) { - a_Client.SendSpawnObject(*this, 90, static_cast<int>(m_PlayerID)); + a_Client.SendSpawnEntity(*this); } @@ -107,7 +107,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) if (IsBlockWater(m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT)) && (m_World->GetBlockMeta(POSX_TOINT, POSY_TOINT, POSZ_TOINT) == 0)) { - if ((!m_CanPickupItem) && (m_AttachedMobID == cEntity::INVALID_ID)) // Check if you can't already pickup a fish and if the floater isn't attached to a mob. + if (!m_CanPickupItem && (m_AttachedMobID == cEntity::INVALID_ID)) // Check if you can't already pickup a fish and if the floater isn't attached to a mob. { if (m_CountDownTime <= 0) { diff --git a/src/Entities/ItemFrame.cpp b/src/Entities/ItemFrame.cpp index aaac0e88b..807a67b15 100644 --- a/src/Entities/ItemFrame.cpp +++ b/src/Entities/ItemFrame.cpp @@ -95,10 +95,6 @@ void cItemFrame::GetDrops(cItems & a_Items, cEntity * a_Killer) void cItemFrame::SpawnOn(cClientHandle & a_ClientHandle) { Super::SpawnOn(a_ClientHandle); - a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing()); + a_ClientHandle.SendSpawnEntity(*this); a_ClientHandle.SendEntityMetadata(*this); } - - - - diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp index b11c29703..2c91c5613 100644 --- a/src/Entities/LeashKnot.cpp +++ b/src/Entities/LeashKnot.cpp @@ -107,7 +107,7 @@ void cLeashKnot::GetDrops(cItems & a_Items, cEntity * a_Killer) void cLeashKnot::SpawnOn(cClientHandle & a_ClientHandle) { Super::SpawnOn(a_ClientHandle); - a_ClientHandle.SendSpawnObject(*this, 77, GetProtocolFacing()); + a_ClientHandle.SendSpawnEntity(*this); a_ClientHandle.SendEntityMetadata(*this); } diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 35bbdf617..8b93dc28c 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -116,7 +116,7 @@ cMinecart::cMinecart(ePayload a_Payload, Vector3d a_Pos): void cMinecart::SpawnOn(cClientHandle & a_ClientHandle) { - a_ClientHandle.SendSpawnVehicle(*this, 10, static_cast<char>(m_Payload)); // 10 = Minecarts + a_ClientHandle.SendSpawnEntity(*this); a_ClientHandle.SendEntityMetadata(*this); } diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index 5c8d58f21..785d29ce9 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -118,7 +118,8 @@ cPickup::cPickup(Vector3d a_Pos, const cItem & a_Item, bool IsPlayerCreated, Vec void cPickup::SpawnOn(cClientHandle & a_Client) { - a_Client.SendPickupSpawn(*this); + a_Client.SendSpawnEntity(*this); + a_Client.SendEntityMetadata(*this); } diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 75ac850e6..c38fa0180 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -283,7 +283,6 @@ std::unique_ptr<cProjectileEntity> cProjectileEntity::Create( return cpp14::make_unique<cFireworkEntity>(a_Creator, a_Pos, *a_Item); } - case pkFishingFloat: break; } LOGWARNING("%s: Unknown projectile kind: %d", __FUNCTION__, a_Kind); @@ -347,7 +346,6 @@ AString cProjectileEntity::GetMCAClassName(void) const case pkSplashPotion: return "SplashPotion"; case pkWitherSkull: return "WitherSkull"; case pkFirework: return "Firework"; - case pkFishingFloat: return ""; // Unknown, perhaps MC doesn't save this? } UNREACHABLE("Unsupported projectile kind"); } @@ -443,8 +441,7 @@ void cProjectileEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a void cProjectileEntity::SpawnOn(cClientHandle & a_Client) { - // Default spawning - use the projectile kind to spawn an object: - a_Client.SendSpawnObject(*this, m_ProjectileKind, 12); + a_Client.SendSpawnEntity(*this); a_Client.SendEntityMetadata(*this); } diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index 439b10118..ddd09f831 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -29,20 +29,19 @@ class cProjectileEntity : public: - /** The kind of the projectile. The numbers correspond to the network type ID used for spawning them in the protocol. */ + /** The kind of the projectile. */ enum eKind { - pkArrow = 60, - pkSnowball = 61, - pkEgg = 62, - pkGhastFireball = 63, - pkFireCharge = 64, - pkEnderPearl = 65, - pkExpBottle = 75, - pkSplashPotion = 73, - pkFirework = 76, - pkWitherSkull = 66, - pkFishingFloat = 90, + pkArrow, + pkSnowball, + pkEgg, + pkGhastFireball, + pkFireCharge, + pkEnderPearl, + pkExpBottle, + pkSplashPotion, + pkFirework, + pkWitherSkull, } ; // tolua_end @@ -93,7 +92,7 @@ public: /** Returns the unique ID of the entity who created this projectile May return an ID <0 */ - UInt32 GetCreatorUniqueID(void) { return m_CreatorData.m_UniqueID; } + UInt32 GetCreatorUniqueID(void) const { return m_CreatorData.m_UniqueID; } /** Returns the name of the player that created the projectile Will be empty for non-player creators @@ -142,6 +141,6 @@ protected: // cEntity overrides: virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; - virtual void SpawnOn(cClientHandle & a_Client) override; + virtual void SpawnOn(cClientHandle & a_Client) final override; } ; // tolua_export diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index 8ed6eb763..35d79e6cd 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -2,7 +2,6 @@ #include "SplashPotionEntity.h" #include "Pawn.h" -#include "../ClientHandle.h" #include "../EffectID.h" @@ -89,17 +88,3 @@ void cSplashPotionEntity::Splash(Vector3d a_HitPos) m_PotionColor ); } - - - - - -void cSplashPotionEntity::SpawnOn(cClientHandle & a_Client) -{ - a_Client.SendSpawnObject(*this, 73, m_PotionColor); - a_Client.SendEntityMetadata(*this); -} - - - - diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 8427f34b3..1a51de1a7 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -84,8 +84,6 @@ protected: @param a_HitPos The position where the potion will splash */ void Splash(Vector3d a_HitPos); - virtual void SpawnOn(cClientHandle & a_Client) override; - private: /** Time in ticks to wait for the hit animation to begin before destroying */ int m_DestroyTimer; diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp index 33c49b097..aaf3261b4 100644 --- a/src/Entities/TNTEntity.cpp +++ b/src/Entities/TNTEntity.cpp @@ -22,8 +22,8 @@ cTNTEntity::cTNTEntity(Vector3d a_Pos, int a_FuseTicks) : void cTNTEntity::SpawnOn(cClientHandle & a_ClientHandle) { - a_ClientHandle.SendSpawnObject(*this, 50, 1); // 50 means TNT - m_bDirtyOrientation = false; + a_ClientHandle.SendSpawnEntity(*this); + m_bDirtyOrientation = false; // TODO: why? m_bDirtyHead = false; } |