475 if (a_ChunkInterface.
DoWithChunkAt(a_BlockPos, [&](
cChunk & a_Chunk) { return CanBeAt(a_Chunk, cChunkDef::AbsoluteToRelative(a_BlockPos), a_Chunk.GetMeta(cChunkDef::AbsoluteToRelative(a_BlockPos))); }))
624 return std::clamp<char>(DropNum, a_MinDrop, a_DropCap);
897 UNREACHABLE(
"Getting handler for unexpected block type");
@ E_BLOCK_ORANGE_GLAZED_TERRACOTTA
@ E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE
@ E_BLOCK_REDSTONE_LAMP_OFF
@ E_BLOCK_WHITE_SHULKER_BOX
@ E_BLOCK_NETHER_BRICK_STAIRS
@ E_BLOCK_PINK_SHULKER_BOX
@ E_BLOCK_PINK_GLAZED_TERRACOTTA
@ E_BLOCK_REDSTONE_TORCH_ON
@ E_BLOCK_STONE_PRESSURE_PLATE
@ E_BLOCK_BLUE_SHULKER_BOX
@ E_BLOCK_GRAY_GLAZED_TERRACOTTA
@ E_BLOCK_OAK_WOOD_STAIRS
@ E_BLOCK_STANDING_BANNER
@ E_BLOCK_DAYLIGHT_SENSOR
@ E_BLOCK_REDSTONE_REPEATER_ON
@ E_BLOCK_BROWN_SHULKER_BOX
@ E_BLOCK_DOUBLE_WOODEN_SLAB
@ E_BLOCK_COBBLESTONE_STAIRS
@ E_BLOCK_STATIONARY_LAVA
@ E_BLOCK_LIGHT_BLUE_SHULKER_BOX
@ E_BLOCK_BIRCH_FENCE_GATE
@ E_BLOCK_DARK_OAK_WOOD_STAIRS
@ E_BLOCK_REPEATING_COMMAND_BLOCK
@ E_BLOCK_BLACK_GLAZED_TERRACOTTA
@ E_BLOCK_ACACIA_FENCE_GATE
@ E_BLOCK_STONE_BRICK_STAIRS
@ E_BLOCK_ENCHANTMENT_TABLE
@ E_BLOCK_END_PORTAL_FRAME
@ E_BLOCK_PRISMARINE_BLOCK
@ E_BLOCK_RED_NETHER_BRICK
@ E_BLOCK_NUMBER_OF_TYPES
Number of individual (different) blocktypes.
@ E_BLOCK_BLOCK_OF_REDSTONE
@ E_BLOCK_MOSSY_COBBLESTONE
@ E_BLOCK_STAINED_GLASS_PANE
@ E_BLOCK_MAGENTA_SHULKER_BOX
@ E_BLOCK_REDSTONE_ORE_GLOWING
@ E_BLOCK_BLUE_GLAZED_TERRACOTTA
@ E_BLOCK_BIRCH_WOOD_STAIRS
@ E_BLOCK_CYAN_SHULKER_BOX
@ E_BLOCK_LIME_SHULKER_BOX
@ E_BLOCK_CHAIN_COMMAND_BLOCK
@ E_BLOCK_NETHER_WART_BLOCK
@ E_BLOCK_PURPLE_SHULKER_BOX
@ E_BLOCK_PISTON_EXTENSION
@ E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB
@ E_BLOCK_JUNGLE_WOOD_STAIRS
@ E_BLOCK_YELLOW_GLAZED_TERRACOTTA
@ E_BLOCK_MAGENTA_GLAZED_TERRACOTTA
@ E_BLOCK_ACACIA_WOOD_STAIRS
@ E_BLOCK_ORANGE_SHULKER_BOX
@ E_BLOCK_CYAN_GLAZED_TERRACOTTA
@ E_BLOCK_INACTIVE_COMPARATOR
@ E_BLOCK_DOUBLE_STONE_SLAB
@ E_BLOCK_ACTIVE_COMPARATOR
@ E_BLOCK_RED_SANDSTONE_STAIRS
@ E_BLOCK_PISTON_MOVED_BLOCK
@ E_BLOCK_STRUCTURE_BLOCK
@ E_BLOCK_SPRUCE_FENCE_GATE
@ E_BLOCK_GRAY_SHULKER_BOX
@ E_BLOCK_LIGHT_BLUE_GLAZED_TERRACOTTA
@ E_BLOCK_SPRUCE_WOOD_STAIRS
@ E_BLOCK_YELLOW_SHULKER_BOX
@ E_BLOCK_DARK_OAK_FENCE_GATE
@ E_BLOCK_CONCRETE_POWDER
@ E_BLOCK_JUNGLE_FENCE_GATE
@ E_BLOCK_PURPLE_GLAZED_TERRACOTTA
@ E_BLOCK_HUGE_BROWN_MUSHROOM
@ E_BLOCK_WOODEN_PRESSURE_PLATE
@ E_BLOCK_HUGE_RED_MUSHROOM
@ E_BLOCK_GREEN_SHULKER_BOX
@ E_BLOCK_BLACK_SHULKER_BOX
@ E_BLOCK_REDSTONE_TORCH_OFF
@ E_BLOCK_LIGHT_GRAY_GLAZED_TERRACOTTA
@ E_BLOCK_NETHER_QUARTZ_ORE
@ E_BLOCK_LIGHT_GRAY_SHULKER_BOX
@ E_BLOCK_GREEN_GLAZED_TERRACOTTA
@ E_BLOCK_SANDSTONE_STAIRS
@ E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE
@ E_BLOCK_REDSTONE_REPEATER_OFF
@ E_BLOCK_PURPUR_DOUBLE_SLAB
@ E_BLOCK_LIME_GLAZED_TERRACOTTA
@ E_BLOCK_REDSTONE_LAMP_ON
@ E_BLOCK_INVERTED_DAYLIGHT_SENSOR
@ E_BLOCK_WHITE_GLAZED_TERRACOTTA
@ E_BLOCK_STATIONARY_WATER
@ E_BLOCK_COBBLESTONE_WALL
@ E_BLOCK_BROWN_GLAZED_TERRACOTTA
@ E_BLOCK_NETHER_BRICK_FENCE
@ E_BLOCK_RED_SANDSTONE_SLAB
@ E_BLOCK_RED_SHULKER_BOX
@ E_BLOCK_RED_GLAZED_TERRACOTTA
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
bool IsTool(short a_ItemType)
static float GetBlockHeight(BLOCKTYPE Block)
Block's height.
static bool IsSolid(BLOCKTYPE Block)
Is this block solid (player cannot walk through)?
Common class that takes care of beetroots, carrots, potatoes and wheat.
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cItem *a_Tool=nullptr) const
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
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.
static void NeighborChanged(cChunkInterface &a_ChunkInterface, Vector3i a_NeighborPos, eBlockFace a_WhichNeighbor)
Notifies the specified neighbor that the current block has changed.
virtual bool IsUseable(void) const
Called to check whether this block supports a rclk action.
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.
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 bloc...
virtual void OnNeighborChanged(cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, eBlockFace a_WhichNeighbor) const
Called when a direct neighbor of this block has been changed.
static unsigned char ToolFortuneLevel(const cItem *a_Tool)
Returns the fortune level of a tool, if it is a valid tool.
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.
static bool ToolHasSilkTouch(const cItem *a_Tool)
Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const
Returns the base colour ID of the block, as will be represented on a map, as per documentation: https...
static const cBlockHandler & For(BLOCKTYPE a_BlockType)
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.
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.
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.
const BLOCKTYPE m_BlockType
Handler for huge mushroom blocks.
Handler for the small (singleblock) mushrooms.
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld.
Handler for blocks that have 3 orientations (hay bale, log), specified by the upper 2 bits in meta.
Handler for stems from which produce grows in an adjacent block (melon, pumpkin) after it becomes rip...
Handles the grass that is 1 block tall.
bool DoWithChunkAt(Vector3i a_BlockPos, cFunctionRef< bool(cChunk &)> a_Callback)
BLOCKTYPE GetBlock(Vector3i a_Pos)
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.
Represents two sets of coords, minimum and maximum for each direction.
cChunkCoords GetPos() const
static bool IsValidHeight(Vector3i a_BlockPosition)
Validates a height-coordinate.
static Vector3i RelativeToAbsolute(Vector3i a_RelBlockPosition, cChunkCoords a_ChunkCoords)
Converts relative block coordinates into absolute coordinates with a known chunk location.
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
IntType RandInt(IntType a_Min, IntType a_Max)
Return a random IntType in the range [a_Min, a_Max].
cEnchantments m_Enchantments
This class bridges a vector of cItem for safe access via Lua.