4 #include "../Defines.h"
55 const cItem & a_HeldItem,
101 constexpr
FoodInfo(
int a_FoodLevel,
double a_Saturation) :
115 virtual bool IsFood(
void)
const;
118 virtual bool IsDrinkable(
short a_ItemDamage)
const;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld.
virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) const
Returns the strength to break a specific block.
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item) const
Called after the player has eaten this item.
virtual void OnItemShoot(cPlayer *, const Vector3i a_BlockPos, eBlockFace a_BlockFace) const
Called when the client sends the SHOOT status in the lclk packet (releasing the bow).
virtual void OnEntityAttack(cPlayer *a_Attacker, cEntity *a_AttackedEntity) const
Called when a player attacks an entity with this item in hand.
static const cItemHandler & For(int a_ItemType)
virtual FoodInfo GetFoodInfo(const cItem *a_Item) const
Returns the FoodInfo for this item.
virtual bool IsDrinkable(short a_ItemDamage) const
Indicates if this item is drinkable.
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_HeldItem, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const
Called when the player tries to use the item (right mouse button).
virtual bool CanRepairWithRawMaterial(short a_ItemType) const
Can the anvil repair this item, when a_Item is the second input?
virtual bool CommitPlacement(cPlayer &a_Player, const cItem &a_HeldItem, Vector3i a_PlacePosition, eBlockFace a_ClickedBlockFace, Vector3i a_CursorPosition) const
Performs the actual placement of this placeable item.
constexpr cItemHandler(int a_ItemType)
eDurabilityLostAction
Actions that may cause durability of an item may be lost, where the magnitude of the loss depends on ...
virtual bool IsPlaceable(void) const
Blocks simply get placed.
virtual void OnUpdate(cWorld *a_World, cPlayer *a_Player, const cItem &a_Item) const
Called every tick while the item is on the player's inventory (used by maps, for example) - For now,...
virtual bool OnDiggingBlock(cWorld *a_World, cPlayer *a_Player, const cItem &a_HeldItem, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const
Called while the player digs a block using this item.
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) const
Get the durability lost which the item will get, when a specified action was performed.
virtual char GetMaxStackSize(void) const
Returns the maximum stack size for a given item.
void OnPlayerPlace(cPlayer &a_Player, const cItem &a_HeldItem, Vector3i a_ClickedPosition, BLOCKTYPE a_ClickedBlockType, NIBBLETYPE a_ClickedBlockMeta, eBlockFace a_ClickedBlockFace, Vector3i a_CursorPosition) const
Called when the player tries to place the item (right mouse button, IsPlaceable() == true).
virtual bool EatItem(cPlayer *a_Player, cItem *a_Item) const
Lets the player eat a selected item.
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) const
Returns whether this tool / item can harvest a specific block (e.g.
virtual bool IsFood(void) const
Indicates if this item is food.
constexpr FoodInfo(int a_FoodLevel, double a_Saturation)