Typed Content API
A native Go module declares what an item or block represents: its identity, name, texture, hardness, preferred tool, drop and creative category.
On this page
Overview
A native Go module declares what an item or block represents: its identity, name, texture, hardness, preferred tool, drop and creative category. Pulce validates those declarations and builds a representation for each enabled Bedrock version. Ordinary modules need no ZIP parser, Bedrock components, runtime IDs or *server.Server.
api, err := module.TypedContent(ctx)
if err != nil {
return err
}
_, err = api.Blocks().Register(
content.Block("example:stone").
Texture("example_stone").
Hardness(0.5).
Tool(content.Pickaxe).
DropsSelf().
WithItem(),
)
return err
Run this code inside Load(ctx module.Context). A successful Register stages content; it does not publish it. After successful module loads, the host resolves references, validates the enabled resource stack, lowers definitions for enabled protocols and atomically publishes a snapshot before Start and player admission.
Public boundary
| API | Purpose |
|---|---|
core/content | Semantic IDs, definitions, builders, registrars and error sentinels |
module.TypedContent(ctx) | Obtain the host-owned staging capability |
core/resources | Logical item/terrain aliases and geometry references |
module.Resources(ctx) | Read-only asset validation against the enabled stack |
ctx.Logger() | Logger with module/version/load generation fields |
ctx.Content() still returns the legacy content.ContentRegistrar. It is a compatibility API, not the typed service. Use module.TypedContent(ctx) and module.Resources(ctx) today. Neither ctx.Content().Items() nor ctx.Resources() belongs to the current module.Context.
internal/content, version lowering, palette allocation and ProtocolNext are host responsibilities. Plugins do not import these packages. Semantic declarations are independent of protocol numbers, network IDs and packet shapes.
Implemented scope
The current API supports ordinary items with icons, full blocks with one terrain texture, custom geometry identifiers, automatic block items, separate placeable items, no/self/single fixed drops, preferred tools and five semantic creative categories. Registration copies typed declarations; changing the original definition after Register cannot change its batch.
Typed hooks, durability, conditional loot, Fortune/Silk Touch policies, per-face materials, transparency modes, states/permutations and a raw-component escape hatch are not implemented. Some declarations accepted by local Validate are rejected by the current host adapter during normalization, including multiple fixed drops. See validation.
Start here
- Quick start: module activation and administrator configuration.
- IDs, items, blocks, creative: definitions and defaults.
- Resources: asset lookup and validation.
- Lifecycle, validation, multi-version: startup contract and limits of the guarantees.
- Legacy migration: moving an existing registrar consumer.
- ExampleContent: a complete module example.
Sources: definitions.go, capabilities.go, bootstrap.go. The design proposal explains decision history; source code determines the available API and its current behavior.
Documentation source
Snapshot from Pulce 4fc8a1bb. This page is generated from committed Markdown; code examples are preserved unchanged.