Content Builders

Build item stacks, blocks, enchants, NBT, and components fluently.

In this section

Related section pages:

Custom Content Registration

Use ctx.RegisterBlock(...), ctx.RegisterItem(...), ctx.RegisterEffect(...), and ctx.RegisterEntityType(...) for custom content. Builder helpers are preferred when definitions include hooks, components, drops, or container metadata.

content.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())

Items And Blocks

Item and block builders keep custom data close to the declaration. Bare vanilla names normalize to minecraft:<name>, while custom content must use namespaced identifiers.

builders.go
sword := item.New("diamond_sword").	Enchant(item.Sharpness(5)).	NameTag("Arena Blade").	Lore("Bound to the arena").	NBTTag("pulse:owner", "Steve").	Component("minecraft:foil", true).	Stack()blockState := block.New("chest").	String("minecraft:cardinal_direction", "north").	Block()

Namespacing