Skip to main content

BlockBehavior

Trait BlockBehavior 

Source
pub trait BlockBehavior: Send + Sync {
Show 66 methods // Required method fn get_state_for_placement( &self, context: &BlockPlaceContext<'_>, ) -> Option<BlockStateId>; // Provided methods fn type_name(&self) -> &'static str { ... } fn pickup_block( &self, world: &Arc<World>, pos: BlockPos, state: BlockStateId, player: Option<&Player>, ) -> Option<PickupResult> { ... } fn update_shape( &self, state: BlockStateId, _world: &dyn ScheduledTickAccess, _pos: BlockPos, _direction: Direction, _neighbor_pos: BlockPos, _neighbor_state: BlockStateId, ) -> BlockStateId { ... } fn update_indirect_neighbour_shapes( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, flags: UpdateFlags, update_limit: i32, ) { ... } fn can_survive( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool { ... } fn can_be_replaced( &self, state: BlockStateId, context: &BlockPlaceContext<'_>, ) -> bool { ... } fn on_place( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, old_state: BlockStateId, moved_by_piston: bool, ) { ... } fn set_placed_by( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source: &PlacementSource<'_>, ) { ... } fn attack( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, ) { ... } fn player_destroy( &self, world: &Arc<World>, player: &Player, pos: BlockPos, state: BlockStateId, block_entity: Option<&SharedBlockEntity>, tool: &ItemStack, ) { ... } fn player_will_destroy( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, ) -> BlockStateId { ... } fn destroy(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos) { ... } fn get_drops( &self, state: BlockStateId, context: &BlockLootContext<'_>, ) -> Option<Vec<ItemStack>> { ... } fn spawn_after_break( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, tool: &ItemStack, drop_experience: bool, ) { ... } fn affect_neighbors_after_removal( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, moved_by_piston: bool, ) { ... } fn use_item_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hand: InteractionHand, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult { ... } fn use_without_item( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult { ... } fn handle_neighbor_changed( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_block: BlockRef, moved_by_piston: bool, ) { ... } fn is_signal_source( &self, _state: BlockStateId, _context: SignalQueryContext, ) -> bool { ... } fn is_diode(&self) -> bool { ... } fn is_trapdoor(&self) -> bool { ... } fn is_rail(&self) -> bool { ... } fn is_piston_base(&self) -> bool { ... } fn get_own_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _context: SignalQueryContext, ) -> i32 { ... } fn get_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, _direction: Direction, context: SignalQueryContext, ) -> i32 { ... } fn get_direct_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _direction: Direction, _context: SignalQueryContext, ) -> i32 { ... } fn is_redstone_conductor( &self, state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool { ... } fn trigger_event( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, param_a: i32, param_b: i32, ) -> bool { ... } fn get_clone_item_stack( &self, block: BlockRef, state: BlockStateId, include_data: bool, ) -> Option<ItemStack> { ... } fn is_pathfindable( &self, state: BlockStateId, computation_type: PathComputationType, ) -> bool { ... } fn is_wooden_door(&self, state: BlockStateId) -> bool { ... } fn set_door_open( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_entity: Option<&dyn Entity>, open: bool, ) -> bool { ... } fn default_get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape { ... } fn get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape { ... } fn get_collision_shape_offset( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> DVec3 { ... } fn get_collision_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> BlockCollisionBoxes { ... } fn get_block_support_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, ) -> BlockCollisionBoxes { ... } fn is_face_sturdy( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool { ... } fn default_get_entity_inside_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, entity: &dyn Entity, ) -> VoxelShape { ... } fn get_entity_inside_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, entity: &dyn Entity, ) -> VoxelShape { ... } fn random_tick( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, ) { ... } fn tick(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos) { ... } fn on_projectile_hit( &self, _state: BlockStateId, _world: &Arc<World>, _hit: &ClipHitResult, _projectile: &dyn Projectile, ) { ... } fn default_entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, effect_collector: &mut InsideBlockEffectCollector, is_precise: bool, ) { ... } fn entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, effect_collector: &mut InsideBlockEffectCollector, is_precise: bool, ) { ... } fn default_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage> { ... } fn fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage> { ... } fn after_fall_on_damage( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, fall_damage: &EntityFallDamage, damage_applied: bool, ) { ... } fn default_update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3 { ... } fn update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3 { ... } fn default_step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, ) { ... } fn step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, ) { ... } fn new_block_entity( &self, level: Weak<World>, pos: BlockPos, state: BlockStateId, ) -> BlockEntityCreation { ... } fn get_block_entity_ticker( &self, world: &Arc<World>, state: BlockStateId, block_entity_type: BlockEntityTypeRef, ) -> Option<BlockEntityTicker> { ... } fn get_game_event_listener( &self, world: &Arc<World>, block_entity: &dyn BlockEntity, ) -> Option<SharedGameEventListener> { ... } fn should_keep_block_entity( &self, old_state: BlockStateId, new_state: BlockStateId, ) -> bool { ... } fn has_analog_output_signal(&self, state: BlockStateId) -> bool { ... } fn get_analog_output_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, ) -> i32 { ... } fn is_liquid_container(&self, state: BlockStateId) -> bool { ... } fn can_place_liquid(&self, state: BlockStateId, fluid: FluidRef) -> bool { ... } fn can_place_liquid_with_player( &self, state: BlockStateId, fluid: FluidRef, _player: Option<&Player>, ) -> bool { ... } fn can_be_replaced_by_fluid( &self, state: BlockStateId, _fluid_block: BlockRef, ) -> bool { ... } fn place_liquid( &self, level: &dyn LevelAccessor, pos: BlockPos, state: BlockStateId, fluid_state: FluidState, ) -> bool { ... } fn as_bonemealable(&self) -> Option<&dyn Bonemealable> { ... } fn as_rail(&self) -> Option<&dyn RailBehavior> { ... }
}
Expand description

