Interface BlockStateResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
BlockState
of a block to an UnbakedModel
.
They replace the blockstates/
JSON files. One block can be mapped to only one block state resolver; multiple
resolvers will not receive the same block.
Block state resolvers can be used to create custom block state formats or dynamically resolve block state models.
Use ModelResolver
instead of this interface if interacting with the block and block states directly is not
necessary. This includes custom model deserializers and loaders.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
The context for block state resolution. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Resolves the models for all block states of the block.
-
Method Details
-
resolveBlockStates
Resolves the models for all block states of the block.For each block state, call
BlockStateResolver.Context.setModel(net.minecraft.block.BlockState, net.minecraft.client.render.model.UnbakedModel)
to set its unbaked model. This method must be called exactly once for each block state.Note that if multiple block states share the same unbaked model instance, it will be baked multiple times (once per block state that has the model set), which is not efficient. To improve efficiency in this case, the model should be delegated to using
DelegatingUnbakedModel
to ensure that it is only baked once. The inner model can be loaded usingModelResolver
if custom loading logic is necessary.
-