Add sitting animation. Also fix armor

This commit is contained in:
Matthew Messinger 2016-01-26 03:20:12 -05:00
parent e5559a5854
commit d6f346eff9
8 changed files with 117 additions and 171 deletions

View file

@ -102,7 +102,7 @@ public class Pony {
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) {
return false;
}
return player.capabilities.isFlying || !(player.onGround || player.isOnLadder() || player.isInWater());
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater());
}
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {

View file

@ -20,6 +20,7 @@ import net.minecraft.client.model.ModelPlayer;
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.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
@ -32,9 +33,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
public ModelRenderer steveRightArm;
public ModelRenderer steveLeftArmwear;
public ModelRenderer steveRightArmwear;
public boolean isArmour = false;
public boolean isVillager;
public boolean isFlying;
public boolean isSleeping;
@ -169,11 +168,11 @@ public abstract class AbstractPonyModel extends ModelPlayer {
}
public void transform(BodyPart part) {
if (this.isRiding && !this.isArmour) {
translate(0.0F, -0.56F, -0.46F);
if (this.isRiding) {
translate(0.0F, -0.6F, -0.2F);
}
if (this.isSleeping && !this.isArmour) {
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);
@ -182,13 +181,16 @@ public abstract class AbstractPonyModel extends ModelPlayer {
}
if (this.metadata.getSize() == PonySize.FOAL || isChild) {
if (this.isSneak && !this.isFlying && !this.isArmour) {
if (this.isSneak && !this.isFlying) {
translate(0.0F, -0.12F, 0.0F);
}
if (this.isSleeping && !this.isArmour) {
if (this.isSleeping) {
translate(0.0F, -1.0F, 0.25F);
}
if (this.isRiding) {
translate(0, -.1, 0);
}
switch (part) {
case NECK:
case HEAD:
@ -220,7 +222,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
}
} else if (this.metadata.getSize() == PonySize.LARGE) {
if (this.isSleeping && !this.isArmour) {
if (this.isSleeping) {
translate(0.0F, -0.47F, 0.2F);
}
@ -228,7 +230,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
case HEAD:
translate(0.0F, -0.17F, -0.04F);
if (this.isSleeping && !this.isArmour) {
if (this.isSleeping) {
translate(0.0F, 0.0F, -0.1F);
}
@ -257,7 +259,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
break;
}
} else if (this.metadata.getSize() == PonySize.TALL) {
if (this.isSleeping && !this.isArmour) {
if (this.isSleeping) {
translate(0.0F, -0.43F, 0.25F);
}
@ -289,7 +291,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
break;
}
} else {
if (this.isSleeping && !this.isArmour) {
if (this.isSleeping) {
translate(0.0F, -0.535F, 0.25F);
}
}
@ -302,8 +304,6 @@ public abstract class AbstractPonyModel extends ModelPlayer {
AbstractPonyModel pony = (AbstractPonyModel) model;
this.isFlying = pony.isFlying;
this.isSleeping = pony.isSleeping;
this.isVillager = pony.isVillager;
}
}
}

View file

@ -7,10 +7,13 @@ public interface PonyModelConstants {
float BODY_CENTRE_Z = 6.0F;
float BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F;
float BODY_ROTATE_ANGLE_X_SNEAK = 0.4F;
float BODY_ROTATE_ANGLE_X_RIDING = (float) (Math.PI * 3.8);
float BODY_RP_Y_NOTSNEAK = 0.0F;
float BODY_RP_Y_SNEAK = 7.0F;
float BODY_RP_Y_RIDING = 3;
float BODY_RP_Z_NOTSNEAK = 0.0F;
float BODY_RP_Z_SNEAK = -4.0F;
float BODY_RP_Z_RIDING = 6F;
float EXT_WING_ROTATE_ANGLE_X = 2.5F;
float FIRSTP_ARM_CENTRE_X = -1.0F;
float FIRSTP_ARM_CENTRE_Y = 4.0F;

View file

@ -5,6 +5,8 @@ import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.renderer.AniParams;
import net.minecraft.client.renderer.GlStateManager;
public abstract class AbstractHeadPart implements IPonyPart {
private AbstractPonyModel pony;
@ -13,10 +15,11 @@ public abstract class AbstractHeadPart implements IPonyPart {
public void init(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony;
}
@Override
public void render(PonyData data, float scale) {
pony.transform(BodyPart.HEAD);
GlStateManager.translate(pony.bipedHead.offsetX, pony.bipedHead.offsetY, pony.bipedHead.offsetZ);
}
@Override

View file

@ -117,11 +117,19 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
}
if (pony.isSneak && !pony.isFlying) {
this.sneak();
} else if (metadata.getRace().hasWings()) {
} else {
this.unsneak(ani.tick);
}
float angle = pony.isRiding ? (float) (Math.PI * .3) : ROTATE_90;
for (int i = 0; i < this.leftWing.length; i++) {
this.leftWing[i].rotateAngleX = angle;
}
for (int i = 0; i < this.rightWing.length; i++) {
this.rightWing[i].rotateAngleX = angle;
}
// Special
this.leftWingExt[1].rotateAngleX -= 0.85F;
this.leftWingExt[2].rotateAngleX -= 0.75F;

View file

@ -12,7 +12,7 @@ import com.google.common.collect.ImmutableMap;
public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
private Map<PonyGender, PlaneRenderer[]> map = ImmutableMap.<PonyGender, PlaneRenderer[]> builder()
private static final Map<PonyGender, PlaneRenderer[]> MUZZLES = ImmutableMap.<PonyGender, PlaneRenderer[]> builder()
.put(PonyGender.MARE, new PlaneRenderer[10])
.put(PonyGender.STALLION, new PlaneRenderer[5])
.build();
@ -21,7 +21,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
public void init(AbstractPonyModel pony, float yOffset, float stretch) {
super.init(pony, yOffset, stretch);
PlaneRenderer[] muzzle = map.get(PonyGender.MARE);
PlaneRenderer[] muzzle = MUZZLES.get(PonyGender.MARE);
muzzle[0] = new PlaneRenderer(pony, 10, 14);
muzzle[1] = new PlaneRenderer(pony, 11, 13);
muzzle[2] = new PlaneRenderer(pony, 9, 14);
@ -54,7 +54,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
muzzle[9].addSidePlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch);
muzzle[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle = map.get(PonyGender.STALLION);
muzzle = MUZZLES.get(PonyGender.STALLION);
muzzle[0] = new PlaneRenderer(pony, 10, 13);
muzzle[1] = new PlaneRenderer(pony, 10, 13);
muzzle[2] = new PlaneRenderer(pony, 18, 7);
@ -77,7 +77,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
public void render(PonyData data, float scale) {
super.render(data, scale);
if (MineLittlePony.getConfig().snuzzles && data.getGender() != null) {
PlaneRenderer[] muzzle = map.get(data.getGender());
PlaneRenderer[] muzzle = MUZZLES.get(data.getGender());
for (int i = 0; i < muzzle.length; i++) {
muzzle[i].render(scale);
}
@ -86,7 +86,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
@Override
protected void position(float posX, float posY, float posZ) {
for (PlaneRenderer[] pr : map.values()) {
for (PlaneRenderer[] pr : MUZZLES.values()) {
for (PlaneRenderer p : pr) {
getPony().setRotationPoint(p, posX, posY, posZ);
}
@ -95,7 +95,7 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
@Override
protected void rotate(float rotX, float rotY) {
for (PlaneRenderer[] pr : map.values()) {
for (PlaneRenderer[] pr : MUZZLES.values()) {
for (PlaneRenderer p : pr) {
p.rotateAngleX = rotX;
p.rotateAngleY = rotY;

View file

@ -10,6 +10,7 @@ import java.util.Random;
import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.PonyModelConstants;
import com.brohoof.minelittlepony.model.part.PegasusWings;
import com.brohoof.minelittlepony.model.part.PonyEars;
@ -77,6 +78,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.Tail[k1].rotateAngleY = bodySwingRotation;
}
this.bipedHead.offsetY = 0f;
this.bipedHead.offsetZ = 0f;
this.bipedHeadwear.offsetY = 0f;
this.bipedHeadwear.offsetZ = 0f;
this.setLegs(aniparams.move, aniparams.swing, aniparams.tick);
this.holdItem();
this.swingItem(this.swingProgress);
@ -85,7 +90,31 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.sneakLegs();
this.setHead(0.0F, 6.0F, -2.0F);
this.sneakTail();
} else if (this.isRiding) {
this.adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
this.adjustNeck((float) (Math.PI * 1), 9, 1);
this.bipedHead.offsetY = .1f;
this.bipedHead.offsetZ = .1f;
this.bipedHeadwear.offsetY = .1f;
this.bipedHeadwear.offsetZ = .1f;
this.bipedLeftLeg.rotationPointZ = 15;
this.bipedLeftLeg.rotationPointY = 21;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * 1.5);
this.bipedLeftLeg.rotateAngleY = -.2f;
this.bipedRightLeg.rotationPointZ = 15;
this.bipedRightLeg.rotationPointY = 21;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * 1.5);
this.bipedRightLeg.rotateAngleY = .2f;
for (int i = 0; i < Tail.length; ++i) {
this.setRotationPoint(this.Tail[i], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
this.Tail[i].rotationPointZ = 15;
this.Tail[i].rotationPointY = 14;
}
} else {
this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
@ -127,6 +156,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.fixSpecialRotationPoints(aniparams.move);
animateWears();
}
private void animateWears() {
@ -470,146 +500,27 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
@Override
public void render() {
if (this.isRiding && !this.isArmour) {
translate(0.0F, -0.56F, -0.46F);
}
if (this.isSleeping && !this.isArmour) {
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);
}
pushMatrix();
this.transform(BodyPart.HEAD);
this.renderHead();
popMatrix();
if (this.metadata.getSize() == PonySize.FOAL || isChild) {
if (this.isSneak && !this.isFlying && !this.isArmour) {
translate(0.0F, -0.12F, 0.0F);
}
pushMatrix();
this.transform(BodyPart.NECK);
this.renderNeck();
popMatrix();
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -1.0F, 0.25F);
}
pushMatrix();
this.transform(BodyPart.BODY);
this.renderBody();
this.renderTail();
popMatrix();
pushMatrix();
translate(0.0F, 0.76F, 0.0F);
scale(0.9F, 0.9F, 0.9F);
this.renderHead();
if (this.isSneak && !this.isFlying) {
translate(0.0F, -0.01F, 0.15F);
}
this.renderNeck();
popMatrix();
pushMatrix();
translate(0.0F, 0.76F, -0.04F);
scale(0.6F, 0.6F, 0.6F);
this.renderBody();
this.renderTail();
popMatrix();
pushMatrix();
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.rainboom) {
translate(0.0F, -0.08F, 0.0F);
}
this.renderLegs();
popMatrix();
} else if (this.metadata.getSize() == PonySize.LARGE) {
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -0.47F, 0.2F);
}
pushMatrix();
translate(0.0F, -0.17F, -0.04F);
if (this.isSleeping && !this.isArmour) {
translate(0.0F, 0.0F, -0.1F);
}
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.15F, 0.0F);
}
this.renderHead();
popMatrix();
pushMatrix();
translate(0.0F, -0.15F, -0.07F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.0F, -0.05F);
}
this.renderNeck();
popMatrix();
pushMatrix();
translate(0.0F, -0.2F, -0.04F);
scale(1.15F, 1.2F, 1.2F);
this.renderBody();
popMatrix();
pushMatrix();
translate(0.0F, -0.2F, 0.08F);
this.renderTail();
popMatrix();
pushMatrix();
translate(0.0F, -0.14F, 0.0F);
scale(1.15F, 1.12F, 1.15F);
this.renderLegs();
popMatrix();
} else if (this.metadata.getSize() == PonySize.TALL) {
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -0.43F, 0.25F);
}
pushMatrix();
translate(0.0F, -0.15F, 0.01F);
if (this.isSneak && !this.isFlying) {
translate(0.0F, 0.05F, 0.0F);
}
this.renderHead();
popMatrix();
pushMatrix();
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);
}
this.renderNeck();
popMatrix();
pushMatrix();
translate(0.0F, -0.1F, 0.0F);
scale(1.0F, 1.0F, 1.0F);
this.renderBody();
this.renderTail();
popMatrix();
pushMatrix();
translate(0.0F, -0.25F, 0.03F);
scale(1.0F, 1.18F, 1.0F);
if (this.rainboom) {
translate(0.0F, 0.05F, 0.0F);
}
this.renderLegs();
popMatrix();
} else {
if (this.isSleeping && !this.isArmour) {
translate(0.0F, -0.535F, 0.25F);
}
this.renderHead();
this.renderNeck();
this.renderBody();
this.renderTail();
this.renderLegs();
}
pushMatrix();
this.transform(BodyPart.LEGS);
this.renderLegs();
popMatrix();
}
protected void renderHead() {
@ -839,7 +750,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightArmwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);
this.bipedRightArmwear.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F);
}
this.bipedLeftArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedLeftArm.addBox(-3.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch);
this.bipedLeftArm.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F);
if (this.bipedLeftArmwear != null) {
this.bipedLeftArmwear.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + 0.25f);

