summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 01:31:21 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 01:31:21 +0100
commit0e0baa940a967b34806891c5d5e9d520b3a558db (patch)
treec577d365de68af7e3fa9b27f751852bee06f95ab /src/ClientHandle.cpp
parentImproved redstone speed and fixed a wire bug (diff)
downloadcuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.gz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.bz2
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.lz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.xz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.zst
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index b3e12ce77..f9a48003e 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -891,14 +891,14 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
else
{
// Check if the block ignores build collision (water, grass etc.):
- cBlockHandler * Handler = cBlockHandler::GetBlockHandler(ClickedBlock);
- if (Handler->DoesIgnoreBuildCollision())
+ if (
+ BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision() ||
+ BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision(m_Player, ClickedBlockMeta)
+ )
{
- Handler->OnDestroyedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ);
+ BlockHandler(ClickedBlock)->OnDestroyedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ);
}
-
- BLOCKTYPE PlaceBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
- if (!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision())
+ else
{
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
@@ -908,7 +908,9 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
return;
}
- BLOCKTYPE PlaceBlock = World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
+ NIBBLETYPE PlaceMeta;
+ BLOCKTYPE PlaceBlock;
+ World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, PlaceBlock, PlaceMeta);
// 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.
@@ -918,10 +920,13 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
}
else
{
- if (!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision())
+ if (
+ !BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision() &&
+ !BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(m_Player, PlaceMeta)
+ )
{
// Tried to place a block *into* another?
- // Happens when you place a block aiming at side of block like torch or stem
+ // Happens when you place a block aiming at side of block with a torch on it or stem beside it
return;
}
}