From 6b926f9a0673190ab1e307c72bddafaccc24aebd Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 16 Mar 2016 05:17:33 +0300 Subject: [PATCH] Javadocs, small cleanup. --- .../client/model/ModelLoader.java | 44 ++++++++++++------- .../client/model/ModelLoaderRegistry.java | 6 +-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 73f40e770c..b72b8cf46c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -94,7 +94,6 @@ public final class ModelLoader extends ModelBakery private final Set missingVariants = Sets.newHashSet(); private final Map loadingExceptions = Maps.newHashMap(); private IModel missingModel = null; - private IModel itemModel = new ItemLayerModel(MODEL_GENERATED); private boolean isLoading = false; public boolean isLoading() @@ -372,6 +371,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Hooked from ModelBakery, allows using MRLs that don't end with "inventory" for items. + */ public static ModelResourceLocation getInventoryVariant(String s) { if(s.contains("#")) @@ -750,7 +752,7 @@ public final class ModelLoader extends ModelBakery } } - public IModel getMissingModel() + protected IModel getMissingModel() { if (missingModel == null) { @@ -766,11 +768,6 @@ public final class ModelLoader extends ModelBakery return missingModel; } - public IModel getItemModel() - { - return itemModel; - } - protected static enum VanillaLoader implements ICustomModelLoader { instance; @@ -787,10 +784,8 @@ public final class ModelLoader extends ModelBakery return loader; } - public void onResourceManagerReload(IResourceManager resourceManager) - { - // do nothing, cause loader will store the reference to the resourceManager - } + // NOOP, handled in loader + public void onResourceManagerReload(IResourceManager resourceManager) {} public boolean accepts(ResourceLocation modelLocation) { @@ -817,12 +812,15 @@ public final class ModelLoader extends ModelBakery } } + /** + * 16x16 pure white sprite. + */ public static final class White extends TextureAtlasSprite { public static ResourceLocation loc = new ResourceLocation("white"); public static White instance = new White(); - protected White() + private White() { super(loc.toString()); } @@ -833,7 +831,6 @@ public final class ModelLoader extends ModelBakery return true; } - // TODO: check if this code is correct @Override public boolean load(IResourceManager manager, ResourceLocation location) { @@ -855,6 +852,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Internal, do not use. + */ public void onPostBakeEvent(IRegistry modelRegistry) { IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING); @@ -973,6 +973,9 @@ public final class ModelLoader extends ModelBakery customStateMappers.put(block.delegate, mapper); } + /** + * Internal, do not use. + */ public static void onRegisterAllBlocks(BlockModelShapes shapes) { for (Entry, IStateMapper> e : customStateMappers.entrySet()) @@ -1003,6 +1006,9 @@ public final class ModelLoader extends ModelBakery customMeshDefinitions.put(item.delegate, meshDefinition); } + /** + * Helper method for registering all itemstacks for given item to map to universal bucket model. + */ public static void setBucketModelDefinition(Item item) { ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { @@ -1015,6 +1021,9 @@ public final class ModelLoader extends ModelBakery ModelBakery.registerItemVariants(item, ModelDynBucket.LOCATION); } + /** + * Internal, do not use. + */ public static void onRegisterItems(ItemModelMesher mesher) { for (Map.Entry, ItemMeshDefinition> e : customMeshDefinitions.entrySet()) @@ -1037,6 +1046,9 @@ public final class ModelLoader extends ModelBakery } } + /** + * Get the default texture getter the models will be baked with. + */ public static Function defaultTextureGetter() { return DefaultTextureGetter.instance; @@ -1053,11 +1065,9 @@ public final class ModelLoader extends ModelBakery this.loader = loader; } + // NOOP, handled in loader @Override - public void onResourceManagerReload(IResourceManager resourceManager) - { - // TODO Auto-generated method stub - } + public void onResourceManagerReload(IResourceManager resourceManager) {} @Override public boolean accepts(ResourceLocation modelLocation) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 3f64a7c71d..93b4c39fb1 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -195,9 +195,9 @@ public class ModelLoaderRegistry { cache.clear(); // putting the builtin models in - cache.put(new ResourceLocation("minecraft:builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); - cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); - cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ModelLoader.VanillaLoader.instance.getLoader().getItemModel()); + cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.instance); + cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.instance); + cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.instance); } static Iterable getTextures()