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

#include <BlockRail.h>

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

Static Public Member Functions

static NIBBLETYPE FindMeta (cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, BLOCKTYPE a_RailType)
 
- Static Public Member Functions inherited from cBlockHandler
static const cBlockHandlerFor (BLOCKTYPE a_BlockType)
 
static char FortuneDiscreteRandom (char a_MinDrop, char a_DefaultMax, unsigned char a_BonusMax, char a_DropCap=25)
 Returns a random number of drops taking into account fortune. More...
 
static void NeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_NeighborPos, eBlockFace a_WhichNeighbor)
 Notifies the specified neighbor that the current block has changed. More...
 
static unsigned char ToolFortuneLevel (const cItem *a_Tool)
 Returns the fortune level of a tool, if it is a valid tool. 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...
 

Private Types

using Super = cClearMetaOnDrop< cBlockHandler >
 

Private Member Functions

virtual bool CanBeAt (const cChunk &a_Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta) const override
 Checks if the block can stay at the specified relative coords in the chunk. More...
 
virtual ColourID GetMapBaseColourID (NIBBLETYPE a_Meta) const override
 Returns the base colour ID of the block, as will be represented on a map, as per documentation: https://minecraft.wiki/w/Map_item_format. More...
 
virtual NIBBLETYPE MetaMirrorXY (NIBBLETYPE a_Meta) const override
 Mirrors a given block meta around the XY plane. More...
 
virtual NIBBLETYPE MetaMirrorYZ (NIBBLETYPE a_Meta) const override
 Mirros a given block meta around the YZ plane. More...
 
virtual NIBBLETYPE MetaRotateCCW (NIBBLETYPE a_Meta) const override
 Rotates a given block meta counter-clockwise. More...
 
virtual NIBBLETYPE MetaRotateCW (NIBBLETYPE a_Meta) const override
 Rotates a given block meta clockwise. More...
 
virtual void OnBroken (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta, const cEntity *a_Digger) const override
 Called after a block gets broken (replaced with air), by natural means. More...
 
virtual void OnNeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const override
 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) const override
 Called by cWorld::SetBlock() after the block has been set. More...
 

Static Private Member Functions

static bool CanBeSupportedBy (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
 
static bool IsNotConnected (cChunkInterface &a_ChunkInterface, Vector3i a_Pos, eBlockFace a_BlockFace, char a_Pure=0)
 
static bool IsUnstable (cChunkInterface &a_ChunkInterface, Vector3i a_Pos)
 

Additional Inherited Members

- Public Member Functions inherited from cClearMetaOnDrop< cBlockHandler >
constexpr cClearMetaOnDrop (BLOCKTYPE a_BlockType)
 
- Public Member Functions inherited from cBlockHandler
virtual bool CanSustainPlant (BLOCKTYPE a_Plant) const
 Checks whether the block has an effect on growing the plant. More...
 
constexpr cBlockHandler (BLOCKTYPE a_BlockType)
 
void Check (cChunkInterface &ChunkInterface, cBlockPluginInterface &a_PluginInterface, Vector3i a_RelPos, cChunk &a_Chunk) const
 Called when one of the neighbors gets set; equivalent to MC block update. More...
 
virtual bool DoesIgnoreBuildCollision (const cWorld &a_World, const cItem &a_HeldItem, Vector3i a_Position, NIBBLETYPE a_Meta, eBlockFace a_ClickedBlockFace, bool a_ClickedDirectly) const
 Checks if the player can build "inside" this block. More...
 
virtual cBoundingBox GetPlacementCollisionBox (BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP) const
 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) const
 Grows this block, if it supports growing, by the specified amount of stages (at most). More...
 
virtual bool IsInsideBlock (const Vector3d a_RelPosition, const NIBBLETYPE a_BlockMeta) const
 Tests if a_RelPosition is inside the block, where a_RelPosition is relative to the origin of the block. More...
 
virtual bool IsUseable (void) const
 Called to check whether this block supports a rclk action. More...
 
virtual NIBBLETYPE MetaMirrorXZ (NIBBLETYPE a_Meta) const
 Mirros a given block meta around the XZ plane. More...
 
virtual void OnCancelRightClick (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const Vector3i a_BlockPos, eBlockFace a_BlockFace) const
 Called when a right click to this block is cancelled. More...
 
virtual void OnDigging (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const Vector3i a_BlockPos) const
 Called when the player starts digging the block. More...
 
