Fix invalid rendering of single-frame B3D models (Fix #3815)
This commit is contained in:
parent
867698eb54
commit
9fdb79ae7a
2 changed files with 9 additions and 4 deletions
|
@ -670,7 +670,7 @@ public final class ModelLoader extends ModelBakery
|
|||
textures.addAll(model.getTextures()); // Kick this, just in case.
|
||||
|
||||
models.add(model);
|
||||
builder.add(Pair.of(model, v.getState()));
|
||||
builder.add(Pair.of(model, new ModelStateComposition(v.getState(), model.getDefaultState())));
|
||||
}
|
||||
|
||||
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
|
||||
|
|
|
@ -496,6 +496,9 @@ public enum B3DLoader implements ICustomModelLoader
|
|||
@Override
|
||||
public ModelWrapper process(ImmutableMap<String, String> data)
|
||||
{
|
||||
ImmutableSet<String> newMeshes = this.meshes;
|
||||
int newDefaultKey = this.defaultKey;
|
||||
boolean hasChanged = false;
|
||||
if(data.containsKey("mesh"))
|
||||
{
|
||||
JsonElement e = new JsonParser().parse(data.get("mesh"));
|
||||
|
@ -518,7 +521,8 @@ public enum B3DLoader implements ICustomModelLoader
|
|||
return this;
|
||||
}
|
||||
}
|
||||
return new ModelWrapper(modelLocation, model, builder.build(), smooth, gui3d, defaultKey, textures);
|
||||
newMeshes = builder.build();
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -531,7 +535,8 @@ public enum B3DLoader implements ICustomModelLoader
|
|||
JsonElement e = new JsonParser().parse(data.get("key"));
|
||||
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber())
|
||||
{
|
||||
return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, e.getAsNumber().intValue(), textures);
|
||||
newDefaultKey = e.getAsNumber().intValue();
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -539,7 +544,7 @@ public enum B3DLoader implements ICustomModelLoader
|
|||
return this;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
return hasChanged ? new ModelWrapper(modelLocation, model, newMeshes, smooth, gui3d, newDefaultKey, textures) : this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue