Skip to content

Class: BlockStateResolver ​

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:21

Selects block models from property values, including multipart conditions and weighted alternatives.

Constructors ​

Constructor ​

ts
new BlockStateResolver(): BlockStateResolver;

Returns ​

BlockStateResolver

Methods ​

choose() ​

ts
static choose(variants, position?): BlockStateVariant;

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:80

Selects by positive integer weights (default 1); world block coordinates make the choice repeatable.

Parameters ​

ParameterType
variants| BlockStateVariant | BlockStateVariant[]
position?readonly [number, number, number]

Returns ​

BlockStateVariant


defaults() ​

ts
static defaults(blockState): Promise<BlockStateProperties>;

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:24

Loads vanilla property defaults, falling back to preview values inferred from the blockstate file.

Parameters ​

ParameterType
blockStateBlockState

Returns ​

Promise<BlockStateProperties>


matching() ​

ts
static matching(blockState, state): (
  | BlockStateVariant
  | BlockStateVariant[])[];

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:55

Returns matching model groups before choosing weighted alternatives.

Parameters ​

ParameterType
blockStateBlockState
stateBlockStateProperties

Returns ​

( | BlockStateVariant | BlockStateVariant[])[]


rotation() ​

ts
static rotation(variant): Euler;

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:117

Converts blockstate rotations in degrees into the Euler rotation used by model rendering.

Parameters ​

ParameterType
variantBlockStateVariant

Returns ​

Euler


select() ​

ts
static select(
   blockState, 
   state, 
   choose?
): BlockStateVariant[];

Defined in: packages/minerender/src/model/block/BlockStateResolver.ts:48

Selects matching models. Supply choose to control selection within each alternatives array.

Parameters ​

ParameterType
blockStateBlockState
stateBlockStateProperties
choose(variants) => BlockStateVariant

Returns ​

BlockStateVariant[]