Class ModelLoader

    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • loadingExceptions

        private final java.util.Map<ResourceLocation,​java.lang.Exception> loadingExceptions
      • isLoading

        private boolean isLoading
      • 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.
    • 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 during ModelRegistryEvent
        Parameters:
        rl - The model, either ModelResourceLocation to point to a blockstate variant, or plain ResourceLocation to point directly to a json in the models folder.
      • getInventoryVariant

        public static ModelResourceLocation getInventoryVariant​(java.lang.String s)
        Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items.
      • 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.