View file

@ -1,6 +1,5 @@
package com.brohoof.minelittlepony.model.pony.armor;
import com.brohoof.minelittlepony.model.part.PonyEars;
import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
import com.brohoof.minelittlepony.renderer.AniParams;
@ -17,13 +16,12 @@ public class ModelPonyArmor extends ModelPlayerPony {
public ModelPonyArmor() {
super(false);
this.isArmour = true;
this.textureHeight = 32;
}
@Override
protected void addParts() {
modelParts.add(new PonyEars());
// modelParts.add(new PonyEars());
}
@Override
@ -31,13 +29,18 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.checkRainboom(aniparams.swing);
this.rotateHead(aniparams.horz, aniparams.vert);
float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && !this.metadata.getRace().hasHorn()) {
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
}
this.bipedBody.rotateAngleY = bodySwingRotation * 0.2F;
this.Bodypiece.rotateAngleY = bodySwingRotation * 0.2F;
this.extBody.rotateAngleY = bodySwingRotation * 0.2F;
this.bipedHead.offsetY = 0f;
this.bipedHead.offsetZ = 0f;
this.extHead[0].offsetY = 0f;
this.extHead[0].offsetZ = 0f;
this.extHead[1].offsetY = 0f;
this.extHead[1].offsetZ = 0f;
this.setLegs(aniparams.move, aniparams.swing, aniparams.tick);
this.holdItem();
this.swingItem(this.swingProgress);
@ -45,15 +48,33 @@ public class ModelPonyArmor extends ModelPlayerPony {
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) {
this.adjustBody(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
this.bipedHead.offsetY = .1f;
this.bipedHead.offsetZ = .1f;
this.extHead[0].offsetY = .1f;
this.extHead[0].offsetZ = .1f;
this.extHead[1].offsetY = .1f;
this.extHead[1].offsetZ = .1f;
this.bipedLeftLeg.rotationPointZ = 15;
this.bipedLeftLeg.rotationPointY = 21;
this.bipedLeftLeg.rotateAngleX = (float) (Math.PI * 1.5);
this.bipedLeftLeg.rotateAngleY = -.2f;
this.bipedRightLeg.rotationPointZ = 15;
this.bipedRightLeg.rotationPointY = 21;
this.bipedRightLeg.rotateAngleX = (float) (Math.PI * 1.5);
this.bipedRightLeg.rotateAngleY = .2f;
} else {
this.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.extLegs[0].rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.extLegs[1].rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(aniparams.tick);
this.setHead(0.0F, 0.0F, 0.0F);
}
if (this.isSleeping) {
@ -64,7 +85,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.aimBow(aniparams.tick);
}
this.fixSpecialRotationPoints(aniparams.move);
// this.fixSpecialRotationPoints(aniparams.move);
}
@Override