summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-05-09 23:43:00 +0200
committerHowaner <franzi.moos@googlemail.com>2014-05-09 23:43:00 +0200
commiteb0f713b6a5a7107a97284d1728858b4b2882c3d (patch)
treec05c31e4fdc79938a5d0bada7e2ecea5977716b0 /src/ClientHandle.cpp
parentAdd DIG_STATUS_CANCELLED packet and add item resend, when a block can't place/break. (diff)
downloadcuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar.gz
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar.bz2
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar.lz
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar.xz
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.tar.zst
cuberite-eb0f713b6a5a7107a97284d1728858b4b2882c3d.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 1535b0482..d1962506d 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1016,6 +1016,17 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
}
cWorld * World = m_Player->GetWorld();
+
+ if (
+ (Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
+ (Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
+ (Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6)
+ )
+ {
+ m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
+ return;
+ }
+
ItemHandler->OnBlockDestroyed(World, m_Player, m_Player->GetEquippedItem(), a_BlockX, a_BlockY, a_BlockZ);
// The ItemHandler is also responsible for spawning the pickups
cChunkInterface ChunkInterface(World->GetChunkMap());
@@ -1191,6 +1202,16 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
// The block is being placed outside the world, ignore this packet altogether (#128)
return;
}
+
+ if (
+ (Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
+ (Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
+ (Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6)
+ )
+ {
+ m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
+ return;
+ }
World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, ClickedBlock, ClickedBlockMeta);