1
0
This commit is contained in:
Howaner 2014-12-13 20:31:37 +01:00
parent a595a4a842
commit 2a8c234f46
4 changed files with 22 additions and 5 deletions

View File

@ -452,10 +452,8 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_AIR ].m_IsSolid = false; a_Info[E_BLOCK_AIR ].m_IsSolid = false;
a_Info[E_BLOCK_BIG_FLOWER ].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_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_CARROTS ].m_IsSolid = false;
a_Info[E_BLOCK_COBWEB ].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_CROPS ].m_IsSolid = false;
a_Info[E_BLOCK_DANDELION ].m_IsSolid = false; a_Info[E_BLOCK_DANDELION ].m_IsSolid = false;
a_Info[E_BLOCK_DETECTOR_RAIL ].m_IsSolid = false; a_Info[E_BLOCK_DETECTOR_RAIL ].m_IsSolid = false;

View File

@ -38,7 +38,7 @@ public:
{ {
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
NIBBLETYPE TypeMeta = Meta & 0x03; NIBBLETYPE TypeMeta = Meta & 0x03;
int GrowState = (Meta & 0x12) >> 2; int GrowState = (Meta & 0x0f) >> 2;
if (GrowState < 2) if (GrowState < 2)
{ {
@ -51,7 +51,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override 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); a_Pickups.Add(E_ITEM_DYE, ((GrowState >= 2) ? 3 : 1), E_META_DYE_BROWN);
} }

View File

@ -40,11 +40,13 @@ public:
NIBBLETYPE BlockMeta; NIBBLETYPE BlockMeta;
a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, 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)) if ((BlockType != E_BLOCK_LOG) || ((BlockMeta & 0x3) != E_META_LOG_JUNGLE))
{ {
return false; return false;
} }
// Get the location from the new cocoa pod.
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false); AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
BlockMeta = cBlockCocoaPodHandler::BlockFaceToMeta(a_BlockFace); BlockMeta = cBlockCocoaPodHandler::BlockFaceToMeta(a_BlockFace);
@ -53,6 +55,7 @@ public:
return false; 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)) 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); a_World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
@ -60,9 +63,11 @@ public:
return false; return false;
} }
// Set block and broadcast place sound
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COCOA_POD, BlockMeta); 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); 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()) if (!a_Player->IsGameModeCreative())
{ {
a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().RemoveOneEquippedItem();

View File

@ -1521,6 +1521,20 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
return true; 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: case E_BLOCK_CROPS:
{ {
if (a_IsByBonemeal && !m_IsCropsBonemealable) if (a_IsByBonemeal && !m_IsCropsBonemealable)