Bonemeal is consumed in survival mode when used on growable blocks
git-svn-id: http://mc-server.googlecode.com/svn/trunk@582 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
648c7fe943
commit
0e236c03f9
@ -1267,6 +1267,10 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
|
|||||||
// Handle bonemeal and dyes on sheep
|
// Handle bonemeal and dyes on sheep
|
||||||
if (HandleDyes(a_Packet))
|
if (HandleDyes(a_Packet))
|
||||||
{
|
{
|
||||||
|
if (m_Player->GetGameMode() == eGameMode_Survival)
|
||||||
|
{
|
||||||
|
m_Player->GetInventory().RemoveItem(Item);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1582,7 +1586,7 @@ bool cClientHandle::HandleDyes(cPacket_BlockPlace * a_Packet)
|
|||||||
if (Equipped.m_ItemHealth == E_META_DYE_WHITE)
|
if (Equipped.m_ItemHealth == E_META_DYE_WHITE)
|
||||||
{
|
{
|
||||||
cWorld * World = m_Player->GetWorld();
|
cWorld * World = m_Player->GetWorld();
|
||||||
World->GrowPlant(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
|
return World->GrowPlant(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -205,7 +205,7 @@ private:
|
|||||||
void HandleDisconnect (cPacket_Disconnect * a_Packet);
|
void HandleDisconnect (cPacket_Disconnect * a_Packet);
|
||||||
void HandleKeepAlive (cPacket_KeepAlive * a_Packet);
|
void HandleKeepAlive (cPacket_KeepAlive * a_Packet);
|
||||||
|
|
||||||
/// Handles rclk with a dye; returns true if normal rclk processing should continue
|
/// Handles rclk with a dye; returns true if the dye is to be be consumed
|
||||||
bool HandleDyes(cPacket_BlockPlace * a_Packet);
|
bool HandleDyes(cPacket_BlockPlace * a_Packet);
|
||||||
|
|
||||||
/// Returns true if the rate block interactions is within a reasonable limit (bot protection)
|
/// Returns true if the rate block interactions is within a reasonable limit (bot protection)
|
||||||
|
@ -844,7 +844,7 @@ void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ)
|
bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
@ -857,7 +857,7 @@ void cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
{
|
{
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case E_BLOCK_MELON_STEM:
|
case E_BLOCK_MELON_STEM:
|
||||||
@ -871,13 +871,13 @@ void cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
{
|
{
|
||||||
GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType);
|
GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case E_BLOCK_SAPLING:
|
case E_BLOCK_SAPLING:
|
||||||
{
|
{
|
||||||
GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
|
GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case E_BLOCK_GRASS:
|
case E_BLOCK_GRASS:
|
||||||
@ -913,15 +913,16 @@ void cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
} // switch (random spawn block)
|
} // switch (random spawn block)
|
||||||
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
|
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
|
||||||
} // for i - 50 times
|
} // for i - 50 times
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case E_BLOCK_SUGARCANE:
|
case E_BLOCK_SUGARCANE:
|
||||||
{
|
{
|
||||||
m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, 3);
|
m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, 3);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
} // switch (BlockType)
|
} // switch (BlockType)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,8 +244,8 @@ public:
|
|||||||
|
|
||||||
void GrowTreeImage(const sSetBlockVector & a_Blocks);
|
void GrowTreeImage(const sSetBlockVector & a_Blocks);
|
||||||
|
|
||||||
/// Grows the plant at the specified block to its ripe stage (bonemeal used)
|
/// Grows the plant at the specified block to its ripe stage (bonemeal used); returns false if the block is not growable.
|
||||||
void GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
bool GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
||||||
|
|
||||||
/// Grows a melon or a pumpkin next to the block specified (assumed to be the stem)
|
/// Grows a melon or a pumpkin next to the block specified (assumed to be the stem)
|
||||||
void GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockType); // tolua_export
|
void GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockType); // tolua_export
|
||||||
|
Loading…
Reference in New Issue
Block a user