Skip to main content

Module block

Module block 

Source
Expand description

Block state IDs for common Minecraft 1.21.4 blocks.

These are the default state IDs from the vanilla data generator. Each block can have multiple states (e.g., grass_block has snowy and non-snowy variants), but we use the default (non-snowy) state.

Constants§

AIR
Air — no block, fully transparent.
BEDROCK
Bedrock — indestructible bottom layer.
CHEST
Chest — default state (facing north, type single, no waterlog).
CRAFTING_TABLE
Crafting table — default state (1.21.4 block state ID).
DIRT
Dirt — soil block without grass.
GRASS_BLOCK
Grass block — dirt with grass on top (default: snowy=false).
GRAVEL
Gravel — underwater floor block.
SAND
Sand — beach and desert block.
SNOW_BLOCK
Snow block — covers high-altitude terrain tops.
STONE
Stone — basic underground block.
WATER
Water — still water (default state, level 0).

Functions§

block_state_to_item_id
Returns the item ID that a block state drops when broken.
chest_adjacent_offsets
Returns the adjacent position for double chest pairing based on facing.
chest_double_types
Given a facing and the offset direction of the adjacent chest, returns (type_for_new, type_for_existing).
chest_facing
Extracts the facing index from a chest state (0=north, 1=south, 2=west, 3=east).
chest_state
Builds a chest state from facing, type, and waterlogged=false.
chest_state_for_yaw
Returns the chest block state for a given player yaw (facing the player).
chest_type
Extracts the type from a chest state (0=single, 1=left, 2=right).
is_chest
Returns true if the block state is any chest variant.
is_crafting_table
Returns true if the block state is a crafting table.
is_single_chest
Returns true if the chest state is a single chest (not part of a double).
is_solid
Returns whether a block state ID represents a solid (collidable) block.
item_to_default_block_state
Maps a Minecraft item registry ID to the default block state ID.