Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
cBlockHandler Class Reference

#include <BlockHandler.h>

Inheritance diagram for cBlockHandler:
Inheritance graph
[legend]

Public Member Functions

virtual bool CanBeAt (cChunkInterface &a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk &a_Chunk)
 Checks if the block can stay at the specified relative coords in the chunk. More...
 
virtual bool CanSustainPlant (BLOCKTYPE a_Plant)
 Checks whether the block has an effect on growing the plant. More...
 
 cBlockHandler (BLOCKTYPE a_BlockType)
 
virtual void Check (cChunkInterface &ChunkInterface, cBlockPluginInterface &a_PluginInterface, Vector3i a_RelPos, cChunk &a_Chunk)
 Called when one of the neighbors gets set; equivalent to MC block update. More...
 
virtual cItems ConvertToPickups (NIBBLETYPE a_BlockMeta, cBlockEntity *a_BlockEntity, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
 Returns the pickups that would result if the block was mined by a_Digger using a_Tool. More...
 
virtual bool DoesDropOnUnsuitable (void)
 Returns if this block drops if it gets destroyed by an unsuitable situation. More...
 
virtual bool DoesIgnoreBuildCollision (cChunkInterface &ChunkInterface, Vector3i a_Pos, cPlayer &a_Player, NIBBLETYPE a_Meta)
 Checks if the player can build "inside" this block. More...
 
virtual ColourID GetMapBaseColourID (NIBBLETYPE a_Meta)
 Returns the base colour ID of the block, as will be represented on a map, as per documentation: https://minecraft.gamepedia.com/Map_item_format. More...
 
virtual bool GetPlacementBlockTypeMeta (cChunkInterface &a_ChunkInterface, 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 before a block is placed into a world. More...
 
virtual cBoundingBox GetPlacementCollisionBox (BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP)
 Returns the relative bounding box that must be entity-free in order for the block to be placed. More...
 
virtual int Grow (cChunk &a_Chunk, Vector3i a_RelPos, int a_NumStages=1)
 Grows this block, if it supports growing, by the specified amount of stages (at most). More...
 
virtual bool IsClickedThrough (void)
 Indicates whether the client will click through this block. More...
 
virtual bool IsInsideBlock (Vector3d a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
 Tests if a_Position is inside the block where a_Position is relative to the origin of the block Note that this is considered from a "top-down" perspective i.e. More...
 
virtual bool IsUseable (void)
 Checks if the block can be placed at this point. More...
 
virtual NIBBLETYPE MetaMirrorXY (NIBBLETYPE a_Meta)
 Mirrors a given block meta around the XY plane. More...
 
virtual NIBBLETYPE MetaMirrorXZ (NIBBLETYPE a_Meta)
 Mirros a given block meta around the XZ plane. More...
 
virtual NIBBLETYPE MetaMirrorYZ (NIBBLETYPE a_Meta)
 Mirros a given block meta around the YZ plane. More...
 
virtual NIBBLETYPE MetaRotateCCW (NIBBLETYPE a_Meta)
 Rotates a given block meta counter-clockwise. More...
 
virtual NIBBLETYPE MetaRotateCW (NIBBLETYPE a_Meta)
 Rotates a given block meta clockwise. More...
 
virtual void OnBreaking (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos)
 Called before a block gets broken (replaced with air), either by player or by natural means. More...
 
virtual void OnBroken (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta)
 Called after a block gets broken (replaced with air), either by player or by natural means. More...
 
virtual void OnCancelRightClick (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
 Called when a right click to this block is cancelled. More...
 
virtual void OnDigging (cChunkInterface &cChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
 Called when the player starts digging the block. More...
 
virtual void OnNeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
 Called when a direct neighbor of this block has been changed. More...
 
virtual void OnPlaced (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 Called by cWorld::SetBlock() after the block has been set. More...
 
virtual void OnPlacedByPlayer (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const sSetBlock &a_BlockChange)
 Called by cPlayer::PlaceBlocks() for each block after it has been set to the world. More...
 
virtual void OnPlayerBreakingBlock (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, Vector3i a_BlockPos)
 Called just before the player breaks the block. More...
 
virtual void OnPlayerBrokeBlock (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta)
 Called just after the player breaks the block. More...
 
virtual void OnUpdate (cChunkInterface &cChunkInterface, cWorldInterface &a_WorldInterface, cBlockPluginInterface &a_BlockPluginInterface, cChunk &a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
 Called when the block gets ticked either by a random tick or by a queued tick. More...
 
virtual bool OnUse (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
 Called if the user right clicks the block and the block is useable returns true if the use was successful, return false to use the block as a "normal" block. More...
 
virtual ~cBlockHandler ()
 

Static Public Member Functions

static void NeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_NeighborPos, eBlockFace a_WhichNeighbor)
 Notifies the specified neighbor that the current block has changed. More...
 
static bool ToolHasSilkTouch (const cItem *a_Tool)
 Returns true if the specified tool is valid and has a non-zero silk-touch enchantment. More...
 

Static Protected Member Functions

static cBlockHandlerCreateBlockHandler (BLOCKTYPE a_BlockType)
 

Protected Attributes

BLOCKTYPE m_BlockType
 

Friends

class cBlockInfo
 

Detailed Description

Definition at line 25 of file BlockHandler.h.

Constructor & Destructor Documentation

cBlockHandler::cBlockHandler ( BLOCKTYPE  a_BlockType)

Definition at line 369 of file BlockHandler.cpp.

virtual cBlockHandler::~cBlockHandler ( )
inlinevirtual

Definition at line 30 of file BlockHandler.h.

Member Function Documentation

bool cBlockHandler::CanBeAt ( cChunkInterface a_ChunkInterface,
int  a_RelX,
int  a_RelY,
int  a_RelZ,
const cChunk a_Chunk 
)
virtual
virtual bool cBlockHandler::CanSustainPlant ( BLOCKTYPE  a_Plant)
inlinevirtual

Checks whether the block has an effect on growing the plant.

Reimplemented in cBlockLavaHandler, cBlockFarmlandHandler, cBlockFluidHandler, and cBlockNetherrack.

Definition at line 138 of file BlockHandler.h.

void cBlockHandler::Check ( cChunkInterface ChunkInterface,
cBlockPluginInterface a_PluginInterface,
Vector3i  a_RelPos,
cChunk a_Chunk 
)
virtual

Called when one of the neighbors gets set; equivalent to MC block update.

By default drops (DropBlockAsPickup() / SetBlock()) if the position is no longer suitable (CanBeAt(), DoesDropOnUnsuitable()), otherwise wakes up all simulators on the block.

Reimplemented in cBlockVineHandler, cBlockFluidHandler, cBlockConcretePowderHandler, and cBlockSpongeHandler.

Definition at line 546 of file BlockHandler.cpp.

cItems cBlockHandler::ConvertToPickups ( NIBBLETYPE  a_BlockMeta,
cBlockEntity a_BlockEntity,
const cEntity a_Digger = nullptr,
const cItem a_Tool = nullptr 
)
virtual

Returns the pickups that would result if the block was mined by a_Digger using a_Tool.

Doesn't do any actual block change / mining, only calculates the pickups. a_BlockEntity is the block entity present at the block, if any, nullptr if none. a_Digger is the entity that caused the conversion, usually the player digging. a_Tool is the tool used for the digging. The default implementation drops a single item created from m_BlockType and the current meta.

Reimplemented in cBlockDoubleSlabHandler, cBlockPistonHeadHandler, cBlockSnowHandler, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04 > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x03, 0x01, 0x02, 0x00, 0x03, false > >, cClearMetaOnDrop< cBlockPlant< false > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x03, 0x02, 0x03, 0x00, 0x01, true > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x03, 0x03, 0x00, 0x02, 0x01, true > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03, true > >, cClearMetaOnDrop< cBlockHandler >, cClearMetaOnDrop< cMetaRotator< cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04 > >, cClearMetaOnDrop< cBlockEntityHandler >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false > >, cClearMetaOnDrop< cMetaRotator< cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2 > >, cContainerEntityHandler< cBlockEntityHandler >, cBlockDoorHandler, cBlockBigFlowerHandler, cBlockCocoaPodHandler, cBlockFireHandler, cBlockVineHandler, cBlockDeadBushHandler, cBlockDropSpenserHandler, cBlockCakeHandler, cBlockSidewaysHandler, cBlockLeavesHandler, cBlockLeverHandler, cBlockPortalHandler, cBlockBedHandler, cBlockTallGrassHandler, cBlockMobSpawnerHandler, cBlockSlabHandler, cBlockDirtHandler, cBlockStemsHandler< ProduceBlockType, StemPickupType >, cBlockCropsHandler< RipeMeta >, cBlockNetherWartHandler, cBlockSaplingHandler, cBlockWallSignHandler, cBlockCommandBlockHandler, cBlockEnderchestHandler, cBlockFluidHandler, cBlockIceHandler, cBlockMelonHandler, cBlockMobHeadHandler, cBlockRedstoneTorchHandler, cBlockSeaLanternHandler, cBlockSignPostHandler, cBlockSugarcaneHandler, cBlockTripwireHandler, cBlockAnvilHandler, cBlockCobWebHandler, cBlockMyceliumHandler, cBlockStoneHandler, cBlockOreHandler, cBlockFlowerHandler, cBlockGlassHandler, cBlockGlowstoneHandler, cBlockGravelHandler, and cBlockRedstoneLampHandler.

Definition at line 456 of file BlockHandler.cpp.

cBlockHandler * cBlockHandler::CreateBlockHandler ( BLOCKTYPE  a_BlockType)
staticprotected

Definition at line 594 of file BlockHandler.cpp.

bool cBlockHandler::DoesDropOnUnsuitable ( void  )
virtual

Returns if this block drops if it gets destroyed by an unsuitable situation.

Default: true

Reimplemented in cBlockVineHandler, and cBlockSnowHandler.

Definition at line 513 of file BlockHandler.cpp.

bool cBlockHandler::DoesIgnoreBuildCollision ( cChunkInterface ChunkInterface,
Vector3i  a_Pos,
cPlayer a_Player,
NIBBLETYPE  a_Meta 
)
virtual

Checks if the player can build "inside" this block.

For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision

Parameters
a_PosPosition of the block
a_PlayerPlayer trying to build on the block
a_MetaMeta value of the block currently at a_Pos

Reimplemented in cBlockFireHandler, cBlockVineHandler, cBlockSnowHandler, cBlockFluidHandler, cBlockTallGrassHandler, cBlockBigFlowerHandler, and cBlockDeadBushHandler.

Definition at line 504 of file BlockHandler.cpp.

ColourID cBlockHandler::GetMapBaseColourID ( NIBBLETYPE  a_Meta)
virtual

Returns the base colour ID of the block, as will be represented on a map, as per documentation: https://minecraft.gamepedia.com/Map_item_format.

Reimplemented in cBlockRailHandler, cBlockDoorHandler, cBlockVineHandler, cBlockDoubleSlabHandler, cBlockFireHandler, cBlockEndPortalFrameHandler, cBlockSaplingHandler, cBlockChestHandler, cBlockLeverHandler, cBlockTorchHandler, cBlockLavaHandler, cBlockSlabHandler, cBlockSpongeHandler, cBlockLeavesHandler, cBlockComparatorHandler, cBlockBigFlowerHandler, cBlockLadderHandler, cBlockDirtHandler, cBlockButtonHandler, cBlockCocoaPodHandler, cBlockPortalHandler, cBlockTrapdoorHandler, cBlockCropsHandler< RipeMeta >, cBlockSnowHandler, cBlockRedstoneRepeaterHandler, cBlockPistonHandler, cBlockTripwireHookHandler, cBlockBedHandler, cBlockTallGrassHandler, cBlockFenceGateHandler, cBlockStairsHandler, cBlockSugarcaneHandler, cBlockWallSignHandler, cBlockSignPostHandler, cBlockDropSpenserHandler, cBlockConcretePowderHandler, cBlockCauldronHandler, cBlockNetherWartHandler, cBlockCactusHandler, cBlockAnvilHandler, cBlockDeadBushHandler, cBlockFluidHandler, cBlockHopperHandler, cBlockQuartzHandler, cBlockIceHandler, cBlockCakeHandler, cBlockCarpetHandler, cBlockPumpkinHandler, cBlockPressurePlateHandler, cBlockRedstoneHandler, cBlockMushroomHandler, cBlockStemsHandler< ProduceBlockType, StemPickupType >, cBlockFurnaceHandler, cBlockCobWebHandler, cBlockStoneHandler, cBlockGlowstoneHandler, cBlockGravelHandler, cBlockMobHeadHandler, cBlockFlowerHandler, cBlockGlassHandler, cBlockCommandBlockHandler, cBlockRedstoneTorchHandler, cBlockMelonHandler, cBlockTripwireHandler, cBlockMyceliumHandler, cBlockEnchantmentTableHandler, cBlockRedstoneLampHandler, cBlockWorkbenchHandler, cBlockPlanksHandler, cBlockBrewingStandHandler, cBlockFlowerPotHandler, cBlockSlimeHandler, cBlockTNTHandler, cBlockLilypadHandler, cBlockClothHandler, and cBlockSandHandler.

Definition at line 575 of file BlockHandler.cpp.

bool cBlockHandler::GetPlacementBlockTypeMeta ( cChunkInterface a_ChunkInterface,
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 
)
virtual
cBoundingBox cBlockHandler::GetPlacementCollisionBox ( BLOCKTYPE  a_XM,
BLOCKTYPE  a_XP,
BLOCKTYPE  a_YM,
BLOCKTYPE  a_YP,
BLOCKTYPE  a_ZM,
BLOCKTYPE  a_ZP 
)
virtual

Returns the relative bounding box that must be entity-free in order for the block to be placed.

a_XM, a_XP, etc. stand for the blocktype of the minus-X neighbor, the positive-X neighbor, etc.

Reimplemented in cBlockDoorHandler, and cBlockFenceHandler.

Definition at line 532 of file BlockHandler.cpp.

virtual int cBlockHandler::Grow ( cChunk a_Chunk,
Vector3i  a_RelPos,
int  a_NumStages = 1 
)
inlinevirtual

Grows this block, if it supports growing, by the specified amount of stages (at most).

Returns the number of stages actually grown, zero if not supported (default).

Reimplemented in cBlockSaplingHandler, cBlockSugarcaneHandler, cBlockCropsHandler< RipeMeta >, cBlockCactusHandler, cBlockTallGrassHandler, cBlockCocoaPodHandler, cBlockStemsHandler< ProduceBlockType, StemPickupType >, and cBlockNetherWartHandler.

Definition at line 205 of file BlockHandler.h.

bool cBlockHandler::IsClickedThrough ( void  )
virtual

Indicates whether the client will click through this block.

For example digging a fire will hit the block below the fire so fire is clicked through

Reimplemented in cBlockEndPortalFrameHandler, and cBlockFireHandler.

Definition at line 495 of file BlockHandler.cpp.

bool cBlockHandler::IsInsideBlock ( Vector3d  a_Position,
const BLOCKTYPE  a_BlockType,
const NIBBLETYPE  a_BlockMeta 
)
virtual

Tests if a_Position is inside the block where a_Position is relative to the origin of the block Note that this is considered from a "top-down" perspective i.e.

empty spaces on the bottom of a block don't matter

Reimplemented in cBlockSlabHandler, and cBlockSnowHandler.

Definition at line 523 of file BlockHandler.cpp.

bool cBlockHandler::IsUseable ( void  )
virtual

Checks if the block can be placed at this point.

Default: CanBeAt(...) NOTE: This call doesn't actually place the block Called to check whether this block supports a rclk action. If it returns true, OnUse() is called

Reimplemented in cBlockFenceHandler, cBlockDoorHandler, cBlockAnvilHandler, cBlockButtonHandler, cBlockFenceGateHandler, cBlockCakeHandler, cBlockCauldronHandler, cBlockLeverHandler, cBlockRedstoneRepeaterHandler, cBlockEntityHandler, cBlockComparatorHandler, cBlockEnchantmentTableHandler, cBlockWorkbenchHandler, cBlockMobSpawnerHandler, and cBlockTrapdoorHandler.

Definition at line 486 of file BlockHandler.cpp.

virtual NIBBLETYPE cBlockHandler::MetaMirrorXY ( NIBBLETYPE  a_Meta)
inlinevirtual
virtual NIBBLETYPE cBlockHandler::MetaMirrorXZ ( NIBBLETYPE  a_Meta)
inlinevirtual

Mirros a given block meta around the XZ plane.

Default: no change Returns block meta following rotation

Reimplemented in cBlockSlabHandler, cBlockStairsHandler, cBlockDropSpenserHandler, and cBlockHopperHandler.

Definition at line 197 of file BlockHandler.h.

virtual NIBBLETYPE cBlockHandler::MetaMirrorYZ ( NIBBLETYPE  a_Meta)
inlinevirtual
virtual NIBBLETYPE cBlockHandler::MetaRotateCCW ( NIBBLETYPE  a_Meta)
inlinevirtual
virtual NIBBLETYPE cBlockHandler::MetaRotateCW ( NIBBLETYPE  a_Meta)
inlinevirtual
void cBlockHandler::NeighborChanged ( cChunkInterface a_ChunkInterface,
Vector3i  a_NeighborPos,
eBlockFace  a_WhichNeighbor 
)
static

Notifies the specified neighbor that the current block has changed.

a_NeighborPos are the coords of the neighbor to be notified a_WhichNeighbor specifies which neighbor (relative to a_NeighborPos) has changed. For example BLOCK_FACE_YP means that the block at {a_NeighborX, a_NeighborY + 1, a_NeighborZ} has changed. BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.)

Definition at line 442 of file BlockHandler.cpp.

virtual void cBlockHandler::OnBreaking ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos 
)
inlinevirtual

Called before a block gets broken (replaced with air), either by player or by natural means.

If by player, it is called after the OnPlayerBreakingBlock() callback. By default does nothing.

Definition at line 82 of file BlockHandler.h.

void cBlockHandler::OnBroken ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos,
BLOCKTYPE  a_OldBlockType,
NIBBLETYPE  a_OldBlockMeta 
)
virtual

Called after a block gets broken (replaced with air), either by player or by natural means.

If by player, it is called before the OnPlayerBrokeBlock() callback. The block is already dug up in the world, the original block type and meta is passed in a_OldBlockType and a_OldBlockMeta. By default notifies all direct neighbors via their OnNeighborChanged() callbacks.

Reimplemented in cBlockPistonHeadHandler, cBlockFenceHandler, cBlockBigFlowerHandler, cBlockRailHandler, cBlockIceHandler, cBlockBedHandler, cBlockPistonHandler, and cBlockDoorHandler.

Definition at line 427 of file BlockHandler.cpp.

virtual void cBlockHandler::OnCancelRightClick ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace 
)
inlinevirtual

Called when a right click to this block is cancelled.

It forces the server to send the real state of a block to the client to prevent client assuming the operation is successfull

Reimplemented in cBlockSlabHandler, cBlockFenceHandler, cBlockFenceGateHandler, cBlockTrapdoorHandler, cBlockRedstoneRepeaterHandler, cBlockComparatorHandler, cBlockDoorHandler, and cBlockTNTHandler.

Definition at line 119 of file BlockHandler.h.

virtual void cBlockHandler::OnDigging ( cChunkInterface cChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ 
)
inlinevirtual

Called when the player starts digging the block.

Definition at line 111 of file BlockHandler.h.

virtual void cBlockHandler::OnNeighborChanged ( cChunkInterface a_ChunkInterface,
Vector3i  a_BlockPos,
eBlockFace  a_WhichNeighbor 
)
inlinevirtual

Called when a direct neighbor of this block has been changed.

The position is the block's own position, NOT the changed neighbor's position. a_WhichNeighbor indicates which neighbor has changed. For example, BLOCK_FACE_YP meant the neighbor above has changed. BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.)

Reimplemented in cBlockRailHandler, cBlockLeavesHandler, and cBlockFarmlandHandler.

Definition at line 101 of file BlockHandler.h.

void cBlockHandler::OnPlaced ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos,
BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
virtual

Called by cWorld::SetBlock() after the block has been set.

Reimplemented in cBlockEndPortalFrameHandler, cBlockRailHandler, and cBlockFireHandler.

Definition at line 412 of file BlockHandler.cpp.

void cBlockHandler::OnPlacedByPlayer ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
const sSetBlock a_BlockChange 
)
virtual

Called by cPlayer::PlaceBlocks() for each block after it has been set to the world.

Called after OnPlaced().

Reimplemented in cBlockBedHandler.

Definition at line 403 of file BlockHandler.cpp.

virtual void cBlockHandler::OnPlayerBreakingBlock ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
Vector3i  a_BlockPos 
)
inlinevirtual

