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();
if (snout != null) {
snout.setGender(metadata.getGender());
}
}
protected void adjustBodyRiding() {
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();
bipedRightArm.rotationPointZ = spread + sin;
bipedLeftArm.rotationPointZ = spread - sin;
float legOutset = getLegOutset();
float rpxl = cos + 1 - legOutset;
float rpxr = legOutset - cos - 1;
float legRPX = cos - getLegOutset();
bipedRightArm.rotationPointX = rpxr;
bipedRightLeg.rotationPointX = rpxr;
bipedLeftArm.rotationPointX = rpxl;
bipedLeftLeg.rotationPointX = rpxl;
bipedRightArm.rotationPointX = -legRPX;
bipedRightLeg.rotationPointX = -legRPX;
bipedLeftArm.rotationPointX = legRPX;
bipedLeftLeg.rotationPointX = legRPX;
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
@ -536,15 +536,15 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
float rarmX = getLegRotationX();
float rarmY = getArmRotationY();
float armX = THIRDP_ARM_CENTRE_X - 2;
float armX = THIRDP_ARM_CENTRE_X;
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);
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);
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);
bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
@ -554,22 +554,22 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
if (bipedLeftArmwear != null) {
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) {
bipedRightArmwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightArmwear.setRotationPoint(-3, yOffset + rarmY, 0);
bipedRightArmwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightArmwear.setRotationPoint(-rarmX, yOffset + rarmY, 0);
}
if (bipedLeftLegwear != null) {
bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightLegwear.setRotationPoint(3, yOffset, 0);
bipedRightLegwear.setRotationPoint(rarmX, yOffset, 0);
}
if (bipedRightLegwear != null) {
bipedRightLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightLegwear.setRotationPoint(-3, yOffset, 0);
bipedRightLegwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
bipedRightLegwear.setRotationPoint(-rarmX, yOffset, 0);
}
}

View file

@ -175,11 +175,17 @@ public class ModelPonyArmor extends ModelMobPony {
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
leftLegging.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z)
.around(3, yOffset, 0)
float rarmX = getLegRotationX();
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);
rightLegging.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z)
.around(-3, yOffset, 0)
rightLegging.offset(armX - 2, armY, armZ)
.around(-rarmX, yOffset, 0)
.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) {
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
if (bipedCape != null) {
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
}
}
protected float getLegOutset() {
if (isCrouching() && smallArms) return 1;
@ -40,15 +42,6 @@ public class ModelEarthPony extends AbstractPonyModel {
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() {
super.initHeadTextures();
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);
}
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
if (smallArms) {
}
}
@Override
public void renderCape(float scale) {
bipedCape.render(scale);

View file

@ -1,12 +1,9 @@
package com.minelittlepony.model.ponies;
import static net.minecraft.client.renderer.GlStateManager.*;
import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.model.armour.ModelSkeletonPonyArmor;
import com.minelittlepony.model.armour.PonyArmor;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.AbstractSkeleton;
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.
private void renderScaledArm(ModelRenderer arm, float x, float y, float z) {
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;
protected int getArmWidth() {
return 2;
}
@Override
protected void renderLegs() {
pushMatrix();
translate(0.05F, -0.21F, 0);
renderScaledArm(bipedLeftArm, 0.5F, 1.15F, 0.5F);
popMatrix();
protected int getArmDepth() {
return 2;
}
pushMatrix();
translate(-0.05F, -0.21F, 0);
renderScaledArm(bipedRightArm, 0.5F, 1.2F, 0.5F);
popMatrix();
protected float getLegRotationX() {
return 3;
}
pushMatrix();
translate(0.05F, -0.21F, 0.35F);
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();
protected float getArmRotationY() {
return 8;
}
}

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