Remove AniParams.

This commit is contained in:
Matthew Messinger 2016-03-04 23:54:50 -05:00
parent 0ce565233c
commit 63a6ea9dc5
8 changed files with 27 additions and 53 deletions

View file

@ -10,7 +10,6 @@ import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.PonySize; import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.model.part.IPonyPart; import com.brohoof.minelittlepony.model.part.IPonyPart;
import com.brohoof.minelittlepony.model.pony.ModelPlayerPony; import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.PlaneRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -62,7 +61,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
protected void initPositions(float yOffset, float stretch) {} protected void initPositions(float yOffset, float stretch) {}
protected void animate(AniParams var1) {} protected void animate(float move, float swing, float tick, float horz, float vert) {}
protected void render() {} protected void render() {}
@ -104,10 +103,9 @@ public abstract class AbstractPonyModel extends ModelPlayer {
super.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, entityIn); super.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, entityIn);
return; return;
} }
AniParams ani = new AniParams(Move, Moveswing, Loop, Right, Down); this.animate(Move, Moveswing, Loop, Right, Down);
this.animate(ani);
for (IPonyPart part : modelParts) { for (IPonyPart part : modelParts) {
part.animate(metadata, ani); part.animate(metadata, Move, Moveswing, Loop, Right, Down);
} }
this.steveRightArm.rotateAngleX = MathHelper.cos(Move * 0.6662F + (float) Math.PI) * 2.0F * Moveswing * 0.5F; this.steveRightArm.rotateAngleX = MathHelper.cos(Move * 0.6662F + (float) Math.PI) * 2.0F * Moveswing * 0.5F;
this.steveRightArm.rotateAngleY = 0; this.steveRightArm.rotateAngleY = 0;

View file

