summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.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/ItemHandler.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/ItemHandler.h')
-rw-r--r--src/Items/ItemHandler.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h
index c7362c5f4..1d5f59f3e 100644
--- a/src/Items/ItemHandler.h
+++ b/src/Items/ItemHandler.h
@@ -19,6 +19,13 @@ class cPlayer;
class cItemHandler
{
public:
+
+ enum eDurabilityLostAction
+ {
+ dlaBreakBlock,
+ dlaAttackEntity,
+ };
+
cItemHandler(int a_ItemType);
/** Force virtual destructor */
@@ -48,11 +55,17 @@ public:
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace);
/** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */
- virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_X, int a_Y, int a_Z);
+ virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ);
+
+ /** Called when a player attacks a other entity. */
+ virtual void OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity);
/** Called after the player has eaten this item. */
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
-
+
+ /** Get the durability lost which the item will get, when a specified action was performed. */
+ virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action);
+
/** Returns the maximum stack size for a given item */
virtual char GetMaxStackSize(void);