Skip to content

server.block

Constants #

const tool_type_none = 0

Tool family bitflags. A block may accept several families at once, so they combine as a mask (leaves are cut by both shears and a sword).

const tool_type_sword = 1
const tool_type_shovel = 2
const tool_type_pickaxe = 4
const tool_type_axe = 8
const tool_type_shears = 16
const tool_type_hoe = 32
const harvest_level_none = 0

Harvest levels per tool tier. A block whose harvest level is 0 is harvested by anything, bare hands included.

const harvest_level_wood = 1
const harvest_level_gold = 2
const harvest_level_stone = 3
const harvest_level_copper = 3
const harvest_level_iron = 4
const harvest_level_diamond = 5
const harvest_level_netherite = 6
const custom_block_runtime_id_start = 10000

Runtime ids for custom blocks start above the vanilla palette so they never collide with it.

const dye_colors = ['white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray',
	'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black']

Decorative-components family: wool, carpet, concrete, terracotta, stained glass(and pane), candles, signs, banners, bed.

const max_cells_per_tick = 4096

max_cells_per_tick caps how many pending cells the manager drains in a single tick so a large flood can never stall the actor thread. Cells left over stay queued and are processed on later ticks - the flow just spreads a bit slower under heavy load instead of blocking the whole server. 4096 is generous: a flat pool spreading 7 cells in every direction is well under this.

const source_depth = 8

depth runs 1..8 internally: 8 is a source, 1..7 are flowing levels where a higher number is a fuller (taller) cell, and a falling cell behaves like a full column. Each horizontal step loses spread_decay levels, so a source reaches at most 7 cells away before the flow is exhausted.

Bedrock encodes this in the liquid_depth block state as liquid_depth = 8 - depth, with +8 added when the cell is falling. A source is minecraft:water (still); anything flowing is minecraft:flowing_water.

const max_flow_depth = 7
const spread_decay = 1
const min_adjacent_sources = 2
const random_tick_speed = 3

Each loaded 16x16x16 subchunk contains 4096 block positions. On every game tick, vanilla selects random_tick_speed positions from each subchunk for random ticking. Therefore, any individual position has a random_tick_speed / 4096 chance of being selected per tick.

const random_tick_chance_denominator = 4096

fn combat_progression_blocks #

fn combat_progression_blocks() []Block

fn container_blocks #

fn container_blocks() []Block

fn decorative_blocks #

fn decorative_blocks() []Block

fn farming_blocks #

fn farming_blocks() []Block

fn loot_for_block #

fn loot_for_block(identifier string) ?BlockLoot

loot_for_block returns the override loot for a block's namespaced identifier.

fn new_andesite #

fn new_andesite() AndesiteBlock

fn new_bedrock_block #

fn new_bedrock_block() BedrockBlock

fn new_blue_ice #

fn new_blue_ice() BlueIceBlock

fn new_calcite #

fn new_calcite() CalciteBlock

fn new_clay #

fn new_clay() ClayBlock

fn new_coal_block #

fn new_coal_block() CoalBlock

fn new_coal_ore #

fn new_coal_ore() CoalOreBlock

fn new_cobbled_deepslate #

fn new_cobbled_deepslate() CobbledDeepslateBlock

fn new_cobblestone #

fn new_cobblestone() CobblestoneBlock

fn new_copper_block #

fn new_copper_block() CopperBlock

fn new_copper_ore #

fn new_copper_ore() CopperOreBlock

fn new_custom_registry #

fn new_custom_registry() CustomRegistry

fn new_diamond_block #

fn new_diamond_block() DiamondBlock

fn new_diamond_ore #

fn new_diamond_ore() DiamondOreBlock

fn new_diorite #

fn new_diorite() DioriteBlock

fn new_dirt_block #

fn new_dirt_block() DirtBlock

fn new_dripstone_block #

fn new_dripstone_block() DripstoneBlock

fn new_emerald_block #

fn new_emerald_block() EmeraldBlock

fn new_emerald_ore #

fn new_emerald_ore() EmeraldOreBlock

fn new_end_bricks #

fn new_end_bricks() EndBricksBlock

fn new_end_stone #

fn new_end_stone() EndStoneBlock

fn new_falling #

fn new_falling() WaterState

new_falling is a falling column - it appears full but spreads like flowing.

fn new_fern_block #

fn new_fern_block() FernBlock

fn new_flowing #

