summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorDamián Imrich <damian@haze.sk>2021-04-03 19:45:20 +0200
committerGitHub <noreply@github.com>2021-04-03 19:45:20 +0200
commit071b7be3d4d08c337c01de7abca034e6c3746194 (patch)
treeb878b6df8abe69493d61098610738edb8d95a82b /src/ClientHandle.cpp
parentFix finisher generating invalid pumpkin (diff)
downloadcuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.gz
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.bz2
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.lz
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.xz
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.zst
cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp87
1 files changed, 36 insertions, 51 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 61370ca4f..cd45068ee 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -574,12 +574,9 @@ void cClientHandle::HandleNPCTrade(int a_SlotNum)
-void cClientHandle::HandleOpenHorseInventory(UInt32 a_EntityID)
+void cClientHandle::HandleOpenHorseInventory()
{
- if (m_Player->GetUniqueID() == a_EntityID)
- {
- m_Player->OpenHorseInventory();
- }
+ m_Player->OpenHorseInventory();
}
@@ -665,6 +662,15 @@ void cClientHandle::HandleCreativeInventory(Int16 a_SlotNum, const cItem & a_Hel
+void cClientHandle::HandleCrouch(const bool a_IsCrouching)
+{
+ m_Player->SetCrouch(a_IsCrouching);
+}
+
+
+
+
+
void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment)
{
if (a_Enchantment > 2)
@@ -749,7 +755,7 @@ void cClientHandle::HandlePlayerAbilities(bool a_IsFlying, float FlyingSpeed, fl
-void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround)
+void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ, bool a_IsOnGround)
{
if (m_Player->IsFrozen())
{
@@ -759,7 +765,6 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
Vector3d NewPosition(a_PosX, a_PosY, a_PosZ);
Vector3d OldPosition = GetPlayer()->GetPosition();
- double OldStance = GetPlayer()->GetStance();
auto PreviousIsOnGround = GetPlayer()->IsOnGround();
#ifdef __clang__
@@ -769,7 +774,6 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
if (
(OldPosition == NewPosition) &&
- (OldStance == a_Stance) &&
(PreviousIsOnGround == a_IsOnGround)
)
{
@@ -799,7 +803,6 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
// TODO: Official server refuses position packets too far away from each other, kicking "hacked" clients; we should, too
m_Player->SetPosition(NewPosition);
- m_Player->SetStance(a_Stance);
m_Player->SetTouchGround(a_IsOnGround);
m_Player->UpdateMovementStats(NewPosition - OldPosition, PreviousIsOnGround);
}
@@ -1513,9 +1516,9 @@ void cClientHandle::HandlePlayerLook(float a_Rotation, float a_Pitch, bool a_IsO
-void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround)
+void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_PosZ, float a_Rotation, float a_Pitch, bool a_IsOnGround)
{
- HandlePlayerPos(a_PosX, a_PosY, a_PosZ, a_Stance, a_IsOnGround);
+ HandlePlayerPos(a_PosX, a_PosY, a_PosZ, a_IsOnGround);
HandlePlayerLook(a_Rotation, a_Pitch, a_IsOnGround);
}
@@ -1567,6 +1570,24 @@ void cClientHandle::HandleSpectate(const cUUID & a_PlayerUUID)
+void cClientHandle::HandleSprint(const bool a_IsSprinting)
+{
+ m_Player->SetSprint(a_IsSprinting);
+}
+
+
+
+
+
+void cClientHandle::HandleStartElytraFlight()
+{
+ m_Player->SetElytraFlight(true);
+}
+
+
+
+
+
void cClientHandle::HandleSteerVehicle(float a_Forward, float a_Sideways)
{
m_Player->SteerVehicle(a_Forward, a_Sideways);
@@ -1831,47 +1852,11 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
-void cClientHandle::HandleEntityCrouch(UInt32 a_EntityID, bool a_IsCrouching)
+void cClientHandle::HandleLeaveBed()
{
- if (a_EntityID != m_Player->GetUniqueID())
- {
- // We should only receive entity actions from the entity that is performing the action
- return;
- }
-
- m_Player->SetCrouch(a_IsCrouching);
-}
-
-
-
-
-
-void cClientHandle::HandleEntityLeaveBed(UInt32 a_EntityID)
-{
- if (a_EntityID != m_Player->GetUniqueID())
- {
- // We should only receive entity actions from the entity that is performing the action
- return;
- }
-
- cChunkInterface Interface(GetPlayer()->GetWorld()->GetChunkMap());
- cBlockBedHandler::SetBedOccupationState(Interface, GetPlayer()->GetLastBedPos(), false);
- GetPlayer()->SetIsInBed(false);
-}
-
-
-
-
-
-void cClientHandle::HandleEntitySprinting(UInt32 a_EntityID, bool a_IsSprinting)
-{
- if (a_EntityID != m_Player->GetUniqueID())
- {
- // We should only receive entity actions from the entity that is performing the action
- return;
- }
-
- m_Player->SetSprint(a_IsSprinting);
+ cChunkInterface Interface(m_Player->GetWorld()->GetChunkMap());
+ cBlockBedHandler::SetBedOccupationState(Interface, m_Player->GetLastBedPos(), false);
+ m_Player->SetIsInBed(false);
}