Pulcedocs

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

APIPurpose
core/contentSemantic IDs, definitions, builders, registrars and error sentinels
module.TypedContent(ctx)Obtain the host-owned staging capability
core/resourcesLogical 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.

Shared defaults

PropertyOmitted behavior
Display nameNo name component; the semantic ID does not become text
HardnessHost mining profile; current internal default 1.0, not a public constant
DropsNone
Block itemNot created without opt-in
Creative categoryHidden
Item stack64
Block geometryBuiltin minecraft:geometry.full_block
Block materialOpaque, one texture for all faces
Preferred toolNone, without a harvest requirement
Block textureRequired during normalization
Item iconRequired during normalization unless the item uses Places

content.Block("example:block") is a shape declaration, not a publishable block: add .Texture(...) before normalization. A block's display label supplies its associated item; current lowering emits no separate block display-name component.

Start here

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.