Interface CustomUnbakedBlockStateModel

All Superinterfaces:
net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked, net.minecraft.client.resources.model.ResolvableModel
All Known Subinterfaces:
CompositeBlockStateModel.Unbaked

public interface CustomUnbakedBlockStateModel extends net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked
Allows defining custom unbaked block state model types which can be used within 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 Variant or SingleVariant.Unbaked is normally valid. Note that if the "fabric:type" key is present, the object will never be parsed as a Variant, even if the custom type does not exist or is not able to parse the object.

BlockStateModel.Unbaked.CODEC and BlockStateModel.Unbaked.HARDCODED_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.resources.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.resources.model.ResolvableModel

    net.minecraft.client.resources.model.ResolvableModel.Resolver
  • Field Summary

    Fields inherited from interface net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked

    CODEC, ELEMENT_CODEC, HARDCODED_WEIGHTED_CODEC
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.MapCodec<? extends CustomUnbakedBlockStateModel>
    Returns the codec which can be used to serialize this model.
    static void
    register(net.minecraft.resources.Identifier id, com.mojang.serialization.MapCodec<? extends CustomUnbakedBlockStateModel> codec)
    Registers a custom block state model type.

    Methods inherited from interface net.minecraft.client.renderer.block.model.BlockStateModel.Unbaked

    asRoot, bake

    Methods inherited from interface net.minecraft.client.resources.model.ResolvableModel

    resolveDependencies