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;
import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.model.ponies.ModelPlayerPony;
import com.minelittlepony.pony.data.IPonyData;
import com.minelittlepony.pony.data.PonyData;
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.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
import java.util.Random;
@ -17,18 +17,33 @@ import java.util.Random;
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 {
/**
* The model's current scale.
*/
protected float scale = 0.0625F;
public boolean isFlying;
public boolean isSleeping;
/**
* Associcated pony data.
*/
public IPonyData metadata = new PonyData();
/**
* Vertical pitch whilst flying.
*/
public float motionPitch;
/**
* Flag indicating that this model is performing a rainboom (flight).
*/
public boolean rainboom;
public AbstractPonyModel(boolean arms) {
super(0, arms);
}
@ -40,7 +55,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
*/
public void init(float yOffset, float stretch) {
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) {
if (doCancelRender()) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
return;
}
}
@ -73,10 +87,35 @@ public abstract class AbstractPonyModel extends ModelPlayer {
return false;
}
public static void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) {
aRenderer.rotationPointX += shiftX;
aRenderer.rotationPointY += shiftY;
aRenderer.rotationPointZ += shiftZ;
/**
* Returns true if this model is on the ground and crouching.
*/
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,135 +144,111 @@ public abstract class AbstractPonyModel extends ModelPlayer {
* FIXME: Too long! Is there a better way to do this?
*/
public void transform(BodyPart part) {
if (this.isRiding) {
translate(0.0F, -0.6F, -0.2F);
if (isRiding) translate(0, -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) {
rotate(90.0F, 0.0F, 1.0F, 0.0F);
rotate(270.0F, 0.0F, 0.0F, 1.0F);
rotate(90.0F, 0.0F, 1.0F, 0.0F);
rotate(180.0F, 0.0F, 0.0F, 1.0F);
rotate(180.0F, 0.0F, 1.0F, 0.0F);
}
if (this.metadata.getSize() == PonySize.FOAL || isChild) {
if (this.isSneak && !this.isFlying) {
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) {
case NECK:
case HEAD:
translate(0.0F, 0.76F, 0.0F);
scale(0.9F, 0.9F, 0.9F);
if (part == BodyPart.HEAD)
break;
if (this.isSneak && !this.isFlying) {
translate(0.0F, -0.01F, 0.15F);
}
break;
case BODY:
case TAIL:
translate(0.0F, 0.76F, -0.04F);
scale(0.6F, 0.6F, 0.6F);
break;
case LEGS:
translate(0.0F, 0.89F, 0.0F);
scale(0.6F, 0.41F, 0.6F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.12F, 0.0F);
}
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
translate(0.0F, -0.08F, 0.0F);
}
break;
}
} else if (this.metadata.getSize() == PonySize.LARGE) {
if (this.isSleeping) {
translate(0.0F, -0.7F, 0.2F);
}
switch (part) {
case HEAD:
translate(0.0F, -0.17F, -0.04F);
if (this.isSleeping) {
translate(0.0F, 0.0F, -0.1F);
}
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.15F, 0.0F);
}
break;
case NECK:
translate(0.0F, -0.15F, -0.07F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.0F, -0.05F);
}
break;
case BODY:
translate(0.0F, -0.2F, -0.04F);
scale(1.15F, 1.2F, 1.2F);
break;
case TAIL:
translate(0.0F, -0.2F, 0.08F);
break;
case LEGS:
translate(0.0F, -0.14F, 0.0F);
scale(1.15F, 1.12F, 1.15F);
break;
}
} else if (this.metadata.getSize() == PonySize.TALL) {
if (this.isSleeping) {
translate(0.0F, -0.65F, 0.25F);
}
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:
translate(0.0F, -0.19F, -0.01F);
scale(1.0F, 1.1F, 1.0F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, -0.06F, -0.04F);
}
break;
case BODY:
case TAIL:
translate(0.0F, -0.1F, 0.0F);
scale(1.0F, 1.0F, 1.0F);
break;
case LEGS:
translate(0.0F, -0.25F, 0.03F);
scale(1.0F, 1.18F, 1.0F);
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
translate(0.0F, 0.05F, 0.0F);
}
break;
}
if (isChild()) {
transformFoal(part);
} else if (metadata.getSize() == PonySize.LARGE) {
transformLarge(part);
} else if (metadata.getSize() == PonySize.TALL) {
transformTall(part);
} else {
if (this.isSleeping) {
translate(0.0F, -0.75F, 0.25F);
}
if (isSleeping) translate(0, -0.75F, 0.25F);
}
if (part == BodyPart.HEAD) {
rotate(motionPitch, 1F, 0F, 0F);
rotate(motionPitch, 1, 0, 0);
}
}
private void transformTall(BodyPart part) {
if (isSleeping) translate(0, -0.65F, 0.25F);
switch (part) {
case HEAD:
translate(0, -0.15F, 0.01F);
if (isCrouching()) translate(0, 0.05F, 0);
break;
case NECK:
translate(0, -0.19F, -0.01F);
scale(1, 1.1F, 1);
if (isCrouching()) translate(0, -0.06F, -0.04F);
break;
case BODY:
case TAIL:
translate(0, -0.1F, 0);
scale(1, 1, 1);
break;
case LEGS:
translate(0, -0.25F, 0.03F);
scale(1, 1.18F, 1);
if (rainboom) translate(0, 0.05F, 0);
break;
}
}
private void transformLarge(BodyPart part) {
if (this.isSleeping) translate(0, -0.7F, 0.2F);
switch (part) {
case HEAD:
translate(0, -0.17F, -0.04F);
if (isSleeping) translate(0, 0, -0.1F);
if (isCrouching()) translate(0, 0.15F, 0);
break;
case NECK:
translate(0, -0.15F, -0.07F);
if (isCrouching()) translate(0, 0, -0.05F);
break;
case BODY:
translate(0, -0.2F, -0.04F);
scale(1.15F, 1.2F, 1.2F);
break;
case TAIL:
translate(0, -0.2F, 0.08F);
break;
case LEGS:
translate(0, -0.14F, 0);
scale(1.15F, 1.12F, 1.15F);
break;
}
}
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) {
case NECK:
case HEAD:
translate(0, 0.76F, 0);
scale(0.9F, 0.9F, 0.9F);
if (part == BodyPart.HEAD)
break;
if (isCrouching()) translate(0, -0.01F, 0.15F);
break;
case BODY:
case TAIL:
translate(0, 0.76F, -0.04F);
scale(0.6F, 0.6F, 0.6F);
break;
case LEGS:
translate(0, 0.89F, 0);
scale(0.6F, 0.41F, 0.6F);
if (isCrouching()) translate(0, 0.12F, 0);
if (rainboom) translate(0, -0.08F, 0);
break;
}
}
@ -249,6 +264,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
isSleeping = pony.isSleeping;
metadata = pony.metadata;
motionPitch = pony.motionPitch;
rainboom = pony.rainboom;
}
}

