summaryrefslogtreecommitdiffstats
path: root/src/Entities
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 /src/Entities
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
Diffstat (limited to 'src/Entities')
-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
8 files changed, 8 insertions, 32 deletions
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;
}