@ -3,7 +3,6 @@ package com.brohoof.minelittlepony.model.part;
import com.brohoof.minelittlepony.PonyData; import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.renderer.AniParams;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -23,8 +22,8 @@ public abstract class AbstractHeadPart implements IPonyPart {
} }
@Override @Override
public final void animate(PonyData data, AniParams ani) { public final void animate(PonyData data, float move, float swing, float tick, float horz, float vert) {
rotateHead(ani.horz, ani.vert); rotateHead(horz, vert);
if (pony.isSneak && !pony.isFlying) { if (pony.isSneak && !pony.isFlying) {
position(0, 6, -2); position(0, 6, -2);
} else { } else {

View file

@ -2,13 +2,12 @@ package com.brohoof.minelittlepony.model.part;
import com.brohoof.minelittlepony.PonyData; import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.renderer.AniParams;
public interface IPonyPart { public interface IPonyPart {
void init(AbstractPonyModel pony, float yOffset, float stretch); void init(AbstractPonyModel pony, float yOffset, float stretch);
void animate(PonyData data, AniParams ani); void animate(PonyData metadata, float move, float moveswing, float loop, float right, float down);
void render(PonyData data, float scale); void render(PonyData data, float scale);

View file

@ -4,7 +4,6 @@ import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.PonyModelConstants; import com.brohoof.minelittlepony.model.PonyModelConstants;
import com.brohoof.minelittlepony.renderer.AniParams;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -90,7 +89,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
} }
@Override @Override
public void animate(PonyData metadata, AniParams ani) { public void animate(PonyData metadata, float move, float swing, float tick, float horz, float vert) {
float bodySwingRotation = 0.0F; float bodySwingRotation = 0.0F;
if (pony.swingProgress > -9990.0F && (!metadata.getRace().hasHorn() || metadata.getGlowColor() == 0)) { if (pony.swingProgress > -9990.0F && (!metadata.getRace().hasHorn() || metadata.getGlowColor() == 0)) {
@ -105,7 +104,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
if (pony.isSneak && !pony.isFlying) { if (pony.isSneak && !pony.isFlying) {
this.sneak(); this.sneak();
} else { } else {
this.unsneak(ani.tick); this.unsneak(tick);
} }

View file

@ -10,7 +10,6 @@ import com.brohoof.minelittlepony.model.part.PegasusWings;
import com.brohoof.minelittlepony.model.part.PonyEars; import com.brohoof.minelittlepony.model.part.PonyEars;
import com.brohoof.minelittlepony.model.part.PonySnout; import com.brohoof.minelittlepony.model.part.PonySnout;
import com.brohoof.minelittlepony.model.part.UnicornHorn; import com.brohoof.minelittlepony.model.part.UnicornHorn;
import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.PlaneRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
@ -42,10 +41,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
@Override @Override
public void animate(AniParams aniparams) { public void animate(float move, float swing, float tick, float horz, float vert) {
this.checkRainboom(aniparams.swing); this.checkRainboom(swing);
this.rotateHead(aniparams.horz, aniparams.vert); this.rotateHead(horz, vert);
this.swingTailZ(aniparams.move, aniparams.swing); this.swingTailZ(move, swing);
float bodySwingRotation = 0.0F; float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) { 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; bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
@ -75,7 +74,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedHead.offsetZ = 0f; this.bipedHead.offsetZ = 0f;
this.bipedHeadwear.offsetY = 0f; this.bipedHeadwear.offsetY = 0f;
this.bipedHeadwear.offsetZ = 0f; this.bipedHeadwear.offsetZ = 0f;
this.setLegs(aniparams.move, aniparams.swing, aniparams.tick); this.setLegs(move, swing, tick);
this.holdItem(); this.holdItem();
this.swingItem(this.swingProgress); this.swingItem(this.swingProgress);
if (this.isSneak && !this.isFlying) { if (this.isSneak && !this.isFlying) {
@ -112,20 +111,20 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(aniparams.tick); this.swingArms(tick);
this.setHead(0.0F, 0.0F, 0.0F); this.setHead(0.0F, 0.0F, 0.0F);
for (k1 = 0; k1 < tailstop; ++k1) { for (k1 = 0; k1 < tailstop; ++k1) {
setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK);
if (this.rainboom) { if (this.rainboom) {
this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(aniparams.move); this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(move);
} else { } else {
this.Tail[k1].rotateAngleX = 0.5F * aniparams.swing; this.Tail[k1].rotateAngleX = 0.5F * swing;
} }
} }
if (!this.rainboom) { if (!this.rainboom) {
this.swingTailX(aniparams.tick); this.swingTailX(tick);
} }
} }
@ -142,11 +141,11 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
} }
if (this.aimedBow) { if (this.aimedBow) {
this.aimBow(aniparams.tick); this.aimBow(tick);
} }
this.fixSpecialRotations(); this.fixSpecialRotations();
this.fixSpecialRotationPoints(aniparams.move); this.fixSpecialRotationPoints(move);
animateWears(); animateWears();

View file

@ -1,6 +1,5 @@
package com.brohoof.minelittlepony.model.pony; package com.brohoof.minelittlepony.model.pony;
import com.brohoof.minelittlepony.renderer.AniParams;
import com.brohoof.minelittlepony.renderer.PlaneRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -18,8 +17,8 @@ public class ModelVillagerPony extends ModelPlayerPony {
} }
@Override @Override
public void animate(AniParams aniparams) { public void animate(float move, float swing, float tick, float horz, float vert) {
super.animate(aniparams); super.animate(move, swing, tick, horz, vert);
float bodySwingRotation = 0.0F; float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) { 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; bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;

View file

@ -1,7 +1,6 @@
package com.brohoof.minelittlepony.model.pony.armor; package com.brohoof.minelittlepony.model.pony.armor;
import com.brohoof.minelittlepony.model.pony.ModelPlayerPony; import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
import com.brohoof.minelittlepony.renderer.AniParams;
import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
@ -25,9 +24,9 @@ public class ModelPonyArmor extends ModelPlayerPony {
} }
@Override @Override
public void animate(AniParams aniparams) { public void animate(float move, float swing, float tick, float horz, float vert) {
this.checkRainboom(aniparams.swing); this.checkRainboom(swing);
this.rotateHead(aniparams.horz, aniparams.vert); this.rotateHead(horz, vert);
float bodySwingRotation = 0.0F; float bodySwingRotation = 0.0F;
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) { 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; bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
@ -41,7 +40,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.extHead[0].offsetZ = 0f; this.extHead[0].offsetZ = 0f;
this.extHead[1].offsetY = 0f; this.extHead[1].offsetY = 0f;
this.extHead[1].offsetZ = 0f; this.extHead[1].offsetZ = 0f;
this.setLegs(aniparams.move, aniparams.swing, aniparams.tick); this.setLegs(move, swing, tick);
this.holdItem(); this.holdItem();
this.swingItem(this.swingProgress); this.swingItem(this.swingProgress);
if (this.isSneak && !this.isFlying) { if (this.isSneak && !this.isFlying) {
@ -72,7 +71,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
this.swingArms(aniparams.tick); this.swingArms(tick);
this.setHead(0.0F, 0.0F, 0.0F); this.setHead(0.0F, 0.0F, 0.0F);
} }
@ -82,7 +81,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
} }
if (this.aimedBow) { if (this.aimedBow) {
this.aimBow(aniparams.tick); this.aimBow(tick);
} }
// this.fixSpecialRotationPoints(aniparams.move); // this.fixSpecialRotationPoints(aniparams.move);

View file

@ -1,18 +0,0 @@
package com.brohoof.minelittlepony.renderer;
public class AniParams {
public float move;
public float swing;
public float tick;
public float horz;
public float vert;
public AniParams(float move, float swing, float tick, float horz, float vert) {
this.move = move;
this.swing = swing;
this.tick = tick;
this.horz = horz;
this.vert = vert;
}
}