summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-04-19 22:03:17 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-04-20 00:29:52 +0200
commit246acb19f99cf974080e1bdf28acd6a263d6e971 (patch)
tree1bf8b98509aea91a629ee08d7c0fc952d9e00ee5
parentCorrect world access in NetherPortalScanner (diff)
downloadcuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar.gz
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar.bz2
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar.lz
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar.xz
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.tar.zst
cuberite-246acb19f99cf974080e1bdf28acd6a263d6e971.zip
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/ClientHandle.h2
-rw-r--r--src/Entities/ArrowEntity.cpp12
-rw-r--r--src/Entities/EnderCrystal.cpp2
-rw-r--r--src/Entities/Floater.cpp2
-rw-r--r--src/Entities/ItemFrame.cpp2
-rw-r--r--src/Entities/LeashKnot.cpp2
-rw-r--r--src/Entities/ProjectileEntity.cpp9
-rw-r--r--src/Entities/SplashPotionEntity.cpp9
-rw-r--r--src/Entities/TNTEntity.cpp2
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
-rw-r--r--src/Protocol/Protocol_1_8.cpp2
-rw-r--r--src/Protocol/Protocol_1_8.h2
-rw-r--r--src/Protocol/Protocol_1_9.cpp2
-rw-r--r--src/Protocol/Protocol_1_9.h2
17 files changed, 19 insertions, 43 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index cb9b83e26..5e9736371 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -3047,9 +3047,9 @@ void cClientHandle::SendSpawnMob(const cMonster & a_Mob)
-void cClientHandle::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch)
+void cClientHandle::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData)
{
- m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_Yaw, a_Pitch);
+ m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index d39e76db8..ecfe43977 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -211,7 +211,7 @@ public: // tolua_export
void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data);
void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock);
void SendSpawnMob (const cMonster & a_Mob);
- void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch);
+ void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData);
void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType = 0);
void SendStatistics (const cStatManager & a_Manager);
void SendTabCompletionResults (const AStringVector & a_Results);
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index 464496d31..e0d1cebc1 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -9,16 +9,6 @@
-/** Converts an angle in degrees into a byte representation used by the network protocol */
-static Byte AngleToProto(double a_X)
-{
- return static_cast<Byte>((a_X * 255) / 360);
-}
-
-
-
-
-
cArrowEntity::cArrowEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkArrow, a_Creator, a_Pos, a_Speed, 0.5, 0.5),
m_PickupState(psNoPickup),
@@ -173,7 +163,7 @@ 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), AngleToProto(GetYaw()), AngleToProto(GetPitch()));
+ a_Client.SendSpawnObject(*this, m_ProjectileKind, static_cast<int>(m_CreatorData.m_UniqueID + 1));
a_Client.SendEntityMetadata(*this);
}
diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp
index 0cb8e4e56..11273f818 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, static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
+ a_ClientHandle.SendSpawnObject(*this, 51, 0);
}
diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp
index 1faf9ff0a..3982a1ca5 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), 0, 0);
+ a_Client.SendSpawnObject(*this, 90, static_cast<int>(m_PlayerID));
}
diff --git a/src/Entities/ItemFrame.cpp b/src/Entities/ItemFrame.cpp
index 03a3186cf..aaac0e88b 100644
--- a/src/Entities/ItemFrame.cpp
+++ b/src/Entities/ItemFrame.cpp
@@ -95,7 +95,7 @@ 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(), static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
+ a_ClientHandle.SendSpawnObject(*this, 71, GetProtocolFacing());
a_ClientHandle.SendEntityMetadata(*this);
}
diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp
index aa9e3dfb4..b11c29703 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(), static_cast<Byte>(GetYaw()), static_cast<Byte>(GetPitch()));
+ a_ClientHandle.SendSpawnObject(*this, 77, GetProtocolFacing());
a_ClientHandle.SendEntityMetadata(*this);
}
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 22b5f9a39..75ac850e6 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -30,13 +30,6 @@
-/** Converts an angle in radians into a byte representation used by the network protocol */
-#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
-
-
-
-
-
////////////////////////////////////////////////////////////////////////////////
// cProjectileTracerCallback:
@@ -451,7 +444,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, ANGLE_TO_PROTO(GetYaw()), ANGLE_TO_PROTO(GetPitch()));
+ a_Client.SendSpawnObject(*this, m_ProjectileKind, 12);
a_Client.SendEntityMetadata(*this);
}
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index bfe708d06..8ed6eb763 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -9,13 +9,6 @@
-/** Converts an angle in radians into a byte representation used by the network protocol */
-#define ANGLE_TO_PROTO(X) static_cast<Byte>(X * 255 / 360)
-
-
-
-
-
////////////////////////////////////////////////////////////////////////////////
// cSplashPotionEntity:
@@ -103,7 +96,7 @@ void cSplashPotionEntity::Splash(Vector3d a_HitPos)
void cSplashPotionEntity::SpawnOn(cClientHandle & a_Client)
{
- a_Client.SendSpawnObject(*this, 73, m_PotionColor, ANGLE_TO_PROTO(GetYaw()), ANGLE_TO_PROTO(GetPitch()));
+ a_Client.SendSpawnObject(*this, 73, m_PotionColor);
a_Client.SendEntityMetadata(*this);
}
diff --git a/src/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp
index ac9d68f72..33c49b097 100644
--- a/src/Entities/TNTEntity.cpp
+++ b/src/Entities/TNTEntity.cpp
@@ -22,7 +22,7 @@ cTNTEntity::cTNTEntity(Vector3d a_Pos, int a_FuseTicks) :
void cTNTEntity::SpawnOn(cClientHandle & a_ClientHandle)
{
- a_ClientHandle.SendSpawnObject(*this, 50, 1, 0, 0); // 50 means TNT
+ a_ClientHandle.SendSpawnObject(*this, 50, 1); // 50 means TNT
m_bDirtyOrientation = false;
m_bDirtyHead = false;
}
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 8622ef8e9..eb7b3cc9a 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -217,7 +217,7 @@ public:
virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0;
virtual void SendSpawnMob (const cMonster & a_Mob) = 0;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) = 0;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData) = 0;
virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) = 0;
virtual void SendStatistics (const cStatManager & a_Manager) = 0;
virtual void SendTabCompletionResults (const AStringVector & a_Results) = 0;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 1bc6f687a..ee6d61cea 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -850,10 +850,10 @@ void cProtocolRecognizer::SendSpawnMob(const cMonster & a_Mob)
-void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch)
+void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData)
{
ASSERT(m_Protocol != nullptr);
- m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_Yaw, a_Pitch);
+ m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData);
}
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index e3d0481ae..9caa891a4 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -119,7 +119,7 @@ public:
virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData) override;
virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override;
virtual void SendStatistics (const cStatManager & a_Manager) override;
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index d4d25d507..4b982562c 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -1386,7 +1386,7 @@ void cProtocol_1_8_0::SendSpawnMob(const cMonster & a_Mob)
-void cProtocol_1_8_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch)
+void cProtocol_1_8_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData)
{
ASSERT(m_State == 3); // In game mode?
double PosX = a_Entity.GetPosX();
diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h
index b8a94e8b0..8177ec34e 100644
--- a/src/Protocol/Protocol_1_8.h
+++ b/src/Protocol/Protocol_1_8.h
@@ -106,7 +106,7 @@ public:
virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData) override;
virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override;
virtual void SendStatistics (const cStatManager & a_Manager) override;
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 1ff28e1ea..ae5948f94 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -1447,7 +1447,7 @@ void cProtocol_1_9_0::SendSpawnMob(const cMonster & a_Mob)
-void cProtocol_1_9_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch)
+void cProtocol_1_9_0::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData)
{
ASSERT(m_State == 3); // In game mode?
double PosX = a_Entity.GetPosX();
diff --git a/src/Protocol/Protocol_1_9.h b/src/Protocol/Protocol_1_9.h
index 49ae8202a..2fb59887c 100644
--- a/src/Protocol/Protocol_1_9.h
+++ b/src/Protocol/Protocol_1_9.h
@@ -112,7 +112,7 @@ public:
virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData) override;
virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override;
virtual void SendStatistics (const cStatManager & a_Manager) override;
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;