Redefine removal value in IRetextureableModel from null to empty string {""} due to ImmutibleMap not allowing null Values. Closes #1927
This commit is contained in:
parent
f62ee5c4f5
commit
fef959d1e9
3 changed files with 11 additions and 10 deletions
|
@ -416,7 +416,7 @@ public class ForgeBlockStateV1 extends Marker
|
|||
for (Entry<String, JsonElement> e : json.get("textures").getAsJsonObject().entrySet())
|
||||
{
|
||||
if (e.getValue().isJsonNull())
|
||||
ret.textures.put(e.getKey(), null);
|
||||
ret.textures.put(e.getKey(), ""); // We have to use "" because ImmutibleMaps don't allow nulls -.-
|
||||
else
|
||||
ret.textures.put(e.getKey(), e.getValue().getAsString());
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ public interface IRetexturableModel extends IModel
|
|||
* as a model should be able to be retextured multiple times producing
|
||||
* a separate model each time.
|
||||
*
|
||||
* The input map MAY map to NULL which should be used to indicate the
|
||||
* texture was removed. Handling of that is up to the model itself.
|
||||
* Such as using default, missing texture, or removing vertices.
|
||||
* The input map MAY map to an empty string "" which should be used
|
||||
* to indicate the texture was removed. Handling of that is up to
|
||||
* the model itself. Such as using default, missing texture, or
|
||||
* removing vertices.
|
||||
*
|
||||
* The input should be considered a DIFF of the old textures, not a
|
||||
* replacement as it may not contain everything.
|
||||
|
|
|
@ -293,7 +293,7 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
if (textures.isEmpty())
|
||||
return this;
|
||||
|
||||
|
||||
List<BlockPart> elements = Lists.newArrayList(); //We have to duplicate this so we can edit it below.
|
||||
for (BlockPart part : (List<BlockPart>)this.model.getElements())
|
||||
{
|
||||
|
@ -307,10 +307,10 @@ public class ModelLoader extends ModelBakery
|
|||
neweModel.parent = this.model.parent;
|
||||
|
||||
Set<String> removed = Sets.newHashSet();
|
||||
|
||||
|
||||
for (Entry<String, String> e : textures.entrySet())
|
||||
{
|
||||
if (e.getValue() == null)
|
||||
if ("".equals(e.getValue()))
|
||||
{
|
||||
removed.add(e.getKey());
|
||||
neweModel.textures.remove(e.getKey());
|
||||
|
@ -321,7 +321,7 @@ public class ModelLoader extends ModelBakery
|
|||
|
||||
// Map the model's texture references as if it was the parent of a model with the retexture map as its textures.
|
||||
Map<String, String> remapped = Maps.newHashMap();
|
||||
|
||||
|
||||
for (Entry<String, String> e : (Set<Entry<String, String>>)neweModel.textures.entrySet())
|
||||
{
|
||||
if (e.getValue().startsWith("#"))
|
||||
|
@ -331,9 +331,9 @@ public class ModelLoader extends ModelBakery
|
|||
remapped.put(e.getKey(), (String)neweModel.textures.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
neweModel.textures.putAll(remapped);
|
||||
|
||||
|
||||
//Remove any faces that use a null texture, this is for performance reasons, also allows some cool layering stuff.
|
||||
for (BlockPart part : (List<BlockPart>)neweModel.getElements())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue