public final class ModelLoader extends ModelBakery
Modifier and Type | Class and Description |
---|---|
static class |
ModelLoader.ItemLoadingException
16x16 pure white sprite.
|
static class |
ModelLoader.White |
Modifier and Type | Field and Description |
---|---|
private static java.util.function.Function<ResourceLocation,IUnbakedModel> |
DEFAULT_MODEL_GETTER
Helper method for registering all itemstacks for given item to map to universal bucket model.
|
private static ModelLoader |
instance |
private boolean |
isLoading |
private java.util.Map<ResourceLocation,java.lang.Exception> |
loadingExceptions |
private static org.apache.logging.log4j.Logger |
LOGGER |
private IUnbakedModel |
missingModel |
private static java.util.Set<ResourceLocation> |
specialModels |
DESTROY_LOCATIONS, DESTROY_RENDER_TYPES, DESTROY_STAGES, LOCATION_BANNER_BASE, LOCATION_FIRE_0, LOCATION_FIRE_1, LOCATION_LAVA_FLOW, LOCATION_SHIELD_BASE, LOCATION_SHIELD_NO_PATTERN, LOCATION_WATER_FLOW, LOCATION_WATER_OVERLAY, LOCATIONS_BUILTIN_TEXTURES, MISSING_MODEL_MESH, MODEL_ENTITY, MODEL_GENERATED, MODEL_MISSING, resourceManager
Constructor and Description |
---|
ModelLoader(IResourceManager manager,
BlockColors colours,
IProfiler profiler,
int maxMipmapLevel) |
Modifier and Type | Method and Description |
---|---|
static void |
addSpecialModel(ResourceLocation rl)
Indicate to vanilla that it should load and bake the given model, even if no blocks or
items use it.
|
static java.util.function.Function<ResourceLocation,IUnbakedModel> |
defaultModelGetter() |
static java.util.function.Function<Material,TextureAtlasSprite> |
defaultTextureGetter()
Get the default texture getter the models will be baked with.
|
static ModelResourceLocation |
getInventoryVariant(java.lang.String s)
Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items.
|
protected IUnbakedModel |
getMissingModel() |
protected ResourceLocation |
getModelLocation(ResourceLocation model) |
IUnbakedModel |
getModelOrLogError(ResourceLocation location,
java.lang.String error)
Use this if you want the model, but need to log the error.
|
IUnbakedModel |
getModelOrMissing(ResourceLocation location)
Use this if you don't care about the exception and want some model anyway.
|
java.util.Set<ResourceLocation> |
getSpecialModels() |
static ModelLoader |
instance() |
boolean |
isLoading() |
void |
onPostBakeEvent(java.util.Map<ResourceLocation,IBakedModel> modelRegistry)
Internal, do not use.
|
bake, getBakedModel, getSpriteMap, getStateModelIds, getTopBakedModels, getUnbakedModel, loadModel, processLoading, uploadTextures
private static final org.apache.logging.log4j.Logger LOGGER
private final java.util.Map<ResourceLocation,java.lang.Exception> loadingExceptions
private IUnbakedModel missingModel
private boolean isLoading
private static ModelLoader instance
private static java.util.Set<ResourceLocation> specialModels
private static final java.util.function.Function<ResourceLocation,IUnbakedModel> DEFAULT_MODEL_GETTER
public ModelLoader(IResourceManager manager, BlockColors colours, IProfiler profiler, int maxMipmapLevel)
@Nullable public static ModelLoader instance()
public boolean isLoading()
public static void addSpecialModel(ResourceLocation rl)
ModelRegistryEvent
rl
- The model, either ModelResourceLocation
to point to a blockstate variant,
or plain ResourceLocation
to point directly to a json in the models folder.public java.util.Set<ResourceLocation> getSpecialModels()
getSpecialModels
in class ModelBakery
public static ModelResourceLocation getInventoryVariant(java.lang.String s)
protected ResourceLocation getModelLocation(ResourceLocation model)
protected IUnbakedModel getMissingModel()
public IUnbakedModel getModelOrMissing(ResourceLocation location)
public IUnbakedModel getModelOrLogError(ResourceLocation location, java.lang.String error)
public void onPostBakeEvent(java.util.Map<ResourceLocation,IBakedModel> modelRegistry)
public static java.util.function.Function<Material,TextureAtlasSprite> defaultTextureGetter()
public static java.util.function.Function<ResourceLocation,IUnbakedModel> defaultModelGetter()