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

#include <BlockFire.h>

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

Classes

struct  Scratch
 

Public Member Functions

constexpr cBlockHandler (BLOCKTYPE a_BlockType)
 
- Public Member Functions inherited from cBlockHandler
virtual bool CanBeAt (const cChunk &a_Chunk, Vector3i a_Position, NIBBLETYPE a_Meta) const
 Checks if the block can stay at the specified relative coords in the chunk. More...
 
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 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 MetaMirrorXY (NIBBLETYPE a_Meta) const
 Mirrors a given block meta around the XY plane. More...
 
virtual NIBBLETYPE MetaMirrorXZ (NIBBLETYPE a_Meta) const
 Mirros a given block meta around the XZ plane. More...
 
virtual NIBBLETYPE MetaMirrorYZ (NIBBLETYPE a_Meta) const
 Mirros a given block meta around the YZ plane. More...
 
virtual NIBBLETYPE MetaRotateCCW (NIBBLETYPE a_Meta) const
 Rotates a given block meta counter-clockwise. More...
 
virtual NIBBLETYPE MetaRotateCW (NIBBLETYPE a_Meta) const
 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
 Called after a block gets broken (replaced with air), by natural means. 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 OnNeighborChanged (cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const
 Called when a direct neighbor of this block has been changed. 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...
 

Private Member Functions

virtual cItems ConvertToPickups (const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
 Returns the pickups that would result if the block was mined by a_Digger using a_Tool. More...
 
virtual bool DoesIgnoreBuildCollision (const cWorld &a_World, const cItem &a_HeldItem, const Vector3i a_Position, const NIBBLETYPE a_Meta, const eBlockFace a_ClickedBlockFace, const bool a_ClickedDirectly) const override
 Checks if the player can build "inside" this block. 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 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 EvaluatePortalBorder (int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface &a_ChunkInterface)
 Evaluates if coords have a valid border on top, based on MaxY. More...
 
static void FindAndSetPortalFrame (int X, int Y, int Z, cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Scratch &a_Scratch)
 Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE) More...
 
static int FindObsidianCeiling (int X, int Y, int Z, cChunkInterface &a_ChunkInterface, int MaxY=0)
 Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding. More...
 
static bool FindPortalSliceX (int X1, int X2, int Y, int Z, int MaxY, cChunkInterface &a_ChunkInterface, Scratch &a_Scratch)
 Evaluates if coordinates are a portal going XP / XM; returns true if so, and writes boundaries to variable Takes coordinates of base block and Y coord of target obsidian ceiling. More...
 
static bool FindPortalSliceZ (int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface &a_ChunkInterface, Scratch &a_Scratch)
 Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable. More...
 

Additional Inherited Members

- 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...
 
- Protected Member Functions inherited from cBlockHandler
 ~cBlockHandler ()=default
 
- Protected Attributes inherited from cBlockHandler
const BLOCKTYPE m_BlockType
 

Detailed Description

Definition at line 10 of file BlockFire.h.

Member Function Documentation

◆ cBlockHandler()

constexpr cBlockHandler::cBlockHandler
inlineconstexpr

Definition at line 29 of file BlockHandler.h.

◆ ConvertToPickups()

virtual cItems cBlockFireHandler::ConvertToPickups ( const NIBBLETYPE  a_BlockMeta,
const cItem *const  a_Tool 
) const
inlineoverrideprivatevirtual

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

Definition at line 61 of file BlockFire.h.

◆ DoesIgnoreBuildCollision()

virtual bool cBlockFireHandler::DoesIgnoreBuildCollision ( const cWorld a_World,
const cItem a_HeldItem,
const Vector3i  a_Position,
const NIBBLETYPE  a_Meta,
const eBlockFace  a_ClickedBlockFace,
const bool  a_ClickedDirectly 
) const
inlineoverrideprivatevirtual

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

Definition at line 251 of file BlockFire.h.

◆ EvaluatePortalBorder()

static bool cBlockFireHandler::EvaluatePortalBorder ( int  X,
int  FoundObsidianY,
int  Z,
int  MaxY,
cChunkInterface a_ChunkInterface 
)
inlinestaticprivate

Evaluates if coords have a valid border on top, based on MaxY.

Definition at line 105 of file BlockFire.h.

◆ FindAndSetPortalFrame()

static void cBlockFireHandler::FindAndSetPortalFrame ( int  X,
int  Y,
int  Z,
cChunkInterface a_ChunkInterface,
cWorldInterface a_WorldInterface,
Scratch a_Scratch 
)
inlinestaticprivate

Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE)

Definition at line 124 of file BlockFire.h.

◆ FindObsidianCeiling()

static int cBlockFireHandler::FindObsidianCeiling ( int  X,
int  Y,
int  Z,
cChunkInterface a_ChunkInterface,
int  MaxY = 0 
)
inlinestaticprivate

Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding.

Definition at line 70 of file BlockFire.h.

◆ FindPortalSliceX()

static bool cBlockFireHandler::FindPortalSliceX ( int  X1,
int  X2,
int  Y,
int  Z,
int  MaxY,
cChunkInterface a_ChunkInterface,
Scratch a_Scratch 
)
inlinestaticprivate

Evaluates if coordinates are a portal going XP / XM; returns true if so, and writes boundaries to variable Takes coordinates of base block and Y coord of target obsidian ceiling.

Definition at line 174 of file BlockFire.h.

◆ FindPortalSliceZ()

static bool cBlockFireHandler::FindPortalSliceZ ( int  X,
int  Y,
int  Z1,
int  Z2,
int  MaxY,
cChunkInterface a_ChunkInterface,
Scratch a_Scratch 
)
inlinestaticprivate

Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable.

Definition at line 213 of file BlockFire.h.

◆ GetMapBaseColourID()

virtual ColourID cBlockFireHandler::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 256 of file BlockFire.h.

◆ OnPlaced()

virtual void cBlockFireHandler::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 30 of file BlockFire.h.


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