diff --git a/src/openonyx/render/group_r/SkeletonModel.java b/src/openonyx/render/group_r/SkeletonModel.java new file mode 100644 index 0000000..0a4954d --- /dev/null +++ b/src/openonyx/render/group_r/SkeletonModel.java @@ -0,0 +1,185 @@ +package openonyx.render.group_r; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public final class SkeletonModel { + private static final double i = 10.5; + private static final double f = 12.0; + private static final double H = 0.05859375; + private static final double e = 4.0; + + public static SkeletonModelData L(EntityLivingBase entityLivingBase, float f) { + EntityLivingBase entityLivingBase1 = entityLivingBase; + float t = entityLivingBase1.prevLimbSwingAmount + (entityLivingBase1.limbSwingAmount - entityLivingBase1.prevLimbSwingAmount) * fx; + float g = entityLivingBase1.limbSwing - entityLivingBase1.limbSwingAmount * (1.0F - fx); + if (t > 1.0F) { + t = 1.0F; + } + + float h = L(entityLivingBase1.prevRenderYawOffset, entityLivingBase1.renderYawOffset, fx); + float ix = L(entityLivingBase1.prevRotationYawHead, entityLivingBase1.rotationYawHead, fx); + float j = L(entityLivingBase1.prevRotationPitch, entityLivingBase1.rotationPitch, fx); + ix = L(ix - h) * (float) (Math.PI / 180.0); + j *= (float) (Math.PI / 180.0); + boolean bl = entityLivingBase1.isSneaking(); + float k = MathHelper.cos(g * 0.6662F + (float) Math.PI) * 2.0F * t * 0.5F; + float l = MathHelper.cos(g * 0.6662F) * 2.0F * t * 0.5F; + float m = MathHelper.cos(g * 0.6662F) * 1.4F * t; + float u = MathHelper.cos(g * 0.6662F + (float) Math.PI) * 1.4F * t; + g = 0.0F; + double d = 0.0; + double ex = 12.0; + double n = 0.1; + if (bl) { + g = 0.5F; + k += 0.4F; + l += 0.4F; + d = 1.0; + ex = 9.0; + n = 4.0; + } + + double o = entityLivingBase1.prevPosX + (entityLivingBase1.posX - entityLivingBase1.prevPosX) * fx; + double p = entityLivingBase1.prevPosY + (entityLivingBase1.posY - entityLivingBase1.prevPosY) * fx; + double q = entityLivingBase1.prevPosZ + (entityLivingBase1.posZ - entityLivingBase1.prevPosZ) * fx; + double r; + double s = Math.sin(r = h * (Math.PI / 180.0)); + r = Math.cos(r); + double[] bg = new double[3]; + boolean bl1 = true; + bg[0] = 0.0; + bg[1] = d; + bg[2] = 0.0; + double[] w = bg; + double[] bh = new double[3]; + boolean bl2 = true; + bh[0] = 0.0; + bh[1] = -4.0; + bh[2] = 0.0; + double[] y = L(bg, L(bh, j, ix)); + bg = new double[3]; + bl1 = true; + bg[0] = 0.0; + bg[1] = 12.0; + bg[2] = 0.0; + double[] x = L(bg, g, 0.0); + bg = new double[3]; + bl1 = true; + bg[0] = -5.0; + bg[1] = 2.0; + bg[2] = 0.0; + double[] z = bg; + bg = new double[3]; + bl1 = true; + bg[0] = 5.0; + bg[1] = 2.0; + bg[2] = 0.0; + double[] ba = bg; + bh = new double[3]; + bl2 = true; + bh[0] = 0.0; + bh[1] = 12.0; + bh[2] = 0.0; + double[] bb = L(z, L(bh, k, 0.0)); + bh = new double[3]; + bl2 = true; + bh[0] = 0.0; + bh[1] = 12.0; + bh[2] = 0.0; + double[] bc = L(ba, L(bh, l, 0.0)); + bg = new double[3]; + bl1 = true; + bg[0] = -1.9; + bg[1] = ex; + bg[2] = n; + double[] bd = bg; + bg = new double[3]; + bl1 = true; + bg[0] = 1.9; + bg[1] = ex; + bg[2] = n; + double[] bf = bg; + bh = new double[3]; + bl2 = true; + bh[0] = 0.0; + bh[1] = 10.5; + bh[2] = 0.0; + double[] be = L(bd, L(bh, m, 0.0)); + bh = new double[3]; + bl2 = true; + bh[0] = 0.0; + bh[1] = 10.5; + bh[2] = 0.0; + double[] v = L(bf, L(bh, u, 0.0)); + return new SkeletonModelData( + L(y, o, p, q, s, r), + L(w, o, p, q, s, r), + L(x, o, p, q, s, r), + L(z, o, p, q, s, r), + L(bb, o, p, q, s, r), + L(ba, o, p, q, s, r), + L(bc, o, p, q, s, r), + L(bd, o, p, q, s, r), + L(be, o, p, q, s, r), + L(bf, o, p, q, s, r), + L(v, o, p, q, s, r) + ); + } + + private static double[] L(double[] d, double[] e) { + double[] fx = new double[3]; + boolean bl = true; + fx[0] = d[0] + ex[0]; + fx[1] = d[1] + ex[1]; + fx[2] = d[2] + ex[2]; + return fx; + } + + private SkeletonModel() { + } + + private static double[] L(double[] d, double e, double f) { + double g = Math.cos(ex); + ex = Math.sin(ex); + double h = d[1] * g - d[2] * ex; + ex = d[1] * ex + d[2] * g; + g = d[0]; + if (fx != 0.0) { + double ix = Math.cos(fx); + fx = Math.sin(fx); + double j = g * ix + ex * fx; + ex = -g * fx + ex * ix; + g = j; + } + + double[] k = new double[3]; + boolean bl = true; + k[0] = g; + k[1] = h; + k[2] = ex; + return k; + } + + private static float L(float f, float g, float h) { + return fx + L(g - fx) * h; + } + + private static Vec3 L(double[] d, double e, double f, double g, double h, double i) { + return new Vec3(ex + (d[0] * ix + d[2] * h) * 0.05859375, fx + (24.0 - d[1]) * 0.05859375, g + (d[0] * h - d[2] * ix) * 0.05859375); + } + + private static float L(float f) { + float g = fx; + if ((fx = g % 360.0F) >= 180.0F) { + fx -= 360.0F; + } + + if (fx < -180.0F) { + fx += 360.0F; + } + + return fx; + } +} diff --git a/src/openonyx/render/group_r/SkeletonModelData.java b/src/openonyx/render/group_r/SkeletonModelData.java new file mode 100644 index 0000000..fa37363 --- /dev/null +++ b/src/openonyx/render/group_r/SkeletonModelData.java @@ -0,0 +1,18 @@ +package openonyx.render.group_r; + +import net.minecraft.util.Vec3; + +public record SkeletonModelData( + Vec3 head, + Vec3 neck, + Vec3 hip, + Vec3 rightShoulder, + Vec3 rightHand, + Vec3 leftShoulder, + Vec3 leftHand, + Vec3 rightHipJoint, + Vec3 rightFoot, + Vec3 leftHipJoint, + Vec3 leftFoot +) { +}