380 int a_BlockX,
int a_BlockY,
int a_BlockZ,
eBlockFace a_BlockFace,
381 int a_CursorX,
int a_CursorY,
int a_CursorZ,
552 if (!
CanBeAt(a_ChunkInterface, a_RelPos.
x, a_RelPos.
y, a_RelPos.
z, a_Chunk))
610 const char * newBlockTypeName;
1276 {
"minecraft:wither_skeleton_wall_skull",
E_BLOCK_HEAD},
1293 for (
const auto & r: regs)
cWorld * GetWorld(void) const
virtual void OnNeighborChanged(cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor)
Called when a direct neighbor of this block has been changed.
Handler for blocks that have 3 orientations (hay bale, log), specified by the upper 2 bits in meta...
Stores information on all known block types.
Wrapper for blocks that have a cBlockEntity descendant attached to them and can be "used" by the play...
void WakeUp(Vector3i a_Block, cChunk *a_Chunk)
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.
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...
static float GetBlockHeight(BLOCKTYPE a_Type)
virtual bool DoesIgnoreBuildCollision(cChunkInterface &ChunkInterface, Vector3i a_Pos, cPlayer &a_Player, NIBBLETYPE a_Meta)
Checks if the player can build "inside" this block.
static bool IsSolid(BLOCKTYPE a_Type)
unsigned char BLOCKTYPE
The datatype used by blockdata.
static cBlockHandler * GetHandler(BLOCKTYPE a_Type)
Vector3i RelativeToAbsolute(Vector3i a_RelBlockPosition)
Converts the coord relative to this chunk into an absolute coord.
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...
static bool IsValidHeight(int a_Height)
Validates a height-coordinate.
const cItem & GetEquippedItem(void) const
cBlockHandler(BLOCKTYPE a_BlockType)
void SetBlock(Vector3i a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
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.
static void NeighborChanged(cChunkInterface &a_ChunkInterface, Vector3i a_NeighborPos, eBlockFace a_WhichNeighbor)
Notifies the specified neighbor that the current block has changed.
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
cSimulatorManager * GetSimulatorManager(void)
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.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Represents two sets of coords, minimum and maximum for each direction.
static bool ToolHasSilkTouch(const cItem *a_Tool)
Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.
void RegisterAllBlockHandlers(BlockTypeRegistry &aRegistry)
Registers all the BlockHandler descendants in the specified registry.
Vector3i GetPos(void) const
Returns the absolute position of the stored block.
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
Vector3< T > addedX(T a_AddX) const
Returns a copy of this vector moved by the specified amount on the X axis.
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld...
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.
cEnchantments m_Enchantments
virtual bool IsClickedThrough(void)
Indicates whether the client will click through this block.
Common class that takes care of beetroots, carrots, potatoes and wheat.
cBlockStemsHandler< E_BLOCK_MELON, E_ITEM_MELON_SEEDS > cBlockMelonStemHandler
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...
Handles the grass that is 1 block tall.
Vector3< T > addedZ(T a_AddZ) const
Returns a copy of this vector moved by the specified amount on the Z axis.
void DropBlockAsPickups(Vector3i a_BlockPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
Digs the block and spawns the relevant pickups, as if a_Digger used a_Tool to dig the block...
static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType)
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
virtual bool IsUseable(void)
Checks if the block can be placed at this point.
BLOCKTYPE GetBlock(Vector3i a_Pos)
virtual bool DoesDropOnUnsuitable(void)
Returns if this block drops if it gets destroyed by an unsuitable situation.
static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType)
Creates a block handler instance based on the specified block type.
Handler used for all types of dirt and grassblock.
cBlockStemsHandler< E_BLOCK_PUMPKIN, E_ITEM_PUMPKIN_SEEDS > cBlockPumpkinStemHandler
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.
void registerBlockType(const AString &aPluginName, const AString &aBlockTypeName, std::shared_ptr< cBlockHandler > aHandler, const std::map< AString, AString > &aHints=std::map< AString, AString >(), const std::map< AString, BlockInfo::HintCallback > &aHintCallbacks=std::map< AString, BlockInfo::HintCallback >())
Registers the specified block type.
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.
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 ...
This class bridges a vector of cItem for safe access via Lua.
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.