diff options
Diffstat (limited to '')
-rw-r--r-- | source/ClientHandle.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index 8ff93ec1b..199f43014 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -854,19 +854,29 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, ClickedBlock, ClickedBlockMeta); - //Special slab handler coding + // Special slab handler coding if ( + // If clicked face top: is slab there in the "bottom" position? + // If clicked face bottom: is the slab there in the "top" position? + // This prevents a dblslab forming below if you click the top face of a "top" slab. (((a_BlockFace == BLOCK_FACE_TOP) && (ClickedBlockMeta == (EquippedBlockDamage & 0x07))) || ((a_BlockFace == BLOCK_FACE_BOTTOM) && (ClickedBlockMeta == (EquippedBlockDamage | 0x08)))) && - ((ClickedBlock == E_BLOCK_STONE_SLAB) || (ClickedBlock == E_BLOCK_WOODEN_SLAB)) && //Is clicked a slab? - ((EquippedBlock == E_BLOCK_STONE_SLAB) || (EquippedBlock == E_BLOCK_WOODEN_SLAB)) && //Is equipped a slab? - ((ClickedBlockMeta & 0x07) == (EquippedBlockDamage & 0x07)) //Is clicked same type of slab as item in hand? + + // Is clicked a slab? This is a SLAB handler, not stone or something! + ((ClickedBlock == E_BLOCK_STONE_SLAB) || (ClickedBlock == E_BLOCK_WOODEN_SLAB)) && + + // Is equipped a some type of slab? + // This prevents a bug where, well, you get a dblslab by placing TNT or something not a slab. + ((EquippedBlock == E_BLOCK_STONE_SLAB) || (EquippedBlock == E_BLOCK_WOODEN_SLAB)) && + + // Is equipped slab type same as the slab in the world? After all, we can't combine different slabs! + ((ClickedBlockMeta & 0x07) == (EquippedBlockDamage & 0x07)) ) { - //Don't move the coordinates + // Coordinates at CLICKED block, don't move them anywhere } else { - //Check if the block ignores build collision (water, grass etc.): + // Check if the block ignores build collision (water, grass etc.): cBlockHandler * Handler = cBlockHandler::GetBlockHandler(ClickedBlock); if (Handler->DoesIgnoreBuildCollision()) { @@ -876,8 +886,9 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c else { AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - //On side of block, make sure that placement won't be cancelled if there is a slab there - //No need to combinability checks, client will do that + + // Clicked on side of block, make sure that placement won't be cancelled if there is a slab able to be double slabbed. + // No need to do combinability (dblslab) checks, client will do that here. if ((World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_STONE_SLAB) || (World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_SLAB)) { //Is a slab, don't do checks and proceed to double-slabbing @@ -904,7 +915,8 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c } } } - + // Special slab handler coding end + BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; if (!a_ItemHandler.GetPlacementBlockTypeMeta(World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta)) |