Rewrite model code (part 1)

This commit is contained in:
Sollace 2018-04-26 16:01:31 +02:00
parent 75cb0eb6fc
commit 280013c8a4
13 changed files with 660 additions and 751 deletions

View file

@ -1,7 +1,6 @@
package com.minelittlepony.model; package com.minelittlepony.model;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.model.ponies.ModelPlayerPony;
import com.minelittlepony.pony.data.IPonyData; import com.minelittlepony.pony.data.IPonyData;
import com.minelittlepony.pony.data.PonyData; import com.minelittlepony.pony.data.PonyData;
import com.minelittlepony.pony.data.PonySize; import com.minelittlepony.pony.data.PonySize;
@ -10,6 +9,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import java.util.Random; import java.util.Random;
@ -17,18 +17,33 @@ import java.util.Random;
import static net.minecraft.client.renderer.GlStateManager.*; import static net.minecraft.client.renderer.GlStateManager.*;
/** /**
* TODO move this into constructor and make separate classes for the races. * TODO: move this into constructor and make separate classes for the races.
*/ */
public abstract class AbstractPonyModel extends ModelPlayer { public abstract class AbstractPonyModel extends ModelPlayer {
/**
* The model's current scale.
*/
protected float scale = 0.0625F; protected float scale = 0.0625F;
public boolean isFlying; public boolean isFlying;
public boolean isSleeping; public boolean isSleeping;
/**
* Associcated pony data.
*/
public IPonyData metadata = new PonyData(); public IPonyData metadata = new PonyData();
/**
* Vertical pitch whilst flying.
*/
public float motionPitch; public float motionPitch;
/**
* Flag indicating that this model is performing a rainboom (flight).
*/
public boolean rainboom;
public AbstractPonyModel(boolean arms) { public AbstractPonyModel(boolean arms) {
super(0, arms); super(0, arms);
} }
@ -40,7 +55,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
*/ */
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
initTextures(); initTextures();
this.initPositions(yOffset, stretch); initPositions(yOffset, stretch);
} }
/** /**
@ -62,7 +77,6 @@ public abstract class AbstractPonyModel extends ModelPlayer {
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
if (doCancelRender()) { if (doCancelRender()) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
return;
} }
} }
@ -73,10 +87,35 @@ public abstract class AbstractPonyModel extends ModelPlayer {
return false; return false;
} }
public static void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) { /**
aRenderer.rotationPointX += shiftX; * Returns true if this model is on the ground and crouching.
aRenderer.rotationPointY += shiftY; */
aRenderer.rotationPointZ += shiftZ; public boolean isCrouching() {
return isSneak && !isFlying;
}
/**
* Returns true if the given entity can and is flying, or has an elytra.
*/
public boolean isFlying(Entity entity) {
return (isFlying && metadata.getRace().hasWings()) ||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
}
/**
* Returns true if the current model is a child or a child-like foal.
*/
public boolean isChild() {
return metadata.getSize() == PonySize.FOAL || isChild;
}
/**
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
*/
public static void shiftRotationPoint(ModelRenderer renderer, float x, float y, float z) {
renderer.rotationPointX += x;
renderer.rotationPointY += y;
renderer.rotationPointZ += z;
} }
/** /**
@ -105,136 +144,112 @@ public abstract class AbstractPonyModel extends ModelPlayer {
* FIXME: Too long! Is there a better way to do this? * FIXME: Too long! Is there a better way to do this?
*/ */
public void transform(BodyPart part) { public void transform(BodyPart part) {
if (this.isRiding) { if (isRiding) translate(0, -0.6F, -0.2F);
translate(0.0F, -0.6F, -0.2F);
if (isSleeping) {
rotate(90, 0, 1, 0);
rotate(270, 0, 0, 1);
rotate(90, 0, 1, 0);
rotate(180, 0, 0, 1);
rotate(180, 0, 1, 0);
} }
if (this.isSleeping) { if (isChild()) {
rotate(90.0F, 0.0F, 1.0F, 0.0F); transformFoal(part);
rotate(270.0F, 0.0F, 0.0F, 1.0F); } else if (metadata.getSize() == PonySize.LARGE) {
rotate(90.0F, 0.0F, 1.0F, 0.0F); transformLarge(part);
rotate(180.0F, 0.0F, 0.0F, 1.0F); } else if (metadata.getSize() == PonySize.TALL) {
rotate(180.0F, 0.0F, 1.0F, 0.0F); transformTall(part);
} else {
if (isSleeping) translate(0, -0.75F, 0.25F);
}
if (part == BodyPart.HEAD) {
rotate(motionPitch, 1, 0, 0);
}
} }
if (this.metadata.getSize() == PonySize.FOAL || isChild) { private void transformTall(BodyPart part) {
if (this.isSneak && !this.isFlying) { if (isSleeping) translate(0, -0.65F, 0.25F);
translate(0.0F, -0.12F, 0.0F);
}
if (this.isSleeping) {
translate(0.0F, -1.2F, 0.25F);
}
if (this.isRiding) {
translate(0, -.1, 0);
}
switch (part) { switch (part) {
case NECK:
case HEAD: case HEAD:
translate(0.0F, 0.76F, 0.0F); translate(0, -0.15F, 0.01F);
scale(0.9F, 0.9F, 0.9F); if (isCrouching()) translate(0, 0.05F, 0);
if (part == BodyPart.HEAD)
break; break;
if (this.isSneak && !this.isFlying) { case NECK:
translate(0.0F, -0.01F, 0.15F); translate(0, -0.19F, -0.01F);
} scale(1, 1.1F, 1);
if (isCrouching()) translate(0, -0.06F, -0.04F);
break; break;
case BODY: case BODY:
case TAIL: case TAIL:
translate(0.0F, 0.76F, -0.04F); translate(0, -0.1F, 0);
scale(0.6F, 0.6F, 0.6F); scale(1, 1, 1);
break; break;
case LEGS: case LEGS:
translate(0.0F, 0.89F, 0.0F); translate(0, -0.25F, 0.03F);
scale(0.6F, 0.41F, 0.6F); scale(1, 1.18F, 1);
if (this.isSneak && !this.isFlying) { if (rainboom) translate(0, 0.05F, 0);
translate(0.0F, 0.12F, 0.0F);
}
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
translate(0.0F, -0.08F, 0.0F);
}
break; break;
} }
} else if (this.metadata.getSize() == PonySize.LARGE) {
if (this.isSleeping) {
translate(0.0F, -0.7F, 0.2F);
} }
private void transformLarge(BodyPart part) {
if (this.isSleeping) translate(0, -0.7F, 0.2F);
switch (part) { switch (part) {
case HEAD: case HEAD:
translate(0, -0.17F, -0.04F);
translate(0.0F, -0.17F, -0.04F); if (isSleeping) translate(0, 0, -0.1F);
if (this.isSleeping) { if (isCrouching()) translate(0, 0.15F, 0);
translate(0.0F, 0.0F, -0.1F);
}
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.15F, 0.0F);
}
break; break;
case NECK: case NECK:
translate(0.0F, -0.15F, -0.07F); translate(0, -0.15F, -0.07F);
if (this.isSneak && !this.isFlying) { if (isCrouching()) translate(0, 0, -0.05F);
translate(0.0F, 0.0F, -0.05F);
}
break; break;
case BODY: case BODY:
translate(0.0F, -0.2F, -0.04F); translate(0, -0.2F, -0.04F);
scale(1.15F, 1.2F, 1.2F); scale(1.15F, 1.2F, 1.2F);
break; break;
case TAIL: case TAIL:
translate(0.0F, -0.2F, 0.08F); translate(0, -0.2F, 0.08F);
break; break;
case LEGS: case LEGS:
translate(0.0F, -0.14F, 0.0F); translate(0, -0.14F, 0);
scale(1.15F, 1.12F, 1.15F); scale(1.15F, 1.12F, 1.15F);
break; break;
} }
} else if (this.metadata.getSize() == PonySize.TALL) {
if (this.isSleeping) {
translate(0.0F, -0.65F, 0.25F);
} }
private void transformFoal(BodyPart part) {
if (isCrouching()) translate(0, -0.12F, 0.0F);
if (isSleeping) translate(0, -1.2F, 0.25F);
if (isRiding) translate(0, -.1, 0);
switch (part) { switch (part) {
case HEAD:
translate(0.0F, -0.15F, 0.01F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.05F, 0.0F);
}
break;
case NECK: case NECK:
translate(0.0F, -0.19F, -0.01F); case HEAD:
scale(1.0F, 1.1F, 1.0F); translate(0, 0.76F, 0);
if (this.isSneak && !this.isFlying) { scale(0.9F, 0.9F, 0.9F);
translate(0.0F, -0.06F, -0.04F); if (part == BodyPart.HEAD)
} break;
if (isCrouching()) translate(0, -0.01F, 0.15F);
break; break;
case BODY: case BODY:
case TAIL: case TAIL:
translate(0.0F, -0.1F, 0.0F); translate(0, 0.76F, -0.04F);
scale(1.0F, 1.0F, 1.0F); scale(0.6F, 0.6F, 0.6F);
break; break;
case LEGS: case LEGS:
translate(0.0F, -0.25F, 0.03F); translate(0, 0.89F, 0);
scale(1.0F, 1.18F, 1.0F); scale(0.6F, 0.41F, 0.6F);
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) { if (isCrouching()) translate(0, 0.12F, 0);
translate(0.0F, 0.05F, 0.0F); if (rainboom) translate(0, -0.08F, 0);
}
break; break;
} }
} else {
if (this.isSleeping) {
translate(0.0F, -0.75F, 0.25F);
}
}
if (part == BodyPart.HEAD) {
rotate(motionPitch, 1F, 0F, 0F);
}
} }
/** /**
@ -249,6 +264,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
isSleeping = pony.isSleeping; isSleeping = pony.isSleeping;
metadata = pony.metadata; metadata = pony.metadata;
motionPitch = pony.motionPitch; motionPitch = pony.motionPitch;
rainboom = pony.rainboom;
} }
} }

View file

@ -33,10 +33,10 @@ public class ModelMobPony extends ModelPlayerPony {
if (this.rightArmPose == ArmPose.EMPTY) return; if (this.rightArmPose == ArmPose.EMPTY) return;
if (!metadata.hasMagic()) { if (!metadata.hasMagic()) {
rotateArmHolding(bipedRightArm, 1, swingProgress, tick); rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
} else { } else {
unicornArmRight.setRotationPoint(-7, 12, -2); unicornArmRight.setRotationPoint(-7, 12, -2);
rotateArmHolding(unicornArmRight, 1, swingProgress, tick); rotateArmHolding(unicornArmRight, -1, swingProgress, tick);
} }
} }
@ -50,10 +50,10 @@ public class ModelMobPony extends ModelPlayerPony {
if (leftArmPose == ArmPose.EMPTY) return; if (leftArmPose == ArmPose.EMPTY) return;
if (!metadata.hasMagic()) { if (!metadata.hasMagic()) {
rotateArmHolding(bipedLeftArm, 1, swingProgress, tick); rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
} else { } else {
unicornArmRight.setRotationPoint(-7, 12, -2); unicornArmRight.setRotationPoint(-7, 12, -2);
rotateArmHolding(unicornArmLeft, 1, swingProgress, tick); rotateArmHolding(unicornArmLeft, -1, swingProgress, tick);
} }
} }
} }

View file

@ -3,9 +3,15 @@ package com.minelittlepony.model;
public final class PonyModelConstants { public final class PonyModelConstants {
public static final float public static final float
BODY_CENTRE_X = 0.0F, PI = (float)Math.PI,
BODY_CENTRE_Y = 8.0F,
BODY_CENTRE_Z = 6.0F, BODY_CENTRE_X = 0,
BODY_CENTRE_Y = 8,
BODY_CENTRE_Z = 6,
NECK_CENTRE_X = BODY_CENTRE_X - 2,
NECK_CENTRE_Y = BODY_CENTRE_Y - 6.8f,
NECK_CENTRE_Z = BODY_CENTRE_Z - 8.8f,
BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F, BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F,
BODY_ROTATE_ANGLE_X_SNEAK = 0.4F, BODY_ROTATE_ANGLE_X_SNEAK = 0.4F,

View file

@ -6,11 +6,11 @@ import net.minecraft.entity.Entity;
import static com.minelittlepony.model.PonyModelConstants.*; import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.ModelMobPony; import com.minelittlepony.model.ModelMobPony;
import com.minelittlepony.render.PonyRenderer;
public class ModelPonyArmor extends ModelMobPony { public class ModelPonyArmor extends ModelMobPony {
public ModelRenderer Bodypiece, extBody; public PonyRenderer Bodypiece, extBody, extLegLeft, extLegRight, extHead;
public ModelRenderer[] extHead, extLegs;
public ModelPonyArmor() { public ModelPonyArmor() {
super(); super();
@ -19,56 +19,47 @@ public class ModelPonyArmor extends ModelMobPony {
@Override @Override
protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) { protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) {
this.bipedBody.rotateAngleY = bodySwing * 0.2F; bipedBody.rotateAngleY = bodySwing * 0.2F;
} }
@Override @Override
protected void adjustBodyRiding() { protected void adjustBodyRiding() {
this.adjustBody(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); adjustBody(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
} }
@Override @Override
protected void setHead(float posX, float posY, float posZ) { protected void setHead(float posX, float posY, float posZ) {
this.bipedHead.setRotationPoint(posX, posY, posZ); super.setHead(posX, posY, posZ);
this.bipedHeadwear.setRotationPoint(posX, posY, posZ); extHead.setRotationPoint(posX, posY, posZ);
this.extHead[0].setRotationPoint(posX, posY, posZ);
this.extHead[1].setRotationPoint(posX, posY, posZ);
} }
@Override @Override
protected void rotateHead(float horz, float vert) { protected void updateHeadRotation(float x, float y) {
super.rotateHead(horz, vert); super.updateHeadRotation(x, y);
extHead.rotateAngleX = x;
float headRotateAngleX = this.bipedHead.rotateAngleX; extHead.rotateAngleX = x;
float headRotateAngleY = this.bipedHead.rotateAngleY;
this.extHead[0].rotateAngleY = headRotateAngleY;
this.extHead[0].rotateAngleX = headRotateAngleX;
this.extHead[1].rotateAngleY = headRotateAngleY;
this.extHead[1].rotateAngleX = headRotateAngleX;
} }
@Override @Override
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) { protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.bipedBody.rotateAngleX = rotateAngleX; bipedBody.rotateAngleX = rotateAngleX;
this.bipedBody.rotationPointY = rotationPointY; bipedBody.rotationPointY = rotationPointY;
this.bipedBody.rotationPointZ = rotationPointZ; bipedBody.rotationPointZ = rotationPointZ;
this.Bodypiece.rotateAngleX = rotateAngleX; Bodypiece.rotateAngleX = rotateAngleX;
this.Bodypiece.rotationPointY = rotationPointY; Bodypiece.rotationPointY = rotationPointY;
this.Bodypiece.rotationPointZ = rotationPointZ; Bodypiece.rotationPointZ = rotationPointZ;
this.extBody.rotateAngleX = rotateAngleX; extBody.rotateAngleX = rotateAngleX;
this.extBody.rotationPointY = rotationPointY; extBody.rotationPointY = rotationPointY;
this.extBody.rotationPointZ = rotationPointZ; extBody.rotationPointZ = rotationPointZ;
} }
@Override @Override
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedHead.render(this.scale); bipedHead.render(this.scale);
this.extHead[0].render(this.scale); extHead.render(this.scale);
this.extHead[1].render(this.scale); bipedHeadwear.render(this.scale);
this.bipedHeadwear.render(this.scale);
} }
@Override @Override
@ -77,165 +68,139 @@ public class ModelPonyArmor extends ModelMobPony {
@Override @Override
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedBody.render(this.scale); bipedBody.render(this.scale);
this.Bodypiece.render(this.scale); Bodypiece.render(this.scale);
this.extBody.render(this.scale); extBody.render(this.scale);
} }
@Override @Override
protected void renderLegs() { protected void renderLegs() {
if (!isSneak) { if (!isSneak) {
boolean isLegs = this.extBody.showModel; boolean isLegs = this.extBody.showModel;
this.extBody.showModel = true; extBody.showModel = true;
this.extBody.postRender(this.scale); extBody.postRender(scale);
this.extBody.showModel = isLegs; extBody.showModel = isLegs;
} }
this.bipedLeftArm.render(this.scale); bipedLeftArm.render(scale);
this.bipedRightArm.render(this.scale); bipedRightArm.render(scale);
this.bipedLeftLeg.render(this.scale); bipedLeftLeg.render(scale);
this.bipedRightLeg.render(this.scale); bipedRightLeg.render(scale);
this.extLegs[0].render(this.scale); extLegRight.render(scale);
this.extLegs[1].render(this.scale); extLegLeft.render(scale);
} }
@Override @Override
protected void initTextures() { protected void initTextures() {
this.extHead = new ModelRenderer[2]; initHeadTextures();
this.extLegs = new ModelRenderer[2]; initBodyTextures();
this.initHeadTextures(); initLegTextures();
this.initBodyTextures();
this.initLegTextures();
} }
@Override @Override
protected void initHeadTextures() { protected void initHeadTextures() {
this.bipedHead = new ModelRenderer(this, 0, 0); bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHeadwear = new ModelRenderer(this, 32, 0); bipedHeadwear = new ModelRenderer(this, 32, 0);
this.extHead[0] = new ModelRenderer(this, 0, 0); extHead = new PonyRenderer(this, 0, 0);
this.extHead[1] = new ModelRenderer(this, 0, 4);
} }
@Override @Override
protected void initBodyTextures() { protected void initBodyTextures() {
this.bipedBody = new ModelRenderer(this, 16, 16); bipedBody = new PonyRenderer(this, 16, 16);
this.Bodypiece = new ModelRenderer(this, 0, 0); Bodypiece = new PonyRenderer(this, 0, 0);
this.extBody = new ModelRenderer(this, 16, 8); extBody = new PonyRenderer(this, 16, 8);
} }
@Override @Override
protected void initLegTextures() { protected void initLegTextures() {
this.bipedRightArm = new ModelRenderer(this, 0, 16); bipedRightArm = new PonyRenderer(this, 0, 16);
bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftArm = new ModelRenderer(this, 0, 16); bipedLeftArm = new PonyRenderer(this, 0, 16).mirror();
this.bipedLeftArm.mirror = true; bipedLeftLeg = new PonyRenderer(this, 0, 16).mirror();
this.bipedLeftLeg = new ModelRenderer(this, 0, 16); unicornArmRight = new PonyRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true; unicornArmLeft = new PonyRenderer(this, 0, 16);
this.bipedRightLeg = new ModelRenderer(this, 0, 16); extLegLeft = new PonyRenderer(this, 48, 8);
extLegRight = new PonyRenderer(this, 48, 8);
this.unicornArmRight = new ModelRenderer(this, 0, 16);
this.unicornArmLeft = new ModelRenderer(this, 0, 16);
this.extLegs[0] = new ModelRenderer(this, 48, 8);
this.extLegs[1] = new ModelRenderer(this, 48, 8);
this.extLegs[1].mirror = true;
} }
@Override @Override
protected void initPositions(float yOffset, float stretch) { protected void initTailPositions(float yOffset, float stretch) {
this.initHeadPositions(yOffset, stretch);
this.initBodyPositions(yOffset, stretch);
this.initLegPositions(yOffset, stretch);
} }
@Override @Override
protected void initHeadPositions(float yOffset, float stretch) { protected void initHeadPositions(float yOffset, float stretch) {
this.bipedHead .addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch * 1.1F); bipedHead .addBox(HEAD_CENTRE_X - 4, HEAD_CENTRE_Y - 4, HEAD_CENTRE_Z - 4, 8, 8, 8, stretch * 1.1F);
this.bipedHeadwear .addBox(-4.0F + HEAD_CENTRE_X, -4.0F + HEAD_CENTRE_Y, -4.0F + HEAD_CENTRE_Z, 8, 8, 8, stretch * 1.1F + 0.5F); bipedHeadwear.addBox(HEAD_CENTRE_X - 4, HEAD_CENTRE_Y - 4, HEAD_CENTRE_Z - 4, 8, 8, 8, stretch * 1.1F + 0.5F);
this.extHead[0].addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch * 0.5F); extHead.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
this.extHead[1].addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch * 0.5F); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, -6, 1, 2, 2, 2, stretch * 0.5F)
.tex(0, 4).box( 2, -6, 1, 2, 2, 2, stretch * 0.5F);
this.bipedHead .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); bipedHead .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.bipedHeadwear .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.extHead[0] .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.extHead[1] .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
} }
@Override @Override
protected void initBodyPositions(float yOffset, float stretch) { protected void initBodyPositions(float yOffset, float stretch) {
this.bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch); bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
this.Bodypiece.addBox(-4.0F, 4.0F, 6.0F, 8, 8, 8, stretch); bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch);
this.extBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 16, stretch);
this.bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); Bodypiece.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
this.Bodypiece.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); .box(-4.0F, 4.0F, 6.0F, 8, 8, 8, stretch);
this.extBody .setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); extBody.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4.0F, 4.0F, -2.0F, 8, 8, 16, stretch);
} }
@Override @Override
protected void initLegPositions(float yOffset, float stretch) { protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch); super.initLegPositions(yOffset, stretch);
this.extLegs[0].addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); extLegLeft.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z)
this.extLegs[1].addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); .around(-3, yOffset, 0)
.box(-2, -6, -2, 4, 12, 4, stretch);
this.extLegs[0].setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F); extLegRight.offset(THIRDP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z)
this.extLegs[1].setRotationPoint(3.0F, 0.0F + yOffset, 0.0F); .around(3, yOffset, 0)
.mirror().box(-2, -6, -2, 4, 12, 4, stretch);
} }
protected void syncLegs() { protected void syncLegs() {
this.extLegs[0].rotateAngleX = this.bipedRightLeg.rotateAngleX; extLegRight.rotateAt(bipedRightLeg).rotateTo(bipedRightLeg);
this.extLegs[0].rotateAngleY = this.bipedRightLeg.rotateAngleY; extLegLeft.rotateAt(bipedLeftLeg).rotateTo(bipedLeftLeg);
this.extLegs[0].rotateAngleZ = this.bipedRightLeg.rotateAngleZ;
this.extLegs[0].rotationPointX = this.bipedRightLeg.rotationPointX;
this.extLegs[0].rotationPointY = this.bipedRightLeg.rotationPointY;
this.extLegs[0].rotationPointZ = this.bipedRightLeg.rotationPointZ;
this.extLegs[1].rotateAngleX = this.bipedLeftLeg.rotateAngleX;
this.extLegs[1].rotateAngleY = this.bipedLeftLeg.rotateAngleY;
this.extLegs[1].rotateAngleZ = this.bipedLeftLeg.rotateAngleZ;
this.extLegs[1].rotationPointX = this.bipedLeftLeg.rotationPointX;
this.extLegs[1].rotationPointY = this.bipedLeftLeg.rotationPointY;
this.extLegs[1].rotationPointZ = this.bipedLeftLeg.rotationPointZ;
} }
@Override @Override
protected void rotateLegs(float move, float swing, float tick, Entity entity) { protected void rotateLegs(float move, float swing, float tick, Entity entity) {
super.rotateLegs(move, swing, tick, entity); super.rotateLegs(move, swing, tick, entity);
this.syncLegs(); syncLegs();
} }
@Override @Override
protected void adjustLegs() { protected void adjustLegs() {
super.adjustLegs(); super.adjustLegs();
this.syncLegs(); syncLegs();
} }
@Override @Override
protected void sneakLegs() { protected void sneakLegs() {
super.sneakLegs(); super.sneakLegs();
this.syncLegs(); syncLegs();
} }
@Override @Override
protected void ponySleep() { protected void ponySleep() {
super.ponySleep(); super.ponySleep();
this.syncLegs(); syncLegs();
} }
public void setVisible(boolean invisible) { public void setVisible(boolean invisible) {
super.setVisible(invisible); super.setVisible(invisible);
this.Bodypiece.showModel = invisible; Bodypiece.showModel = invisible;
extBody.showModel = invisible; extBody.showModel = invisible;
for (ModelRenderer m : extHead) { extHead.showModel = invisible;
m.showModel = invisible; extLegLeft.showModel = invisible;
} extLegRight.showModel = invisible;
for (ModelRenderer m : extLegs) {
m.showModel = invisible;
}
} }
} }

View file

@ -1,34 +1,23 @@
package com.minelittlepony.model.armour; package com.minelittlepony.model.armour;
import net.minecraft.entity.Entity;
/** /**
* Armour for skeleton ponies. * Armour for skeleton ponies.
* *
*/ */
public class ModelSkeletonPonyArmor extends ModelPonyArmor { public class ModelSkeletonPonyArmor extends ModelPonyArmor {
/**
* The code here is copied from ModelMobPony, all with but one line of difference.
*/
@Override @Override
protected void rotateRightArm(float move, float tick) { protected void rotateLegs(float move, float swing, float tick, Entity entity) {
if (this.rightArmPose == ArmPose.EMPTY) return; super.rotateLegs(move, swing, tick, entity);
aimBow(leftArmPose, rightArmPose, tick);
if (!this.metadata.hasMagic()) {
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
} else {
// With everything that's happening in ModelPonyArmor,
// it's hard to tell if this is need or not.
// Testing will probably reveal all.
//unicornArmRight.setRotationPoint(-7, 12, -2);
rotateArmHolding(unicornArmRight, 1, swingProgress, tick);
}
} }
@Override @Override
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose != ArmPose.EMPTY && !this.metadata.hasMagic()) { if (rightArmPose != ArmPose.EMPTY && !metadata.hasMagic()) {
this.bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4.0F); bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4.0F);
} }
} }
} }

