From d233399b68439bc4a2b4dcec413d46a4b8cfc1c7 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 26 Apr 2018 17:21:38 +0200 Subject: [PATCH] Fixed skeleton legs not swinging --- .../model/ponies/ModelSkeletonPony.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelSkeletonPony.java b/src/main/java/com/minelittlepony/model/ponies/ModelSkeletonPony.java index c7e69e19..e237685f 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelSkeletonPony.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelSkeletonPony.java @@ -7,6 +7,7 @@ import com.minelittlepony.model.armour.ModelSkeletonPonyArmor; import com.minelittlepony.model.armour.PonyArmor; import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.AbstractSkeleton; @@ -55,31 +56,41 @@ public class ModelSkeletonPony extends ModelMobPony { bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4); } } + + // 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; + } @Override protected void renderLegs() { pushMatrix(); translate(0.05F, -0.21F, 0); - scale(0.5F, 1.15F, 0.5F); - bipedLeftArm.render(this.scale); + renderScaledArm(bipedLeftArm, 0.5F, 1.15F, 0.5F); popMatrix(); pushMatrix(); translate(-0.05F, -0.21F, 0); - scale(0.5F, 1.2F, 0.5F); - bipedRightArm.render(this.scale); + renderScaledArm(bipedRightArm, 0.5F, 1.2F, 0.5F); popMatrix(); pushMatrix(); translate(0.05F, -0.21F, 0.35F); - scale(0.5F, 1.2F, 0.5F); - bipedLeftLeg.render(this.scale); + renderScaledArm(bipedLeftLeg, 0.5F, 1.2F, 0.5F); popMatrix(); pushMatrix(); translate(-0.05F, -0.21F, 0.35F); - scale(0.5F, 1.15F, 0.5F); - bipedRightLeg.render(this.scale); + renderScaledArm(bipedRightLeg, 0.5F, 1.15F, 0.5F); popMatrix(); } }