Appearance
helix / BlockState
Class: BlockState
Defined in: core/values/block-state.ts:46
A resource-pack blockstate definition (assets/<ns>/blockstates/<block>.json), mapping each state of a block to the model(s) that render it. Blockstate files override the appearance of an existing (usually vanilla) block - there is no vanilla "new block", so this is the file half of any custom-block technique (that technique - allocation, place/break detection - is policy for a higher layer). Registered via Datapack.blockState.
dp.blockState("note_block", BlockState.variants({ "note=0": { model: myModel }, // repurpose an unused note pitch }));
Constructors
Constructor
new BlockState():
BlockState
Returns
BlockState
Methods
part()
part(
part):this
Defined in: core/values/block-state.ts:65
Add a multipart case verbatim ({ when?, apply }) - the flexible builder.
Parameters
part
unknown
Returns
this
raw()
raw(
json):this
Defined in: core/values/block-state.ts:71
Verbatim blockstate JSON escape hatch; wins over the typed fields.
Parameters
json
Record<string, unknown>
Returns
this
toJson()
toJson():
Record<string,unknown>
Defined in: core/values/block-state.ts:77
The blockstate-file JSON.
Returns
Record<string, unknown>
variant()
variant(
state,v):this
Defined in: core/values/block-state.ts:59
Map a single blockstate string to a variant (repeatable).
Parameters
state
string
v
VariantValue
Returns
this
variants()
staticvariants(map):BlockState
Defined in: core/values/block-state.ts:52
A variants-style file mapping state strings ("", facing=north) to models.
Parameters
map
Record<string, VariantValue>
Returns
BlockState