View file

@ -1,5 +1,6 @@
package com.minelittlepony.model.armour; package com.minelittlepony.model.armour;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
public class ModelZombiePonyArmor extends ModelPonyArmor { public class ModelZombiePonyArmor extends ModelPonyArmor {
@ -8,6 +9,7 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
return MathHelper.sin(move / 20f) < 0; return MathHelper.sin(move / 20f) < 0;
} }
// Copied from ModelZombiePony
@Override @Override
protected void rotateRightArm(float move, float tick) { protected void rotateRightArm(float move, float tick) {
if (rightArmPose != ArmPose.EMPTY) return; if (rightArmPose != ArmPose.EMPTY) return;
@ -21,16 +23,16 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
@Override @Override
protected void rotateLeftArm(float move, float tick) { protected void rotateLeftArm(float move, float tick) {
// Zombies are unidexterous.
} }
@Override @Override
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose != ArmPose.EMPTY) return; if (rightArmPose != ArmPose.EMPTY) return;
if (isRight(move)) { boolean right = isRight(move);
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3); float xchange = right ? 0.5f : -0.5f;
} else { ModelRenderer arm = right ? bipedRightArm : bipedLeftArm;
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
} shiftRotationPoint(arm, xchange, 1.5f, 3);
} }
} }

View file

