Package net.minecraftforge.client.model
Class ModelLoader
- java.lang.Object
-
- net.minecraft.client.renderer.model.ModelBakery
-
- net.minecraftforge.client.model.ModelLoader
-
public final class ModelLoader extends ModelBakery
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ModelLoader.ItemLoadingException
16x16 pure white sprite.static class
ModelLoader.White
-
Field Summary
Fields Modifier and Type Field 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
-
Fields inherited from class net.minecraft.client.renderer.model.ModelBakery
BANNER_BASE, BLOCK_ENTITY_MARKER, BREAKING_LOCATIONS, DESTROY_STAGES, DESTROY_TYPES, FIRE_0, FIRE_1, GENERATION_MARKER, LAVA_FLOW, MISSING_MODEL_LOCATION, MISSING_MODEL_MESH, NO_PATTERN_SHIELD, resourceManager, SHIELD_BASE, UNREFERENCED_TEXTURES, WATER_FLOW, WATER_OVERLAY
-
-
Constructor Summary
Constructors Constructor Description ModelLoader(IResourceManager manager, BlockColors colours, IProfiler profiler, int maxMipmapLevel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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<RenderMaterial,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.-
Methods inherited from class net.minecraft.client.renderer.model.ModelBakery
bake, getBakedModel, getBakedTopLevelModels, getModel, getModelGroups, getSpriteMap, loadBlockModel, processLoading, uploadTextures
-
-
-
-
Field Detail
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
loadingExceptions
private final java.util.Map<ResourceLocation,java.lang.Exception> loadingExceptions
-
missingModel
private IUnbakedModel missingModel
-
isLoading
private boolean isLoading
-
instance
private static ModelLoader instance
-
specialModels
private static java.util.Set<ResourceLocation> specialModels
-
DEFAULT_MODEL_GETTER
private static final java.util.function.Function<ResourceLocation,IUnbakedModel> DEFAULT_MODEL_GETTER
Helper method for registering all itemstacks for given item to map to universal bucket model.
-
-
Constructor Detail
-
ModelLoader
public ModelLoader(IResourceManager manager, BlockColors colours, IProfiler profiler, int maxMipmapLevel)
-
-
Method Detail
-
instance
@Nullable public static ModelLoader instance()
-
isLoading
public boolean isLoading()
-
addSpecialModel
public 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. This is useful if e.g. you have baked models only for entity renderers. Call duringModelRegistryEvent
- Parameters:
rl
- The model, eitherModelResourceLocation
to point to a blockstate variant, or plainResourceLocation
to point directly to a json in the models folder.
-
getSpecialModels
public java.util.Set<ResourceLocation> getSpecialModels()
- Overrides:
getSpecialModels
in classModelBakery
-
getInventoryVariant
public static ModelResourceLocation getInventoryVariant(java.lang.String s)
Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items.
-
getModelLocation
protected ResourceLocation getModelLocation(ResourceLocation model)
-
getMissingModel
protected IUnbakedModel getMissingModel()
-
getModelOrMissing
public IUnbakedModel getModelOrMissing(ResourceLocation location)
Use this if you don't care about the exception and want some model anyway.
-
getModelOrLogError
public IUnbakedModel getModelOrLogError(ResourceLocation location, java.lang.String error)
Use this if you want the model, but need to log the error.
-
onPostBakeEvent
public void onPostBakeEvent(java.util.Map<ResourceLocation,IBakedModel> modelRegistry)
Internal, do not use.
-
defaultTextureGetter
public static java.util.function.Function<RenderMaterial,TextureAtlasSprite> defaultTextureGetter()
Get the default texture getter the models will be baked with.
-
defaultModelGetter
public static java.util.function.Function<ResourceLocation,IUnbakedModel> defaultModelGetter()
-
-