Interface CustomUnbakedBlockStateModel
- All Superinterfaces:
BlockStateModel.Unbaked
,ResolvableModel
- All Known Subinterfaces:
CompositeBlockStateModel.Unbaked
blockstates/
files. It is
not necessary to implement this interface when using a custom subclass of BlockStateModel.Unbaked
at runtime
, e.g. for ModelModifier
.
The format for custom unbaked block state models is as follows:
{
"fabric:type": "<identifier of the type>",
// extra model data, dependent on the type
}
The above JSON object may be used in a blockstates/
file wherever a ModelVariant
or
SimpleBlockStateModel.Unbaked
is normally valid. Note that if the "fabric:type"
key is present,
the object will never be parsed as a ModelVariant
, even if the custom type does not exist or is not able to
parse the object.
BlockStateModel.Unbaked.CODEC
and BlockStateModel.Unbaked.WEIGHTED_CODEC
are automatically patched
to support custom models. Custom types are encouraged to use BlockStateModel.Unbaked.CODEC
to
deserialize/serialize submodels.
All types must be registered using register(net.minecraft.util.Identifier, com.mojang.serialization.MapCodec<? extends net.fabricmc.fabric.api.client.model.loading.v1.CustomUnbakedBlockStateModel>)
for deserialization/serialization to work.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.render.model.ResolvableModel
ResolvableModel.Resolver
-
Field Summary
Fields inherited from interface net.minecraft.client.render.model.BlockStateModel.Unbaked
CODEC, WEIGHTED_CODEC, WEIGHTED_VARIANT_CODEC
-
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec
<? extends CustomUnbakedBlockStateModel> codec()
Returns the codec which can be used to serialize this model.static void
register
(Identifier id, com.mojang.serialization.MapCodec<? extends CustomUnbakedBlockStateModel> codec) Registers a custom block state model type.Methods inherited from interface net.minecraft.client.render.model.BlockStateModel.Unbaked
bake, cached
Methods inherited from interface net.minecraft.client.render.model.ResolvableModel
resolve
-
Method Details
-
register
static void register(Identifier id, com.mojang.serialization.MapCodec<? extends CustomUnbakedBlockStateModel> codec) Registers a custom block state model type. -
codec
com.mojang.serialization.MapCodec<? extends CustomUnbakedBlockStateModel> codec()Returns the codec which can be used to serialize this model. Must match the codec passed toregister(net.minecraft.util.Identifier, com.mojang.serialization.MapCodec<? extends net.fabricmc.fabric.api.client.model.loading.v1.CustomUnbakedBlockStateModel>)
which deserializes objects of this type.
-