Fixed various leg alignment issues (may break resourcepacks)

May Break Resourcepacks:
 To fix, just rescale skeleton legs to 2x2 pixels
 width keeping the original positions.
This commit is contained in:
Sollace 2018-04-29 18:00:26 +02:00
parent 7060359f58
commit 7d4c7ede88
7 changed files with 44 additions and 76 deletions

View file

@ -126,8 +126,10 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
animateWears(); animateWears();
if (snout != null) {
snout.setGender(metadata.getGender()); snout.setGender(metadata.getGender());
} }
}
protected void adjustBodyRiding() { protected void adjustBodyRiding() {
adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
@ -243,17 +245,15 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
float spread = getLegSpread(); float spread = getLegSpread();
bipedRightArm.rotationPointZ = spread + sin; bipedRightArm.rotationPointZ = spread + sin;
bipedLeftArm.rotationPointZ = spread - sin; bipedLeftArm.rotationPointZ = spread - sin;
float legOutset = getLegOutset(); float legRPX = cos - getLegOutset();
float rpxl = cos + 1 - legOutset;
float rpxr = legOutset - cos - 1;
bipedRightArm.rotationPointX = rpxr; bipedRightArm.rotationPointX = -legRPX;
bipedRightLeg.rotationPointX = rpxr; bipedRightLeg.rotationPointX = -legRPX;
bipedLeftArm.rotationPointX = rpxl;
bipedLeftLeg.rotationPointX = rpxl; bipedLeftArm.rotationPointX = legRPX;
bipedLeftLeg.rotationPointX = legRPX;
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY; bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY; bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
@ -536,15 +536,15 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
float rarmX = getLegRotationX(); float rarmX = getLegRotationX();
float rarmY = getArmRotationY(); float rarmY = getArmRotationY();
float armX = THIRDP_ARM_CENTRE_X - 2; float armX = THIRDP_ARM_CENTRE_X;
float armY = THIRDP_ARM_CENTRE_Y - 6; float armY = THIRDP_ARM_CENTRE_Y - 6;
float armZ = THIRDP_ARM_CENTRE_Z - 2; float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
bipedLeftArm .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch); bipedLeftArm .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch);
bipedRightArm.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch); bipedRightArm.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch);
bipedLeftLeg .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch); bipedLeftLeg .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch);
bipedRightLeg.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch); bipedRightLeg.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch);
bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0); bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0); bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
@ -554,22 +554,22 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
if (bipedLeftArmwear != null) { if (bipedLeftArmwear != null) {
bipedLeftArmwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f); bipedLeftArmwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedLeftArmwear.setRotationPoint(3, yOffset + rarmY, 0); bipedLeftArmwear.setRotationPoint(rarmX, yOffset + rarmY, 0);
} }
if (bipedRightArmwear != null) { if (bipedRightArmwear != null) {
bipedRightArmwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f); bipedRightArmwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightArmwear.setRotationPoint(-3, yOffset + rarmY, 0); bipedRightArmwear.setRotationPoint(-rarmX, yOffset + rarmY, 0);
} }
if (bipedLeftLegwear != null) { if (bipedLeftLegwear != null) {
bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f); bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightLegwear.setRotationPoint(3, yOffset, 0); bipedRightLegwear.setRotationPoint(rarmX, yOffset, 0);
} }
if (bipedRightLegwear != null) { if (bipedRightLegwear != null) {
bipedRightLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f); bipedRightLegwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightLegwear.setRotationPoint(-3, yOffset, 0); bipedRightLegwear.setRotationPoint(-rarmX, yOffset, 0);
} }
} }

View file

