1
0

Bonemeal works on crops, melons, pumpkins, saplings and grass. Plant growing has been refactored into separate functions callable from Lua, too.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@573 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-06-07 21:07:21 +00:00
parent f8167f3577
commit 876014b8e8
10 changed files with 286 additions and 6 deletions

View File

@@ -977,6 +977,7 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
cDoors::ChangeDoor(m_Player->GetWorld(), a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
break;
}
default:
{
break;
@@ -1211,12 +1212,12 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
}
case E_ITEM_SIGN:
{
LOG("Sign Dir: %i", a_Packet->m_Direction);
LOGD("Sign Dir: %i", a_Packet->m_Direction);
if (a_Packet->m_Direction == 1)
{
LOG("Player Rotation: %f", m_Player->GetRotation());
LOGD("Player Rotation: %f", m_Player->GetRotation());
MetaData = cSign::RotationToMetaData(m_Player->GetRotation());
LOG("Sign rotation %i", MetaData);
LOGD("Sign rotation %i", MetaData);
a_Packet->m_ItemType = E_BLOCK_SIGN_POST;
}
else
@@ -1261,6 +1262,15 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet)
a_Packet->m_ItemType = E_BLOCK_PUMPKIN_STEM;
break;
}
case E_ITEM_DYE:
{
// Handle bonemeal and dyes on sheep
if (HandleDyes(a_Packet))
{
return;
}
break;
}
default:
{
break;
@@ -1557,6 +1567,26 @@ void cClientHandle::HandleKeepAlive(cPacket_KeepAlive * a_Packet)
bool cClientHandle::HandleDyes(cPacket_BlockPlace * a_Packet)
{
cItem & Equipped = m_Player->GetInventory().GetEquippedItem();
// TODO: Handle coloring the sheep, too
// Handle growing the plants:
if (Equipped.m_ItemHealth == E_META_DYE_WHITE)
{
cWorld * World = m_Player->GetWorld();
World->GrowPlant(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
}
return false;
}
bool cClientHandle::CheckBlockInteractionsRate(void)
{
ASSERT(m_Player != NULL);