Called just before the player breaks the block.

The block is still valid in the world. By default does nothing special; descendants may provide further behavior.

Definition at line 63 of file BlockHandler.h.

virtual void cBlockHandler::OnPlayerBrokeBlock ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
Vector3i  a_BlockPos,
BLOCKTYPE  a_OldBlockType,
NIBBLETYPE  a_OldBlockMeta 
)
inlinevirtual

Called just after the player breaks the block.

The block is already dug up in the world, the original block type and meta is passed in a_OldBlockType and a_OldBlockMeta. By default does nothing special, descendants may provide further behavior.

Reimplemented in cBlockOreHandler, and cBlockMobSpawnerHandler.

Definition at line 72 of file BlockHandler.h.

void cBlockHandler::OnUpdate ( cChunkInterface cChunkInterface,
cWorldInterface a_WorldInterface,
cBlockPluginInterface a_BlockPluginInterface,
cChunk a_Chunk,
int  a_RelX,
int  a_RelY,
int  a_RelZ 
)
virtual

Called when the block gets ticked either by a random tick or by a queued tick.

Note that the coords are chunk-relative!

Reimplemented in cBlockVineHandler, cBlockLavaHandler, cBlockLeavesHandler, cBlockCauldronHandler, cBlockPortalHandler, cBlockDirtHandler, cBlockSaplingHandler, cBlockCocoaPodHandler, cBlockFarmlandHandler, cBlockPlant< NeedsLightToGrow >, cBlockPlant< false >, and cBlockPlant< true >.

