Expand description
Block and item behavior system.
This module contains the behavior traits and registries that define how blocks and items behave dynamically. This is separate from the static data in steel-registry to maintain a clean separation between constant data and functional/dynamic behavior.
§Architecture
After the main registry (steel-registry) is frozen, behavior registries
are created:
BlockBehaviorRegistry- assigns default or custom behaviors to each blockItemBehaviorRegistry- assigns default or custom behaviors to each item
§Usage
ⓘ
use steel_core::behavior::{init_behaviors, BLOCK_BEHAVIORS, ITEM_BEHAVIORS};
// After registry is frozen, call once at startup:
init_behaviors();
// Then access behaviors via the global registries:
let behavior = BLOCK_BEHAVIORS.get_behavior(block);Re-exports§
pub use fluid::FLUID_BEHAVIORS;pub use fluid::FluidBehaviorRegistry;pub use items::BedItem;pub use items::BlockItem;pub use items::BucketItem;pub use items::DefaultItemBehavior;pub use items::DoubleHighBlockItem;pub use items::EnderEyeItem;pub use items::HangingSignItem;pub use items::ScaffoldingBlockItem;pub use items::ShovelItem;pub use items::SignItem;pub use items::SolidBucketItem;pub use items::StandingAndWallBlockItem;
Modules§
- block 🔒
- Block behavior trait and registry.
- block_
behaviors - Generated block behavior assignments.
- blocks
- Block behavior implementations for vanilla blocks.
- candle_
cakes - consume_
effect 🔒 - Consume-effect behavior registry.
- context 🔒
- Context types and results for block and item interactions.
- fluid
- Fluid behavior registry.
- item 🔒
- Item behavior trait and registry.
- item_
behaviors - Generated item behavior assignments.
- item_
utils 🔒 - Helpers shared by item behavior implementations.
- items
- Item behavior implementations.
- mob_
effect 🔒 - Mob-effect behavior registry.
- strippables
- Generated Mapping of Logs and Woods to their stripped Variant
- waxables
- Generated mapping of copper blocks to their waxed variants.
- weathering
Structs§
- Block
Behavior Lock - Wrapper for the global block behavior registry that implements
Deref. - Block
Behavior Registry - Registry for block behaviors.
- Block
Collision Context - Entity facts used by vanilla
CollisionContextfor block collision shapes. - Block
HitResult - Result of a ray cast hitting a block.
- Block
Loot Context - Live parameters used to resolve a block’s loot.
- Block
Place Context - Context for placing a block.
- Brushable
Data - Data exposed by blocks that support vanilla archaeology brushing.
- Consume
Effect Behavior Registry - Registry for consume-effect behaviors.
- Default
Block Behavior - Default placement plus the common water tick used by unported waterlogged blocks.
- Entity
Fall Damage - Fall damage requested by a block landing hook.
- Entity
Fall OnContext - Entity facts needed by
Block.fallOn. - Entity
Fall OnFacts - Entity facts needed by
Block.fallOn. - Entity
Landing Context - Entity facts needed by
Block.updateEntityMovementAfterFallOn. - Inventory
Access - Access to the player’s inventory.
- Item
Behavior Lock - Wrapper for the global item behavior registry that implements
Deref. - Item
Behavior Registry - Registry for item behaviors.
- MobEffect
Behavior Registry - Registry for mob-effect behaviors.
- Placement
Source - Player and item data retained across one block placement operation.
- UseItem
Context - Context for using an item (general usage).
- UseOn
Context - Context for using an item on a block.
Enums§
- Block
Entity Creation - Result of invoking a block’s Vanilla block-entity factory.
- Interaction
Result - Result of an interaction (item use, block use, etc.)
- Item
UseAnimation - Arm animation displayed while using an item.
- Placement
Orientation - Placement direction behavior derived from either a player or a synthetic caller.
Statics§
- BLOCK_
BEHAVIORS - Global block behavior registry.
- CONSUME_
EFFECT_ BEHAVIORS - Global consume-effect behavior registry.
- ITEM_
BEHAVIORS - Global item behavior registry.
- MOB_
EFFECT_ BEHAVIORS - Global mob-effect behavior registry.
Traits§
- Block
Behavior - Trait defining the behavior of a block.
- Block
State Behavior Ext - Extension trait for
BlockStateIdthat provides access to behavior-dependent methods. - Fallable
- Shared behavior exposed by blocks implementing vanilla’s
Fallableinterface. - Item
Behavior - Trait defining the behavior of an item.
- Rail
Behavior - Shared behavior exposed by blocks in vanilla’s
BaseRailBlockhierarchy.
Functions§
- init_
behaviors - Initializes the global behavior registries.
Type Aliases§
- Block
Collision Boxes - Resolved block-local collision boxes for a live block state.