fn new_flowing(depth int) WaterState

new_flowing builds a flowing cell at the given depth.

fn new_glowstone #

fn new_glowstone() GlowstoneBlock

fn new_gold_block #

fn new_gold_block() GoldBlock

fn new_gold_ore #

fn new_gold_ore() GoldOreBlock

fn new_granite #

fn new_granite() GraniteBlock

fn new_grass_block #

fn new_grass_block() GrassBlock

fn new_gravel #

fn new_gravel() GravelBlock

fn new_ice #

fn new_ice() IceBlock

fn new_iron_block #

fn new_iron_block() IronBlock

fn new_iron_ore #

fn new_iron_ore() IronOreBlock

fn new_lapis_block #

fn new_lapis_block() LapisBlock

fn new_lapis_ore #

fn new_lapis_ore() LapisOreBlock

fn new_magma_block #

fn new_magma_block() MagmaBlock

fn new_manager #

fn new_manager(host Host) &LiquidManager

new_manager builds a LiquidManager bound to host and precomputes the water id table (all source, flowing and falling states) once.

fn new_mossy_cobblestone #

fn new_mossy_cobblestone() MossyCobblestoneBlock

fn new_netherrack #

fn new_netherrack() NetherrackBlock

fn new_obsidian #

fn new_obsidian() ObsidianBlock

fn new_packed_ice #

fn new_packed_ice() PackedIceBlock

fn new_polished_andesite #

fn new_polished_andesite() PolishedAndesiteBlock

fn new_polished_diorite #

fn new_polished_diorite() PolishedDioriteBlock

fn new_polished_granite #

fn new_polished_granite() PolishedGraniteBlock

fn new_purpur_block #

fn new_purpur_block() PurpurBlock

fn new_red_sand #

fn new_red_sand() RedSandBlock

fn new_red_shrub_block #

fn new_red_shrub_block() RedShrubBlock

fn new_redstone_block #

fn new_redstone_block() RedstoneBlock

fn new_redstone_ore #

fn new_redstone_ore() RedstoneOreBlock

fn new_registry #

fn new_registry() Registry

new_registry builds a Registry pre-populated with the built-in block classes.

fn new_sand #

fn new_sand() SandBlock

fn new_sandstone #

fn new_sandstone() SandstoneBlock

fn new_short_grass_block #

fn new_short_grass_block() ShortGrassBlock

fn new_smooth_basalt #

fn new_smooth_basalt() SmoothBasaltBlock

fn new_snow #

fn new_snow() SnowBlock

fn new_soul_sand #

fn new_soul_sand() SoulSandBlock

fn new_soul_soil #

fn new_soul_soil() SoulSoilBlock

fn new_source #

fn new_source() WaterState

new_source is the full still water source.

fn new_stone_block #

fn new_stone_block() StoneBlock

fn new_tuff #

fn new_tuff() TuffBlock

fn redstone_component_blocks #

fn redstone_component_blocks() []Block

fn replaceable_plant_blocks #

fn replaceable_plant_blocks() []Block

fn shelf_mushroom_blocks #

fn shelf_mushroom_blocks() []Block

fn wood_blocks #

fn wood_blocks() []Block

interface Block #

interface Block {
	// identifier returns the namespaced block id.
	identifier() string
	// runtime_id is the network runtime id sent on the wire.
	runtime_id() int
	// hardness is how long the block resists breaking, in vanilla units.
	hardness() f32
	// breakable reports whether survival players can destroy this block.
	breakable() bool
}

Block is the behaviour contract every block class implements. Every block is its own class built on a family base struct (SimpleBlock, UnbreakableBlock) and registered in the Registry so the session layer can look it up by its runtime id or namespaced identifier.

interface BlockSink #

interface BlockSink {
mut:
	set_block_id(id int, x int, y int, z int)
}

BlockSink writes a block by network id and broadcasts the change to viewers. Every liquid write routes through this so a spread looks like a normal edit.

interface BlockSource #

interface BlockSource {
mut:
	get_block(x int, y int, z int) int
}

BlockSource reads block network ids from a world by absolute coordinates. Hub satisfies it structurally; tests use an in-memory grid.

interface Host #

interface Host {
	BlockSource
	BlockSink
}

Host is what the LiquidManager needs from its world: read and write blocks. Hub satisfies it via get_block/set_block_id, so this module never imports session and stays unit-testable against a fake grid.

