summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-08 17:02:54 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-08 17:02:54 +0200
commit8f8693a71eb896ccc7c14c4033ae8d07dae27ac3 (patch)
tree8c9e19b4c5155eae5986943293a6cd8f77c8b831 /src/ClientHandle.cpp
parentUpdated chunk sending to 1.8 (diff)
downloadcuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar.gz
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar.bz2
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar.lz
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar.xz
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.tar.zst
cuberite-8f8693a71eb896ccc7c14c4033ae8d07dae27ac3.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 4a768771e..4c36dec4d 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1198,6 +1198,12 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
cWorld * World = m_Player->GetWorld();
+ // 1.8 protocol fix
+ if ((int)a_BlockFace == 255)
+ {
+ a_BlockFace = BLOCK_FACE_NONE;
+ }
+
if (
(a_BlockFace != BLOCK_FACE_NONE) && // The client is interacting with a specific block
(
@@ -1268,22 +1274,25 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
return;
}
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
- cBlockHandler * BlockHandler = cBlockInfo::GetHandler(BlockType);
-
- if (BlockHandler->IsUseable() && !m_Player->IsCrouched())
+ if ((Vector3d(a_BlockX, a_BlockY, a_BlockZ) - m_Player->GetPosition()).Length() <= 5)
{
- if (PlgMgr->CallHookPlayerUsingBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta))
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+ cBlockHandler * BlockHandler = cBlockInfo::GetHandler(BlockType);
+
+ if (BlockHandler->IsUseable() && !m_Player->IsCrouched())
{
- // A plugin doesn't agree with using the block, abort
+ if (PlgMgr->CallHookPlayerUsingBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta))
+ {
+ // A plugin doesn't agree with using the block, abort
+ return;
+ }
+ cChunkInterface ChunkInterface(World->GetChunkMap());
+ BlockHandler->OnUse(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
+ PlgMgr->CallHookPlayerUsedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
return;
}
- cChunkInterface ChunkInterface(World->GetChunkMap());
- BlockHandler->OnUse(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
- PlgMgr->CallHookPlayerUsedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
- return;
}
short EquippedDamage = Equipped.m_ItemDamage;