Skip to content

helix / Model

Class: Model

Defined in: core/values/model.ts:15

A resource-pack model definition (assets/<ns>/models/...json). Covers the common item case out of the box - Model.item(texture) is the flat item/generated sprite - with .parent/.texture for anything else and a .raw(json) escape hatch for shapes the typed builder doesn't model yet (mirrors dp.registryFile). Registered via Datapack.model, which also emits the 1.21.4+ item-definition file and hands back a ModelRef the author attaches with Item.X.model(ref).

dp.model("web_shooter", Model.item("minecraft:item/carrot_on_a_stick"))

Constructors

Constructor

new Model(): Model

Returns

Model

Methods

parent()

parent(id): this

Defined in: core/values/model.ts:39

Set the parent model id (namespace defaults to minecraft:).

Parameters

id

string

Returns

this


raw()

raw(json): this

Defined in: core/values/model.ts:51

Verbatim model JSON escape hatch; wins over the typed fields.

Parameters

json

Record<string, unknown>

Returns

this


texture()

texture(slot, id): this

Defined in: core/values/model.ts:45

Bind a texture slot (e.g. layer0, all) to a texture id.

Parameters

slot

string

id

string

Returns

this


toJson()

toJson(): Record<string, unknown>

Defined in: core/values/model.ts:57

The model-file JSON (assets/<ns>/models/item/<name>.json).

Returns

Record<string, unknown>


cubeAll()

static cubeAll(texture): Model

Defined in: core/values/model.ts:26

A full-cube block model with one texture on every face (block/cube_all).

Parameters

texture

string

Returns

Model


cubeColumn()

static cubeColumn(side, end): Model

Defined in: core/values/model.ts:31

A column block model - end on top/bottom, side around (block/cube_column).

Parameters

side

string

end

string

Returns

Model


item()

static item(texture): Model

Defined in: core/values/model.ts:21

A flat sprite item model (parent: item/generated, textures.layer0 = texture).

Parameters

texture

string

Returns

Model

Released under the MIT License · Credits