summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemChest.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-10-16 10:06:34 +0200
committerGitHub <noreply@github.com>2019-10-16 10:06:34 +0200
commit221cc4ec5cb6301743e947eaabed3fecedba796f (patch)
tree4e44c8bb7523e5d1d04468fc906ae24674c10abc /src/Items/ItemChest.h
parentFixed crash in hopper while pulling items from blockentity above itself (#4412) (diff)
downloadcuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.gz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.bz2
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.lz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.xz
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.zst
cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.zip
Diffstat (limited to 'src/Items/ItemChest.h')
-rw-r--r--src/Items/ItemChest.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h
index 58f6fbc6e..817020a25 100644
--- a/src/Items/ItemChest.h
+++ b/src/Items/ItemChest.h
@@ -40,13 +40,15 @@ public:
}
// Check if the block ignores build collision (water, grass etc.):
- BLOCKTYPE ClickedBlock;
- NIBBLETYPE ClickedBlockMeta;
- a_World.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, ClickedBlock, ClickedBlockMeta);
+ BLOCKTYPE clickedBlock;
+ NIBBLETYPE clickedBlockMeta;
+ Vector3i blockPos(a_BlockX, a_BlockY, a_BlockZ);
+ a_World.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, clickedBlock, clickedBlockMeta);
cChunkInterface ChunkInterface(a_World.GetChunkMap());
- if (BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision(ChunkInterface, { a_BlockX, a_BlockY, a_BlockZ }, a_Player, ClickedBlockMeta))
+ auto blockHandler = BlockHandler(clickedBlock);
+ if (blockHandler->DoesIgnoreBuildCollision(ChunkInterface, blockPos, a_Player, clickedBlockMeta))
{
- BlockHandler(ClickedBlock)->OnDestroyedByPlayer(ChunkInterface, a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ blockHandler->OnPlayerBreakingBlock(ChunkInterface, a_World, a_Player, blockPos);
}
else
{
@@ -64,7 +66,7 @@ public:
// 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 (BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision(ChunkInterface, { a_BlockX, a_BlockY, a_BlockZ }, a_Player, ClickedBlockMeta))
+ if (blockHandler->DoesIgnoreBuildCollision(ChunkInterface, blockPos, a_Player, clickedBlockMeta))
{
// Tried to place a block into another?
// Happens when you place a block aiming at side of block with a torch on it or stem beside it