1
0

Fixed 1.8 dirt types

This commit is contained in:
Howaner 2014-09-30 20:31:27 +02:00
parent 83973520c8
commit 425df6b694
3 changed files with 35 additions and 3 deletions

View File

@ -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:

View File

@ -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);
}
}

View File

@ -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;