summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemDye.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-12-13 20:31:37 +0100
committerHowaner <franzi.moos@googlemail.com>2014-12-13 20:31:37 +0100
commit2a8c234f464ebf9986132c8ba435f1a1cec3461c (patch)
tree5cbecc238cd5df4d9f3b86c5551327b8485e45d9 /src/Items/ItemDye.h
parentMerge branch 'master' into Cocoa (diff)
downloadcuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar.gz
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar.bz2
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar.lz
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar.xz
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.tar.zst
cuberite-2a8c234f464ebf9986132c8ba435f1a1cec3461c.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemDye.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h
index 6598d8a24..da978040d 100644
--- a/src/Items/ItemDye.h
+++ b/src/Items/ItemDye.h
@@ -40,11 +40,13 @@ public:
NIBBLETYPE BlockMeta;
a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+ // Check if the block that the player clicked is a jungle log.
if ((BlockType != E_BLOCK_LOG) || ((BlockMeta & 0x3) != E_META_LOG_JUNGLE))
{
return false;
}
+ // Get the location from the new cocoa pod.
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
BlockMeta = cBlockCocoaPodHandler::BlockFaceToMeta(a_BlockFace);
@@ -53,6 +55,7 @@ public:
return false;
}
+ // Check plugins
if (cRoot::Get()->GetPluginManager()->CallHookPlayerPlacingBlock(*a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, 0, 0, 0, E_BLOCK_COCOA_POD, BlockMeta))
{
a_World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
@@ -60,9 +63,11 @@ public:
return false;
}
+ // Set block and broadcast place sound
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COCOA_POD, BlockMeta);
a_World->BroadcastSoundEffect("dig.stone", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);
+ // Remove one cocoa pod from the inventory
if (!a_Player->IsGameModeCreative())
{
a_Player->GetInventory().RemoveOneEquippedItem();