@ -17,75 +17,62 @@ public class HornGlow extends ModelBox {
private TexturedQuad[] quadList; private TexturedQuad[] quadList;
public HornGlow(HornGlowRenderer parent, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10, float alpha) { public HornGlow(HornGlowRenderer parent, int texU, int texV, float x, float y, float z, int w, int h, int d, float scale, float alpha) {
super(parent, par2, par3, par4, par5, par6, par7, par8, par9, par10); super(parent, texU, texV, x, y, z, w, h, d, scale);
this.parent = parent; this.parent = parent;
this.alpha = alpha; this.alpha = alpha;
this.quadList = new TexturedQuad[6]; this.quadList = new TexturedQuad[6];
float var11 = par4 + par7;
float var12 = par5 + par8; float x2 = x + w + scale;
float var13 = par6 + par9; float y2 = y + h + scale;
float halfpar4 = par4 + par7 * 0.05F; float z2 = z + d + scale;
float halfpar6 = par6 + par9 * 0.05F;
float halfvar11 = par4 + par7 * 0.95F; x -= scale;
float halfvar13 = par6 + par9 * 0.95F; y -= scale;
par4 -= par10; z -= scale;
par5 -= par10;
par6 -= par10;
var11 += par10;
var12 += par10;
var13 += par10;
if (parent.mirror) { if (parent.mirror) {
float var26 = var11; float f3 = x2;
var11 = par4; x2 = x;
par4 = var26; x = f3;
} }
PositionTextureVertex var32 = new PositionTextureVertex(halfpar4, par5, halfpar6, 0.0F, 0.0F); float halfpar4 = x + w * 0.05F;
PositionTextureVertex var15 = new PositionTextureVertex(halfvar11, par5, halfpar6, 0.0F, 8.0F); float halfpar6 = z + d * 0.05F;
PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F); float halfvar11 = x + w * 0.95F;
PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F); float halfvar13 = z + d * 0.95F;
PositionTextureVertex var18 = new PositionTextureVertex(halfpar4, par5, halfvar13, 0.0F, 0.0F);
PositionTextureVertex var19 = new PositionTextureVertex(halfvar11, par5, halfvar13, 0.0F, 8.0F); PositionTextureVertex p7 = new PositionTextureVertex(halfpar4, y, halfpar6, 0, 0);
PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F); PositionTextureVertex p0 = new PositionTextureVertex(halfvar11, y, halfpar6, 0, 8);
PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F); PositionTextureVertex p1 = new PositionTextureVertex(x2, y2, z, 8, 8);
PositionTextureVertex p2 = new PositionTextureVertex(x, y2, z, 8, 0);
PositionTextureVertex p3 = new PositionTextureVertex(halfpar4, y, halfvar13, 0, 0);
PositionTextureVertex p4 = new PositionTextureVertex(halfvar11, y, halfvar13, 0, 8);
PositionTextureVertex p5 = new PositionTextureVertex(x2, y2, z2, 8, 8);
PositionTextureVertex p6 = new PositionTextureVertex(x, y2, z2, 8, 0);
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{p4, p0, p1, p5}, texU + d + w, texV + d, texU + d + w + d, texV + d + h, parent.textureWidth, parent.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{p7, p3, p6, p2}, texU, texV + d, texU + d, texV + d + h, parent.textureWidth, parent.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{p4, p3, p7, p0}, texU + d, texV, texU + d + w, texV + d, parent.textureWidth, parent.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{p1, p2, p6, p5}, texU + d + w, texV + d, texU + d + w + w, texV, parent.textureWidth, parent.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{p0, p7, p2, p1}, texU + d, texV + d, texU + d + w, texV + d + h, parent.textureWidth, parent.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{p3, p4, p5, p6}, texU + d + w + d, texV + d, texU + d + w + d + w, texV + d + h, parent.textureWidth, parent.textureHeight);
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20},
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8,
parent.textureWidth, parent.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{var32, var18, var21, var17}, par2,
par3 + par9, par2 + par9, par3 + par9 + par8, parent.textureWidth,
parent.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var32, var15}, par2 + par9,
par3, par2 + par9 + par7, par3 + par9, parent.textureWidth, parent.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20},
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, parent.textureWidth,
parent.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var32, var17, var16}, par2 + par9,
par3 + par9, par2 + par9 + par7, par3 + par9 + par8, parent.textureWidth,
parent.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{var18, var19, var20, var21},
par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8,
parent.textureWidth, parent.textureHeight);
if (parent.mirror) { if (parent.mirror) {
TexturedQuad[] var22 = this.quadList; for (TexturedQuad i : quadList) {
i.flipFace();
for (TexturedQuad var25 : var22) {
var25.flipFace();
} }
} }
} }
@Override @Override
public void render(@Nonnull BufferBuilder buffer, float par2) { public void render(@Nonnull BufferBuilder buffer, float scale) {
parent.applyTint(alpha); parent.applyTint(alpha);
TexturedQuad[] var3 = this.quadList; for (TexturedQuad i : quadList) {
for (TexturedQuad var6 : var3) { i.draw(buffer, scale);
var6.draw(buffer, par2);
} }
} }
} }

