summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/BlockID.h1
-rw-r--r--src/Blocks/BlockDirt.h10
-rw-r--r--src/Items/ItemHoe.h27
3 files changed, 35 insertions, 3 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index 9a8830710..03a7f63e6 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -477,6 +477,7 @@ enum
// E_BLOCK_DIRT metas:
E_META_DIRT_NORMAL = 0,
E_META_DIRT_GRASSLESS = 1,
+ E_META_DIRT_COARSE = 1,
E_META_DIRT_PODZOL = 2,
// E_BLOCK_DISPENSER / E_BLOCK_DROPPER metas:
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index 60d81db72..b6d762dcf 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -21,7 +21,15 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0));
+ if (a_BlockMeta == E_META_DIRT_COARSE)
+ {
+ // Drop the coarse block (dirt, meta 1)
+ a_Pickups.Add(E_BLOCK_DIRT, 1, 1);
+ }
+ else
+ {
+ a_Pickups.Add(E_BLOCK_DIRT, 1, 0);
+ }
}
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;