diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index b9371adb..37352e72 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -1,30 +1,24 @@ package com.minelittlepony.model; -import com.google.common.collect.Lists; import com.minelittlepony.PonyData; import com.minelittlepony.PonySize; -import com.minelittlepony.model.part.IPonyPart; import com.minelittlepony.model.pony.ModelHumanPlayer; import com.minelittlepony.model.pony.ModelPlayerPony; -import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelBase; 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.player.EnumPlayerModelParts; -import net.minecraft.item.EnumAction; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHandSide; import net.minecraft.util.math.MathHelper; -import java.util.List; import java.util.Random; import static net.minecraft.client.renderer.GlStateManager.rotate; import static net.minecraft.client.renderer.GlStateManager.scale; import static net.minecraft.client.renderer.GlStateManager.translate; +/** + * TODO move this into constructor and make separate classes for the races. + */ public abstract class AbstractPonyModel extends ModelPlayer { protected float scale = 0.0625F; @@ -40,7 +34,6 @@ public abstract class AbstractPonyModel extends ModelPlayer { public PonyData metadata = new PonyData(); public float motionPitch; - protected List modelParts = Lists.newArrayList(); public AbstractPonyModel(boolean arms) { super(0, arms); @@ -50,12 +43,9 @@ public abstract class AbstractPonyModel extends ModelPlayer { this.steveRightArmwear = this.bipedLeftArmwear; } - public final void init(float yOffset, float stretch) { + public void init(float yOffset, float stretch) { this.initTextures(); this.initPositions(yOffset, stretch); - for (IPonyPart part : modelParts) { - part.init(yOffset, stretch); - } } protected void initTextures() { @@ -64,46 +54,16 @@ public abstract class AbstractPonyModel extends ModelPlayer { protected void initPositions(float yOffset, float stretch) { } - protected void animate(float move, float swing, float tick, float horz, float vert, Entity entityIn) { - } - - protected void render() { - } - @Override - public void render(Entity player, float Move, float Moveswing, float Loop, float Right, float Down, float Scale) { - if (player instanceof AbstractClientPlayer) { - setModelVisibilities((AbstractClientPlayer) player); - } - if (!doCancelRender()) { - this.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, player); - GlStateManager.pushMatrix(); - this.render(); - GlStateManager.popMatrix(); - for (IPonyPart part : modelParts) { - GlStateManager.pushMatrix(); - part.render(metadata, scale); - GlStateManager.popMatrix(); - } - } else { - super.render(player, Move, Moveswing, Loop, Right, Down, Scale); - } - } - - @Override - public void setRotationAngles(float Move, float Moveswing, float Loop, float Right, float Down, float Scale, Entity entityIn) { + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { if (doCancelRender()) { - super.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, entityIn); + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); return; } - this.animate(Move, Moveswing, Loop, Right, Down, entityIn); - for (IPonyPart part : modelParts) { - 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(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount * 0.5F; this.steveRightArm.rotateAngleY = 0; this.steveRightArm.rotateAngleZ = 0; - this.steveLeftArm.rotateAngleX = MathHelper.cos(Move * 0.6662F) * 2.0F * Moveswing * 0.5F; + this.steveLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; this.steveLeftArm.rotateAngleY = 0; this.steveLeftArm.rotateAngleZ = 0; @@ -111,69 +71,6 @@ public abstract class AbstractPonyModel extends ModelPlayer { copyModelAngles(steveLeftArm, steveLeftArmwear); } - protected void setModelVisibilities(AbstractClientPlayer clientPlayer) { - ModelPlayer modelplayer = this; - - if (clientPlayer.isSpectator()) { - modelplayer.setInvisible(false); - modelplayer.bipedHead.showModel = true; - modelplayer.bipedHeadwear.showModel = true; - } else { - modelplayer.setInvisible(true); - modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT); - modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET); - modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG); - modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG); - modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE); - modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE); - modelplayer.isSneak = clientPlayer.isSneaking(); - - ItemStack main = clientPlayer.getHeldItemMainhand(); - ArmPose mainPose; - if (main.isEmpty()) { - mainPose = ArmPose.EMPTY; - } else { - mainPose = ArmPose.ITEM; - - if (clientPlayer.getItemInUseCount() > 0) { - EnumAction enumaction = main.getItemUseAction(); - - if (enumaction == EnumAction.BLOCK) { - mainPose = ArmPose.BLOCK; - } else if (enumaction == EnumAction.BOW) { - mainPose = ArmPose.BOW_AND_ARROW; - } - } - } - - ItemStack off = clientPlayer.getHeldItemOffhand(); - ArmPose offPose; - if (off.isEmpty()) { - offPose = ArmPose.EMPTY; - } else { - offPose = ArmPose.ITEM; - - if (clientPlayer.getItemInUseCount() > 0) { - EnumAction enumaction = off.getItemUseAction(); - - if (enumaction == EnumAction.BLOCK) { - offPose = ArmPose.BLOCK; - } else if (enumaction == EnumAction.BOW) { - offPose = ArmPose.BOW_AND_ARROW; - } - } - } - - if (clientPlayer.getPrimaryHand() == EnumHandSide.RIGHT) { - modelplayer.rightArmPose = mainPose; - modelplayer.leftArmPose = offPose; - } else { - modelplayer.leftArmPose = mainPose; - modelplayer.rightArmPose = offPose; - } - } - } - protected boolean doCancelRender() { return false; } diff --git a/src/main/java/com/minelittlepony/model/part/PegasusWings.java b/src/main/java/com/minelittlepony/model/PegasusWings.java similarity index 90% rename from src/main/java/com/minelittlepony/model/part/PegasusWings.java rename to src/main/java/com/minelittlepony/model/PegasusWings.java index ac54a3fc..2c8eb838 100644 --- a/src/main/java/com/minelittlepony/model/part/PegasusWings.java +++ b/src/main/java/com/minelittlepony/model/PegasusWings.java @@ -1,13 +1,15 @@ -package com.minelittlepony.model.part; +package com.minelittlepony.model; -import com.minelittlepony.PonyData; import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.PonyModelConstants; +import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; import net.minecraft.util.math.MathHelper; -public class PegasusWings implements IPonyPart, PonyModelConstants { +public class PegasusWings extends ModelBase implements PonyModelConstants { + private final AbstractPonyModel pony; @@ -17,12 +19,9 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { public ModelRenderer[] leftWingExt; public ModelRenderer[] rightWingExt; - public PegasusWings(AbstractPonyModel pony) { + public PegasusWings(AbstractPonyModel pony, float yOffset, float stretch) { this.pony = pony; - } - @Override - public void init(float yOffset, float stretch) { this.leftWing = new ModelRenderer[3]; this.rightWing = new ModelRenderer[3]; this.leftWingExt = new ModelRenderer[6]; @@ -47,10 +46,6 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { this.pony.boxList.remove(this.rightWingExt[i]); } - initPositions(yOffset, stretch); - } - - private void initPositions(float yOffset, float stretch) { this.leftWing[0].addBox(4.0F, 5.0F, 2.0F, 2, 6, 2, stretch); this.leftWing[0].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); this.leftWing[0].rotateAngleX = ROTATE_90; @@ -96,10 +91,10 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { } @Override - public void animate(PonyData metadata, float move, float swing, float tick, float horz, float vert) { + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { float bodySwingRotation = 0.0F; - if (pony.swingProgress > -9990.0F && !metadata.hasMagic()) { + if (pony.swingProgress > -9990.0F && !pony.metadata.hasMagic()) { bodySwingRotation = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F; } for (ModelRenderer aLeftWing : this.leftWing) { @@ -111,7 +106,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { if (pony.isSneak && !pony.isFlying) { this.sneak(); } else { - this.unsneak(tick); + this.unsneak(ageInTicks); } @@ -136,10 +131,12 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { } @Override - public void render(PonyData data, float scale) { + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + pony.transform(BodyPart.BODY); pony.bipedBody.postRender(scale); - if (data.getRace() != null && data.getRace().hasWings()) { + if (pony.metadata.getRace() != null && pony.metadata.getRace().hasWings()) { if (!pony.isFlying && !pony.isSneak) { for (ModelRenderer aLeftWing : this.leftWing) { diff --git a/src/main/java/com/minelittlepony/model/part/PonySnout.java b/src/main/java/com/minelittlepony/model/PonySnout.java similarity index 71% rename from src/main/java/com/minelittlepony/model/part/PonySnout.java rename to src/main/java/com/minelittlepony/model/PonySnout.java index 0c284eb6..ede56470 100644 --- a/src/main/java/com/minelittlepony/model/part/PonySnout.java +++ b/src/main/java/com/minelittlepony/model/PonySnout.java @@ -1,24 +1,21 @@ -package com.minelittlepony.model.part; +package com.minelittlepony.model; -import com.minelittlepony.PonyData; import com.minelittlepony.PonyGender; import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.renderer.PlaneRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.Entity; -public class PonySnout extends AbstractHeadPart implements PonyModelConstants { +public class PonySnout extends ModelBase implements PonyModelConstants { + + private PonyGender gender; private PlaneRenderer mare; private PlaneRenderer stallion; - public PonySnout(AbstractPonyModel pony) { - super(pony); - } - - @Override - public void init(float yOffset, float stretch) { - - mare = new PlaneRenderer(this.pony); + public PonySnout(AbstractPonyModel pony, float yOffset, float stretch) { + mare = new PlaneRenderer(pony); mare.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); mare.setTextureOffset(10, 14).addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, 0, stretch); @@ -32,7 +29,9 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants { mare.setTextureOffset(11, 12).addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); mare.setTextureOffset(12, 12).addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); - stallion = new PlaneRenderer(this.pony); + pony.bipedHead.addChild(mare); + + stallion = new PlaneRenderer(pony); stallion.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); stallion.setTextureOffset(10, 13).addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, 0, stretch); @@ -40,23 +39,17 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants { stallion.setTextureOffset(18, 7).addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); stallion.setTextureOffset(10, 13).addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); stallion.setTextureOffset(13, 13).addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); + + pony.bipedHead.addChild(stallion); } @Override - public void animate(PonyData metadata, float move, float swing, float tick, float horz, float vert) { - mare.isHidden = metadata.getGender() != PonyGender.MARE; - stallion.isHidden = metadata.getGender() != PonyGender.STALLION; + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + mare.isHidden = gender != PonyGender.MARE; + stallion.isHidden = gender != PonyGender.STALLION; } -// @Override -// public void render(PonyData data, float scale) { -// super.render(data, scale); -// if (MineLittlePony.getConfig().snuzzles && data.getGender() != null) { -// PlaneRenderer[] muzzle = MUZZLES.get(data.getGender()); -// for (int i = 0; i < muzzle.length; i++) { -// muzzle[i].render(scale); -// } -// } -// } - + public void setGender(PonyGender gender) { + this.gender = gender; + } } diff --git a/src/main/java/com/minelittlepony/model/part/UnicornHorn.java b/src/main/java/com/minelittlepony/model/UnicornHorn.java similarity index 80% rename from src/main/java/com/minelittlepony/model/part/UnicornHorn.java rename to src/main/java/com/minelittlepony/model/UnicornHorn.java index 3e939b86..adb8bd8e 100644 --- a/src/main/java/com/minelittlepony/model/part/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/model/UnicornHorn.java @@ -1,26 +1,26 @@ -package com.minelittlepony.model.part; +package com.minelittlepony.model; import com.minelittlepony.PonyData; import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.renderer.HornGlowRenderer; +import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped.ArmPose; import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; import org.lwjgl.opengl.GL11; import static net.minecraft.client.renderer.GlStateManager.*; -public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants { +public class UnicornHorn extends ModelBase implements PonyModelConstants { + protected final AbstractPonyModel pony; private ModelRenderer horn; private HornGlowRenderer[] hornglow; - public UnicornHorn(AbstractPonyModel pony) { - super(pony); - } + public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) { + this.pony = pony; - @Override - public void init(float yOffset, float stretch) { this.horn = new ModelRenderer(pony, 0, 3); this.hornglow = new HornGlowRenderer[2]; for (int i = 0; i < hornglow.length; i++) { @@ -36,8 +36,10 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants } @Override - public void render(PonyData data, float scale) { - super.render(data, scale); + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + PonyData data = pony.metadata; + if (data.getRace() != null && data.getRace().hasHorn()) { this.horn.render(scale); if ((pony.leftArmPose != ArmPose.EMPTY || pony.rightArmPose != ArmPose.EMPTY) && data.hasMagic()) { diff --git a/src/main/java/com/minelittlepony/model/part/AbstractHeadPart.java b/src/main/java/com/minelittlepony/model/part/AbstractHeadPart.java deleted file mode 100644 index 923117c6..00000000 --- a/src/main/java/com/minelittlepony/model/part/AbstractHeadPart.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.minelittlepony.model.part; - -import com.minelittlepony.PonyData; -import com.minelittlepony.model.AbstractPonyModel; - -public abstract class AbstractHeadPart implements IPonyPart { - - protected final AbstractPonyModel pony; - - public AbstractHeadPart(AbstractPonyModel pony) { - this.pony = pony; - } - - @Override - public void render(PonyData data, float scale) {} - - @Override - public void animate(PonyData metadata, float move, float swing, float tick, float horz, float vert) {} -} diff --git a/src/main/java/com/minelittlepony/model/part/IPonyPart.java b/src/main/java/com/minelittlepony/model/part/IPonyPart.java deleted file mode 100644 index 8e2b5bae..00000000 --- a/src/main/java/com/minelittlepony/model/part/IPonyPart.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.minelittlepony.model.part; - -import com.minelittlepony.PonyData; - -public interface IPonyPart { - - void init(float yOffset, float stretch); - - void render(PonyData data, float scale); - - void animate(PonyData metadata, float move, float swing, float tick, float horz, float vert); - -} diff --git a/src/main/java/com/minelittlepony/model/part/PonyEars.java b/src/main/java/com/minelittlepony/model/part/PonyEars.java deleted file mode 100644 index 3b6a20d2..00000000 --- a/src/main/java/com/minelittlepony/model/part/PonyEars.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.minelittlepony.model.part; - -import com.minelittlepony.model.AbstractPonyModel; -import com.minelittlepony.model.PonyModelConstants; - -public class PonyEars extends AbstractHeadPart implements PonyModelConstants { - - public PonyEars(AbstractPonyModel pony) { - super(pony); - } - - @Override - public void init(float yOffset, float stretch) { - - this.pony.bipedHead.setTextureOffset(12, 16); - this.pony.bipedHead.addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); - this.pony.bipedHead.mirror = true; - this.pony.bipedHead.addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); - - } - -} diff --git a/src/main/java/com/minelittlepony/model/pony/ModelPlayerPony.java b/src/main/java/com/minelittlepony/model/pony/ModelPlayerPony.java index 88c35a46..f872355c 100644 --- a/src/main/java/com/minelittlepony/model/pony/ModelPlayerPony.java +++ b/src/main/java/com/minelittlepony/model/pony/ModelPlayerPony.java @@ -3,10 +3,9 @@ package com.minelittlepony.model.pony; import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.PonyModelConstants; -import com.minelittlepony.model.part.PegasusWings; -import com.minelittlepony.model.part.PonyEars; -import com.minelittlepony.model.part.PonySnout; -import com.minelittlepony.model.part.UnicornHorn; +import com.minelittlepony.model.PegasusWings; +import com.minelittlepony.model.PonySnout; +import com.minelittlepony.model.UnicornHorn; import com.minelittlepony.renderer.PlaneRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -30,25 +29,29 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst public ModelRenderer unicornArmRight; public ModelRenderer unicornArmLeft; public PlaneRenderer[] Tail; + private PonySnout snout; + private UnicornHorn horn; + private PegasusWings wings; public ModelPlayerPony(boolean smallArms) { super(smallArms); this.smallArms = smallArms; - addParts(); } - protected void addParts() { - modelParts.add(new PonyEars(this)); - modelParts.add(new PonySnout(this)); - modelParts.add(new UnicornHorn(this)); - modelParts.add(new PegasusWings(this)); + public void init(float yOffset, float stretch) { + super.init(yOffset, stretch); + snout = new PonySnout(this, yOffset, stretch); + horn = new UnicornHorn(this, yOffset, stretch); + wings = new PegasusWings(this, yOffset, stretch); } @Override - public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) { - this.checkRainboom(entity, swing); - this.rotateHead(horz, vert); - this.swingTailZ(move, swing); + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + + this.checkRainboom(entityIn, limbSwingAmount); + this.rotateHead(netHeadYaw, headPitch); + this.swingTailZ(limbSwing, limbSwingAmount); float bodySwingRotation = 0.0F; if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) { bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F; @@ -78,9 +81,9 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst this.bipedHead.offsetZ = 0f; this.bipedHeadwear.offsetY = 0f; this.bipedHeadwear.offsetZ = 0f; - this.setLegs(move, swing, tick, entity); - this.holdItem(swing); - this.swingItem(entity, this.swingProgress); + this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn); + this.holdItem(limbSwingAmount); + this.swingItem(entityIn, this.swingProgress); if (this.isSneak && !this.isFlying) { this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); this.sneakLegs(); @@ -114,20 +117,20 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; - this.swingArms(tick); + this.swingArms(ageInTicks); this.setHead(0.0F, 0.0F, 0.0F); for (k1 = 0; k1 < tailstop; ++k1) { setRotationPoint(this.Tail[k1], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); if (this.rainboom) { - this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(move); + this.Tail[k1].rotateAngleX = ROTATE_90 + 0.1F * MathHelper.sin(limbSwing); } else { - this.Tail[k1].rotateAngleX = 0.5F * swing; + this.Tail[k1].rotateAngleX = 0.5F * limbSwingAmount; } } if (!this.rainboom) { - this.swingTailX(tick); + this.swingTailX(ageInTicks); } } @@ -143,14 +146,18 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst this.ponySleep(); } - this.aimBow(leftArmPose, rightArmPose, tick); + this.aimBow(leftArmPose, rightArmPose, ageInTicks); this.fixSpecialRotations(); - this.fixSpecialRotationPoints(move); + this.fixSpecialRotationPoints(limbSwing); animateWears(); this.bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0; + + this.snout.setGender(this.metadata.getGender()); + this.snout.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + this.wings.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); } private void animateWears() { @@ -569,11 +576,13 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst } @Override - public void render() { + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { pushMatrix(); this.transform(BodyPart.HEAD); this.renderHead(); + this.horn.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + this.snout.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); popMatrix(); pushMatrix(); @@ -584,6 +593,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst pushMatrix(); this.transform(BodyPart.BODY); this.renderBody(); + this.wings.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); this.renderTail(); popMatrix(); @@ -753,6 +763,12 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst 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); + 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); } diff --git a/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java b/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java index 12f84ebe..dd504e1d 100644 --- a/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/model/pony/ModelVillagerPony.java @@ -17,8 +17,9 @@ public class ModelVillagerPony extends ModelPlayerPony { } @Override - public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) { - super.animate(move, swing, tick, horz, vert, entity); + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); + float bodySwingRotation = 0.0F; if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) { bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F; diff --git a/src/main/java/com/minelittlepony/model/pony/armor/ModelPonyArmor.java b/src/main/java/com/minelittlepony/model/pony/armor/ModelPonyArmor.java index eeb80ae9..70c076d3 100644 --- a/src/main/java/com/minelittlepony/model/pony/armor/ModelPonyArmor.java +++ b/src/main/java/com/minelittlepony/model/pony/armor/ModelPonyArmor.java @@ -1,7 +1,6 @@ package com.minelittlepony.model.pony.armor; import com.minelittlepony.model.pony.ModelPlayerPony; -import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.math.MathHelper; @@ -19,14 +18,10 @@ public class ModelPonyArmor extends ModelPlayerPony { } @Override - protected void addParts() { - // modelParts.add(new PonyEars()); - } + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { - @Override - public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) { - this.checkRainboom(entity, swing); - this.rotateHead(horz, vert); + this.checkRainboom(entityIn, limbSwingAmount); + this.rotateHead(netHeadYaw, headPitch); float bodySwingRotation = 0.0F; if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) { bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F; @@ -40,9 +35,9 @@ public class ModelPonyArmor extends ModelPlayerPony { this.extHead[0].offsetZ = 0f; this.extHead[1].offsetY = 0f; this.extHead[1].offsetZ = 0f; - this.setLegs(move, swing, tick, entity); - this.holdItem(swing); - this.swingItem(entity, this.swingProgress); + this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn); + this.holdItem(limbSwingAmount); + this.swingItem(entityIn, this.swingProgress); if (this.isSneak && !this.isFlying) { this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); this.sneakLegs(); @@ -71,7 +66,7 @@ public class ModelPonyArmor extends ModelPlayerPony { this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; - this.swingArms(tick); + this.swingArms(ageInTicks); this.setHead(0.0F, 0.0F, 0.0F); } @@ -80,7 +75,7 @@ public class ModelPonyArmor extends ModelPlayerPony { this.ponySleep(); } - this.aimBow(leftArmPose, rightArmPose, tick); + this.aimBow(leftArmPose, rightArmPose, ageInTicks); // this.fixSpecialRotationPoints(aniparams.move); } @@ -284,10 +279,6 @@ public class ModelPonyArmor extends ModelPlayerPony { this.syncLegs(); } - @Override - protected void setModelVisibilities(AbstractClientPlayer clientPlayer) { - } - @Override public void setInvisible(boolean invisible) { super.setInvisible(invisible);