interface Interactable #

interface Interactable {
	// interact runs this block's right click behaviour at (x, y, z).
	// Returns whether it did anything, false means fall through, letting
	// the session layer treat the click as an ordinary placement attempt.
	interact(x int, y int, z int, click_face int, mut w TickWorld) bool
}

Interactable is implemented by blocks with a behaviour on right click.

interface Punchable #

interface Punchable {
	// punch runs this block's left click behaviour at (x, y, z). Unlike
	// interact() there's no fall through decision to make, punching a
	// block always proceeds to the normal start break animation regardless.
	punch(x int, y int, z int, click_face int, mut w TickWorld)
}

Punchable is implemented by blocks with a behaviour on left click. the moment a player starts breaking it, separate from Interactable's right click behaviour and from anything that happens once the break actually completes.

interface RandomTicker #

interface RandomTicker {
	random_tick(x int, y int, z int, mut w TickWorld)
}

RandomTicker is implemented by blocks that may receive random updates. On each game tick, every eligible block position has a random_tick_speed / random_tick_chance_denominator chance of having random_tick called.

Examples include crop growth and leaf decay.

interface Replaceable #

interface Replaceable {
	replaceable() bool
}

Replaceable is implemented by blocks that get silently overwritten by a placement instead of blocking it.

interface ScheduledTicker #

interface ScheduledTicker {
	scheduled_tick(x int, y int, z int, mut w TickWorld)
}

ScheduledTicker is implemented by blocks that need to perform a one time update after a delay. scheduled_tick is called delay game ticks after the block position is queued using TickWorld.schedule_tick.

Examples include liquid spreading and delayed redstone propagation.

interface TickWorld #

interface TickWorld {
	block_id(x int, y int, z int) int
mut:
	set_block(x int, y int, z int, id int)
	schedule_tick(x int, y int, z int, delay int)
}

TickWorld provides the world operations available during block ticks. It allows tick handlers to read blocks, including neighbouring positions, update blocks and schedule a future tick for a position.

interface ToolRequirement #

interface ToolRequirement {
	tool_type() int
	harvest_level() int
}

ToolRequirement is implemented by block classes that pin their own tool family and tier. Blocks that don't implement it fall back to the shared name based defaults.

struct AndesiteBlock #

struct AndesiteBlock {
	SimpleBlock
}

AndesiteBlock is the class for 'minecraft:andesite'.

struct BedrockBlock #

struct BedrockBlock {
	UnbreakableBlock
}

BedrockBlock is the class for 'minecraft:bedrock'.

struct BlockLoot #

struct BlockLoot {
pub:
	item_name string
	min_count int = 1
	max_count int = 1
}

BlockLoot describes drops that differ from a block's normal item form. Blocks without custom loot are resolved through the block to item mapping.

This only models simple count ranges. Tool requirements, enchantments, growth stages and full vanilla loot table behavior are not yet supported.

struct BlueIceBlock #

struct BlueIceBlock {
	SimpleBlock
}

BlueIceBlock is the class for 'minecraft:blue_ice'.

struct BoxComponent #

struct BoxComponent {
pub:
	origin_x f32 = -8.0
	origin_y f32
	origin_z f32 = -8.0
	size_x   f32 = 16.0
	size_y   f32 = 16.0
	size_z   f32 = 16.0
}

BoxComponent is a collision or selection box: origin is the corner offset from the block origin (-8..8), size the extent in pixels (0..16).

struct BreakInfo #

struct BreakInfo {
pub:
	hardness      f32 = 1.0
	tool_type     int
	harvest_level int
}

BreakInfo is everything the break time formula needs about one block.

fn (BreakInfo) breakable #

fn (i BreakInfo) breakable() bool

breakable reports whether the block can be destroyed at all.

fn (BreakInfo) breaks_instantly #

fn (i BreakInfo) breaks_instantly() bool

breaks_instantly reports whether the block is destroyed within one tick regardless of the held item.

fn (BreakInfo) tool_compatible #

fn (i BreakInfo) tool_compatible(tool_type int, harvest_level int) bool

tool_compatible reports whether a tool of the given family and harvest level harvests this block, which decides both the break time multiplier and whether the block drops anything.

fn (BreakInfo) break_seconds #

fn (i BreakInfo) break_seconds(tool_type int, harvest_level int, efficiency f32) f32

