Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Types | List of all members
cItemPumpkinHandler Class Reference

#include <ItemPumpkin.h>

Inheritance diagram for cItemPumpkinHandler:
Inheritance graph
[legend]
Collaboration diagram for cItemPumpkinHandler:
Collaboration graph
[legend]

Public Member Functions

 cItemPumpkinHandler (void)
 
virtual bool OnPlayerPlace (cWorld &a_World, cPlayer &a_Player, const cItem &a_EquippedItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
 Called when the player tries to place the item (right mouse button, IsPlaceable() == true). More...
 
bool TrySpawnGolem (cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Spawns a snow / iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. More...
 
bool TrySpawnIronGolem (cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Spawns an iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. More...
 
bool TrySpawnSnowGolem (cWorld &a_World, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Spawns a snow golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin. More...
 
- Public Member Functions inherited from cItemHandler
virtual bool CanHarvestBlock (BLOCKTYPE a_BlockType)
 Returns whether this tool / item can harvest a specific block (e.g. More...
 
virtual bool CanRepairWithRawMaterial (short a_ItemType)
 Can the anvil repair this item, when a_Item is the second input? More...
 
 cItemHandler (int a_ItemType)
 
virtual bool EatItem (cPlayer *a_Player, cItem *a_Item)
 Lets the player eat a selected item. More...
 
virtual float GetBlockBreakingStrength (BLOCKTYPE a_Block)
 Returns the strength to break a specific block. More...
 
virtual bool GetBlocksToPlace (cWorld &a_World, cPlayer &a_Player, const cItem &a_EquippedItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, sSetBlockVector &a_BlocksToSet)
 Called from OnPlayerPlace() to determine the blocks that the current placement operation should set. More...
 
virtual short GetDurabilityLossByAction (eDurabilityLostAction a_Action)
 Get the durability lost which the item will get, when a specified action was performed. More...
 
virtual FoodInfo GetFoodInfo (const cItem *a_Item)
 Returns the FoodInfo for this item. More...
 
virtual char GetMaxStackSize (void)
 Returns the maximum stack size for a given item. More...
 
virtual bool GetPlacementBlockTypeMeta (cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
 Called when the player right-clicks with this item and IsPlaceable() == true, and OnPlayerPlace() is not overridden. More...
 
virtual bool IsDrinkable (short a_ItemDamage)
 Indicates if this item is drinkable. More...
 
virtual bool IsFood (void)
 Indicates if this item is food. More...
 
virtual bool IsPlaceable (void)
 Blocks simply get placed. More...
 
virtual bool IsTool (void)
 Indicates if this item is a tool. More...
 
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 while the player digs a block using this item. More...
 
virtual void OnEntityAttack (cPlayer *a_Attacker, cEntity *a_AttackedEntity)
 Called when a player attacks a other entity. More...
 
virtual void OnFoodEaten (cWorld *a_World, cPlayer *a_Player, cItem *a_Item)
 Called after the player has eaten this item. More...
 
virtual void OnItemShoot (cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
 Called when the client sends the SHOOT status in the lclk packet. More...
 
virtual bool OnItemUse (cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
 Called when the player tries to use the item (right mouse button). More...
 
virtual void OnUpdate (cWorld *a_World, cPlayer *a_Player, const cItem &a_Item)
 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...
 
virtual ~cItemHandler ()
 Force virtual destructor. More...
 

Private Types

typedef cItemHandler super
 

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 Public Member Functions inherited from cItemHandler
static void Deinit ()
 
static cItemHandlerGetItemHandler (int a_ItemType)
 
static cItemHandlerGetItemHandler (const cItem &a_Item)
 
- Static Protected Member Functions inherited from cItemHandler
static cItemHandlerCreateItemHandler (int m_ItemType)
 
- Protected Attributes inherited from cItemHandler
int m_ItemType
 
- Static Protected Attributes inherited from cItemHandler
static bool m_HandlerInitialized = false
 
static cItemHandlerm_ItemHandler [E_ITEM_LAST+1]
 

Detailed Description

Definition at line 10 of file ItemPumpkin.h.

Member Typedef Documentation

Definition at line 13 of file ItemPumpkin.h.

Constructor & Destructor Documentation

cItemPumpkinHandler::cItemPumpkinHandler ( void  )
inline

Definition at line 16 of file ItemPumpkin.h.

Member Function Documentation

virtual bool cItemPumpkinHandler::OnPlayerPlace ( cWorld a_World,
cPlayer a_Player,
const cItem a_EquippedItem,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ 
)
inlineoverridevirtual

Called when the player tries to place the item (right mouse button, IsPlaceable() == true).

The block coords are for the block that has been clicked. The default handler uses GetBlocksToPlace() and places the returned blocks. Override if the item needs advanced processing, such as spawning a mob based on the blocks being placed. If the block placement is refused inside this call, it will automatically revert the client-side changes. Returns true if the placement succeeded, false if the placement was aborted for any reason.

Reimplemented from cItemHandler.

Definition at line 22 of file ItemPumpkin.h.

bool cItemPumpkinHandler::TrySpawnGolem ( cWorld a_World,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

Spawns a snow / iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin.

Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched.

Definition at line 47 of file ItemPumpkin.h.

bool cItemPumpkinHandler::TrySpawnIronGolem ( cWorld a_World,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

Spawns an iron golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin.

Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched. Assumes that the block below the specified block has already been checked and is an iron block.

Definition at line 99 of file ItemPumpkin.h.

bool cItemPumpkinHandler::TrySpawnSnowGolem ( cWorld a_World,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inline

Spawns a snow golem if the shape matches the recipe, supposing that the block placed at the specified coords is a pumpkin.

Returns true if the golem blocks are removed (for spawning), false if the recipe is not matched. Assumes that the block below the specified block has already been checked and is a snow block.

Definition at line 72 of file ItemPumpkin.h.


The documentation for this class was generated from the following file: