summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-12 18:21:11 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-12 18:21:11 +0200
commit80b0631c43d2f0bb18fa4a10611d747a8f464462 (patch)
tree659c3b59a0909c687d4770ee580a15618cdae0e1 /src/Items
parentAdded hoe interact sound. (diff)
downloadcuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar.gz
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar.bz2
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar.lz
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar.xz
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.tar.zst
cuberite-80b0631c43d2f0bb18fa4a10611d747a8f464462.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHoe.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h
index a92337b62..5b2423949 100644
--- a/src/Items/ItemHoe.h
+++ b/src/Items/ItemHoe.h
@@ -20,9 +20,14 @@ public:
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
{
+ if ((a_Dir == BLOCK_FACE_NONE) || (a_BlockY >= cChunkDef::Height))
+ {
+ return false;
+ }
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
+ BLOCKTYPE UpperBlock = a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ);
- if ((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS))
+ if (IsBlockTypeOfDirt(Block) && (UpperBlock == E_BLOCK_AIR))
{
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0);
a_World->BroadcastSoundEffect("dig.gravel", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);