break_seconds is how long the block takes to break with a tool of the given family, harvest level and mining efficiency. Efficiency only counts when the tool family matches, so a diamond pickaxe is no faster than a hand on dirt.

struct CalciteBlock #

struct CalciteBlock {
	SimpleBlock
}

CalciteBlock is the class for 'minecraft:calcite'.

struct ChestBlock #

struct ChestBlock {
	SimpleBlock
}

struct ClayBlock #

struct ClayBlock {
	SimpleBlock
}

ClayBlock is the class for 'minecraft:clay'.

struct CoalBlock #

struct CoalBlock {
	SimpleBlock
}

CoalBlock is the class for 'minecraft:coal_block'.

struct CoalOreBlock #

struct CoalOreBlock {
	SimpleBlock
}

CoalOreBlock is the class for 'minecraft:coal_ore'.

struct CobbledDeepslateBlock #

struct CobbledDeepslateBlock {
	SimpleBlock
}

CobbledDeepslateBlock is the class for 'minecraft:cobbled_deepslate'.

struct CobblestoneBlock #

struct CobblestoneBlock {
	SimpleBlock
}

CobblestoneBlock is the class for 'minecraft:cobblestone'.

struct CopperBlock #

struct CopperBlock {
	SimpleBlock
}

CopperBlock is the class for 'minecraft:copper_block'.

struct CopperOreBlock #

struct CopperOreBlock {
	SimpleBlock
}

CopperOreBlock is the class for 'minecraft:copper_ore'.

struct CustomBlockDefinition #

struct CustomBlockDefinition {
pub mut:
	id                   string
	display_name         string
	texture              string
	geometry             string
	materials            []MaterialInstance
	friction             f32 = 0.4
	break_hardness       f32 = 1.0
	explosion_resistance int = 5
	light_emission       int
	light_dampening      int = 15
	map_color            string
	creative_category    string = 'construction'
	creative_group       string
	collision            ?BoxComponent
	selection            ?BoxComponent
	runtime_id           int
}

CustomBlockDefinition describes a data-driven block a plugin registers. It is serialized to block property NBT and shipped in the StartGamePacket blocks list so the client can build render state for it.

fn (CustomBlockDefinition) network_entry #

fn (d &CustomBlockDefinition) network_entry() NetworkEntry

network_entry builds the block property NBT: a components compound, menu_category, molang version and the allocated runtime id under vanilla_block_data.

struct CustomRegistry #

struct CustomRegistry {
mut:
	defs    []CustomBlockDefinition
	ids     map[string]int
	next_id int = custom_block_runtime_id_start
}

CustomRegistry owns every registered custom block definition and hands out runtime ids sequentially, starting at custom_block_runtime_id_start.

fn (CustomRegistry) register #

fn (mut r CustomRegistry) register(def CustomBlockDefinition) int

register allocates a runtime id for def and stores it. Registering the same id again returns the previously allocated runtime id unchanged.

fn (CustomRegistry) all #

fn (r &CustomRegistry) all() []CustomBlockDefinition

fn (CustomRegistry) len #

fn (r &CustomRegistry) len() int

fn (CustomRegistry) runtime_id #

fn (r &CustomRegistry) runtime_id(id string) ?int

fn (CustomRegistry) names #

fn (r &CustomRegistry) names() []string

struct DiamondBlock #

struct DiamondBlock {
	SimpleBlock
}

DiamondBlock is the class for 'minecraft:diamond_block'.

struct DiamondOreBlock #

struct DiamondOreBlock {
	SimpleBlock
}

DiamondOreBlock is the class for 'minecraft:diamond_ore'.

struct DioriteBlock #

struct DioriteBlock {
	SimpleBlock
}

DioriteBlock is the class for 'minecraft:diorite'.

struct DirtBlock #

struct DirtBlock {
	SimpleBlock
}

DirtBlock is the class for 'minecraft:dirt'.

struct DripstoneBlock #

struct DripstoneBlock {
	SimpleBlock
}

DripstoneBlock is the class for 'minecraft:dripstone_block'.

struct EmeraldBlock #

struct EmeraldBlock {
	SimpleBlock
}

EmeraldBlock is the class for 'minecraft:emerald_block'.

struct EmeraldOreBlock #

struct EmeraldOreBlock {
	SimpleBlock
}

EmeraldOreBlock is the class for 'minecraft:emerald_ore'.

struct EndBricksBlock #

