Reworked vanilla texture resolution, hopefully fixes NPE bug in FaceBakery

This commit is contained in:
RainWarrior committed 2015-02-08 15:51:41 +03:00
1 parent 9e90febd37
commit 9a6fb600ec
2 files changed
+6 -14

No files matched your search

@@ -56,7 +56,6 @@ import com.google.common.collect.Sets;
public class ModelLoader extends ModelBakery
{
private final Map<ModelResourceLocation, IModel> stateModels = new HashMap<ModelResourceLocation, IModel>();
private final Set<ResourceLocation> resolveTextures = new HashSet<ResourceLocation>();
private final Set<ResourceLocation> textures = new HashSet<ResourceLocation>();
private final Set<ResourceLocation> loadingModels = new HashSet<ResourceLocation>();
private final Set<ModelResourceLocation> missingVariants = Sets.newHashSet();
@@ -145,7 +144,6 @@ public class ModelLoader extends ModelBakery
{
ResourceLocation file = getItemLocation(s);
ModelResourceLocation memory = new ModelResourceLocation(s, "inventory");
resolveTextures.add(ModelLoaderRegistry.getActualLocation(file));
IModel model = getModel(file);
if(model == null || model == getMissingModel())
{
@@ -217,10 +215,7 @@ public class ModelLoader extends ModelBakery
}
}
if(!resolveTextures.contains(location)) return Collections.emptyList();
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
builder.add(new ResourceLocation(model.resolveTextureName("particle")));
if(hasItemModel(model))
{
@@ -243,9 +238,12 @@ public class ModelLoader extends ModelBakery
}
}
}
if(location.getResourcePath().startsWith("models/block/") || !ModelLoader.this.isBuiltinModel(model.getRootModel()))
for(String s : (Iterable<String>)model.textures.values())
{
builder.addAll(ModelLoader.this.getTextureLocations(model));
if(!s.startsWith("#"))
{
builder.add(new ResourceLocation(s));
}
}
return builder.build();
}
@@ -328,7 +326,6 @@ public class ModelLoader extends ModelBakery
for(Variant v : (List<Variant>)variants.getVariants())
{
ResourceLocation loc = v.getModelLocation();
resolveTextures.add(ModelLoaderRegistry.getActualLocation(loc));
locations.add(loc);
IModel model = new WeightedPartWrapper(getModel(loc));
models.add(model);
@@ -344,12 +341,6 @@ public class ModelLoader extends ModelBakery
public Collection<ResourceLocation> getTextures()
{
/*ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
for(ResourceLocation loc : locations)
{
builder.addAll(getModel(loc).getTextures());
}
return builder.build();*/
return Collections.emptyList();
}