Pulcedocs

Semantic IDs and asset references

These are distinct defined types in core/content.

On this page

Overview

type BlockID string
type ItemID string
type TextureID string

These are distinct defined types in core/content. A block and item may share the same textual ID, but Go cannot pass a typed ItemID to content.Block without an explicit conversion. Pulce establishes the relationship for automatic block items.

const stone content.BlockID = "example:stone"
block := content.Block(stone)
item := content.Item("example:token")

String literals and untyped constants work naturally in builders. For configuration values use ParseBlockID(string) (BlockID, error) or ParseItemID(string) (ItemID, error). Parsers validate without rewriting an ID. A direct cast creates a typed value without validation; Register still validates its definition.

Exact grammar

An ID contains exactly one namespace:path pair. The namespace and each path segment allow only ASCII a-z, 0-9, _, . and -. Paths also allow / between nonempty segments. Empty namespaces/paths, uppercase letters, spaces, extra :, empty segments and ./.. segments are rejected. Whitespace is not trimmed and case is not normalized.

ValueRegistration
example:stoneValid
example:decor/stoneValid
stoneMissing namespace
Example:stoneUppercase is invalid
example:../stoneInvalid segment
minecraft:stoneReserved namespace for new definitions

Vanilla IDs are valid references: for example, a fixed drop minecraft:stone or Places("minecraft:stone") when the block exists in the authoritative registry. ParseItemID and ParseBlockID validate new plugin definitions and also reject the reserved minecraft namespace; they are not general parsers for vanilla references.

BlockID and ItemID provide Validate() error and UnmarshalText([]byte) error. There is no separate public Normalize, MustParse or custom JSON codec. Respect your configuration format's ordinary Go serialization rules and validate values explicitly if its decoder does not call UnmarshalText. Parsers return a zero ID on error. UnmarshalText uses the same plugin-only namespace policy and leaves its destination unchanged on error.

Texture and geometry IDs

TextureID is an atlas alias, not a file path. Aliases need no namespace: both token and example:stone are valid logical asset names. Semantic ID namespace grammar does not apply to atlas aliases.

resources.ItemTextureRef, BlockTextureRef and GeometryRef are distinct defined string types. content.GeometryID aliases resources.GeometryRef. Constructors resources.ItemTexture, BlockTexture and Geometry create references; the resource service checks completeness and ambiguity.

icon := resources.ItemTexture("token")
terrain := resources.BlockTexture("example:stone")
model := resources.Geometry("geometry.example_stone")

Item and terrain atlases have separate namespaces: a matching alias in one cannot satisfy a reference to the other. A geometry identifier is also not replaced with a .geo.json path.

Staging registration returns ItemRef{ID ItemID} or BlockRef{ID BlockID, ItemID ItemID}. BlockRef.Item() (ItemRef, bool) reports whether an associated item was requested; it does not establish publication. Runtime/network IDs are intentionally absent and may differ across client protocols and server snapshots.

Sources: ids.go, resources.go. Next: items, blocks.

Documentation source

Snapshot from Pulce 4fc8a1bb. This page is generated from committed Markdown; code examples are preserved unchanged.