virtual void OnUpdate (cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cBlockPluginInterface &a_BlockPluginInterface, cChunk &a_Chunk, const Vector3i a_RelPos) const
 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, const Vector3i a_BlockPos, eBlockFace a_BlockFace, const Vector3i a_CursorPos) const
 Called when the user right clicks the block and the block is useable. More...
 
- Protected Member Functions inherited from cClearMetaOnDrop< cBlockHandler >
 ~cClearMetaOnDrop ()=default
 
- Protected Member Functions inherited from cBlockHandler
 ~cBlockHandler ()=default
 
- Protected Attributes inherited from cBlockHandler
const BLOCKTYPE m_BlockType
 

Detailed Description

Definition at line 27 of file BlockRail.h.

Member Typedef Documentation

◆ Super

Definition at line 30 of file BlockRail.h.

Member Function Documentation

◆ CanBeAt()

virtual bool cBlockRailHandler::CanBeAt ( const cChunk a_Chunk,
const Vector3i  a_Position,
NIBBLETYPE  a_Meta 
) const
inlineoverrideprivatevirtual

Checks if the block can stay at the specified relative coords in the chunk.

Reimplemented from cBlockHandler.

Definition at line 178 of file BlockRail.h.

◆ CanBeSupportedBy()

static bool cBlockRailHandler::CanBeSupportedBy ( BLOCKTYPE  a_BlockType,
NIBBLETYPE  a_BlockMeta 
)
inlinestaticprivate

Definition at line 165 of file BlockRail.h.

◆ FindMeta()

static NIBBLETYPE cBlockRailHandler::FindMeta ( cChunkInterface a_ChunkInterface,
Vector3i  a_BlockPos,
BLOCKTYPE  a_RailType 
)
inlinestatic

Definition at line 37 of file BlockRail.h.

◆ GetMapBaseColourID()

virtual ColourID cBlockRailHandler::GetMapBaseColourID ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

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

Reimplemented from cBlockHandler.

Definition at line 658 of file BlockRail.h.

◆ IsNotConnected()

static bool cBlockRailHandler::IsNotConnected ( cChunkInterface a_ChunkInterface,
Vector3i  a_Pos,
eBlockFace  a_BlockFace,
char  a_Pure = 0 
)
inlinestaticprivate

Definition at line 353 of file BlockRail.h.

◆ IsUnstable()

static bool cBlockRailHandler::IsUnstable ( cChunkInterface a_ChunkInterface,
Vector3i  a_Pos 
)
inlinestaticprivate

Definition at line 220 of file BlockRail.h.

◆ MetaMirrorXY()

virtual NIBBLETYPE cBlockRailHandler::MetaMirrorXY ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

Mirrors a given block meta around the XY plane.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 580 of file BlockRail.h.

◆ MetaMirrorYZ()

virtual NIBBLETYPE cBlockRailHandler::MetaMirrorYZ ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

Mirros a given block meta around the YZ plane.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 619 of file BlockRail.h.

◆ MetaRotateCCW()

virtual NIBBLETYPE cBlockRailHandler::MetaRotateCCW ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

Rotates a given block meta counter-clockwise.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 507 of file BlockRail.h.

◆ MetaRotateCW()

virtual NIBBLETYPE cBlockRailHandler::MetaRotateCW ( NIBBLETYPE  a_Meta) const
inlineoverrideprivatevirtual

Rotates a given block meta clockwise.

Default: no change Returns block meta following rotation

Reimplemented from cBlockHandler.

Definition at line 544 of file BlockRail.h.

◆ OnBroken()

virtual void cBlockRailHandler::OnBroken ( cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Vector3i  a_BlockPos,
BLOCKTYPE  a_OldBlockType,
NIBBLETYPE  a_OldBlockMeta,
const cEntity a_Digger 
) const
inlineoverrideprivatevirtual

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

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. You can determine what kind of entity broke the block (e.g. player) by checking a_Digger!

Reimplemented from cBlockHandler.

Definition at line 453 of file BlockRail.h.

◆ OnNeighborChanged()

virtual void cBlockRailHandler::OnNeighborChanged ( cChunkInterface a_ChunkInterface,
Vector3i  a_BlockPos,
eBlockFace  a_WhichNeighbor 
) const
inlineoverrideprivatevirtual

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 from cBlockHandler.

Definition at line 474 of file BlockRail.h.

◆ OnPlaced()

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

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

Reimplemented from cBlockHandler.

Definition at line 487 of file BlockRail.h.


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