summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemShears.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-29 16:27:19 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-29 16:27:19 +0200
commit8811837aea2a33ba5da424087429864f811bf5e5 (patch)
treebaeedba8fb618766cf7d4e1657d2d48c84f45a59 /src/Items/ItemShears.h
parentSuggestions (diff)
parentDistortedHeightmap: Now generates gravel in deep ocean. (diff)
downloadcuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar.gz
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar.bz2
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar.lz
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar.xz
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.tar.zst
cuberite-8811837aea2a33ba5da424087429864f811bf5e5.zip
Diffstat (limited to 'src/Items/ItemShears.h')
-rw-r--r--src/Items/ItemShears.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h
index 39d2776fa..fa2794df2 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);
@@ -54,7 +59,25 @@ public:
return true;
}
} // switch (a_BlockType)
- return false;
+ return super::CanHarvestBlock(a_BlockType);
+ }
+
+
+ virtual short GetDurabilityLossByAction(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();
+ }
}
} ;