View file

@ -33,10 +33,10 @@ public class ModelMobPony extends ModelPlayerPony {
if (this.rightArmPose == ArmPose.EMPTY) return;
if (!metadata.hasMagic()) {
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
} else {
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 (!metadata.hasMagic()) {
rotateArmHolding(bipedLeftArm, 1, swingProgress, tick);
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
} else {
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 static final float
BODY_CENTRE_X = 0.0F,
BODY_CENTRE_Y = 8.0F,
BODY_CENTRE_Z = 6.0F,
PI = (float)Math.PI,
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_SNEAK = 0.4F,

View file

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

View file

@ -1,34 +1,23 @@
package com.minelittlepony.model.armour;
import net.minecraft.entity.Entity;
/**
* Armour for skeleton ponies.
*
*/
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
/**
* The code here is copied from ModelMobPony, all with but one line of difference.
*/
@Override
protected void rotateRightArm(float move, float tick) {
if (this.rightArmPose == ArmPose.EMPTY) return;
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);
}
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
super.rotateLegs(move, swing, tick, entity);
aimBow(leftArmPose, rightArmPose, tick);
}
@Override
protected void fixSpecialRotationPoints(float move) {
if (this.rightArmPose != ArmPose.EMPTY && !this.metadata.hasMagic()) {
this.bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4.0F);
if (rightArmPose != ArmPose.EMPTY && !metadata.hasMagic()) {
bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4.0F);
}
}
}

View file

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

View file

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

View file

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

View file

