Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <ItemFood.h>
Public Member Functions | |
constexpr | cItemFoodHandler (int a_ItemType, FoodInfo a_FoodInfo) |
virtual bool | EatItem (cPlayer *a_Player, cItem *a_Item) const override |
Lets the player eat a selected item. More... | |
virtual FoodInfo | GetFoodInfo (const cItem *a_Item) const override |
Returns the FoodInfo for this item. More... | |
virtual bool | IsFood (void) const override |
Indicates if this item is food. More... | |
Public Member Functions inherited from cItemHandler | |
virtual bool | CanHarvestBlock (BLOCKTYPE a_BlockType) const |
Returns whether this tool / item can harvest a specific block (e.g. More... | |
virtual bool | CanRepairWithRawMaterial (short a_ItemType) const |
Can the anvil repair this item, when a_Item is the second input? More... | |
constexpr | cItemHandler (int a_ItemType) |
virtual float | GetBlockBreakingStrength (BLOCKTYPE a_Block) const |
Returns the strength to break a specific block. More... | |
virtual short | GetDurabilityLossByAction (eDurabilityLostAction a_Action) const |
Get the durability lost which the item will get, when a specified action was performed. More... | |
virtual char | GetMaxStackSize (void) const |
Returns the maximum stack size for a given item. More... | |
virtual bool | IsDrinkable (short a_ItemDamage) const |
Indicates if this item is drinkable. More... | |
virtual bool | IsPlaceable (void) const |
Blocks simply get placed. More... | |
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. More... | |
virtual void | OnEntityAttack (cPlayer *a_Attacker, cEntity *a_AttackedEntity) const |
Called when a player attacks an entity with this item in hand. More... | |
virtual void | OnFoodEaten (cWorld *a_World, cPlayer *a_Player, cItem *a_Item) const |
Called after the player has eaten this item. More... | |
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). More... | |
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). More... | |
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). More... | |
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, called only for equipped items. More... | |
Protected Member Functions | |
~cItemFoodHandler ()=default | |
Protected Member Functions inherited from cItemHandler | |
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. More... | |
~cItemHandler ()=default | |
Protected Attributes | |
FoodInfo | m_FoodInfo |
Protected Attributes inherited from cItemHandler | |
const int | m_ItemType |
Private Types | |
using | Super = cItemHandler |
Additional Inherited Members | |
Public Types inherited from cItemHandler | |
enum | eDurabilityLostAction { dlaAttackEntity , dlaBreakBlock , dlaBreakBlockInstant } |
Actions that may cause durability of an item may be lost, where the magnitude of the loss depends on the specific item used to perform the action. More... | |
Static Protected Member Functions inherited from cItemHandler | |
static const cItemHandler & | For (int a_ItemType) |
Definition at line 10 of file ItemFood.h.
|
private |
Definition at line 13 of file ItemFood.h.
|
inlineconstexpr |
Definition at line 17 of file ItemFood.h.
|
protecteddefault |
|
inlineoverridevirtual |
Lets the player eat a selected item.
Returns true if the player ate the item
Reimplemented from cItemHandler.
Reimplemented in cItemSpiderEyeHandler, cItemSoupHandler, cItemRottenFleshHandler, cItemRawFishHandler, cItemRawChickenHandler, cItemPoisonousPotatoHandler, cItemGoldenAppleHandler, and cItemChorusFruitHandler.
Definition at line 35 of file ItemFood.h.
Returns the FoodInfo for this item.
(FoodRecovery and Saturation)
Reimplemented from cItemHandler.
Reimplemented in cItemRawFishHandler, and cItemCookedFishHandler.
Definition at line 29 of file ItemFood.h.
|
inlineoverridevirtual |
Indicates if this item is food.
Reimplemented from cItemHandler.
Definition at line 24 of file ItemFood.h.
|
protected |
Definition at line 51 of file ItemFood.h.