struct EndBricksBlock {
	SimpleBlock
}

EndBricksBlock is the class for 'minecraft:end_bricks'.

struct EndStoneBlock #

struct EndStoneBlock {
	SimpleBlock
}

EndStoneBlock is the class for 'minecraft:end_stone'.

struct FernBlock #

struct FernBlock {
	SimpleBlock
}

fn (FernBlock) replaceable #

fn (b FernBlock) replaceable() bool

struct GlowstoneBlock #

struct GlowstoneBlock {
	SimpleBlock
}

GlowstoneBlock is the class for 'minecraft:glowstone'.

struct GoldBlock #

struct GoldBlock {
	SimpleBlock
}

GoldBlock is the class for 'minecraft:gold_block'.

struct GoldOreBlock #

struct GoldOreBlock {
	SimpleBlock
}

GoldOreBlock is the class for 'minecraft:gold_ore'.

struct GraniteBlock #

struct GraniteBlock {
	SimpleBlock
}

GraniteBlock is the class for 'minecraft:granite'.

struct GrassBlock #

struct GrassBlock {
	SimpleBlock
}

GrassBlock is the class for 'minecraft:grass_block'.

struct GravelBlock #

struct GravelBlock {
	SimpleBlock
}

GravelBlock is the class for 'minecraft:gravel'.

struct IceBlock #

struct IceBlock {
	SimpleBlock
}

IceBlock is the class for 'minecraft:ice'.

struct IronBlock #

struct IronBlock {
	SimpleBlock
}

IronBlock is the class for 'minecraft:iron_block'.

struct IronOreBlock #

struct IronOreBlock {
	SimpleBlock
}

IronOreBlock is the class for 'minecraft:iron_ore'.

struct LapisBlock #

struct LapisBlock {
	SimpleBlock
}

LapisBlock is the class for 'minecraft:lapis_block'.

struct LapisOreBlock #

struct LapisOreBlock {
	SimpleBlock
}

LapisOreBlock is the class for 'minecraft:lapis_ore'.

struct LiquidManager #

@[heap]
struct LiquidManager {
mut:
	host    Host
	pending map[string]Pos
	// water_states maps every known water network id to its resolved cell so the
	// manager can tell water apart from other blocks when it reads the world.
	water_states map[int]WaterState
	air_id       int
}

LiquidManager owns the set of block positions that still need a liquid update and processes them on the actor thread each tick. It holds no world of its own - the Host it is handed reads and writes blocks.

fn (LiquidManager) place_source #

fn (mut m LiquidManager) place_source(x int, y int, z int)

place_source sets a water source at the position and queues it for spreading.

fn (LiquidManager) enqueue #

fn (mut m LiquidManager) enqueue(x int, y int, z int)

enqueue marks a cell as needing a liquid update on a later tick.

fn (LiquidManager) on_block_changed #

fn (mut m LiquidManager) on_block_changed(x int, y int, z int)

on_block_changed re-evaluates a cell and its neighbours after a block edit - placing water starts its flow, breaking a block frees a path for adjacent water to spread into. Only water cells actually do anything when processed.

fn (LiquidManager) pending_count #

fn (m &LiquidManager) pending_count() int

pending_count is the number of cells still queued. Used by tests.

fn (LiquidManager) tick #

fn (mut m LiquidManager) tick()

tick drains up to max_cells_per_tick queued cells and processes each. Cells a processed cell touches (neighbours it fills, or itself when it changes) are re-queued for the next call, so the flow advances one ring per call. The world runtime only calls this every few ticks, which is what sets the vanilla flow rate. Runs on the owning world's actor thread.

struct MagmaBlock #

struct MagmaBlock {
	SimpleBlock
}

MagmaBlock is the class for 'minecraft:magma'.

struct MaterialInstance #

struct MaterialInstance {
pub:
	face          string = '*'
	texture       string
	render_method string = 'opaque'
}

MaterialInstance is the render description for one face (or '*' for all).

struct MossyCobblestoneBlock #

struct MossyCobblestoneBlock {
	SimpleBlock
}

MossyCobblestoneBlock is the class for 'minecraft:mossy_cobblestone'.

struct NetherrackBlock #

struct NetherrackBlock {
	SimpleBlock
}

NetherrackBlock is the class for 'minecraft:netherrack'.

struct NetworkEntry #

struct NetworkEntry {
pub:
	name       string
	properties nbt.RootTag
}

