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

#include <ItemMobHead.h>

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

Public Member Functions

void AwardSpawnWitherAchievement (cWorld &a_World, Vector3i a_BlockPos) const
 Awards the achievement to all players close to the specified point. More...
 
virtual bool CommitPlacement (cPlayer &a_Player, const cItem &a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override
 Performs the actual placement of this placeable item. More...
 
virtual bool IsPlaceable (void) const override
 Blocks simply get placed. More...
 
void RegularHeadPlaced (const cPlayer &a_Player, const cItem &a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace) const
 Called after placing a regular head block with no mob spawning. More...
 
bool TrySpawnWitherAround (cPlayer &a_Player, const Vector3i a_BlockPos) const
 Spawns a wither if the wither skull placed at the specified coords completes wither's spawning formula. More...
 
bool TrySpawnWitherAt (cWorld &a_World, cPlayer &a_Player, Vector3i a_PlacedHeadPos, int a_OffsetX, int a_OffsetZ) const
 Tries to spawn a wither at the specified offset from the placed head block. More...
 
bool TrySpawnWitherFromImage (cWorld &a_World, cPlayer &a_Player, const sSetBlock(&a_Image)[9], Vector3i a_PlacedHeadPos, int a_OffsetX, int a_OffsetZ) const
 Tries to spawn a wither from the specified image at the specified offset from the placed head block. 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 bool EatItem (cPlayer *a_Player, cItem *a_Item) const
 Lets the player eat a selected item. More...
 
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 FoodInfo GetFoodInfo (const cItem *a_Item) const
 Returns the FoodInfo for this item. 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 IsFood (void) const
 Indicates if this item is food. 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...
 

Static Public Member Functions

static NIBBLETYPE BlockFaceToBlockMeta (int a_BlockFace)
 Converts the block face of the placement (which face of the block was clicked to place the head) into the block's metadata value. More...
 

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...
 
- Protected Member Functions inherited from cItemHandler
 ~cItemHandler ()=default
 
- Static Protected Member Functions inherited from cItemHandler
static const cItemHandlerFor (int a_ItemType)
 
- Protected Attributes inherited from cItemHandler
const int m_ItemType
 

Detailed Description

Definition at line 12 of file ItemMobHead.h.

Member Typedef Documentation

◆ Super

Definition at line 15 of file ItemMobHead.h.

Member Function Documentation

◆ AwardSpawnWitherAchievement()

void cItemMobHeadHandler::AwardSpawnWitherAchievement ( cWorld a_World,
Vector3i  a_BlockPos 
) const
inline

Awards the achievement to all players close to the specified point.

Definition at line 280 of file ItemMobHead.h.

◆ BlockFaceToBlockMeta()

static NIBBLETYPE cItemMobHeadHandler::BlockFaceToBlockMeta ( int  a_BlockFace)
inlinestatic

Converts the block face of the placement (which face of the block was clicked to place the head) into the block's metadata value.

Definition at line 302 of file ItemMobHead.h.

◆ CommitPlacement()

virtual bool cItemMobHeadHandler::CommitPlacement ( cPlayer a_Player,
const cItem a_HeldItem,
const Vector3i  a_PlacePosition,
const eBlockFace  a_ClickedBlockFace,
const Vector3i  a_CursorPosition 
) const
inlineoverridevirtual

Performs the actual placement of this placeable item.

The descendant handler should call a_Player.PlaceBlock(s) supplying correct values for the newly placed block. The default handler uses the stored block type and meta copied from the lowest 4 bits of the player's equipped item's damage value. Handlers return what a_Player.PlaceBlock(s) returns, indicating whether the placement was successful.

Reimplemented from cItemHandler.

Definition at line 25 of file ItemMobHead.h.

◆ IsPlaceable()

virtual bool cItemMobHeadHandler::IsPlaceable ( void  ) const
inlineoverridevirtual

Blocks simply get placed.

Reimplemented from cItemHandler.

Definition at line 323 of file ItemMobHead.h.

◆ RegularHeadPlaced()

void cItemMobHeadHandler::RegularHeadPlaced ( const cPlayer a_Player,
const cItem a_HeldItem,
const Vector3i  a_PlacePosition,
const eBlockFace  a_ClickedBlockFace 
) const
inline

Called after placing a regular head block with no mob spawning.

Adjusts the mob head entity based on the equipped item's data.

Definition at line 58 of file ItemMobHead.h.

◆ TrySpawnWitherAround()

bool cItemMobHeadHandler::TrySpawnWitherAround ( cPlayer a_Player,
const Vector3i  a_BlockPos 
) const
inline

Spawns a wither if the wither skull placed at the specified coords completes wither's spawning formula.

Returns true if the wither was created.

Definition at line 88 of file ItemMobHead.h.

◆ TrySpawnWitherAt()

bool cItemMobHeadHandler::TrySpawnWitherAt ( cWorld a_World,
cPlayer a_Player,
Vector3i  a_PlacedHeadPos,
int  a_OffsetX,
int  a_OffsetZ 
) const
inline

Tries to spawn a wither at the specified offset from the placed head block.

PlacedHead coords are used to override the block query - at those coords the block is not queried from the world, but assumed to be a head instead. Offset is used to shift the image around the X and Z axis. Returns true iff the wither was created successfully.

Definition at line 127 of file ItemMobHead.h.

◆ TrySpawnWitherFromImage()

bool cItemMobHeadHandler::TrySpawnWitherFromImage ( cWorld a_World,
cPlayer a_Player,
const sSetBlock(&)  a_Image[9],
Vector3i  a_PlacedHeadPos,
int  a_OffsetX,
int  a_OffsetZ 
) const
inline

Tries to spawn a wither from the specified image at the specified offset from the placed head block.

PlacedHead coords are used to override the block query - at those coords the block is not queried from the world, but assumed to be a head instead. Offset is used to shift the image around the X and Z axis. Returns true iff the wither was created successfully.

Definition at line 185 of file ItemMobHead.h.


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