View file

@ -8,12 +8,12 @@ import com.minelittlepony.model.components.PegasusWings;
import com.minelittlepony.model.components.PonySnout; import com.minelittlepony.model.components.PonySnout;
import com.minelittlepony.model.components.PonyTail; import com.minelittlepony.model.components.PonyTail;
import com.minelittlepony.model.components.UnicornHorn; import com.minelittlepony.model.components.UnicornHorn;
import com.minelittlepony.render.PonyRenderer;
import com.minelittlepony.render.plane.PlaneRenderer; import com.minelittlepony.render.plane.PlaneRenderer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -24,16 +24,15 @@ import static com.minelittlepony.model.PonyModelConstants.*;
public class ModelPlayerPony extends AbstractPonyModel { public class ModelPlayerPony extends AbstractPonyModel {
private final boolean smallArms; private final boolean smallArms;
public boolean rainboom;
public ModelRenderer bipedCape; public ModelRenderer bipedCape;
public PlaneRenderer[] Bodypiece; public PlaneRenderer upperTorso;
public PlaneRenderer BodypieceNeck; public PlaneRenderer neck;
public ModelRenderer unicornArmRight, unicornArmLeft; public PonyRenderer unicornArmRight, unicornArmLeft;
public PonyTail Tail; public PonyTail tail;
public PonySnout snout; public PonySnout snout;
public UnicornHorn horn; public UnicornHorn horn;
public PegasusWings wings; public PegasusWings wings;
@ -70,73 +69,63 @@ public class ModelPlayerPony extends AbstractPonyModel {
rotateLook(limbSwing, limbSwingAmount, bodySwingRotation, ageInTicks); rotateLook(limbSwing, limbSwingAmount, bodySwingRotation, ageInTicks);
this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn); setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn);
this.holdItem(limbSwingAmount); holdItem(limbSwingAmount);
this.swingItem(entityIn, this.swingProgress); swingItem(entityIn, swingProgress);
if (this.isSneak && !this.isFlying && !this.rainboom) {
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); if (isCrouching() && !rainboom) {
this.sneakLegs(); adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
this.setHead(0.0F, 6.0F, -2.0F); sneakLegs();
} else if (this.isRiding) { setHead(0, 6, -2);
} else if (isRiding) {
this.adjustBodyRiding(); this.adjustBodyRiding();
this.bipedLeftLeg.rotationPointZ = 15; bipedLeftLeg.rotationPointZ = 15;
this.bipedLeftLeg.rotationPointY = 10; bipedLeftLeg.rotationPointY = 10;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * -0.25); bipedLeftLeg.rotateAngleX = -PI / 4;
this.bipedLeftLeg.rotateAngleY = (float) (Math.PI * -0.2); bipedLeftLeg.rotateAngleY = -PI / 5;
this.bipedRightLeg.rotationPointZ = 15; bipedRightLeg.rotationPointZ = 15;
this.bipedRightLeg.rotationPointY = 10; bipedRightLeg.rotationPointY = 10;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * -0.25); bipedRightLeg.rotateAngleX = -PI / 4;
this.bipedRightLeg.rotateAngleY = (float) (Math.PI * 0.2); bipedRightLeg.rotateAngleY = PI / 5;
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06); bipedLeftArm.rotateAngleZ = -PI * 0.06f;
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06); bipedRightArm.rotateAngleZ = PI * 0.06f;
} else { } else {
adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; swingArms(ageInTicks);
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; setHead(0, 0, 0);
this.swingArms(ageInTicks);
this.setHead(0.0F, 0.0F, 0.0F);
} }
if (this.isSleeping) { if (isSleeping) ponySleep();
this.ponySleep();
}
this.aimBow(leftArmPose, rightArmPose, ageInTicks); aimBow(leftArmPose, rightArmPose, ageInTicks);
fixSpecialRotationPoints(limbSwing);
this.fixSpecialRotations();
this.fixSpecialRotationPoints(limbSwing);
animateWears(); animateWears();
this.bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0; bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
this.snout.setGender(this.metadata.getGender()); snout.setGender(metadata.getGender());
this.wings.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); wings.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
} }
protected void adjustBodyRiding() { protected void adjustBodyRiding() {
this.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);
this.adjustNeck(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); adjustNeck(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.setHead(0.0F, 0.0F, 0.0F); setHead(0, 0, 0);
} }
protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) { protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) {
this.Tail.setRotationAndAngles(rainboom, limbSwing, limbSwingAmount, bodySwing, ticks); tail.setRotationAndAngles(rainboom, limbSwing, limbSwingAmount, bodySwing, ticks);
bodySwing /= 5;
for (PlaneRenderer i : this.Bodypiece) { upperTorso.rotateAngleY = bodySwing;
i.rotateAngleY = bodySwing * 0.2F; bipedBody.rotateAngleY = bodySwing;
} neck.rotateAngleY = bodySwing;
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;
} }
private void animateWears() { private void animateWears() {
@ -147,56 +136,57 @@ public class ModelPlayerPony extends AbstractPonyModel {
copyModelAngles(bipedBody, bipedBodyWear); copyModelAngles(bipedBody, bipedBodyWear);
} }
/**
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
*/
protected void checkRainboom(Entity entity, float swing) { protected void checkRainboom(Entity entity, float swing) {
boolean flying = this.metadata.getRace().hasWings() && this.isFlying rainboom = isFlying(entity) && swing >= 0.9999F;
|| entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying();
this.rainboom = flying && swing >= 0.9999F;
} }
/**
* Sets the head rotation angle.
*/
protected void setHead(float posX, float posY, float posZ) { protected void setHead(float posX, float posY, float posZ) {
this.bipedHead.setRotationPoint(posX, posY, posZ); bipedHead.setRotationPoint(posX, posY, posZ);
this.bipedHeadwear.setRotationPoint(posX, posY, posZ); bipedHeadwear.setRotationPoint(posX, posY, posZ);
} }
protected void rotateHead(float horz, float vert) { /**
float headRotateAngleY; * Rotates the head within reason. X is clamped to around motionPitch.
float headRotateAngleX; * Both arguments are also ignored when sleeping.
if (this.isSleeping) { */
headRotateAngleY = 1.4F; private void rotateHead(float horz, float vert) {
headRotateAngleX = 0.1F; float headRotateAngleY = isSleeping ? 1.4f : horz / 57.29578F;
} else { float headRotateAngleX = isSleeping ? 0.1f : vert / 57.29578F;
headRotateAngleY = horz / 57.29578F;
headRotateAngleX = vert / 57.29578F; headRotateAngleX = Math.min(headRotateAngleX, (float) (0.5f - Math.toRadians(motionPitch)));
headRotateAngleX = Math.max(headRotateAngleX, (float) (-1.25f - Math.toRadians(motionPitch)));
updateHeadRotation(headRotateAngleX, headRotateAngleY);
} }
final float max = (float) (0.5f - Math.toRadians(this.motionPitch)); /**
final float min = (float) (-1.25f - Math.toRadians(this.motionPitch)); * Called to update the head rotation.
headRotateAngleX = Math.min(headRotateAngleX, max); *
headRotateAngleX = Math.max(headRotateAngleX, min); * @param x New rotation X
this.bipedHead.rotateAngleY = headRotateAngleY; * @param y New rotation Y
this.bipedHead.rotateAngleX = headRotateAngleX; */
this.bipedHeadwear.rotateAngleY = headRotateAngleY; protected void updateHeadRotation(float x, float y) {
this.bipedHeadwear.rotateAngleX = headRotateAngleX; bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = y;
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = x;
} }
protected void setLegs(float move, float swing, float tick, Entity entity) { protected void setLegs(float move, float swing, float tick, Entity entity) {
this.rotateLegs(move, swing, tick, entity); rotateLegs(move, swing, tick, entity);
this.adjustLegs(); adjustLegs();
}
public boolean isFlying(Entity entity) {
return (isFlying && metadata.getRace().hasWings()) ||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
} }
protected void rotateLegs(float move, float swing, float tick, Entity entity) { protected void rotateLegs(float move, float swing, float tick, Entity entity) {
float leftArm, rightArm, float leftArm, rightArm, leftLeg, rightLeg;
leftLeg, rightLeg;
if (isFlying(entity)) { if (isFlying(entity)) {
if (this.rainboom) { if (rainboom) {
rightArm = leftArm = ROTATE_270; rightArm = leftArm = ROTATE_270;
rightLeg = leftLeg = ROTATE_90; rightLeg = leftLeg = ROTATE_90;
} else { } else {
@ -207,10 +197,9 @@ public class ModelPlayerPony extends AbstractPonyModel {
bipedRightArm.rotateAngleY = 0.2F; bipedRightArm.rotateAngleY = 0.2F;
bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F; bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F;
this.bipedLeftLeg.rotateAngleY = 0.2F; bipedLeftLeg.rotateAngleY = 0.2F;
} else { } else {
float PI = (float)Math.PI;
float pi = PI * (float) Math.pow(swing, 16); float pi = PI * (float) Math.pow(swing, 16);
float mve = move * 0.6662F; // magic number ahoy float mve = move * 0.6662F; // magic number ahoy
@ -222,33 +211,30 @@ public class ModelPlayerPony extends AbstractPonyModel {
leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt; leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt;
rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt; rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt;
this.bipedRightArm.rotateAngleY = 0; bipedLeftArm.rotateAngleY = 0;
bipedRightArm.rotateAngleY = 0;
this.bipedLeftArm.rotateAngleY = 0; bipedLeftLeg.rotateAngleY = 0;
this.bipedRightLeg.rotateAngleY = 0; bipedRightLeg.rotateAngleY = 0;
this.bipedLeftLeg.rotateAngleY = 0;
this.unicornArmRight.rotateAngleY = 0; unicornArmRight.rotateAngleY = 0;
this.unicornArmLeft.rotateAngleY = 0; unicornArmLeft.rotateAngleY = 0;
} }
bipedLeftArm.rotateAngleX = leftArm;
bipedRightArm.rotateAngleX = rightArm;
bipedLeftLeg.rotateAngleX = leftLeg;
bipedRightLeg.rotateAngleX = rightLeg;
bipedLeftArm.rotateAngleZ = 0;
bipedRightArm.rotateAngleZ = 0;
unicornArmLeft.rotateAngleZ = 0;
unicornArmRight.rotateAngleZ = 0;
this.bipedLeftArm.rotateAngleX = leftArm; unicornArmLeft.rotateAngleX = 0;
this.bipedRightArm.rotateAngleX = rightArm; unicornArmRight.rotateAngleX = 0;
this.bipedLeftArm.rotateAngleZ = 0;
this.bipedRightArm.rotateAngleZ = 0;
this.bipedLeftLeg.rotateAngleX = leftLeg;
this.bipedRightLeg.rotateAngleX = rightLeg;
this.unicornArmRight.rotateAngleX = 0;
this.unicornArmLeft.rotateAngleX = 0;
this.unicornArmRight.rotateAngleZ = 0;
this.unicornArmLeft.rotateAngleZ = 0;
} }
private float getLegOutset() { private float getLegOutset() {
@ -292,16 +278,17 @@ public class ModelPlayerPony extends AbstractPonyModel {
protected void holdItem(float swing) { protected void holdItem(float swing) {
if (!this.rainboom && !this.metadata.hasMagic()) { boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
boolean bothHoovesAreOccupied = this.leftArmPose == ArmPose.ITEM && this.rightArmPose == ArmPose.ITEM;
alignArmForAction(bipedLeftArm, leftArmPose, bothHoovesAreOccupied, swing); if (!rainboom && !metadata.hasMagic()) {
alignArmForAction(bipedRightArm, rightArmPose, bothHoovesAreOccupied, swing); alignArmForAction(bipedLeftArm, leftArmPose, both, swing);
} else if (this.metadata.hasMagic()) { alignArmForAction(bipedRightArm, rightArmPose, both, swing);
if (this.leftArmPose == ArmPose.BLOCK) blockArm(unicornArmLeft); } else if (metadata.hasMagic()) {
if (this.rightArmPose == ArmPose.BLOCK) blockArm(unicornArmRight); alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
} }
this.horn.setUsingMagic(this.leftArmPose != ArmPose.EMPTY || this.rightArmPose != ArmPose.EMPTY); horn.setUsingMagic(this.leftArmPose != ArmPose.EMPTY || this.rightArmPose != ArmPose.EMPTY);
} }
private void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) { private void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) {
@ -309,42 +296,42 @@ public class ModelPlayerPony extends AbstractPonyModel {
case ITEM: case ITEM:
float swag = 1; float swag = 1;
if (!isFlying && both) { if (!isFlying && both) {
swag = (float) (1 - Math.pow(swing, 2)); swag -= (float)Math.pow(swing, 2);
} }
float mult = 0.5f + (1 - swag)/2; float mult = 1 - swag/2f;
arm.rotateAngleX = this.bipedLeftArm.rotateAngleX * mult - ((float) Math.PI / 10) * swag; arm.rotateAngleX = bipedLeftArm.rotateAngleX * mult - (PI / 10) * swag;
case EMPTY: case EMPTY:
arm.rotateAngleY = 0; arm.rotateAngleY = 0;
break; break;
case BLOCK: case BLOCK:
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F; blockArm(arm);
arm.rotateAngleY = (float) (Math.PI / 6);
break; break;
default: default:
} }
} }
private void blockArm(ModelRenderer arm) { private void blockArm(ModelRenderer arm) {
arm.rotateAngleX = arm.rotateAngleX * 0.5F - 0.9424779F; arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
arm.rotateAngleY = (float) (Math.PI / 6); arm.rotateAngleY = PI / 6;
} }
protected void swingItem(Entity entity, float swingProgress) { protected void swingItem(Entity entity, float swingProgress) {
if (swingProgress > -9990.0F && !this.isSleeping) { 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); EnumHandSide mainSide = this.getMainHand(entity);
boolean mainRight = mainSide == EnumHandSide.RIGHT; boolean mainRight = mainSide == EnumHandSide.RIGHT;
ArmPose mainPose = mainRight ? this.rightArmPose : this.leftArmPose; ArmPose mainPose = mainRight ? rightArmPose : leftArmPose;
if (this.metadata.hasMagic() && mainPose != ArmPose.EMPTY) { if (mainPose == ArmPose.EMPTY) return;
swingArm(mainRight ? this.unicornArmRight : this.unicornArmLeft, f22, f33, f28);
float f16 = 1 - swingProgress;
f16 *= f16 * f16;
f16 = 1 - f16;
float f22 = MathHelper.sin(f16 * PI);
float f28 = MathHelper.sin(swingProgress * PI);
float f33 = f28 * (0.7F - bipedHead.rotateAngleX) * 0.75F;
if (metadata.hasMagic()) {
swingArm(mainRight ? unicornArmRight : unicornArmLeft, f22, f33, f28);
} else { } else {
swingArm(getArmForSide(mainSide), f22, f33, f28); swingArm(getArmForSide(mainSide), f22, f33, f28);
} }
@ -388,54 +375,44 @@ public class ModelPlayerPony extends AbstractPonyModel {
} }
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) { protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
this.bipedBody.rotateAngleX = rotateAngleX; bipedBody.rotateAngleX = rotateAngleX;
this.bipedBody.rotationPointY = rotationPointY; bipedBody.rotationPointY = rotationPointY;
this.bipedBody.rotationPointZ = rotationPointZ; bipedBody.rotationPointZ = rotationPointZ;
for (PlaneRenderer i : Bodypiece) { upperTorso.rotateAngleX = rotateAngleX;
i.rotateAngleX = rotateAngleX; upperTorso.rotationPointY = rotationPointY;
i.rotationPointY = rotationPointY; upperTorso.rotationPointZ = rotationPointZ;
i.rotationPointZ = rotationPointZ;
}
} }
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) { protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
BodypieceNeck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ); neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
} }
/**
* Aligns legs to a sneaky position.
*/
protected void sneakLegs() { protected void sneakLegs() {
this.unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT; unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT; unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT; bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT; bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
this.bipedLeftLeg.rotationPointY = this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK; bipedLeftLeg.rotationPointY = bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
} }
protected void ponySleep() { protected void ponySleep() {
this.bipedRightArm.rotateAngleX = ROTATE_270; bipedRightArm.rotateAngleX = ROTATE_270;
this.bipedLeftArm.rotateAngleX = ROTATE_270; bipedLeftArm.rotateAngleX = ROTATE_270;
this.bipedRightLeg.rotateAngleX = ROTATE_90; bipedRightLeg.rotateAngleX = ROTATE_90;
this.bipedLeftLeg.rotateAngleX = ROTATE_90; bipedLeftLeg.rotateAngleX = ROTATE_90;
float headPosX, headPosY, headPosZ; setHead(1, 2, isSneak ? -1 : 1);
if (this.isSneak) { shiftRotationPoint(bipedRightArm, 0, 2, 6);
headPosY = 2; shiftRotationPoint(bipedLeftArm, 0, 2, 6);
headPosZ = -1; shiftRotationPoint(bipedRightLeg, 0, 2, -8);
headPosX = 1; shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
} else {
headPosY = 2;
headPosZ = 1;
headPosX = 1;
}
this.setHead(headPosX, headPosY, headPosZ);
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);
} }
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) { protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
@ -452,20 +429,12 @@ public class ModelPlayerPony extends AbstractPonyModel {
} }
protected void aimBowPony(ModelRenderer arm, float tick, boolean shift) { protected void aimBowPony(ModelRenderer arm, float tick, boolean shift) {
arm.rotateAngleZ = 0.0F; arm.rotateAngleZ = 0;
arm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY; arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F;
arm.rotateAngleX = ROTATE_270 + this.bipedHead.rotateAngleX; arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX;
arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F; arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F; arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
if (shift) shiftRotationPoint(arm, 0.0F, 0.0F, 1.0F); if (shift) shiftRotationPoint(arm, 0, 0, 1);
}
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;
} }
protected void fixSpecialRotationPoints(float move) { protected void fixSpecialRotationPoints(float move) {
@ -475,197 +444,175 @@ public class ModelPlayerPony extends AbstractPonyModel {
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
pushMatrix(); pushMatrix();
this.transform(BodyPart.HEAD); transform(BodyPart.HEAD);
this.renderHead(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderHead(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
this.transform(BodyPart.NECK); transform(BodyPart.NECK);
this.renderNeck(); renderNeck();
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
this.transform(BodyPart.BODY); transform(BodyPart.BODY);
this.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
this.Tail.render(this.metadata.getTail(), this.scale); tail.render(metadata.getTail(), scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
this.transform(BodyPart.LEGS); transform(BodyPart.LEGS);
this.renderLegs(); renderLegs();
popMatrix(); popMatrix();
} }
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedHead.render(this.scale); bipedHead.render(scale);
this.bipedHeadwear.render(this.scale); bipedHeadwear.render(scale);
this.bipedHead.postRender(scale); bipedHead.postRender(scale);
this.horn.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); horn.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
} }
protected void renderNeck() { protected void renderNeck() {
GlStateManager.scale(0.9, 0.9, 0.9); GlStateManager.scale(0.9, 0.9, 0.9);
this.BodypieceNeck.render(this.scale); neck.render(scale);
} }
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
this.bipedBody.render(this.scale); bipedBody.render(scale);
if (this.textureHeight == 64) { if (textureHeight == 64) {
this.bipedBodyWear.render(this.scale); bipedBodyWear.render(scale);
} }
for (PlaneRenderer aBodypiece : this.Bodypiece) { upperTorso.render(scale);
aBodypiece.render(this.scale); bipedBody.postRender(scale);
} wings.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
this.bipedBody.postRender(scale);
this.wings.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, this.scale);
} }
protected void renderLegs() { protected void renderLegs() {
if (!this.isSneak) { if (!isSneak) bipedBody.postRender(scale);
this.bipedBody.postRender(this.scale);
}
this.bipedLeftArm.render(this.scale); bipedLeftArm.render(scale);
this.bipedRightArm.render(this.scale); bipedRightArm.render(scale);
this.bipedLeftLeg.render(this.scale); bipedLeftLeg.render(scale);
this.bipedRightLeg.render(this.scale); bipedRightLeg.render(scale);
if (this.textureHeight == 64) { if (textureHeight == 64) {
this.bipedLeftArmwear.render(this.scale); bipedLeftArmwear.render(scale);
this.bipedRightArmwear.render(this.scale); bipedRightArmwear.render(scale);
this.bipedLeftLegwear.render(this.scale); bipedLeftLegwear.render(scale);
this.bipedRightLegwear.render(this.scale); bipedRightLegwear.render(scale);
} }
} }
@Override @Override
protected void initTextures() { protected void initTextures() {
this.boxList.clear(); boxList.clear();
this.Bodypiece = new PlaneRenderer[14]; initHeadTextures();
this.initHeadTextures(); initBodyTextures();
this.initBodyTextures(); initLegTextures();
this.initLegTextures(); tail = new PonyTail(this);
this.Tail = new PonyTail(this);
} }
protected void initHeadTextures() { protected void initHeadTextures() {
this.bipedCape = new ModelRenderer(this, 0, 0).setTextureSize(64, 32); bipedCape = new PonyRenderer(this, 0, 0).size(64, 32);
this.bipedHead = new ModelRenderer(this, 0, 0); bipedHead = new PonyRenderer(this, 0, 0);
this.bipedHeadwear = new ModelRenderer(this, 32, 0); bipedHeadwear = new PonyRenderer(this, 32, 0);
} }
protected void initBodyTextures() { protected void initBodyTextures() {
this.bipedBody = new ModelRenderer(this, 16, 16); bipedBody = new ModelRenderer(this, 16, 16);
if (this.textureHeight == 64) { if (textureHeight == 64) {
this.bipedBodyWear = new ModelRenderer(this, 16, 32); bipedBodyWear = new ModelRenderer(this, 16, 32);
} }
this.Bodypiece[0] = new PlaneRenderer(this, 24, 0); upperTorso = new PlaneRenderer(this, 24, 0);
this.Bodypiece[0].mirrorz = true; neck = new PlaneRenderer(this, 0, 16);
this.Bodypiece[1] = new PlaneRenderer(this, 24, 0);
this.Bodypiece[2] = new PlaneRenderer(this, 32, 20);
this.Bodypiece[2].mirrorz = true;
this.Bodypiece[3] = new PlaneRenderer(this, 56, 0);
this.Bodypiece[4] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[4].mirrorz = true;
this.Bodypiece[5] = new PlaneRenderer(this, 4, 0);
this.Bodypiece[6] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[7] = new PlaneRenderer(this, 36, 16);
this.Bodypiece[8] = new PlaneRenderer(this, 36, 16);
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);
this.Bodypiece[12] = new PlaneRenderer(this, 32, 0);
this.Bodypiece[13] = new PlaneRenderer(this, 32, 0);
this.BodypieceNeck = new PlaneRenderer(this, 0, 16);
} }
protected void initLegTextures() { protected void initLegTextures() {
this.bipedRightArm = new ModelRenderer(this, 40, 16); bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightLeg = new ModelRenderer(this, 0, 16); bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftArm = new ModelRenderer(this, 32, 48); bipedLeftArm = new ModelRenderer(this, 32, 48);
this.bipedLeftLeg = new ModelRenderer(this, 16, 48); bipedLeftLeg = new ModelRenderer(this, 16, 48);
this.bipedRightArmwear = new ModelRenderer(this, 40, 32); bipedRightArmwear = new ModelRenderer(this, 40, 32);
this.bipedRightLegwear = new ModelRenderer(this, 0, 32); bipedRightLegwear = new ModelRenderer(this, 0, 32);
this.bipedLeftArmwear = new ModelRenderer(this, 48, 48); bipedLeftArmwear = new ModelRenderer(this, 48, 48);
this.bipedLeftLegwear = new ModelRenderer(this, 0, 48); bipedLeftLegwear = new ModelRenderer(this, 0, 48);
this.unicornArmRight = new ModelRenderer(this, 40, 32).setTextureSize(64, 64); unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
this.unicornArmLeft = new ModelRenderer(this, 40, 32).setTextureSize(64, 64); unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
this.boxList.remove(this.unicornArmRight); boxList.remove(unicornArmRight);
} }
@Override @Override
protected void initPositions(float yOffset, float stretch) { protected void initPositions(float yOffset, float stretch) {
this.initHeadPositions(yOffset, stretch); initHeadPositions(yOffset, stretch);
this.initBodyPositions(yOffset, stretch); initBodyPositions(yOffset, stretch);
this.initLegPositions(yOffset, stretch); initLegPositions(yOffset, stretch);
this.Tail.init(yOffset, stretch); initTailPositions(yOffset, stretch);
}
protected void initTailPositions(float yOffset, float stretch) {
tail.init(yOffset, stretch);
} }
protected void initHeadPositions(float yOffset, float stretch) { protected void initHeadPositions(float yOffset, float stretch) {
this.bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch); 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);
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); ((PonyRenderer)bipedHead).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
this.bipedHeadwear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch)
.tex(12, 16)
.box(-4, -6, 1, 2, 2, 2, stretch)
.mirror()
.box(2, -6, 1, 2, 2, 2, stretch);
((PonyRenderer)bipedHeadwear).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch + 0.5F);
} }
/**
* Creates the main torso and neck.
*/
protected void initBodyPositions(float yOffset, float stretch) { protected void initBodyPositions(float yOffset, float stretch) {
this.bipedBody.addBox(-4.0F, 4.0F, -2.0F, 8, 8, 4, stretch); bipedBody.addBox(-4, 4, -2, 8, 8, 4, stretch);
this.bipedBody.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); 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); bipedBodyWear.addBox(-4, 4, -2, 8, 8, 4, stretch + 0.25F);
this.Bodypiece[1].addEastPlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 8, stretch); bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
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++) { upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
this.Bodypiece[i].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
} .tex(24, 0) .addEastPlane( 4, -4, -4, 8, 8, stretch)
.tex(56, 0) .addBottomPlane(-4, 4, -4, 8, 8, stretch)
.tex(4, 0) .addEastPlane( 4, -4, 4, 8, 4, stretch)
.tex(36, 16) .addBackPlane(-4, -4, 8, 8, 4, stretch)
.addBackPlane(-4, 0, 8, 8, 4, stretch)
.addBottomPlane(-4, 4, 4, 8, 4, stretch)
.flipZ().tex(24, 0).addWestPlane(-4, -4, -4, 8, 8, stretch)
.tex(32, 20).addTopPlane(-4, -4, -4, 8, 12, stretch)
.tex(4, 0) .addWestPlane(-4, -4, 4, 8, 4, stretch)
// Tail stub
.child(0)
.tex(32, 0).addTopPlane(-1, 2, 2, 2, 6, stretch)
.addBottomPlane(-1, 4, 2, 2, 6, stretch)
.addEastPlane( 1, 2, 2, 2, 6, stretch)
.addBackPlane(-1, 2, 8, 2, 2, stretch)
.flipZ().addWestPlane(-1, 2, 2, 2, 6, stretch)
.rotateAngleX = 0.5F;
this.BodypieceNeck.addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch); neck.at(NECK_CENTRE_X, NECK_CENTRE_Y, NECK_CENTRE_Z)
this.BodypieceNeck.addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, stretch); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
this.BodypieceNeck.addEastPlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch); .addFrontPlane(0, 0, 0, 4, 4, stretch)
this.BodypieceNeck.addWestPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, stretch); .addBackPlane(0, 0, 4, 4, 4, stretch)
.addEastPlane(4, 0, 0, 4, 4, stretch)
this.BodypieceNeck.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); .addWestPlane(0, 0, 0, 4, 4, stretch)
this.BodypieceNeck.rotateAngleX = NECK_ROT_X; .rotateAngleX = NECK_ROT_X;
} }
protected void initLegPositions(float yOffset, float stretch) { protected void initLegPositions(float yOffset, float stretch) {
@ -677,47 +624,47 @@ public class ModelPlayerPony extends AbstractPonyModel {
float armY = THIRDP_ARM_CENTRE_Y - 6; float armY = THIRDP_ARM_CENTRE_Y - 6;
float armZ = THIRDP_ARM_CENTRE_Z - 2; float armZ = THIRDP_ARM_CENTRE_Z - 2;
this.bipedLeftArm .addBox(armX, armY, armZ, armWidth, 12, 4, stretch); bipedLeftArm .addBox(armX, armY, armZ, armWidth, 12, 4, stretch);
this.bipedRightArm.addBox(armX, armY, armZ, armWidth, 12, 4, stretch); bipedRightArm.addBox(armX, armY, armZ, armWidth, 12, 4, stretch);
this.bipedLeftLeg .addBox(armX, armY, armZ, 4, 12, 4, stretch); bipedLeftLeg .addBox(armX, armY, armZ, 4, 12, 4, stretch);
this.bipedRightLeg.addBox(armX, armY, armZ, 4, 12, 4, stretch); bipedRightLeg.addBox(armX, armY, armZ, 4, 12, 4, stretch);
this.bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0); bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
this.bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0); bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
this.bipedLeftLeg .setRotationPoint( rarmX, yOffset, 0); bipedLeftLeg .setRotationPoint( rarmX, yOffset, 0);
this.bipedRightLeg.setRotationPoint(-rarmX, yOffset, 0); bipedRightLeg.setRotationPoint(-rarmX, yOffset, 0);
if (bipedLeftArmwear != null) { if (bipedLeftArmwear != null) {
this.bipedLeftArmwear.addBox(armX, armY, armZ, 3, 12, 4, stretch + 0.25f); bipedLeftArmwear.addBox(armX, armY, armZ, 3, 12, 4, stretch + 0.25f);
this.bipedLeftArmwear.setRotationPoint(3, yOffset + rarmY, 0); bipedLeftArmwear.setRotationPoint(3, yOffset + rarmY, 0);
} }
if (bipedRightArmwear != null) { if (bipedRightArmwear != null) {
this.bipedRightArmwear.addBox(armX, armY, armZ, armWidth, 12, 4, stretch + 0.25f); bipedRightArmwear.addBox(armX, armY, armZ, armWidth, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3, yOffset + rarmY, 0); bipedRightArmwear.setRotationPoint(-3, yOffset + rarmY, 0);
} }
if (this.bipedLeftLegwear != null) { if (bipedLeftLegwear != null) {
this.bipedLeftLegwear.addBox(armX, armY, armZ, 4, 12, 4, stretch + 0.25f); bipedLeftLegwear.addBox(armX, armY, armZ, 4, 12, 4, stretch + 0.25f);
this.bipedRightLegwear.setRotationPoint(3, yOffset, 0); bipedRightLegwear.setRotationPoint(3, yOffset, 0);
} }
if (bipedRightLegwear != null) { if (bipedRightLegwear != null) {
this.bipedRightLegwear.addBox(armX, armY, armZ, 4, 12, 4, stretch + 0.25f); bipedRightLegwear.addBox(armX, armY, armZ, 4, 12, 4, stretch + 0.25f);
this.bipedRightLegwear.setRotationPoint(-3, yOffset, 0); bipedRightLegwear.setRotationPoint(-3, yOffset, 0);
} }
this.unicornArmLeft .addBox(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f); unicornArmLeft .addBox(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f);
this.unicornArmRight.addBox(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f); unicornArmRight.addBox(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f);
this.unicornArmLeft .setRotationPoint(5, yOffset + 2, 0); unicornArmLeft .setRotationPoint(5, yOffset + 2, 0);
this.unicornArmRight.setRotationPoint(-5, yOffset + 2, 0); unicornArmRight.setRotationPoint(-5, yOffset + 2, 0);
} }
@Override @Override
public void renderCape(float scale) { public void renderCape(float scale) {
this.bipedCape.render(scale); bipedCape.render(scale);
} }
} }