NetworkEntry is the wire form of a custom block: the name plus the block property NBT the session layer wraps into a protocol.BlockEntry.

struct ObsidianBlock #

struct ObsidianBlock {
	SimpleBlock
}

ObsidianBlock is the class for 'minecraft:obsidian'.

struct PackedIceBlock #

struct PackedIceBlock {
	SimpleBlock
}

PackedIceBlock is the class for 'minecraft:packed_ice'.

struct PaletteEntry #

struct PaletteEntry {
pub:
	name       string
	network_id int
}

PaletteEntry is one block state from the wire palette, in palette order.

struct PolishedAndesiteBlock #

struct PolishedAndesiteBlock {
	SimpleBlock
}

PolishedAndesiteBlock is the class for 'minecraft:polished_andesite'.

struct PolishedDioriteBlock #

struct PolishedDioriteBlock {
	SimpleBlock
}

PolishedDioriteBlock is the class for 'minecraft:polished_diorite'.

struct PolishedGraniteBlock #

struct PolishedGraniteBlock {
	SimpleBlock
}

PolishedGraniteBlock is the class for 'minecraft:polished_granite'.

struct PurpurBlock #

struct PurpurBlock {
	SimpleBlock
}

PurpurBlock is the class for 'minecraft:purpur_block'.

struct RedSandBlock #

struct RedSandBlock {
	SimpleBlock
}

RedSandBlock is the class for 'minecraft:red_sand'.

struct RedShrubBlock #

struct RedShrubBlock {
	SimpleBlock
}

RedShrubBlock is the class for 'minecraft:red_shrub', one of the blocks the game drives from the block definitions rather than implementing natively.

fn (RedShrubBlock) replaceable #

fn (b RedShrubBlock) replaceable() bool

struct RedstoneBlock #

struct RedstoneBlock {
	SimpleBlock
}

RedstoneBlock is the class for 'minecraft:redstone_block'.

struct RedstoneOreBlock #

struct RedstoneOreBlock {
	SimpleBlock
}

RedstoneOreBlock is the class for 'minecraft:redstone_ore'.

struct Registry #

struct Registry {
mut:
	by_runtime map[int]Block
	by_name    map[string]Block
}

Registry maps block runtime ids and namespaced ids to their concrete Block class. The session layer holds one Registry and queries it for per-block behaviour (breakability, hardness, ...) instead of hard-coding runtime ids.

fn (Registry) register #

fn (mut r Registry) register(b Block)

register adds or overrides the class for a block.

fn (Registry) register_fallbacks #

fn (mut r Registry) register_fallbacks(entries []PaletteEntry)

fn (Registry) get #

fn (r &Registry) get(runtime_id int) ?Block

get returns the registered class for a runtime id, or none if unregistered.

fn (Registry) get_by_name #

fn (r &Registry) get_by_name(id string) ?Block

get_by_name returns the registered class for a namespaced id, or none if unregistered.

fn (Registry) breakable #

fn (r &Registry) breakable(runtime_id int) bool

breakable reports whether survival players may destroy the block with the given runtime id. Unregistered blocks fall back to breakable.

fn (Registry) hardness #

fn (r &Registry) hardness(runtime_id int) f32

hardness returns the break hardness for a runtime id, falling back to 1.0 for unregistered blocks.

fn (Registry) break_info #

fn (r &Registry) break_info(runtime_id int) BreakInfo

break_info returns the break time inputs for a runtime id, falling back to a plain hardness 1.0 no tool block for unregistered ids.

fn (Registry) len #

fn (r &Registry) len() int

len is the number of registered block classes.

struct RepeaterBlock #

struct RepeaterBlock {
	SimpleBlock
	next_delay_id int
}

RepeaterBlock is the class for 'minecraft:unpowered_repeater'/ 'minecraft:powered_repeater'.

fn (RepeaterBlock) interact #

fn (b RepeaterBlock) interact(x int, y int, z int, click_face int, mut w TickWorld) bool

struct SandBlock #

struct SandBlock {
	SimpleBlock
}

SandBlock is the class for 'minecraft:sand'.

struct SandstoneBlock #

struct SandstoneBlock {
	SimpleBlock
}

SandstoneBlock is the class for 'minecraft:sandstone'.

struct ShearsBlock #

struct ShearsBlock {
	SimpleBlock
}

ShearsBlock is a block shears take apart. Wool keeps its family whatever shape it is cut into, which the name based tool fallback cannot tell from the name of a slab or a stair.

fn (ShearsBlock) tool_type #

fn (b ShearsBlock) tool_type() int

fn (ShearsBlock) harvest_level #

fn (b ShearsBlock) harvest_level() int

struct ShelfMushroomBlock #

struct ShelfMushroomBlock {
	SimpleBlock
}

ShelfMushroomBlock is the class for 'minecraft:shelf_mushroom'. It breaks instantly and takes a sword or shears the way the other fungi do.

fn (ShelfMushroomBlock) tool_type #

fn (b ShelfMushroomBlock) tool_type() int

fn (ShelfMushroomBlock) harvest_level #

fn (b ShelfMushroomBlock) harvest_level() int

struct ShortGrassBlock #

struct ShortGrassBlock {
	SimpleBlock
}

fn (ShortGrassBlock) replaceable #

fn (b ShortGrassBlock) replaceable() bool

struct SignBlock #

struct SignBlock {
	SimpleBlock
}

struct SimpleBlock #

struct SimpleBlock {
pub:
	id             string
	block_runtime  int
	break_hardness f32 = 1.0
}

SimpleBlock is the base class for blocks that carry no special behaviour beyond a hardness value. Concrete blocks embed it and fill in their identity; anything unregistered behaves like a default SimpleBlock.

fn (SimpleBlock) identifier #

fn (b SimpleBlock) identifier() string

fn (SimpleBlock) runtime_id #

fn (b SimpleBlock) runtime_id() int

fn (SimpleBlock) hardness #

fn (b SimpleBlock) hardness() f32

fn (SimpleBlock) breakable #

fn (b SimpleBlock) breakable() bool

struct SmoothBasaltBlock #

struct SmoothBasaltBlock {
	SimpleBlock
}

SmoothBasaltBlock is the class for 'minecraft:smooth_basalt'.

struct SnowBlock #

struct SnowBlock {
	SimpleBlock
}

SnowBlock is the class for 'minecraft:snow'.

struct SoulSandBlock #

struct SoulSandBlock {
	SimpleBlock
}

SoulSandBlock is the class for 'minecraft:soul_sand'.

struct SoulSoilBlock #

struct SoulSoilBlock {
	SimpleBlock
}

SoulSoilBlock is the class for 'minecraft:soul_soil'.

struct StoneBlock #

struct StoneBlock {
	SimpleBlock
}

StoneBlock is the class for 'minecraft:stone'.

struct TuffBlock #

struct TuffBlock {
	SimpleBlock
}

TuffBlock is the class for 'minecraft:tuff'.

struct UnbreakableBlock #

struct UnbreakableBlock {
pub:
	id            string
	block_runtime int
}

UnbreakableBlock is the base class for blocks survival players can never destroy (bedrock, barriers). Creative mode bypasses the check in the session layer. Concrete blocks embed it, one class per block.

fn (UnbreakableBlock) identifier #

fn (b UnbreakableBlock) identifier() string

fn (UnbreakableBlock) runtime_id #

fn (b UnbreakableBlock) runtime_id() int

fn (UnbreakableBlock) hardness #

fn (b UnbreakableBlock) hardness() f32

fn (UnbreakableBlock) breakable #

fn (b UnbreakableBlock) breakable() bool

struct WaterState #

struct WaterState {
pub:
	depth   int
	falling bool
}

WaterState is a resolved water cell: its internal depth and whether it is falling. It knows how to encode itself into a Bedrock network id.

fn (WaterState) is_source #

fn (w WaterState) is_source() bool

is_source reports whether this cell is a full still source.

fn (WaterState) network_id #

fn (w WaterState) network_id() int

network_id resolves this water cell to its Bedrock runtime id. Source cells use minecraft:water, flowing/falling cells use minecraft:flowing_water.

struct WheatBlock #

struct WheatBlock {
	SimpleBlock
	next_growth_id int // 0 once fully grown (growth=7) - no further tick
	farmland_ids   []int
}

WheatBlock is the class for 'minecraft:wheat'. Its growth stages (0-7) tick forward via random_tick.

This is a deliberate simplification, not vanilla parity: it only checks for farmland underneath, not light level, haste, or bonemeal adjacent growth rate boosts.

fn (WheatBlock) random_tick #

fn (b WheatBlock) random_tick(x int, y int, z int, mut w TickWorld)