diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-07-23 16:32:09 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-07-23 16:32:09 +0200 |
commit | 396739cc0faf01a099acbe669c5a9def98d3aaae (patch) | |
tree | 91cff4c6ac486b2158edefce878174fe95e2fb3d /src/Items/ItemShears.h | |
parent | CheckBasicStyle: Added a lua shebang. (diff) | |
download | cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar.gz cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar.bz2 cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar.lz cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar.xz cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.tar.zst cuberite-396739cc0faf01a099acbe669c5a9def98d3aaae.zip |
Diffstat (limited to 'src/Items/ItemShears.h')
-rw-r--r-- | src/Items/ItemShears.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h index 39d2776fa..f1b6cafc3 100644 --- a/src/Items/ItemShears.h +++ b/src/Items/ItemShears.h @@ -12,6 +12,7 @@ class cItemShearsHandler : public cItemHandler { + typedef cItemHandler super; public: cItemShearsHandler(int a_ItemType) : cItemHandler(a_ItemType) @@ -30,8 +31,12 @@ public: BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES)) { + NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + cBlockHandler * Handler = cBlockInfo::GetHandler(Block); + cItems Drops; - Drops.push_back(cItem(Block, 1, a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x03)); + Handler->ConvertToPickups(Drops, Meta); + Drops.push_back(cItem(Block, 1, Meta & 3)); a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); @@ -56,6 +61,24 @@ public: } // switch (a_BlockType) return false; } + + + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + { + return 0; + } + + + virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ) override + { + super::OnBlockDestroyed(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ); + + BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); + if ((Block == E_BLOCK_TRIPWIRE) || (Block == E_BLOCK_VINES)) + { + a_Player->UseEquippedItem(); + } + } } ; |