View file

@ -61,25 +61,25 @@ public class ModelSkeletonPony extends ModelMobPony {
pushMatrix(); pushMatrix();
translate(0.05F, -0.21F, 0); translate(0.05F, -0.21F, 0);
scale(0.5F, 1.15F, 0.5F); scale(0.5F, 1.15F, 0.5F);
this.bipedLeftArm.render(this.scale); 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); scale(0.5F, 1.2F, 0.5F);
this.bipedRightArm.render(this.scale); 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); scale(0.5F, 1.2F, 0.5F);
this.bipedLeftLeg.render(this.scale); 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); scale(0.5F, 1.15F, 0.5F);
this.bipedRightLeg.render(this.scale); bipedRightLeg.render(this.scale);
popMatrix(); popMatrix();
} }
} }

View file

@ -33,7 +33,7 @@ public class ModelVillagerPony extends ModelPlayerPony {
super.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); super.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
if (entityIn instanceof EntityVillager) { if (entityIn instanceof EntityVillager) {
this.bipedBody.postRender(this.scale); bipedBody.postRender(this.scale);
int profession = ((EntityVillager) entityIn).getProfession(); int profession = ((EntityVillager) entityIn).getProfession();
if (profession < 2) { if (profession < 2) {
bag.render(scale); bag.render(scale);
@ -43,49 +43,44 @@ public class ModelVillagerPony extends ModelPlayerPony {
apron.render(scale); apron.render(scale);
} }
} }
} }
@Override @Override
protected void initTextures() { protected void initTextures() {
super.initTextures(); super.initTextures();
bag = new PlaneRenderer(this, 56, 19).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z); bag = new PlaneRenderer(this, 56, 19);
apron = new PlaneRenderer(this, 56, 16).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z); apron = new PlaneRenderer(this, 56, 16);
trinket = new PlaneRenderer(this, 0, 3).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z); trinket = new PlaneRenderer(this, 0, 3);
} }
@Override @Override
protected void initPositions(float yOffset, float stretch) { protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch); super.initPositions(yOffset, stretch);
bag.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
bag.setTextureOffset(56, 29); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
bag.addWestPlane(-7, -5, -4, 6, 8, stretch); .tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front
bag.addWestPlane(-4, -5, -4, 6, 8, stretch); .addBackPlane( 4, -5, -4, 3, 6, stretch) //left bag front
bag.addWestPlane( 4, -5, -4, 6, 8, stretch); .tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back
bag.addWestPlane( 7, -5, -4, 6, 8, stretch); .addBackPlane( 5, -5, 4, 3, 6, stretch) //left bag back
.tex(56, 29).addWestPlane(-7, -5, -4, 6, 8, stretch) //right bag outside
.addWestPlane( 7, -5, -4, 6, 8, stretch) //left bag outside
.addWestPlane(-4, -5, -4, 6, 8, stretch) //right bag inside
.addWestPlane( 4, -5, -4, 6, 8, stretch) //left bag inside
.tex(56, 31).addTopPlane(-4, -4.5F, -1, 8, 1, stretch) //strap front
.addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back
.child(0).tex(56, 16).addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top
.addTopPlane(2, -5, -13, 8, 3, stretch) //left bag top
.tex(56, 22).addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom
.addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom
.rotateAngleY = 4.712389F;
PlaneRenderer rotatedPieces = new PlaneRenderer(this, 56, 16); apron.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
rotatedPieces.rotateAngleY = 4.712389F; .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
bag.addChild(rotatedPieces); .addBackPlane(-4, -4, -9, 8, 10, stretch);
trinket.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
rotatedPieces.addTopPlane(2, -5, -2, 8, 3, stretch); .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
rotatedPieces.addTopPlane(2, -5, -13, 8, 3, stretch); .addBackPlane(-2, -4, -9, 4, 5, stretch);
rotatedPieces.setTextureOffset(56, 22);
rotatedPieces.addBottomPlane(2, 1, -2, 8, 3, stretch);
bag.setTextureOffset(56, 22);
bag.addBottomPlane(2, 1, -13, 8, 3, stretch);
bag.setTextureOffset(56, 25);
bag.addBackPlane(-7, -5, -4, 3, 6, stretch);
bag.addBackPlane( 4, -5, -4, 3, 6, stretch);
bag.setTextureOffset(59, 25);
bag.addBackPlane(-7, -5, 4, 3, 6, stretch);
bag.addBackPlane( 5, -5, 4, 3, 6, stretch);
bag.setTextureOffset(56, 31);
bag.addTopPlane(-4, -4.5F, -1, 8, 1, stretch);
bag.addTopPlane(-4, -4.5F, 0, 8, 1, stretch);
apron.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z).addBackPlane(-4, -4, -9, 8, 10, stretch);
trinket.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z).addBackPlane(-2, -4, -9, 4, 5, stretch);
} }
} }

