Datageneration/States and Models/1.18
The model providers are a specific type of data generators for defining models. All model providers are a subclass of
ModelProvider provides methods to define models for blocks and items alike: cubes, single textures, doors, slabs, and even custom non-data-generated models as parent models.
All references to textures or other data files not generated for data generation must reference existing files on the system. This is to ensure that all referenced textures are in the correct places, so typos can be found and corrected.
ExistingFileHelper is the class responsible for validating the existence of those data files. An instance can be retrieved from
--existing <folderpath> argument allows the specified folder and its subfolders to be used when validating the existence of files. By default, only the vanilla datapack and resources are available to the
There are three main abstract implementations of
For items, use
ItemModelProvider to define their models: override
#registerModels and use the helper methods.
For blocks, it is recommended to use
BlockStateProvider to define the blockstates, models, and their item models in a single class. It contains an instance of both
ItemModelProvider, which can be accessed through
BlockModelProvider is used to define only block models.
#getVariantBuilder(Block) to get a
VariantBlockStateBuilder for building a blockstate with different variants, or
#getMultipartBuilder(Block) to get a
MultiPartBlockStateBuilder for building a blockstate using multiparts.