diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-05-29 22:45:25 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-05-29 22:45:25 +0200 |
commit | 2372419d0ccb6c0c689437305c47e494ce74bd2b (patch) | |
tree | 13f86db29ad48e679a412164287ccc135933c689 | |
parent | Refactored item-eating from cClientHandle into cPlayer (diff) | |
download | cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar.gz cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar.bz2 cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar.lz cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar.xz cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.tar.zst cuberite-2372419d0ccb6c0c689437305c47e494ce74bd2b.zip |
-rw-r--r-- | source/Defines.h | 4 | ||||
-rw-r--r-- | source/cClientHandle.cpp | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/source/Defines.h b/source/Defines.h index 5ec09fb1e..ddf18dc48 100644 --- a/source/Defines.h +++ b/source/Defines.h @@ -15,6 +15,10 @@ extern bool g_BlockOneHitDig[]; //--DO NOT DELETE THIS COMMENT-- //tolua_export
+
+
+
+
inline bool IsValidBlock( int a_BlockID ) //tolua_export
{ //tolua_export
if( a_BlockID > -1 &&
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index f5aa9024d..9e88f47a1 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -986,7 +986,7 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet) m_Player->GetInventory().RemoveItem(Item);
return;
}
-
+
if (a_Packet->m_Direction < 0)
{
// clicked in air
@@ -995,7 +995,17 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet) bool isDoor = false;
//TODO: Wrong Blocks!
- int ClickedBlock = (int)m_Player->GetWorld()->GetBlock(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
+ BLOCKTYPE ClickedBlock = m_Player->GetWorld()->GetBlock(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ);
+
+ if (ItemCategory::IsHoe(Item.m_ItemID))
+ {
+ if ((ClickedBlock == E_BLOCK_DIRT) || (ClickedBlock == E_BLOCK_GRASS))
+ {
+ m_Player->GetWorld()->FastSetBlock(a_Packet->m_PosX, a_Packet->m_PosY, a_Packet->m_PosZ, E_BLOCK_FARMLAND, 0);
+ }
+ return;
+ }
+
char MetaData = (char)Equipped.m_ItemHealth;
bool LavaBucket = false;
bool WaterBucket = false;
|