Add potential support for models defining 'vanilla like' rotations in Forge's Modified Blockstate format.

This commit is contained in:
LexManos 2018-05-24 18:37:05 -07:00
parent f492e25bc9
commit b654b84393
2 changed files with 8 additions and 27 deletions

View file

@ -387,29 +387,6 @@ public class ForgeHooksClient
modelLoader.onPostBakeEvent(modelRegistry);
}
@SuppressWarnings("deprecation")
public static Matrix4f getMatrix(ItemTransformVec3f transform)
{
javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f();
m.setIdentity();
m.setTranslation(TRSRTransformation.toVecmath(transform.translation));
t.setIdentity();
t.rotY(transform.rotation.y);
m.mul(t);
t.setIdentity();
t.rotX(transform.rotation.x);
m.mul(t);
t.setIdentity();
t.rotZ(transform.rotation.z);
m.mul(t);
t.setIdentity();
t.m00 = transform.scale.x;
t.m11 = transform.scale.y;
t.m22 = transform.scale.z;
m.mul(t);
return m;
}
private static final Matrix4f flipX;
static {
flipX = new Matrix4f();
@ -762,7 +739,7 @@ public class ForgeHooksClient
{
MinecraftForge.EVENT_BUS.post(new InputUpdateEvent(player, movementInput));
}
public static String getHorseArmorTexture(EntityHorse horse, ItemStack armorStack)
{
String texture = armorStack.getItem().getHorseArmorTexture(horse, armorStack);

View file

@ -945,11 +945,15 @@ public class ForgeBlockStateV1 extends Marker
}
return ret;
}
else
else if (e.isJsonArray())
{
// quaternion
return new Quat4f(parseFloatArray(e, 4, "Rotation"));
JsonArray array = e.getAsJsonArray();
if (array.size() == 3) //Vanilla rotation
return TRSRTransformation.quatFromXYZDegrees(new Vector3f(parseFloatArray(e, 3, "Rotation")));
else // quaternion
return new Quat4f(parseFloatArray(e, 4, "Rotation"));
}
else throw new JsonParseException("Rotation: expected array or object, got: " + e);
}
else if (e.isJsonObject())
{