MineLittlePony/src/main/java/com/minelittlepony/model/ponies/ModelPlayerPony.java

725 lines
31 KiB
Java
Raw Normal View History

package com.minelittlepony.model.ponies;
2015-08-02 00:36:33 +02:00
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.ModelPonyArmor;
import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.model.components.PegasusWings;
import com.minelittlepony.model.components.PonySnout;
import com.minelittlepony.model.components.PonyTail;
import com.minelittlepony.model.components.UnicornHorn;
import com.minelittlepony.render.plane.PlaneRenderer;
2015-08-02 00:36:33 +02:00
import net.minecraft.client.model.ModelRenderer;
2016-04-09 08:24:15 +02:00
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide;
2016-05-04 03:23:57 +02:00
import net.minecraft.util.math.MathHelper;
2015-08-02 00:36:33 +02:00
2016-11-25 05:40:19 +01:00
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
import static com.minelittlepony.model.PonyModelConstants.*;
2016-11-25 05:40:19 +01:00
public class ModelPlayerPony extends AbstractPonyModel {
private final boolean smallArms;
public boolean rainboom;
2015-08-02 00:36:33 +02:00
public ModelRenderer bipedCape;
2015-08-02 00:36:33 +02:00
public PlaneRenderer[] Bodypiece;
public PlaneRenderer BodypieceNeck;
public ModelRenderer unicornArmRight, unicornArmLeft;
public PonyTail Tail;
public PonySnout snout;
public UnicornHorn horn;
public PegasusWings wings;
2015-08-02 00:36:33 +02:00
public ModelPlayerPony(boolean smallArms) {
super(smallArms);
this.smallArms = smallArms;
}
@Override
public PonyArmor createArmour() {
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
}
@Override
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
snout = new PonySnout(this, yOffset, stretch);
horn = new UnicornHorn(this, yOffset, stretch);
wings = new PegasusWings(this, yOffset, stretch);
2015-08-02 00:36:33 +02:00
}
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
this.checkRainboom(entityIn, limbSwingAmount);
this.rotateHead(netHeadYaw, headPitch);
2015-08-02 00:36:33 +02:00
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
2016-11-17 05:45:04 +01:00
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
2015-08-02 00:36:33 +02:00
}
rotateLook(limbSwing, limbSwingAmount, bodySwingRotation, ageInTicks);
2015-08-02 00:36:33 +02:00
this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn);
this.holdItem(limbSwingAmount);
this.swingItem(entityIn, this.swingProgress);
if (this.isSneak && !this.isFlying && !this.rainboom) {
2015-08-02 00:36:33 +02:00
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
this.sneakLegs();
this.setHead(0.0F, 6.0F, -2.0F);
2016-01-26 09:20:12 +01:00
} else if (this.isRiding) {
this.adjustBodyRiding();
2016-01-26 09:20:12 +01:00
this.bipedLeftLeg.rotationPointZ = 15;
2016-05-20 10:51:27 +02:00
this.bipedLeftLeg.rotationPointY = 10;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedLeftLeg.rotateAngleY = (float) (Math.PI * -0.2);
2016-01-26 09:20:12 +01:00
this.bipedRightLeg.rotationPointZ = 15;
2016-05-20 10:51:27 +02:00
this.bipedRightLeg.rotationPointY = 10;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * -0.25);
this.bipedRightLeg.rotateAngleY = (float) (Math.PI * 0.2);
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06);
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06);
2015-08-02 00:36:33 +02:00
} else {
2016-01-26 09:20:12 +01:00
2015-08-02 00:36:33 +02:00
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(ageInTicks);
2015-08-02 00:36:33 +02:00
this.setHead(0.0F, 0.0F, 0.0F);
}
2015-08-02 00:36:33 +02:00
if (this.isSleeping) {
this.ponySleep();
}
this.aimBow(leftArmPose, rightArmPose, ageInTicks);
2015-08-02 00:36:33 +02:00
this.fixSpecialRotations();
this.fixSpecialRotationPoints(limbSwing);
2015-08-02 00:36:33 +02:00
animateWears();
2016-01-26 09:20:12 +01:00
2016-04-09 08:24:15 +02:00
this.bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
this.snout.setGender(this.metadata.getGender());
this.wings.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
2015-08-02 00:36:33 +02:00
}
protected void adjustBodyRiding() {
this.adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
this.adjustNeck(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.setHead(0.0F, 0.0F, 0.0F);
}
protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) {
this.Tail.setRotationAndAngles(rainboom, limbSwing, limbSwingAmount, bodySwing, ticks);
for (PlaneRenderer i : this.Bodypiece) {
i.rotateAngleY = bodySwing * 0.2F;
}
this.bipedBody.rotateAngleY = bodySwing * 0.2F;
this.BodypieceNeck.rotateAngleY = bodySwing * 0.2F;
this.bipedHead.offsetY = 0f;
this.bipedHead.offsetZ = 0f;
this.bipedHeadwear.offsetY = 0f;
this.bipedHeadwear.offsetZ = 0f;
}
2015-08-02 00:36:33 +02:00
private void animateWears() {
copyModelAngles(bipedLeftArm, bipedLeftArmwear);
copyModelAngles(bipedRightArm, bipedRightArmwear);
copyModelAngles(bipedLeftLeg, bipedLeftLegwear);
copyModelAngles(bipedRightLeg, bipedRightLegwear);
copyModelAngles(bipedBody, bipedBodyWear);
}
protected void checkRainboom(Entity entity, float swing) {
boolean flying = this.metadata.getRace().hasWings() && this.isFlying
|| entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying();
this.rainboom = flying && swing >= 0.9999F;
2015-08-02 00:36:33 +02:00
}
protected void setHead(float posX, float posY, float posZ) {
this.bipedHead.setRotationPoint(posX, posY, posZ);
this.bipedHeadwear.setRotationPoint(posX, posY, posZ);
2015-08-02 00:36:33 +02:00
}
protected void rotateHead(float horz, float vert) {
float headRotateAngleY;
float headRotateAngleX;
if (this.isSleeping) {
headRotateAngleY = 1.4F;
headRotateAngleX = 0.1F;
} else {
headRotateAngleY = horz / 57.29578F;
headRotateAngleX = vert / 57.29578F;
}
final float max = (float) (0.5f - Math.toRadians(this.motionPitch));
final float min = (float) (-1.25f - Math.toRadians(this.motionPitch));
2016-03-01 05:42:22 +01:00
headRotateAngleX = Math.min(headRotateAngleX, max);
headRotateAngleX = Math.max(headRotateAngleX, min);
2015-08-02 00:36:33 +02:00
this.bipedHead.rotateAngleY = headRotateAngleY;
this.bipedHead.rotateAngleX = headRotateAngleX;
this.bipedHeadwear.rotateAngleY = headRotateAngleY;
this.bipedHeadwear.rotateAngleX = headRotateAngleX;
}
protected void setLegs(float move, float swing, float tick, Entity entity) {
this.rotateLegs(move, swing, tick, entity);
2015-08-02 00:36:33 +02:00
this.adjustLegs();
}
public boolean isFlying(Entity entity) {
return (isFlying && metadata.getRace().hasWings()) ||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
}
2015-08-02 00:36:33 +02:00
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float leftArm, rightArm,
leftLeg, rightLeg;
if (isFlying(entity)) {
2015-08-02 00:36:33 +02:00
if (this.rainboom) {
rightArm = leftArm = ROTATE_270;
rightLeg = leftLeg = ROTATE_90;
2015-08-02 00:36:33 +02:00
} else {
rightArm = leftArm = MathHelper.sin(-swing / 2);
rightLeg = leftLeg = MathHelper.sin(swing / 2);
2015-08-02 00:36:33 +02:00
}
steveRightArm.rotateAngleY = bipedRightArm.rotateAngleY = 0.2F;
bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F;
2015-08-02 00:36:33 +02:00
this.bipedLeftLeg.rotateAngleY = 0.2F;
} else {
float PI = (float)Math.PI;
float pi = PI * (float) Math.pow(swing, 16);
float mve = move * 0.6662F; // magic number ahoy
float srt = swing / 4;
leftArm = MathHelper.cos(mve + pi) * srt;
rightArm = MathHelper.cos(mve + PI + pi / 2) * srt;
leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt;
rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt;
this.steveRightArm.rotateAngleY = 0;
this.unicornArmRight.rotateAngleY = 0;
this.unicornArmLeft.rotateAngleY = 0;
this.bipedRightArm.rotateAngleY = 0;
this.bipedLeftArm.rotateAngleY = 0;
this.bipedRightLeg.rotateAngleY = 0;
this.bipedLeftLeg.rotateAngleY = 0;
2015-08-02 00:36:33 +02:00
}
this.bipedRightArm.rotateAngleX = rightArm;
this.steveRightArm.rotateAngleX = rightArm;
this.unicornArmRight.rotateAngleX = 0;
this.unicornArmLeft.rotateAngleX = 0;
2015-08-02 00:36:33 +02:00
this.bipedLeftArm.rotateAngleX = leftArm;
this.bipedRightLeg.rotateAngleX = rightLeg;
this.bipedLeftLeg.rotateAngleX = leftLeg;
this.bipedRightArm.rotateAngleZ = 0;
2015-08-02 00:36:33 +02:00
this.steveRightArm.rotateAngleZ = 0;
this.unicornArmRight.rotateAngleZ = 0;
this.unicornArmLeft.rotateAngleZ = 0;
this.bipedLeftArm.rotateAngleZ = 0;
}
private float getLegOutset() {
if (isSleeping) return 2.6f;
if (isSneak && !isFlying) return smallArms ? 1 : 0;
return 4;
2015-08-02 00:36:33 +02:00
}
protected void adjustLegs() {
float sinBodyRotateAngleYFactor = MathHelper.sin(this.bipedBody.rotateAngleY) * 5;
float cosBodyRotateAngleYFactor = MathHelper.cos(this.bipedBody.rotateAngleY) * 5;
float legOutset = getLegOutset();
float spread = rainboom ? 2 : 1;
2015-08-02 00:36:33 +02:00
this.bipedRightArm.rotationPointZ = spread + sinBodyRotateAngleYFactor;
this.steveRightArm.rotationPointZ = spread + sinBodyRotateAngleYFactor;
this.bipedLeftArm.rotationPointZ = spread - sinBodyRotateAngleYFactor;
this.steveRightArm.rotationPointX = -cosBodyRotateAngleYFactor;
2015-08-02 00:36:33 +02:00
float rpxl = legOutset - cosBodyRotateAngleYFactor - 1;
float rpxr = cosBodyRotateAngleYFactor + 2 - legOutset;
bipedRightArm.rotationPointX = bipedRightLeg.rotationPointX = rpxl;
bipedLeftArm.rotationPointX = bipedLeftLeg.rotationPointX = rpxr;
2015-08-02 00:36:33 +02:00
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY;
bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY;
2015-08-02 00:36:33 +02:00
2016-11-25 05:40:19 +01:00
//noinspection SuspiciousNameCombination
2015-08-02 00:36:33 +02:00
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
bipedRightArm.rotationPointY = bipedLeftArm.rotationPointY = 8;
bipedRightLeg.rotationPointZ = bipedLeftLeg.rotationPointZ = 10;
2015-08-02 00:36:33 +02:00
}
protected void holdItem(float swing) {
if (!this.rainboom && !this.metadata.hasMagic()) {
boolean bothHoovesAreOccupied = this.leftArmPose == ArmPose.ITEM && this.rightArmPose == ArmPose.ITEM;
alignArmForAction(bipedLeftArm, leftArmPose, bothHoovesAreOccupied, swing);
alignArmForAction(bipedRightArm, rightArmPose, bothHoovesAreOccupied, swing);
2016-07-08 07:59:34 +02:00
} else if (this.metadata.hasMagic()) {
if (this.leftArmPose == ArmPose.BLOCK) blockArm(unicornArmLeft);
if (this.rightArmPose == ArmPose.BLOCK) blockArm(unicornArmRight);
2015-08-02 00:36:33 +02:00
}
this.horn.setUsingMagic(this.leftArmPose != ArmPose.EMPTY || this.rightArmPose != ArmPose.EMPTY);
2015-08-02 00:36:33 +02:00
}
@SuppressWarnings("incomplete-switch")
private void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean bothHoovesAreOccupied, float swing) {
switch (pose) {
case ITEM:
float swag = 1;
if (!isFlying && bothHoovesAreOccupied) {
swag = (float) (1 - Math.pow(swing, 2));
}
float rotationMultiplier = 0.5f + (1 - swag)/2;
arm.rotateAngleX = this.bipedLeftArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10) * swag;
case EMPTY:
arm.rotateAngleY = 0;
break;
case BLOCK:
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
arm.rotateAngleY = (float) (Math.PI / 6);
break;
}
}
private void blockArm(ModelRenderer arm) {
arm.rotateAngleX = arm.rotateAngleX * 0.5F - 0.9424779F;
arm.rotateAngleY = (float) (Math.PI / 6);
}
2015-08-02 00:36:33 +02:00
protected void swingItem(Entity entity, float swingProgress) {
2015-08-02 00:36:33 +02:00
if (swingProgress > -9990.0F && !this.isSleeping) {
float f16 = 1.0F - swingProgress;
f16 *= f16 * f16;
f16 = 1.0F - f16;
float f22 = MathHelper.sin(f16 * 3.1415927F);
float f28 = MathHelper.sin(swingProgress * 3.1415927F);
float f33 = f28 * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
EnumHandSide mainSide = this.getMainHand(entity);
boolean mainRight = mainSide == EnumHandSide.RIGHT;
ArmPose mainPose = mainRight ? this.rightArmPose : this.leftArmPose;
if (this.metadata.hasMagic() && mainPose != ArmPose.EMPTY) {
swingArm(mainRight ? this.unicornArmRight : this.unicornArmLeft, f22, f33, f28);
2015-08-02 00:36:33 +02:00
} else {
swingArm(this.getArmForSide(mainSide), f22, f33, f28);
swingArm(mainRight ? this.steveRightArm : this.steveLeftArm, f22, f33, f28);
2015-08-02 00:36:33 +02:00
}
}
}
private void swingArm(ModelRenderer arm, float f22, float f33, float f28) {
arm.rotateAngleX = (float) (this.unicornArmRight.rotateAngleX - (f22 * 1.2D + f33));
arm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
arm.rotateAngleZ = f28 * -0.4F;
2015-08-02 00:36:33 +02:00
}
2016-11-25 05:40:19 +01:00
protected void swingArms(float tick) {
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
2016-05-04 03:23:57 +02:00
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
if (this.metadata.hasMagic()) {
this.unicornArmRight.rotateAngleZ += cosTickFactor;
this.unicornArmRight.rotateAngleX += sinTickFactor;
2015-08-02 00:36:33 +02:00
} else {
this.bipedRightArm.rotateAngleZ += cosTickFactor;
this.bipedRightArm.rotateAngleX += sinTickFactor;
this.steveRightArm.rotateAngleZ += cosTickFactor;
this.steveRightArm.rotateAngleX += sinTickFactor;
2015-08-02 00:36:33 +02:00
}
}
if (this.leftArmPose != ArmPose.EMPTY && !this.isSleeping) {
if (this.metadata.hasMagic()) {
this.unicornArmLeft.rotateAngleZ += cosTickFactor;
this.unicornArmLeft.rotateAngleX += sinTickFactor;
} else {
this.bipedLeftArm.rotateAngleZ += cosTickFactor;
this.bipedLeftArm.rotateAngleX += sinTickFactor;
this.steveLeftArm.rotateAngleZ += cosTickFactor;
this.steveLeftArm.rotateAngleX += sinTickFactor;
}
}
2015-08-02 00:36:33 +02:00
}
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
this.adjustNeck(rotateAngleX, rotationPointY, rotationPointZ);
}
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.bipedBody.rotateAngleX = rotateAngleX;
this.bipedBody.rotationPointY = rotationPointY;
this.bipedBody.rotationPointZ = rotationPointZ;
for (PlaneRenderer i : Bodypiece) {
i.rotateAngleX = rotateAngleX;
i.rotationPointY = rotationPointY;
i.rotationPointZ = rotationPointZ;
2015-08-02 00:36:33 +02:00
}
}
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
BodypieceNeck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
2015-08-02 00:36:33 +02:00
}
protected void sneakLegs() {
this.steveRightArm.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
2015-08-02 00:36:33 +02:00
this.bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
this.bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
2015-08-02 00:36:33 +02:00
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
}
protected void ponySleep() {
this.bipedRightArm.rotateAngleX = ROTATE_270;
this.bipedLeftArm.rotateAngleX = ROTATE_270;
this.bipedRightLeg.rotateAngleX = ROTATE_90;
this.bipedLeftLeg.rotateAngleX = ROTATE_90;
float headPosX, headPosY, headPosZ;
if (this.isSneak) {
headPosY = 2;
headPosZ = -1;
headPosX = 1;
2015-08-02 00:36:33 +02:00
} else {
headPosY = 2;
headPosZ = 1;
headPosX = 1;
2015-08-02 00:36:33 +02:00
}
this.setHead(headPosX, headPosY, headPosZ);
2016-03-01 05:42:22 +01:00
shiftRotationPoint(this.bipedRightArm, 0.0F, 2.0F, 6.0F);
shiftRotationPoint(this.bipedLeftArm, 0.0F, 2.0F, 6.0F);
shiftRotationPoint(this.bipedRightLeg, 0.0F, 2.0F, -8.0F);
shiftRotationPoint(this.bipedLeftLeg, 0.0F, 2.0F, -8.0F);
2015-08-02 00:36:33 +02:00
}
2016-05-04 03:23:57 +02:00
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
2015-08-02 00:36:33 +02:00
if (this.metadata.hasMagic()) {
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, tick, true);
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, tick, false);
2016-05-04 03:23:57 +02:00
} else {
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, tick, false);
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, tick, false);
2016-05-04 03:23:57 +02:00
}
}
2015-08-02 00:36:33 +02:00
}
protected void aimBowPony(ModelRenderer arm, float tick, boolean shift) {
arm.rotateAngleZ = 0.0F;
arm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
arm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX;
arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
if (shift) shiftRotationPoint(arm, 0.0F, 0.0F, 1.0F);
2015-08-02 00:36:33 +02:00
}
protected void fixSpecialRotations() {
this.Bodypiece[9].rotateAngleX += 0.5F;
this.Bodypiece[10].rotateAngleX += 0.5F;
this.Bodypiece[11].rotateAngleX += 0.5F;
this.Bodypiece[12].rotateAngleX += 0.5F;
this.Bodypiece[13].rotateAngleX += 0.5F;
}
2016-11-25 05:40:19 +01:00
protected void fixSpecialRotationPoints(float move) {
}
2015-08-02 00:36:33 +02:00
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
2015-08-02 00:36:33 +02:00
2016-01-26 09:20:12 +01:00
pushMatrix();
this.transform(BodyPart.HEAD);
this.renderHead(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
2016-01-26 09:20:12 +01:00
popMatrix();
2015-08-02 00:36:33 +02:00
2016-01-26 09:20:12 +01:00
pushMatrix();
this.transform(BodyPart.NECK);
this.renderNeck();
popMatrix();
2015-08-02 00:36:33 +02:00
2016-01-26 09:20:12 +01:00
pushMatrix();
this.transform(BodyPart.BODY);
this.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
this.Tail.render(this.metadata.getTail(), this.scale);
2016-01-26 09:20:12 +01:00
popMatrix();
2015-08-02 00:36:33 +02:00
2016-01-26 09:20:12 +01:00
pushMatrix();
this.transform(BodyPart.LEGS);
this.renderLegs();
popMatrix();
2015-08-02 00:36:33 +02:00
}
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
2015-08-02 00:36:33 +02:00
this.bipedHead.render(this.scale);
this.bipedHeadwear.render(this.scale);
this.bipedHead.postRender(scale);
this.horn.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
2015-08-02 00:36:33 +02:00
}
protected void renderNeck() {
2016-04-09 08:24:15 +02:00
GlStateManager.scale(0.9, 0.9, 0.9);
this.BodypieceNeck.render(this.scale);
2015-08-02 00:36:33 +02:00
}
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
2015-08-02 00:36:33 +02:00
this.bipedBody.render(this.scale);
if (this.textureHeight == 64) {
this.bipedBodyWear.render(this.scale);
}
2016-11-25 05:40:19 +01:00
for (PlaneRenderer aBodypiece : this.Bodypiece) {
aBodypiece.render(this.scale);
2015-08-02 00:36:33 +02:00
}
this.bipedBody.postRender(scale);
this.wings.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, this.scale);
2015-08-02 00:36:33 +02:00
}
protected void renderLegs() {
if (!this.isSneak) {
2016-07-08 07:59:34 +02:00
this.bipedBody.postRender(this.scale);
}
2016-05-20 10:51:27 +02:00
2015-08-02 00:36:33 +02:00
this.bipedLeftArm.render(this.scale);
this.bipedRightArm.render(this.scale);
this.bipedLeftLeg.render(this.scale);
this.bipedRightLeg.render(this.scale);
2015-08-02 00:36:33 +02:00
if (this.textureHeight == 64) {
this.bipedLeftArmwear.render(this.scale);
this.bipedRightArmwear.render(this.scale);
this.bipedLeftLegwear.render(this.scale);
this.bipedRightLegwear.render(this.scale);
}
}
2016-04-07 04:13:05 +02:00
@Override
2015-08-02 00:36:33 +02:00
protected void initTextures() {
2016-05-30 05:59:43 +02:00
this.boxList.clear();
2015-08-02 00:36:33 +02:00
this.Bodypiece = new PlaneRenderer[14];
this.initHeadTextures();
this.initBodyTextures();
this.initLegTextures();
this.Tail = new PonyTail(this);
2015-08-02 00:36:33 +02:00
}
protected void initHeadTextures() {
2015-08-15 05:32:22 +02:00
this.bipedCape = new ModelRenderer(this, 0, 0).setTextureSize(64, 32);
2015-08-02 00:36:33 +02:00
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHeadwear = new ModelRenderer(this, 32, 0);
}
protected void initBodyTextures() {
this.bipedBody = new ModelRenderer(this, 16, 16);
2015-08-02 00:36:33 +02:00
if (this.textureHeight == 64) {
this.bipedBodyWear = new ModelRenderer(this, 16, 32);
}
2015-08-02 00:36:33 +02:00
this.Bodypiece[0] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[0].mirrorz = true;
2015-08-02 00:36:33 +02:00
this.Bodypiece[1] = new PlaneRenderer(this, 24, 0);
2015-08-02 00:36:33 +02:00
this.Bodypiece[2] = new PlaneRenderer(this, 32, 20);
this.Bodypiece[2].mirrorz = true;
2015-08-02 00:36:33 +02:00
this.Bodypiece[3] = new PlaneRenderer(this, 56, 0);
2015-08-02 00:36:33 +02:00
this.Bodypiece[4] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[4].mirrorz = true;
2015-08-02 00:36:33 +02:00
this.Bodypiece[5] = new PlaneRenderer(this, 4, 0);
2015-08-02 00:36:33 +02:00
this.Bodypiece[6] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[7] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[8] = new PlaneRenderer(this, 36, 16);
2015-08-02 00:36:33 +02:00
this.Bodypiece[11] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[11].mirror = true;
this.Bodypiece[9] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[10] = new PlaneRenderer(this, 32, 0);
2015-08-02 00:36:33 +02:00
this.Bodypiece[12] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[13] = new PlaneRenderer(this, 32, 0);
this.BodypieceNeck = new PlaneRenderer(this, 0, 16);
2015-08-02 00:36:33 +02:00
}
protected void initLegTextures() {
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftArm = new ModelRenderer(this, 32, 48);
this.bipedLeftLeg = new ModelRenderer(this, 16, 48);
2015-08-02 00:36:33 +02:00
this.bipedRightArmwear = new ModelRenderer(this, 40, 32);
this.bipedRightLegwear = new ModelRenderer(this, 0, 32);
this.bipedLeftArmwear = new ModelRenderer(this, 48, 48);
this.bipedLeftLegwear = new ModelRenderer(this, 0, 48);
2015-08-02 06:19:14 +02:00
this.unicornArmRight = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.unicornArmLeft = new ModelRenderer(this, 40, 32).setTextureSize(64, 64);
this.boxList.remove(this.steveRightArm);
this.boxList.remove(this.unicornArmRight);
2015-08-02 00:36:33 +02:00
}
2016-04-07 04:13:05 +02:00
@Override
2015-08-02 00:36:33 +02:00
protected void initPositions(float yOffset, float stretch) {
this.initHeadPositions(yOffset, stretch);
this.initBodyPositions(yOffset, stretch);
this.initLegPositions(yOffset, stretch);
this.Tail.init(yOffset, stretch);
2015-08-02 00:36:33 +02:00
}
protected void initHeadPositions(float yOffset, float stretch) {
this.bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
this.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -4 + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch);
2016-04-09 08:24:15 +02:00
this.bipedHead.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2);
// set ears
this.bipedHead.setTextureOffset(12, 16);
this.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch);
this.bipedHead.mirror = true;
this.bipedHead.addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch);
this.bipedHeadwear.addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch + 0.5F);
2016-04-09 08:24:15 +02:00
this.bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2);
2015-08-02 00:36:33 +02:00
}
protected void initBodyPositions(float yOffset, float stretch) {
this.bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch);
this.bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.bipedBodyWear.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch + 0.25F);
this.bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece[0].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 12, stretch);
this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch);
this.Bodypiece[4].addWestPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[5].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 4, stretch);
this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[11].addWestPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[12].addEastPlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 6, stretch);
this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, stretch);
for (int i = 0; i < this.Bodypiece.length; i++) {
this.Bodypiece[i].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
this.BodypieceNeck.addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck.addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck.addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck.addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch);
this.BodypieceNeck.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.BodypieceNeck.rotateAngleX = NECK_ROT_X;
2015-08-02 00:36:33 +02:00
}
protected void initLegPositions(float yOffset, float stretch) {
int armWidth = this.smallArms ? 3 : 4;
float armY = this.smallArms ? 8.5f : 8f;
float armX = this.smallArms ? -2f : -3f;
this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, armWidth, 12, 4, stretch);
this.bipedLeftArm .addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, armWidth, 12, 4, stretch);
this.bipedRightArm.setRotationPoint(armX, yOffset + armY, 0.0F);
this.bipedLeftArm .setRotationPoint(3.0F, yOffset + armY, 0.0F);
this.bipedRightLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedLeftLeg .addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
2015-08-02 00:36:33 +02:00
this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
this.unicornArmRight.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmLeft .addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f);
this.unicornArmRight.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
this.unicornArmLeft .setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F);
if (bipedRightArmwear != null) {
this.bipedRightArmwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, armWidth, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3.0F, yOffset + armY, 0.0F);
}
if (bipedLeftArmwear != null) {
this.bipedLeftArmwear .addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 3, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear .setRotationPoint(3.0F, yOffset + armY, 0.0F);
}
2015-08-02 00:36:33 +02:00
if (bipedRightLegwear != null) {
this.bipedRightLegwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
2015-08-02 00:36:33 +02:00
this.bipedRightLegwear.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F);
}
if (this.bipedLeftLegwear != null) {
this.bipedLeftLegwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
2015-08-02 00:36:33 +02:00
}
}
@Override
public void renderCape(float scale) {
this.bipedCape.render(scale);
2015-08-02 00:36:33 +02:00
}
}