summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-30 20:31:27 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-30 20:31:27 +0200
commit425df6b69490e29b367c62476a125aa84bbcbcc5 (patch)
treed6683f73a0e1f08385dbbd9fd0295624aa3b8eab /src/Items
parentFixed iron trapdoors (diff)
downloadcuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar.gz
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar.bz2
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar.lz
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar.xz
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.tar.zst
cuberite-425df6b69490e29b367c62476a125aa84bbcbcc5.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHoe.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h
index de8b9a061..ae3723323 100644
--- a/src/Items/ItemHoe.h
+++ b/src/Items/ItemHoe.h
@@ -24,12 +24,35 @@ public:
{
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);
+ BLOCKTYPE Block;
+ NIBBLETYPE BlockMeta;
+ a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, Block, BlockMeta);
+
if (((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS)) && (UpperBlock == E_BLOCK_AIR))
{
- a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0);
+ BLOCKTYPE NewBlock = E_BLOCK_FARMLAND;
+ if (Block == E_BLOCK_DIRT)
+ {
+ switch (BlockMeta)
+ {
+ case E_META_DIRT_COARSE:
+ {
+ // Transform to normal dirt
+ NewBlock = E_BLOCK_DIRT;
+ break;
+ }
+ case E_META_DIRT_PODZOL:
+ {
+ // You can't transform this block with a hoe in vanilla
+ return false;
+ }
+ default: break;
+ }
+ }
+
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, NewBlock, 0);
a_World->BroadcastSoundEffect("dig.gravel", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);
a_Player->UseEquippedItem();
return true;