summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHoe.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHoe.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h
index 8d0b71478..987357739 100644
--- a/src/Items/ItemHoe.h
+++ b/src/Items/ItemHoe.h
@@ -18,11 +18,15 @@ 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
+ 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
{
- BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
+ if (a_Dir == BLOCK_FACE_NONE)
+ {
+ return false;
+ }
- if ((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS))
+ BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
+ if (IsBlockTypeOfDirt(Block))
{
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0);
a_Player->UseEquippedItem();