Trait defining the behavior of a block.

This trait handles all dynamic/functional aspects of blocks:

  • Placement logic
  • Neighbor updates
  • Player interactions
  • State changes

Required Methods§

Source

fn get_state_for_placement( &self, context: &BlockPlaceContext<'_>, ) -> Option<BlockStateId>

Returns the block state to use when placing this block.

Provided Methods§

Source

fn type_name(&self) -> &'static str

Returns the Rust type name of the concrete behavior implementation.

Source

fn pickup_block( &self, world: &Arc<World>, pos: BlockPos, state: BlockStateId, player: Option<&Player>, ) -> Option<PickupResult>

Called when a player uses an empty bucket on this block.

Should:

  • Remove or modify the block
  • Return the filled bucket stack to give

Return None if pickup failed.

Source

fn update_shape( &self, state: BlockStateId, _world: &dyn ScheduledTickAccess, _pos: BlockPos, _direction: Direction, _neighbor_pos: BlockPos, _neighbor_state: BlockStateId, ) -> BlockStateId

Called when a neighboring block changes shape. Returns the new state for this block after considering the neighbor change. Implementations also own any block or fluid ticks that Vanilla schedules from updateShape; the world dispatcher does not infer them from the result.

Source

fn update_indirect_neighbour_shapes( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, flags: UpdateFlags, update_limit: i32, )

Queues indirect neighbor-shape updates after this state changes.

Vanilla’s default is a no-op. Redstone wire overrides this for vertical corner connections.

Source

fn can_survive( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool

Returns whether this block can survive at the given position.

Vanilla parity: BlockBehavior.canSurvive(BlockState, LevelReader, BlockPos).

Used during placement validation, shape updates (to break unsupported blocks), and when removing water from waterlogged blocks. The default returns true; override for blocks that require physical support (torches, buttons, candles, cactus, etc.).

Source

fn can_be_replaced( &self, state: BlockStateId, context: &BlockPlaceContext<'_>, ) -> bool

Returns whether this block can be replaced by the held item during placement.

Vanilla parity: BlockState.canBeReplaced(BlockPlaceContext).

Default behavior mirrors BlockBehaviour.canBeReplaced.

Source

fn on_place( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, old_state: BlockStateId, moved_by_piston: bool, )

Called when this block is placed in the world.

§Arguments
  • state - The new block state that was placed
  • world - The world the block was placed in
  • pos - The position where the block was placed
  • old_state - The previous block state at this position
  • moved_by_piston - Whether the block was moved by a piston
Source

fn set_placed_by( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source: &PlacementSource<'_>, )

Called by block items after this block has been placed by an entity.

Vanilla parity: Block.setPlacedBy(Level, BlockPos, BlockState, LivingEntity, ItemStack). Steel passes the placement source instead of a borrowed stack so the caller does not hold the inventory lock while dispatching block behavior and synthetic placements can retain a directly supplied stack. This is intentionally separate from [on_place], which fires for any world block mutation.

Source

fn attack( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, )

Called when a player starts attacking this block.

Vanilla parity: Block.attack(BlockState, Level, BlockPos, Player).

Source

fn player_destroy( &self, world: &Arc<World>, player: &Player, pos: BlockPos, state: BlockStateId, block_entity: Option<&SharedBlockEntity>, tool: &ItemStack, )

Called after a player destroys this block and drops/effects are processed.

Vanilla parity: Block.playerDestroy(Level, Player, BlockPos, BlockState, BlockEntity, ItemStack).

Source

fn player_will_destroy( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, ) -> BlockStateId

Called before a player removes this block.

Vanilla parity: Block.playerWillDestroy(Level, BlockPos, BlockState, Player). The returned state is the state used for tool damage and loot after the block is removed.

Source

fn destroy(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called after a player successfully removes this block.

Mirrors vanilla Block.destroy(LevelAccessor, BlockPos, BlockState).

Source

fn get_drops( &self, state: BlockStateId, context: &BlockLootContext<'_>, ) -> Option<Vec<ItemStack>>

Overrides the loot generated for this block state.

Returning None evaluates the state’s normal loot table. Returning Some uses the provided items, including an empty list. This mirrors vanilla’s per-block getDrops override point.

Source

fn spawn_after_break( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, tool: &ItemStack, drop_experience: bool, )

Called for post-break effects such as experience drops.

Vanilla parity: Block.spawnAfterBreak(BlockState, ServerLevel, BlockPos, ItemStack, boolean). Normal block destruction invokes this after loot; other destruction paths retain their Vanilla-specific ordering. Ore experience and similar non-item drops belong here rather than in the loot-table override.

Source

fn affect_neighbors_after_removal( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, moved_by_piston: bool, )

Called after this block is removed from the world, to affect neighbors.

This is used for things like rails notifying neighbors when removed.

§Arguments
  • state - The block state that was removed
  • world - The world the block was removed from
  • pos - The position where the block was removed
  • moved_by_piston - Whether the block was moved by a piston
Source

fn use_item_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hand: InteractionHand, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult

Called when a player uses an item on this block.

Returns TryEmptyHandInteraction by default to fall through to item use. Override this to handle block-specific interactions (e.g., opening chests, using buttons, etc.).

Source

fn use_without_item( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, player: &Player, hit_result: &BlockHitResult, inv: &mut InventoryAccess, ) -> InteractionResult

Called when a player uses this block without an item (or as a fallback when use_item_on returns TryEmptyHandInteraction).

Returns Pass by default. Override this for blocks that have interactions without needing an item (e.g., buttons, levers, repeaters).

Source

fn handle_neighbor_changed( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_block: BlockRef, moved_by_piston: bool, )

Called when a neighboring block changes (not shape-related).

This is the Rust equivalent of vanilla’s BlockState.handleNeighborChanged(). Used by redstone components, doors, and other blocks that react to neighbor changes.

§Arguments
  • state - The current block state
  • world - The world
  • pos - Position of this block
  • source_block - The block type that changed
  • moved_by_piston - Whether the change was caused by a piston
Source

fn is_signal_source( &self, _state: BlockStateId, _context: SignalQueryContext, ) -> bool

Returns whether this state is a redstone signal source.

Source

fn is_diode(&self) -> bool

Returns whether this behavior is a vanilla diode block.

Vanilla uses its DiodeBlock class hierarchy for side-input filtering.

Source

fn is_trapdoor(&self) -> bool

Returns whether this behavior implements vanilla TrapDoorBlock semantics.

Redstone wire uses this class-hierarchy check when deciding whether it can climb onto a neighboring block.

Source

fn is_rail(&self) -> bool

Returns whether this behavior implements vanilla BaseRailBlock semantics.

Source

fn is_piston_base(&self) -> bool

Returns whether this behavior implements vanilla PistonBaseBlock semantics.

Source

fn get_own_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _context: SignalQueryContext, ) -> i32

Returns this state’s direction-independent redstone signal strength.

Source

fn get_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, _direction: Direction, context: SignalQueryContext, ) -> i32

Returns the weak redstone signal emitted toward direction.

Source

fn get_direct_signal( &self, _state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, _direction: Direction, _context: SignalQueryContext, ) -> i32

Returns the direct redstone signal emitted toward direction.

Source

fn is_redstone_conductor( &self, state: BlockStateId, _world: &dyn LevelReader, _pos: BlockPos, ) -> bool

Returns whether this state conducts direct redstone power through itself.

Most blocks use extracted state data. Dynamic blocks can override this with a live level/position query, matching vanilla’s state predicate surface.

Source

fn trigger_event( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, param_a: i32, param_b: i32, ) -> bool

Handles a queued server block event.

Mirrors Vanilla BlockBehaviour.triggerEvent. Returning true publishes the corresponding event packet to nearby clients.

Source

fn get_clone_item_stack( &self, block: BlockRef, state: BlockStateId, include_data: bool, ) -> Option<ItemStack>

Returns the item stack to give when a player picks this block (middle click).

The default implementation looks up an item with the same key as the block. Override this for blocks where the pick item differs from the block key (e.g., crops → seeds, redstone wire → redstone dust, wall torch → torch).

§Arguments
  • block - The block being picked
  • _state - The block state (some blocks vary pick item based on state)
  • _include_data - Whether to include block entity data (creative + Ctrl)
Source

fn is_pathfindable( &self, state: BlockStateId, computation_type: PathComputationType, ) -> bool

Returns whether this block state is pathfindable for the supplied vanilla path computation.

Vanilla baseline for BlockBehaviour.isPathfindable.

Source

fn is_wooden_door(&self, state: BlockStateId) -> bool

Mirrors vanilla DoorBlock.isWoodenDoor.

Despite the vanilla name, this returns true for any door block type that can be opened by hand.

Source

fn set_door_open( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, source_entity: Option<&dyn Entity>, open: bool, ) -> bool

Mirrors vanilla DoorBlock.setOpen for AI door goals.

Source

fn default_get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape

Returns this block state’s collision shape for the supplied collision context.

Vanilla baseline for BlockState.getCollisionShape(BlockGetter, BlockPos, CollisionContext).

Source

fn get_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> VoxelShape

Returns this block state’s collision shape for the supplied collision context.

Overrides that mirror vanilla super.getCollisionShape(...) should call Self::default_get_collision_shape.

Source

fn get_collision_shape_offset( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> DVec3

Returns a block-local translation for this block state’s collision shape.

Vanilla baseline for BlockState.getOffset(BlockPos) where getCollisionShape delegates to the offset outline shape.

Source

fn get_collision_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, context: BlockCollisionContext, ) -> BlockCollisionBoxes

Resolves this block state’s collision shape to owned block-local boxes.

Vanilla dynamic-shape blocks may override this directly. Static blocks inherit the collision shape and positional offset hooks above.

Source

fn get_block_support_boxes( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, ) -> BlockCollisionBoxes

Resolves vanilla BlockState.getBlockSupportShape to owned block-local boxes.

Most states use extracted support shapes. Dynamic blocks can override this hook to consult live world data, as vanilla does when its state cache is disabled by dynamicShape().

Source

fn is_face_sturdy( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool

Mirrors vanilla BlockState.isFaceSturdy(level, pos, direction, supportType).

Static states retain their registry fast path. Dynamic states evaluate the live support boxes so block entities and other world-dependent shapes remain observable to attachment logic.

Source

fn default_get_entity_inside_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, entity: &dyn Entity, ) -> VoxelShape

Returns this block state’s shape used by vanilla entity-inside effects.

Vanilla baseline for BlockState.getEntityInsideCollisionShape(BlockGetter, BlockPos, Entity).

Source

fn get_entity_inside_collision_shape( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, entity: &dyn Entity, ) -> VoxelShape

Returns this block state’s shape used by vanilla entity-inside effects.

Source

fn random_tick(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called on random tick for blocks that support random ticking.

This is only called when the block state’s extracted metadata marks it as randomly ticking. Used for crop growth, grass spread, ice melting, fire behavior, etc.

§Arguments
  • state - The current block state
  • world - The world the block is in
  • pos - The position of the block
Source

fn tick(&self, state: BlockStateId, world: &Arc<World>, pos: BlockPos)

Called when a scheduled tick fires for this block.

Unlike random_tick, scheduled ticks are deterministic — they fire after a precise delay set by World::schedule_block_tick. Used for buttons unpressing, repeaters firing, fluids flowing, etc.

§Arguments
  • state - The current block state
  • world - The world the block is in
  • pos - The position of the block
Source

fn on_projectile_hit( &self, _state: BlockStateId, _world: &Arc<World>, _hit: &ClipHitResult, _projectile: &dyn Projectile, )

Called when a projectile hits this block.

Vanilla parity: BlockState.onProjectileHit(Level, BlockState, BlockHitResult, Projectile).

Source

fn default_entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, effect_collector: &mut InsideBlockEffectCollector, is_precise: bool, )

Default entity-inside hook.

Overrides that mirror vanilla super.entityInside(...) should call Self::default_entity_inside.

Source

fn entity_inside( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, effect_collector: &mut InsideBlockEffectCollector, is_precise: bool, )

Called when an entity is inside this block’s collision area.

Used by cactus (damage), fire (ignite), sweet berry bush (slow + damage), etc.

§Arguments
  • state - The current block state
  • world - The world
  • pos - The position of the block
  • entity - The entity inside the block
Source

fn default_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage>

Default fall-on hook.

Overrides that mirror vanilla super.fallOn(...) should call Self::default_fall_on.

Source

fn fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityFallOnContext<'_>, ) -> Option<EntityFallDamage>

Called when an entity lands on this block.

Vanilla parity: Block.fallOn(Level, BlockState, BlockPos, Entity, double).

Source

fn after_fall_on_damage( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, fall_damage: &EntityFallDamage, damage_applied: bool, )

Called after fall damage requested by BlockBehavior::fall_on is applied.

Vanilla parity hook for block-specific fall side effects that depend on whether Entity.causeFallDamage returned true.

Source

fn default_update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3

Default post-fall movement hook.

Overrides that mirror vanilla super.updateEntityMovementAfterFallOn(...) should call Self::default_update_entity_movement_after_fall_on.

Source

fn update_entity_movement_after_fall_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, context: EntityLandingContext, ) -> DVec3

Updates entity velocity after a vertical movement collision with this block.

Vanilla mutates the entity in Block.updateEntityMovementAfterFallOn. Steel returns the velocity to apply so movement resolution keeps entity state changes centralized in Entity::move_entity.

Source

fn default_step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, )

Default step-on hook.

Overrides that mirror vanilla super.stepOn(...) should call Self::default_step_on.

Source

fn step_on( &self, state: BlockStateId, world: &Arc<World>, pos: BlockPos, entity: &dyn Entity, )

Called when an entity steps on this block while on ground.

Vanilla parity: Block.stepOn(Level, BlockPos, BlockState, Entity).

Source

fn new_block_entity( &self, level: Weak<World>, pos: BlockPos, state: BlockStateId, ) -> BlockEntityCreation

Creates a new block entity for this block.

Structural block-entity presence comes from the extracted block-entity type registry. The result distinguishes a missing Steel implementation from a Vanilla factory that intentionally returns no entity.

§Arguments
  • level - Weak reference to the world
  • pos - The position where the block entity will be placed
  • state - The block state for this block entity
Source

fn get_block_entity_ticker( &self, world: &Arc<World>, state: BlockStateId, block_entity_type: BlockEntityTypeRef, ) -> Option<BlockEntityTicker>

Returns the server ticker selected by this live block state and entity type.

Mirrors Vanilla EntityBlock.getTicker. Selection runs without chunk, section, or block-entity storage locks.

Source

fn get_game_event_listener( &self, world: &Arc<World>, block_entity: &dyn BlockEntity, ) -> Option<SharedGameEventListener>

Returns the game-event listener exposed by this block entity.

Mirrors Vanilla EntityBlock.getListener. Block implementations may override the provider result; the default delegates to the block entity’s listener capability.

Source

fn should_keep_block_entity( &self, old_state: BlockStateId, new_state: BlockStateId, ) -> bool

Returns whether this new block should keep the old state’s block entity.

Vanilla defaults to false; copper chests and copper golem statues explicitly keep their entity across transformations within their respective block family. Steel checks those two extracted tags here until those block classes have their own complete behaviors, rather than registering partial block implementations. Non-Vanilla behaviors must opt in explicitly even if a plugin extends either tag.

§Arguments
  • old_state - The previous block state
  • new_state - The requested replacement state
Source

fn has_analog_output_signal(&self, state: BlockStateId) -> bool

Returns whether this block can provide an analog output signal to comparators.

Override to return true for containers (chests, barrels, hoppers, etc.) and other blocks that comparators can read (composters, beehives, etc.).

Source

fn get_analog_output_signal( &self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos, direction: Direction, ) -> i32

Returns the analog output signal strength (0-15) for comparators.

Only called if has_analog_output_signal() returns true. For containers, this is typically based on how full they are.

§Arguments
  • state - The current block state
  • world - The world
  • pos - The position of the block
  • direction - The face from which the comparator reads the block
Source

fn is_liquid_container(&self, state: BlockStateId) -> bool

Vanilla parity: whether this block implements LiquidBlockContainer.

This is a block behavior capability, not just a state property. Most simple waterlogged blocks expose it through WATERLOGGED, but vanilla also has liquid containers without that property, such as kelp and seagrass.

Source

fn can_place_liquid(&self, state: BlockStateId, fluid: FluidRef) -> bool

Vanilla parity: LiquidBlockContainer.canPlaceLiquid().

Returns true if the given fluid type may be placed into this block at the given state. Called by the fluid-spread logic; there is no player context here (fluid spreading has no associated player).

Default (SimpleWaterloggedBlock): accepts source water for blocks with a WATERLOGGED property. Override for blocks that need different restrictions (e.g. double-slabs, barriers).

Vanilla signature: canPlaceLiquid(@Nullable LivingEntity, BlockGetter, BlockPos, BlockState, Fluid) — the Fluid parameter is a type, not a state.

Source

fn can_place_liquid_with_player( &self, state: BlockStateId, fluid: FluidRef, _player: Option<&Player>, ) -> bool

Vanilla parity: LiquidBlockContainer.canPlaceLiquid() with a user.

Runtime bucket placement supplies the acting player; fluid spread and other no-user callers should use can_place_liquid.

Source

fn can_be_replaced_by_fluid( &self, state: BlockStateId, _fluid_block: BlockRef, ) -> bool

Vanilla parity: BlockBehaviour.BlockStateBase.canBeReplaced(Fluid).

This is a behavior hook because vanilla block subclasses can override the base replacement rule. The default mirrors Block.canBeReplaced(Fluid).

Source

fn place_liquid( &self, level: &dyn LevelAccessor, pos: BlockPos, state: BlockStateId, fluid_state: FluidState, ) -> bool

Vanilla parity: LiquidBlockContainer.placeLiquid().

Attempts to place fluid_state into this block. Returns true on success, false if placement was rejected.

Default (SimpleWaterloggedBlock): sets WATERLOGGED = true and schedules a fluid tick. Vanilla’s default placeLiquid directly accepts source water and does not delegate to canPlaceLiquid.

Source

fn as_bonemealable(&self) -> Option<&dyn Bonemealable>

Returns the trait object for Blocks that have the Bonemealable trait implemented.

Source

fn as_rail(&self) -> Option<&dyn RailBehavior>

Returns the shared vanilla rail capability implemented by this block.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl BlockBehavior for AmethystBlock

Source§

impl BlockBehavior for AmethystClusterBlock

Source§

impl BlockBehavior for AnvilBlock

Source§

impl BlockBehavior for AzaleaBlock

Source§

impl BlockBehavior for BambooSaplingBlock

Source§

impl BlockBehavior for BambooStalkBlock

Source§

impl BlockBehavior for BarrelBlock

Source§

impl BlockBehavior for BarrierBlock

Source§

impl BlockBehavior for BaseCoralFanBlock

Source§

impl BlockBehavior for BaseCoralPlantBlock

Source§

impl BlockBehavior for BaseCoralWallFanBlock

Source§

impl BlockBehavior for BedBlock

Source§

impl BlockBehavior for BeehiveBlock

Source§

impl BlockBehavior for BigDripleafBlock

Source§

impl BlockBehavior for BigDripleafStemBlock

Source§

impl BlockBehavior for BubbleColumnBlock

Source§

impl BlockBehavior for BuddingAmethystBlock

Source§

impl BlockBehavior for BushBlock

Source§

impl BlockBehavior for ButtonBlock

Source§

impl BlockBehavior for CactusBlock

Source§

impl BlockBehavior for CactusFlowerBlock

Source§

impl BlockBehavior for CakeBlock

Source§

impl BlockBehavior for CampfireBlock

Source§

impl BlockBehavior for CandleBlock

Source§

impl BlockBehavior for CandleCakeBlock

Source§

impl BlockBehavior for CarpetBlock

Source§

impl BlockBehavior for CauldronBlock

Source§

impl BlockBehavior for CaveVinesBlock

Source§

impl BlockBehavior for CaveVinesPlantBlock

Source§

impl BlockBehavior for CeilingHangingSignBlock

Source§

impl BlockBehavior for ChainBlock

Source§

impl BlockBehavior for ChorusFlowerBlock

Source§

impl BlockBehavior for ChorusPlantBlock

Source§

impl BlockBehavior for CocoaBlock

Source§

impl BlockBehavior for ComparatorBlock

Source§

impl BlockBehavior for ComposterBlock

Source§

impl BlockBehavior for CopperBulbBlock

Source§

impl BlockBehavior for CoralBlock

Source§

impl BlockBehavior for CoralFanBlock

Source§

impl BlockBehavior for CoralPlantBlock

Source§

impl BlockBehavior for CoralWallFanBlock

Source§

impl BlockBehavior for CraftingTableBlock

Source§

impl BlockBehavior for DaylightDetectorBlock

Source§

impl BlockBehavior for DefaultBlockBehavior

Source§

impl BlockBehavior for DetectorRailBlock

Source§

impl BlockBehavior for DirtPathBlock

Source§

impl BlockBehavior for DoorBlock

Source§

impl BlockBehavior for DoublePlantBlock

Source§

impl BlockBehavior for DryVegetationBlock

Source§

impl BlockBehavior for EndGatewayBlock

Source§

impl BlockBehavior for EndPortalBlock

Source§

impl BlockBehavior for EndPortalFrameBlock

Source§

impl BlockBehavior for EyeblossomBlock

Source§

impl BlockBehavior for FarmlandBlock

Source§

impl BlockBehavior for FenceBlock

Source§

impl BlockBehavior for FenceGateBlock

Source§

impl BlockBehavior for FireBlock

Source§

impl BlockBehavior for FireflyBushBlock

Source§

impl BlockBehavior for FlowerBedBlock

Source§

impl BlockBehavior for FlowerBlock

Source§

impl BlockBehavior for GlazedTerracottaBlock

Source§

impl BlockBehavior for GlowLichenBlock

Source§

impl BlockBehavior for GrowingPlantBodyBlock

Source§

impl BlockBehavior for GrowingPlantHeadBlock

Source§

impl BlockBehavior for HangingMossBlock

Source§

impl BlockBehavior for HangingRootsBlock

Source§

impl BlockBehavior for HayBlock

Source§

impl BlockBehavior for HoneyBlock

Source§

impl BlockBehavior for IceBlock

Source§

impl BlockBehavior for IronBarsBlock

Source§

impl BlockBehavior for KelpBlock

Source§

impl BlockBehavior for KelpPlantBlock

Source§

impl BlockBehavior for LadderBlock

Source§

impl BlockBehavior for LavaCauldronBlock

Source§

impl BlockBehavior for LayeredCauldronBlock

Source§

impl BlockBehavior for LeafLitterBlock

Source§

impl BlockBehavior for LeavesBlock

Source§

impl BlockBehavior for LeverBlock

Source§

impl BlockBehavior for LilyPadBlock

Source§

impl BlockBehavior for LiquidBlock

Source§

impl BlockBehavior for MagmaBlock

Source§

impl BlockBehavior for MangroveLeavesBlock

Source§

impl BlockBehavior for MangrovePropaguleBlock

Source§

impl BlockBehavior for MossyCarpetBlock

Source§

impl BlockBehavior for MovingPistonBlock

Source§

impl BlockBehavior for MudBlock

Source§

impl BlockBehavior for MushroomBlock

Source§

impl BlockBehavior for NetherFungusBlock

Source§

impl BlockBehavior for NetherPortalBlock

Source§

impl BlockBehavior for NetherRootsBlock

Source§

impl BlockBehavior for NetherSproutsBlock

Source§

impl BlockBehavior for NetherWartBlock

Source§

impl BlockBehavior for NoteBlock

Source§

impl BlockBehavior for ObserverBlock

Source§

impl BlockBehavior for PistonBaseBlock

Source§

impl BlockBehavior for PistonHeadBlock

Source§

impl BlockBehavior for PitcherCropBlock

Source§

impl BlockBehavior for PointedDripstoneBlock

Source§

impl BlockBehavior for PotentSulfurBlock

Source§

impl BlockBehavior for PowderSnowBlock

Source§

impl BlockBehavior for PoweredBlock

Source§

impl BlockBehavior for PoweredRailBlock

Source§

impl BlockBehavior for PressurePlateBlock

Source§

impl BlockBehavior for PumpkinBlock

Source§

impl BlockBehavior for RailBlock

Source§

impl BlockBehavior for RedStoneOreBlock

Source§

impl BlockBehavior for RedStoneWireBlock

Source§

impl BlockBehavior for RedstoneLampBlock

Source§

impl BlockBehavior for RedstoneTorchBlock

Source§

impl BlockBehavior for RedstoneWallTorchBlock

Source§

impl BlockBehavior for RepeaterBlock

Source§

impl BlockBehavior for RespawnAnchorBlock

Source§

impl BlockBehavior for RootedDirtBlock

Source§

impl BlockBehavior for RotatedPillarBlock

Source§

impl BlockBehavior for SaplingBlock

Source§

impl BlockBehavior for ScaffoldingBlock

Source§

impl BlockBehavior for SculkVeinBlock

Source§

impl BlockBehavior for SeaPickleBlock

Source§

impl BlockBehavior for SeagrassBlock

Source§

impl BlockBehavior for ShortDryGrassBlock

Source§

impl BlockBehavior for SlabBlock

Source§

impl BlockBehavior for SlimeBlock

Source§

impl BlockBehavior for SmallDripleafBlock

Source§

impl BlockBehavior for SnowLayerBlock

Source§

impl BlockBehavior for SoulFireBlock

Source§

impl BlockBehavior for SpongeBlock

Source§

impl BlockBehavior for SporeBlossomBlock

Source§

impl BlockBehavior for StainedGlassPaneBlock

Source§

impl BlockBehavior for StairBlock

Source§

impl BlockBehavior for StandingSignBlock

Source§

impl BlockBehavior for SugarCaneBlock

Source§

impl BlockBehavior for SulfurSpikeBlock

Source§

impl BlockBehavior for SweetBerryBushBlock

Source§

impl BlockBehavior for TallDryGrassBlock

Source§

impl BlockBehavior for TallFlowerBlock

Source§

impl BlockBehavior for TallGrassBlock

Source§

impl BlockBehavior for TallSeagrassBlock

Source§

impl BlockBehavior for TargetBlock

Source§

impl BlockBehavior for TintedParticleLeavesBlock

Source§

impl BlockBehavior for TorchBlock

Source§

impl BlockBehavior for TrapDoorBlock

Source§

impl BlockBehavior for TripWireBlock

Source§

impl BlockBehavior for TripWireHookBlock

Source§

impl BlockBehavior for TwistingVinesBlock

Source§

impl BlockBehavior for TwistingVinesPlantBlock

Source§

impl BlockBehavior for UntintedParticleLeavesBlock

Source§

impl BlockBehavior for VineBlock

Source§

impl BlockBehavior for WallBlock

Source§

impl BlockBehavior for WallHangingSignBlock

Source§

impl BlockBehavior for WallSignBlock

Source§

impl BlockBehavior for WallTorchBlock

Source§

impl BlockBehavior for WaterloggedTransparentBlock

Source§

impl BlockBehavior for WeatheringCopperBarsBlock

Source§

impl BlockBehavior for WeatheringCopperBulbBlock

Source§

impl BlockBehavior for WeatheringCopperChainBlock

Source§

impl BlockBehavior for WeatheringCopperDoorBlock

Source§

impl BlockBehavior for WeatheringCopperFullBlock

Source§

impl BlockBehavior for WeatheringCopperGrateBlock

Source§

impl BlockBehavior for WeatheringCopperSlabBlock

Source§

impl BlockBehavior for WeatheringCopperStairBlock

Source§

impl BlockBehavior for WeatheringCopperTrapDoorBlock

Source§

impl BlockBehavior for WebBlock

Source§

impl BlockBehavior for WeepingVinesBlock

Source§

impl BlockBehavior for WeepingVinesPlantBlock

Source§

impl BlockBehavior for WeightedPressurePlateBlock

Source§

impl BlockBehavior for WetSpongeBlock

Source§

impl BlockBehavior for WitherRoseBlock

Source§

impl BlockBehavior for WoolCarpetBlock

Source§

impl<T: CropLike + Bonemealable + Send + Sync> BlockBehavior for T