View file

@ -33,8 +33,8 @@ public class HornGlowRenderer extends BasePonyRenderer<HornGlowRenderer> {
} }
@Override @Override
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
this.cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, a)); cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, a));
} }
@Override @Override
@ -42,4 +42,9 @@ public class HornGlowRenderer extends BasePonyRenderer<HornGlowRenderer> {
super.render(scale); super.render(scale);
color(1, 1, 1, 1); color(1, 1, 1, 1);
} }
@Override
protected HornGlowRenderer copySelf() {
return new HornGlowRenderer(baseModel, textureOffsetX, textureOffsetY);
}
} }

View file

@ -9,13 +9,13 @@ import com.minelittlepony.model.armour.ModelPonyArmor;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.resources.ResourcePackRepository; import net.minecraft.client.resources.ResourcePackRepository;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.EntityEquipmentSlot.Type;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -42,11 +42,12 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
@Override @Override
public void doPonyRender(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { public void doPonyRender(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
pony = ((IRenderPony) getRenderer()).getPlayerModel(); pony = ((IRenderPony) getRenderer()).getPlayerModel();
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.FEET);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.LEGS);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.CHEST);
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.HEAD);
for (EntityEquipmentSlot i : EntityEquipmentSlot.values()) {
if (i.getSlotType() == Type.ARMOR) {
renderArmor(entity, limbSwing, limbSwingAmount, ticks, ageInTicks, netHeadYaw, headPitch, scale, i);
}
}
} }
private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot) { private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot) {
@ -134,9 +135,8 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
model.bipedLeftArm.showModel = true; model.bipedLeftArm.showModel = true;
model.bipedRightLeg.showModel = !isPony; model.bipedRightLeg.showModel = !isPony;
model.bipedLeftLeg.showModel = !isPony; model.bipedLeftLeg.showModel = !isPony;
for (ModelRenderer extLeg : model.extLegs) { model.extLegLeft.showModel = isPony;
extLeg.showModel = isPony; model.extLegRight.showModel = isPony;
}
break; break;
// legs // legs
case LEGS: case LEGS:
@ -147,9 +147,8 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
model.bipedBody.showModel = !isPony; model.bipedBody.showModel = !isPony;
model.Bodypiece.showModel = !isPony; model.Bodypiece.showModel = !isPony;
model.extBody.showModel = isPony; model.extBody.showModel = isPony;
for (ModelRenderer extLeg : model.extLegs) { model.extLegLeft.showModel = isPony;
extLeg.showModel = isPony; model.extLegRight.showModel = isPony;
}
break; break;
// chest // chest
case CHEST: case CHEST:
@ -160,9 +159,7 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
// head // head
case HEAD: case HEAD:
model.bipedHead.showModel = true; model.bipedHead.showModel = true;
for (ModelRenderer head : model.extHead) { model.extHead.showModel = isPony;
head.showModel = isPony;
}
} }
} }