Pulcedocs

Legacy content hooks

Typed and classic behavior contracts for blocks, items, and redstone/light/fallback integrations.

On this page

v0.2 archive

Current semantic API

Behavior Contracts

  • Use ctx.RegisterBlock(content.DefineBlock(...)) and ctx.RegisterTypedBlock(...) for block behavior.
  • Use ctx.RegisterItem(content.DefineItem(...)) and ctx.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 {
		worldHandle, err := event.World()
		if err != nil {
			return err
		}
		return worldHandle.SetBlock(event.Pos, block.New("gold_block").Block())
	}).
	Spec())

ctx.RegisterEffect(content.DefineEffect("example:focus").
	BedrockID(200).
	Spec())