Fixed skeleton legs not swinging

This commit is contained in:
Sollace 2018-04-26 17:21:38 +02:00
parent af3dff6c87
commit d233399b68

View file

@ -7,6 +7,7 @@ import com.minelittlepony.model.armour.ModelSkeletonPonyArmor;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.AbstractSkeleton; import net.minecraft.entity.monster.AbstractSkeleton;
@ -56,30 +57,40 @@ 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;
}
@Override @Override
protected void renderLegs() { protected void renderLegs() {
pushMatrix(); pushMatrix();
translate(0.05F, -0.21F, 0); translate(0.05F, -0.21F, 0);
scale(0.5F, 1.15F, 0.5F); renderScaledArm(bipedLeftArm, 0.5F, 1.15F, 0.5F);
bipedLeftArm.render(this.scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
translate(-0.05F, -0.21F, 0); translate(-0.05F, -0.21F, 0);
scale(0.5F, 1.2F, 0.5F); renderScaledArm(bipedRightArm, 0.5F, 1.2F, 0.5F);
bipedRightArm.render(this.scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
translate(0.05F, -0.21F, 0.35F); translate(0.05F, -0.21F, 0.35F);
scale(0.5F, 1.2F, 0.5F); renderScaledArm(bipedLeftLeg, 0.5F, 1.2F, 0.5F);
bipedLeftLeg.render(this.scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
translate(-0.05F, -0.21F, 0.35F); translate(-0.05F, -0.21F, 0.35F);
scale(0.5F, 1.15F, 0.5F); renderScaledArm(bipedRightLeg, 0.5F, 1.15F, 0.5F);
bipedRightLeg.render(this.scale);
popMatrix(); popMatrix();
} }
} }