From 33e2e0b0284fbdf464957555abe629e93d53fd84 Mon Sep 17 00:00:00 2001 From: shadekiller666 Date: Wed, 19 Aug 2015 14:09:01 -0700 Subject: [PATCH] Fixed a bug with item model loading that would occur if ModelBakery.addVariantName() was called with the same string location parameter for 2 different items, and the string pointed to a location that didn't exist, where ModelLoader.loadAnyModel() would substitute the blockdefinition in for the item model, but wouldn't remove the original input location from the loadingModels list, which would cause the location from the second call to throw an IllegalStateException even though that location now has a model. --- .../client/model/ModelLoader.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 8e79f8fbf..63e7128ed 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -217,13 +217,20 @@ public class ModelLoader extends ModelBakery throw new IllegalStateException("circular model dependencies involving model " + location); } loadingModels.add(location); - IModel model = ModelLoaderRegistry.getModel(location); - for(ResourceLocation dep : model.getDependencies()) + try { - getModel(dep); + IModel model = ModelLoaderRegistry.getModel(location); + for (ResourceLocation dep : model.getDependencies()) + { + getModel(dep); + + } + textures.addAll(model.getTextures()); + } + finally + { + loadingModels.remove(location); } - textures.addAll(model.getTextures()); - loadingModels.remove(location); } private class VanillaModelWrapper implements IRetexturableModel