mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Fix root transform matrix format, allow using all four root transform formats (#9496)
This commit is contained in:
1 parent
c8f9e59fef
commit
2ab2ced589
3 files changed
+13
-2
No files matched your search
@@ -63,7 +63,7 @@ public class ExtendedBlockModelDeserializer extends BlockModel.Deserializer
|
||||
|
||||
if (jsonobject.has("transform"))
|
||||
{
|
||||
JsonObject transform = GsonHelper.getAsJsonObject(jsonobject, "transform");
|
||||
JsonElement transform = jsonobject.get("transform");
|
||||
model.customData.setRootTransform(deserializationContext.deserialize(transform, Transformation.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ public final class TransformationHelper
|
||||
if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e);
|
||||
JsonArray m = e.getAsJsonArray();
|
||||
if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size());
|
||||
Matrix4f matrix = new Matrix4f().zero();
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
for (int rowIdx = 0; rowIdx < 3; rowIdx++)
|
||||
{
|
||||
if (!m.get(rowIdx).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(rowIdx));
|
||||
@@ -268,6 +268,8 @@ public final class TransformationHelper
|
||||
}
|
||||
}
|
||||
}
|
||||
// JOML's unsafe matrix component setter does not recalculate these properties, so the matrix would stay marked as identity
|
||||
matrix.determineProperties();
|
||||
return matrix;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user