diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-18 21:41:29 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-18 21:41:29 +0200 |
commit | c68aa68c699a618d0172bceacf553ab96fc32cdd (patch) | |
tree | a2eb1d2e76ea183f2c0aee66accd98beeba48e0d /source/Items/ItemSeeds.h | |
parent | Fixed item damage value not being read from the 1.3.2 protocol (wtf, why was it disabled?) (diff) | |
download | cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar.gz cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar.bz2 cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar.lz cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar.xz cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.tar.zst cuberite-c68aa68c699a618d0172bceacf553ab96fc32cdd.zip |
Diffstat (limited to 'source/Items/ItemSeeds.h')
-rw-r--r-- | source/Items/ItemSeeds.h | 27 |
1 files changed, 18 insertions, 9 deletions
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);
}
} ;
|