From c68aa68c699a618d0172bceacf553ab96fc32cdd Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 18 Oct 2012 19:41:29 +0000 Subject: Fixed a few bugs in fluid placement - fluid into other fluid, fluid into washable blocks. git-svn-id: http://mc-server.googlecode.com/svn/trunk@977 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Items/ItemSeeds.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'source/Items/ItemSeeds.h') diff --git a/source/Items/ItemSeeds.h b/source/Items/ItemSeeds.h index 3eb9d6e86..f013af3be 100644 --- a/source/Items/ItemSeeds.h +++ b/source/Items/ItemSeeds.h @@ -12,8 +12,8 @@ class cItemSeedsHandler : public cItemHandler { public: - cItemSeedsHandler(int a_ItemID) - : cItemHandler(a_ItemID) + cItemSeedsHandler(int a_ItemType) + : cItemHandler(a_ItemType) { } @@ -25,7 +25,7 @@ public: virtual BLOCKTYPE GetBlockType() override { - switch(m_ItemID) + switch(m_ItemType) { case E_ITEM_SEEDS: return E_BLOCK_CROPS; case E_ITEM_MELON_SEEDS: return E_BLOCK_MELON_STEM; @@ -39,18 +39,27 @@ public: return 0; //Not grown yet } - virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override + + virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override { - int X = a_X, - Y = a_Y, - Z = a_Z; + if (a_Dir != BLOCK_FACE_TOP) + { + // Only allow planting seeds from the top side of the block + return; + } + + int X = a_BlockX; + int Y = a_BlockY; + int Z = a_BlockZ; AddDirection(X, Y, Z, a_Dir, true); - if(a_World->GetBlock(X, Y, Z) != E_BLOCK_FARMLAND) + if (a_World->GetBlock(X, Y, Z) != E_BLOCK_FARMLAND) + { return; + } - return cItemHandler::PlaceBlock(a_World, a_Player, a_Item, a_X, a_Y, a_Z, a_Dir); + return cItemHandler::PlaceBlock(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ, a_Dir); } } ; -- cgit v1.2.3