Content Behaviors (v0.2)
Typed and classic behavior contracts for blocks, items, and redstone/light/fallback integrations.
In this section
Related section pages:
Behavior Contracts
- Use
ctx.RegisterBlock(content.DefineBlock(...))andctx.RegisterTypedBlock(...)for block behavior. - Use
ctx.RegisterItem(content.DefineItem(...))andctx.RegisterTypedItem(...)for item behavior. - Runtime integration exists for redstone power/wire/diode/connect and light context contracts.
- Some light/liquid/falling/replaceable block integrations remain declaration-only in v0.2.
content-behaviors.go
ctx.RegisterBlock(content.DefineBlock("example:crate"). Container(27). Hardness(4). Tool("axe"). Drop(item.New("example:ruby").Stack()). OnInteract(func(event content.BlockContext) error { return nil }). Spec())ctx.RegisterItem(content.DefineItem("example:wand"). MaxCount(1). Component("minecraft:foil", true). OnUseOnBlock(func(event content.ItemContext) error { return event.World.SetBlock(event.Pos, block.New("gold_block").Block()) }). Spec())ctx.RegisterEffect(content.DefineEffect("example:focus"). BedrockID(200). Spec())