Definition at line 395 of file BlockHandler.cpp.

virtual bool cBlockHandler::OnUse ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
cPlayer a_Player,
int  a_BlockX,
int  a_BlockY,
int  a_BlockZ,
eBlockFace  a_BlockFace,
int  a_CursorX,
int  a_CursorY,
int  a_CursorZ 
)
inlinevirtual

Called if the user right clicks the block and the block is useable returns true if the use was successful, return false to use the block as a "normal" block.

Reimplemented in cBlockFenceHandler, cBlockRedstoneRepeaterHandler, cBlockBedHandler, cBlockFenceGateHandler, cBlockTrapdoorHandler, cBlockAnvilHandler, cBlockEntityHandler, cBlockButtonHandler, cBlockLeverHandler, cBlockComparatorHandler, cBlockCakeHandler, cBlockDoorHandler, cBlockCauldronHandler, cBlockEnchantmentTableHandler, cBlockMobSpawnerHandler, and cBlockWorkbenchHandler.

Definition at line 115 of file BlockHandler.h.

bool cBlockHandler::ToolHasSilkTouch ( const cItem a_Tool)
static

Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.

Helper used in many ConvertToPickups() implementations.

Definition at line 585 of file BlockHandler.cpp.

Friends And Related Function Documentation

friend class cBlockInfo
friend

Definition at line 218 of file BlockHandler.h.

Member Data Documentation

BLOCKTYPE cBlockHandler::m_BlockType
protected

Definition at line 213 of file BlockHandler.h.


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