@ -175,11 +175,17 @@ public class ModelPonyArmor extends ModelMobPony {
protected void initLegPositions(float yOffset, float stretch) { protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch); super.initLegPositions(yOffset, stretch);
leftLegging.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z) float rarmX = getLegRotationX();
.around(3, yOffset, 0)
float armX = THIRDP_ARM_CENTRE_X;
float armY = THIRDP_ARM_CENTRE_Y;
float armZ = THIRDP_ARM_CENTRE_Z;
leftLegging.offset(armX + 2, armY, armZ)
.around(rarmX, yOffset, 0)
.box(-2, -6, -2, 4, 12, 4, stretch); .box(-2, -6, -2, 4, 12, 4, stretch);
rightLegging.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z) rightLegging.offset(armX - 2, armY, armZ)
.around(-3, yOffset, 0) .around(-rarmX, yOffset, 0)
.flipX().box(-2, -6, -2, 4, 12, 4, stretch); .flipX().box(-2, -6, -2, 4, 12, 4, stretch);
} }

View file

@ -20,8 +20,10 @@ public class ModelEarthPony extends AbstractPonyModel {
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) { public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity); super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
if (bipedCape != null) {
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0; bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
} }
}
protected float getLegOutset() { protected float getLegOutset() {
if (isCrouching() && smallArms) return 1; if (isCrouching() && smallArms) return 1;
@ -40,15 +42,6 @@ public class ModelEarthPony extends AbstractPonyModel {
return smallArms ? 8.5f : super.getArmRotationY(); return smallArms ? 8.5f : super.getArmRotationY();
} }
protected void adjustLegs(float move, float swing, float tick) {
super.adjustLegs(move, swing, tick);
// Push the front legs back apart if we're a thin pony
if (smallArms) {
bipedLeftArm.rotationPointX++;
bipedLeftLeg.rotationPointX++;
}
}
protected void initHeadTextures() { protected void initHeadTextures() {
super.initHeadTextures(); super.initHeadTextures();
bipedCape = new PonyRenderer(this, 0, 0).size(64, 32); bipedCape = new PonyRenderer(this, 0, 0).size(64, 32);
@ -59,13 +52,6 @@ public class ModelEarthPony extends AbstractPonyModel {
bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch); bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
} }
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
if (smallArms) {
}
}
@Override @Override
public void renderCape(float scale) { public void renderCape(float scale) {
bipedCape.render(scale); bipedCape.render(scale);

View file

@ -1,12 +1,9 @@
package com.minelittlepony.model.ponies; package com.minelittlepony.model.ponies;
import static net.minecraft.client.renderer.GlStateManager.*;
import com.minelittlepony.model.ModelMobPony; import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.model.armour.ModelSkeletonPonyArmor; import com.minelittlepony.model.armour.ModelSkeletonPonyArmor;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.AbstractSkeleton; import net.minecraft.entity.monster.AbstractSkeleton;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -51,40 +48,19 @@ public class ModelSkeletonPony extends ModelMobPony {
} }
} }
// TODO: HACK It would be better to just change the size of the legs. protected int getArmWidth() {
private void renderScaledArm(ModelRenderer arm, float x, float y, float z) { return 2;
scale(x, y, z);
x /= 1.5f;
z /= 1.5f;
arm.rotateAngleX /= x;
arm.rotateAngleY /= y;
arm.rotateAngleZ /= z;
arm.render(scale);
arm.rotateAngleX *= x;
arm.rotateAngleY *= y;
arm.rotateAngleZ *= z;
} }
@Override protected int getArmDepth() {
protected void renderLegs() { return 2;
pushMatrix(); }
translate(0.05F, -0.21F, 0);
renderScaledArm(bipedLeftArm, 0.5F, 1.15F, 0.5F);
popMatrix();
pushMatrix(); protected float getLegRotationX() {
translate(-0.05F, -0.21F, 0); return 3;
renderScaledArm(bipedRightArm, 0.5F, 1.2F, 0.5F); }
popMatrix();
pushMatrix(); protected float getArmRotationY() {
translate(0.05F, -0.21F, 0.35F); return 8;
renderScaledArm(bipedLeftLeg, 0.5F, 1.2F, 0.5F);
popMatrix();
pushMatrix();
translate(-0.05F, -0.21F, 0.35F);
renderScaledArm(bipedRightLeg, 0.5F, 1.15F, 0.5F);
popMatrix();
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB