summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/BlockInfo.cpp2
-rw-r--r--src/Blocks/BlockCocoaPod.h4
-rw-r--r--src/Items/ItemDye.h5
-rw-r--r--src/World.cpp16
4 files changed, 22 insertions, 5 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 413fd41b2..3c5e8d7b7 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -452,10 +452,8 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_AIR ].m_IsSolid = false;
a_Info[E_BLOCK_BIG_FLOWER ].m_IsSolid = false;
a_Info[E_BLOCK_BROWN_MUSHROOM ].m_IsSolid = false;
- a_Info[E_BLOCK_CAKE ].m_IsSolid = false;
a_Info[E_BLOCK_CARROTS ].m_IsSolid = false;
a_Info[E_BLOCK_COBWEB ].m_IsSolid = false;
- a_Info[E_BLOCK_COCOA_POD ].m_IsSolid = false;
a_Info[E_BLOCK_CROPS ].m_IsSolid = false;
a_Info[E_BLOCK_DANDELION ].m_IsSolid = false;
a_Info[E_BLOCK_DETECTOR_RAIL ].m_IsSolid = false;
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
index 9e1d64cc6..cfd3b4479 100644
--- a/src/Blocks/BlockCocoaPod.h
+++ b/src/Blocks/BlockCocoaPod.h
@@ -38,7 +38,7 @@ public:
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
NIBBLETYPE TypeMeta = Meta & 0x03;
- int GrowState = (Meta & 0x12) >> 2;
+ int GrowState = (Meta & 0x0f) >> 2;
if (GrowState < 2)
{
@@ -51,7 +51,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- int GrowState = (a_BlockMeta & 0x12) >> 2;
+ int GrowState = (a_BlockMeta & 0x0f) >> 2;
a_Pickups.Add(E_ITEM_DYE, ((GrowState >= 2) ? 3 : 1), E_META_DYE_BROWN);
}
diff --git a/src/Items/ItemDye.h b/src/Items/ItemDye.h
index 6598d8a24..da978040d 100644
--- a/src/Items/ItemDye.h
+++ b/src/Items/ItemDye.h
@@ -40,11 +40,13 @@ public:
NIBBLETYPE BlockMeta;
a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
+ // Check if the block that the player clicked is a jungle log.
if ((BlockType != E_BLOCK_LOG) || ((BlockMeta & 0x3) != E_META_LOG_JUNGLE))
{
return false;
}
+ // Get the location from the new cocoa pod.
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
BlockMeta = cBlockCocoaPodHandler::BlockFaceToMeta(a_BlockFace);
@@ -53,6 +55,7 @@ public:
return false;
}
+ // Check plugins
if (cRoot::Get()->GetPluginManager()->CallHookPlayerPlacingBlock(*a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, 0, 0, 0, E_BLOCK_COCOA_POD, BlockMeta))
{
a_World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
@@ -60,9 +63,11 @@ public:
return false;
}
+ // Set block and broadcast place sound
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COCOA_POD, BlockMeta);
a_World->BroadcastSoundEffect("dig.stone", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);
+ // Remove one cocoa pod from the inventory
if (!a_Player->IsGameModeCreative())
{
a_Player->GetInventory().RemoveOneEquippedItem();
diff --git a/src/World.cpp b/src/World.cpp
index 1bee6e344..fc4a1fdfd 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1520,7 +1520,21 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
}
return true;
}
-
+
+ case E_BLOCK_COCOA_POD:
+ {
+ NIBBLETYPE TypeMeta = BlockMeta & 0x03;
+ int GrowState = (BlockMeta & 0x0f) >> 2;
+
+ if (GrowState < 2)
+ {
+ GrowState++;
+ FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, (NIBBLETYPE) (GrowState << 2 | TypeMeta));
+ BroadcastSoundParticleEffect(2005, a_BlockX, a_BlockY, a_BlockZ, 0);
+ }
+ return true;
+ }
+
case E_BLOCK_CROPS:
{
if (a_IsByBonemeal && !m_IsCropsBonemealable)