summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemShears.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-21 22:19:22 +0200
committerGitHub <noreply@github.com>2020-04-21 22:19:22 +0200
commit487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch)
tree054a846942f414060e29c72f4a717c8a89e70893 /src/Items/ItemShears.h
parentDelet SpawnObject params (diff)
downloadcuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.gz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.bz2
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.lz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.xz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.zst
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemShears.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h
index a100a52a3..140e26c5e 100644
--- a/src/Items/ItemShears.h
+++ b/src/Items/ItemShears.h
@@ -22,25 +22,33 @@ public:
}
+
+
+
virtual bool IsTool(void) override
{
return true;
}
- virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
+
+
+
+ virtual bool OnDiggingBlock(
+ cWorld * a_World,
+ cPlayer * a_Player,
+ const cItem & a_HeldItem,
+ const Vector3i a_ClickedBlockPos,
+ eBlockFace a_ClickedBlockFace
+ ) override
{
BLOCKTYPE Block;
NIBBLETYPE BlockMeta;
- a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, Block, BlockMeta);
+ a_World->GetBlockTypeMeta(a_ClickedBlockPos, Block, BlockMeta);
if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES))
{
- cItems Drops;
- Drops.Add(Block, 1, BlockMeta & 3);
- a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
-
- a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
+ a_World->DropBlockAsPickups(a_ClickedBlockPos, a_Player, &a_HeldItem);
return true;
}
@@ -48,6 +56,9 @@ public:
}
+
+
+
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
switch (a_BlockType)
@@ -63,6 +74,9 @@ public:
}
+
+
+
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
{
switch (a_Action)
@@ -93,5 +107,4 @@ public:
return Super::GetBlockBreakingStrength(a_Block);
}
}
-
} ;