@ -59,27 +59,27 @@ public class ModelSkeletonPony extends ModelMobPony {
@Override
protected void renderLegs() {
pushMatrix();
translate(0.05F, -0.21F, 0);
scale(0.5F, 1.15F, 0.5F);
this.bipedLeftArm.render(this.scale);
translate(0.05F, -0.21F, 0);
scale(0.5F, 1.15F, 0.5F);
bipedLeftArm.render(this.scale);
popMatrix();
pushMatrix();
translate(-0.05F, -0.21F, 0);
scale(0.5F, 1.2F, 0.5F);
this.bipedRightArm.render(this.scale);
translate(-0.05F, -0.21F, 0);
scale(0.5F, 1.2F, 0.5F);
bipedRightArm.render(this.scale);
popMatrix();
pushMatrix();
translate(0.05F, -0.21F, 0.35F);
scale(0.5F, 1.2F, 0.5F);
this.bipedLeftLeg.render(this.scale);
translate(0.05F, -0.21F, 0.35F);
scale(0.5F, 1.2F, 0.5F);
bipedLeftLeg.render(this.scale);
popMatrix();
pushMatrix();
translate(-0.05F, -0.21F, 0.35F);
scale(0.5F, 1.15F, 0.5F);
this.bipedRightLeg.render(this.scale);
translate(-0.05F, -0.21F, 0.35F);
scale(0.5F, 1.15F, 0.5F);
bipedRightLeg.render(this.scale);
popMatrix();
}
}

View file

@ -33,7 +33,7 @@ public class ModelVillagerPony extends ModelPlayerPony {
super.renderBody(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
if (entityIn instanceof EntityVillager) {
this.bipedBody.postRender(this.scale);
bipedBody.postRender(this.scale);
int profession = ((EntityVillager) entityIn).getProfession();
if (profession < 2) {
bag.render(scale);
@ -43,49 +43,44 @@ public class ModelVillagerPony extends ModelPlayerPony {
apron.render(scale);
}
}
}
@Override
protected void initTextures() {
super.initTextures();
bag = new PlaneRenderer(this, 56, 19).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z);
apron = new PlaneRenderer(this, 56, 16).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z);
trinket = new PlaneRenderer(this, 0, 3).at(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z);
bag = new PlaneRenderer(this, 56, 19);
apron = new PlaneRenderer(this, 56, 16);
trinket = new PlaneRenderer(this, 0, 3);
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
bag.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
bag.setTextureOffset(56, 29);
bag.addWestPlane(-7, -5, -4, 6, 8, stretch);
bag.addWestPlane(-4, -5, -4, 6, 8, stretch);
bag.addWestPlane( 4, -5, -4, 6, 8, stretch);
bag.addWestPlane( 7, -5, -4, 6, 8, stretch);
bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front
.addBackPlane( 4, -5, -4, 3, 6, stretch) //left bag front
.tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back
.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);
rotatedPieces.rotateAngleY = 4.712389F;
bag.addChild(rotatedPieces);
rotatedPieces.addTopPlane(2, -5, -2, 8, 3, stretch);
rotatedPieces.addTopPlane(2, -5, -13, 8, 3, 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);
apron.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addBackPlane(-4, -4, -9, 8, 10, stretch);
trinket.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.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
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) {
this.cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, a));
public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) {
cubeList.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, a));
}
@Override
@ -42,4 +42,9 @@ public class HornGlowRenderer extends BasePonyRenderer<HornGlowRenderer> {
super.render(scale);
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.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.resources.ResourcePackRepository;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.EntityEquipmentSlot.Type;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
@ -42,11 +42,12 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
@Override
public void doPonyRender(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float ticks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
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) {
@ -134,9 +135,8 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
model.bipedLeftArm.showModel = true;
model.bipedRightLeg.showModel = !isPony;
model.bipedLeftLeg.showModel = !isPony;
for (ModelRenderer extLeg : model.extLegs) {
extLeg.showModel = isPony;
}
model.extLegLeft.showModel = isPony;
model.extLegRight.showModel = isPony;
break;
// legs
case LEGS:
@ -147,9 +147,8 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
model.bipedBody.showModel = !isPony;
model.Bodypiece.showModel = !isPony;
model.extBody.showModel = isPony;
for (ModelRenderer extLeg : model.extLegs) {
extLeg.showModel = isPony;
}
model.extLegLeft.showModel = isPony;
model.extLegRight.showModel = isPony;
break;
// chest
case CHEST:
@ -160,9 +159,7 @@ public class LayerPonyArmor extends AbstractPonyLayer<EntityLivingBase> {
// head
case HEAD:
model.bipedHead.showModel = true;
for (ModelRenderer head : model.extHead) {
head.showModel = isPony;
}
model.extHead.showModel = isPony;
}
}