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 classModelLoader.ItemLoadingException16x16 pure white sprite.static classModelLoader.White
-
Field Summary
Fields Modifier and Type Field Description private static java.util.function.Function<ResourceLocation,IUnbakedModel>DEFAULT_MODEL_GETTERHelper method for registering all itemstacks for given item to map to universal bucket model.private static ModelLoaderinstanceprivate booleanisLoadingprivate java.util.Map<ResourceLocation,java.lang.Exception>loadingExceptionsprivate static org.apache.logging.log4j.LoggerLOGGERprivate IUnbakedModelmissingModelprivate 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 voidaddSpecialModel(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 ModelResourceLocationgetInventoryVariant(java.lang.String s)Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items.protected IUnbakedModelgetMissingModel()protected ResourceLocationgetModelLocation(ResourceLocation model)IUnbakedModelgetModelOrLogError(ResourceLocation location, java.lang.String error)Use this if you want the model, but need to log the error.IUnbakedModelgetModelOrMissing(ResourceLocation location)Use this if you don't care about the exception and want some model anyway.java.util.Set<ResourceLocation>getSpecialModels()static ModelLoaderinstance()booleanisLoading()voidonPostBakeEvent(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, eitherModelResourceLocationto point to a blockstate variant, or plainResourceLocationto point directly to a json in the models folder.
-
getSpecialModels
public java.util.Set<ResourceLocation> getSpecialModels()
- Overrides:
getSpecialModelsin 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()
-
-