diff --git a/src/main/java/com/brohoof/minelittlepony/model/BodyPart.java b/src/main/java/com/brohoof/minelittlepony/model/BodyPart.java new file mode 100644 index 00000000..c3b03209 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/BodyPart.java @@ -0,0 +1,9 @@ +package com.brohoof.minelittlepony.model; + +public enum BodyPart { + HEAD, + BODY, + TAIL, + NECK, + LEGS, +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/ModelHornGlow.java b/src/main/java/com/brohoof/minelittlepony/model/ModelHornGlow.java index 6c0a5735..d94d1772 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/ModelHornGlow.java +++ b/src/main/java/com/brohoof/minelittlepony/model/ModelHornGlow.java @@ -2,31 +2,20 @@ package com.brohoof.minelittlepony.model; import com.brohoof.minelittlepony.renderer.HornGlowRenderer; +import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.PositionTextureVertex; import net.minecraft.client.model.TexturedQuad; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; + +public class ModelHornGlow extends ModelBox { -public class ModelHornGlow { - private PositionTextureVertex[] vertexPositions; private TexturedQuad[] quadList; - public final float posX1; - public final float posY1; - public final float posZ1; - public final float posX2; - public final float posY2; - public final float posZ2; - public String field_78247_g; @SuppressWarnings("unused") - public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, - int par7, int par8, int par9, float par10) { - this.posX1 = par4; - this.posY1 = par5; - this.posZ1 = par6; - this.posX2 = par4 + par7; - this.posY2 = par5 + par8; - this.posZ2 = par6 + par9; - this.vertexPositions = new PositionTextureVertex[8]; + public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) { + super(par1ModelRenderer, par2, par3, par4, par5, par6, par7, par8, par9, par10); + + PositionTextureVertex[] vertexPositions = new PositionTextureVertex[8]; this.quadList = new TexturedQuad[6]; float var11 = par4 + par7; float var12 = par5 + par8; @@ -57,14 +46,7 @@ public class ModelHornGlow { 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); - this.vertexPositions[0] = var32; - this.vertexPositions[1] = var15; - this.vertexPositions[2] = var16; - this.vertexPositions[3] = var17; - this.vertexPositions[4] = var18; - this.vertexPositions[5] = var19; - this.vertexPositions[6] = var20; - this.vertexPositions[7] = var21; + this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { var19, var15, var16, var20 }, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); @@ -92,16 +74,12 @@ public class ModelHornGlow { } - public void render(Tessellator par1Tessellator, float par2) { + @Override + public void render(WorldRenderer renderer, float par2) { TexturedQuad[] var3 = this.quadList; for (TexturedQuad var6 : var3) { - var6.draw(par1Tessellator.getWorldRenderer(), par2); + var6.draw(renderer, par2); } } - - public ModelHornGlow func_78244_a(String par1Str) { - this.field_78247_g = par1Str; - return this; - } } diff --git a/src/main/java/com/brohoof/minelittlepony/model/ModelPony.java b/src/main/java/com/brohoof/minelittlepony/model/ModelPony.java index 8fa67eb3..25661893 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/ModelPony.java +++ b/src/main/java/com/brohoof/minelittlepony/model/ModelPony.java @@ -1,13 +1,27 @@ package com.brohoof.minelittlepony.model; +import static net.minecraft.client.renderer.GlStateManager.rotate; +import static net.minecraft.client.renderer.GlStateManager.scale; +import static net.minecraft.client.renderer.GlStateManager.translate; + +import java.util.List; + import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.Pony; import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.PonySize; +import com.brohoof.minelittlepony.model.part.IPonyPart; +import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv; import com.brohoof.minelittlepony.renderer.AniParams; +import com.brohoof.minelittlepony.renderer.PlaneRenderer; +import com.google.common.collect.Lists; import net.minecraft.client.Minecraft; 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.client.renderer.entity.RenderPlayer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EnumPlayerModelParts; @@ -16,44 +30,35 @@ import net.minecraft.item.ItemStack; public abstract class ModelPony extends ModelPlayer { - protected float strech = 0.0F; protected float scale = 0.0625F; - public boolean issneak = false; public boolean isArmour = false; public boolean isVillager; public boolean isFlying; - public boolean isGlow; public boolean isSleeping; public PonyData metadata = new PonyData(); - public int heldItemLeft; - public int heldItemRight; - public boolean aimedBow; + protected List modelParts = Lists.newArrayList(); public ModelPony() { super(0, false); } - public void setStrech(float strech) { - this.strech = strech; + public final void init(float yOffset, float stretch) { + this.initTextures(); + this.initPositions(yOffset, stretch); + for (IPonyPart part : modelParts) { + part.init(this, yOffset, stretch); + } } - /** - * @param var1 - * @param var2 - */ - public void init(float var1, float var2) {} + protected void initTextures() {} - /** - * @param var1 - */ - public void animate(AniParams var1) {} + protected void initPositions(float yOffset, float stretch) {} - /** - * @param var1 - */ - public void render(AniParams var1) {} + protected void animate(AniParams var1) {} + + protected void render() {} @Override public void render(Entity player, float Move, float Moveswing, float Loop, float Right, float Down, float Scale) { @@ -63,7 +68,17 @@ public abstract class ModelPony extends ModelPlayer { if (!doCancelRender()) { AniParams ani = new AniParams(Move, Moveswing, Loop, Right, Down); this.animate(ani); - this.render(ani); + for (IPonyPart part : modelParts) { + part.animate(metadata, ani); + } + 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); } @@ -98,15 +113,15 @@ public abstract class ModelPony extends ModelPlayer { setModelRotationAngles(f1, f2, f3, f4, f5, f6, ent); } - public void renderModelRightArm() { + protected void renderModelRightArm() { super.renderRightArm(); } - public void renderModelLeftArm() { + protected void renderModelLeftArm() { super.renderLeftArm(); } - public void setModelRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity ent) { + protected void setModelRotationAngles(float f1, float f2, float f3, float f4, float f5, float f6, Entity ent) { super.setRotationAngles(f1, f2, f3, f4, f5, f6, ent); } @@ -152,4 +167,166 @@ public abstract class ModelPony extends ModelPlayer { return false; } + public void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) { + aRenderer.rotationPointX = setX; + aRenderer.rotationPointY = setY; + aRenderer.rotationPointZ = setZ; + } + + public void setRotationPoint(PlaneRenderer aPlaneRenderer, float setX, float setY, float setZ) { + aPlaneRenderer.rotationPointX = setX; + aPlaneRenderer.rotationPointY = setY; + aPlaneRenderer.rotationPointZ = setZ; + } + + public void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) { + aPlaneRenderer.rotationPointX += shiftX; + aPlaneRenderer.rotationPointY += shiftY; + aPlaneRenderer.rotationPointZ += shiftZ; + } + + public void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) { + aRenderer.rotationPointX += shiftX; + aRenderer.rotationPointY += shiftY; + aRenderer.rotationPointZ += shiftZ; + } + + public void transform(BodyPart part) { + 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); + } + + if (this.metadata.getSize() == PonySize.FOAL) { + if (this.isSneak && !this.isFlying && !this.isArmour) { + translate(0.0F, -0.12F, 0.0F); + } + + if (this.isSleeping && !this.isArmour) { + translate(0.0F, -1.0F, 0.25F); + } + 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 pm_newPonyAdv && ((pm_newPonyAdv) this).rainboom) { + translate(0.0F, -0.08F, 0.0F); + } + + break; + } + + } else if (this.metadata.getSize() == PonySize.LARGE) { + if (this.isSleeping && !this.isArmour) { + translate(0.0F, -0.47F, 0.2F); + } + + switch (part) { + case HEAD: + + 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); + } + + 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.PRINCESS) { + if (this.isSleeping && !this.isArmour) { + translate(0.0F, -0.43F, 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 pm_newPonyAdv && ((pm_newPonyAdv) this).rainboom) { + translate(0.0F, 0.05F, 0.0F); + } + break; + } + } else { + if (this.isSleeping && !this.isArmour) { + translate(0.0F, -0.535F, 0.25F); + } + } + } + + @Override + public void setModelAttributes(ModelBase model) { + super.setModelAttributes(model); + if (model instanceof ModelPony) { + ModelPony pony = (ModelPony) model; + this.isFlying = pony.isFlying; + this.isSleeping = pony.isSleeping; + this.isVillager = pony.isVillager; + } + } + } diff --git a/src/main/java/com/brohoof/minelittlepony/model/PonyModelConstants.java b/src/main/java/com/brohoof/minelittlepony/model/PonyModelConstants.java new file mode 100644 index 00000000..47c22528 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/PonyModelConstants.java @@ -0,0 +1,59 @@ +package com.brohoof.minelittlepony.model; + +public interface PonyModelConstants { + + float BODY_CENTRE_X = 0.0F; + float BODY_CENTRE_Y = 8.0F; + float BODY_CENTRE_Z = 6.0F; + float BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F; + float BODY_ROTATE_ANGLE_X_SNEAK = 0.4F; + float BODY_RP_Y_NOTSNEAK = 0.0F; + float BODY_RP_Y_SNEAK = 7.0F; + float BODY_RP_Z_NOTSNEAK = 0.0F; + float BODY_RP_Z_SNEAK = -4.0F; + float EXT_WING_ROTATE_ANGLE_X = 2.5F; + float FIRSTP_ARM_CENTRE_X = -1.0F; + float FIRSTP_ARM_CENTRE_Y = 4.0F; + float FIRSTP_ARM_CENTRE_Z = 0.0F; + float FRONT_LEG_RP_Y_NOTSNEAK = 8.0F; + float FRONT_LEG_RP_Y_SNEAK = 7.0F; + float HEAD_CENTRE_X = 0.0F; + float HEAD_CENTRE_Y = -1.0F; + float HEAD_CENTRE_Z = -2.0F; + float HEAD_RP_X = 0.0F; + float HEAD_RP_Y = 0.0F; + float HEAD_RP_Z = 0.0F; + float LEFT_WING_EXT_RP_X = 4.5F; + float LEFT_WING_EXT_RP_Y = 5.0F; + float LEFT_WING_EXT_RP_Z = 6.0F; + float LEFT_WING_ROTATE_ANGLE_Z_SNEAK = -6.0F; + float LEFT_WING_RP_Y_NOTSNEAK = 5.5F; + float LEFT_WING_RP_Y_SNEAK = 10.5F; + float LEFT_WING_RP_Z_NOTSNEAK = 3.0F; + float LEFT_WING_RP_Z_SNEAK = 2.0F; + float RIDING_SHIFT_Y = -10.0F; + float RIDING_SHIFT_Z = -10.0F; + float RIGHT_WING_EXT_RP_X = -4.5F; + float RIGHT_WING_EXT_RP_Y = 5.0F; + float RIGHT_WING_EXT_RP_Z = 6.0F; + float RIGHT_WING_ROTATE_ANGLE_Z_SNEAK = 6.0F; + float RIGHT_WING_RP_Y_NOTSNEAK = 6.5F; + float RIGHT_WING_RP_Y_SNEAK = 11.5F; + float RIGHT_WING_RP_Z_NOTSNEAK = 3.0F; + float RIGHT_WING_RP_Z_SNEAK = 2.0F; + float ROTATE_270 = 4.712F; + float ROTATE_90 = 1.571F; + float SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F; + float TAIL_RP_X = 0.0F; + float TAIL_RP_Y = 0.8F; + float TAIL_RP_Z = 0.0F; + float TAIL_RP_Z_NOTSNEAK = 14.0F; + float TAIL_RP_Z_SNEAK = 10.0F; + float THIRDP_ARM_CENTRE_X = 0.0F; + float THIRDP_ARM_CENTRE_Y = 10.0F; + float THIRDP_ARM_CENTRE_Z = 0.0F; + float WING_FOLDED_RP_Y = 13.0F; + float WING_FOLDED_RP_Z = -3.0F; + float NECK_ROT_X = 0.166F; + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/ScalableModelBox.java b/src/main/java/com/brohoof/minelittlepony/model/ScalableModelBox.java deleted file mode 100644 index afcd1924..00000000 --- a/src/main/java/com/brohoof/minelittlepony/model/ScalableModelBox.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.brohoof.minelittlepony.model; - -import com.brohoof.minelittlepony.renderer.ScalableModelRenderer; - -import net.minecraft.client.model.PositionTextureVertex; -import net.minecraft.client.model.TexturedQuad; -import net.minecraft.client.renderer.Tessellator; - -public class ScalableModelBox { - private PositionTextureVertex[] vertexPositions; - private TexturedQuad[] quadList; - public final float posX1; - public final float posY1; - public final float posZ1; - public final float posX2; - public final float posY2; - public final float posZ2; - public String field_78247_g; - - public ScalableModelBox(ScalableModelRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) { - this.posX1 = par4; - this.posY1 = par5; - this.posZ1 = par6; - this.posX2 = par4 + par7; - this.posY2 = par5 + par8; - this.posZ2 = par6 + par9; - this.vertexPositions = new PositionTextureVertex[8]; - this.quadList = new TexturedQuad[6]; - float var11 = par4 + par7; - float var12 = par5 + par8; - float var13 = par6 + par9; - par4 -= par10; - par5 -= par10; - par6 -= par10; - var11 += par10; - var12 += par10; - var13 += par10; - if(par1ModelRenderer.mirror) { - float var23 = var11; - var11 = par4; - par4 = var23; - } - - PositionTextureVertex var231 = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F); - PositionTextureVertex var15 = new PositionTextureVertex(var11, par5, par6, 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(par4, par5, var13, 0.0F, 0.0F); - PositionTextureVertex var19 = new PositionTextureVertex(var11, par5, var13, 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); - this.vertexPositions[0] = var231; - this.vertexPositions[1] = var15; - this.vertexPositions[2] = var16; - this.vertexPositions[3] = var17; - this.vertexPositions[4] = var18; - this.vertexPositions[5] = var19; - this.vertexPositions[6] = var20; - this.vertexPositions[7] = var21; - this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{var231, var18, var21, var17}, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var231, var15}, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var231, var17, var16}, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.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, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - if(par1ModelRenderer.mirror) { - for (TexturedQuad element : this.quadList) { - element.flipFace(); - } - } - - } - - public void render(Tessellator par1Tessellator, float par2) { - for (TexturedQuad element : this.quadList) { - element.draw(par1Tessellator.getWorldRenderer(), par2); - } - - } - - public ScalableModelBox func_78244_a(String par1Str) { - this.field_78247_g = par1Str; - return this; - } -} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java b/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java new file mode 100644 index 00000000..d373007e --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java @@ -0,0 +1,56 @@ +package com.brohoof.minelittlepony.model.part; + +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.model.BodyPart; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.renderer.AniParams; + +public abstract class AbstractHeadPart implements IPonyPart { + + private ModelPony pony; + + @Override + public void init(ModelPony pony, float yOffset, float stretch) { + this.pony = pony; + } + + @Override + public void render(PonyData data, float scale) { + pony.transform(BodyPart.HEAD); + } + + @Override + public final void animate(PonyData data, AniParams ani) { + rotateHead(ani.horz, ani.vert); + if (pony.isSneak && !pony.isFlying) { + position(0, 6, -2); + } else { + position(0, 0, 0); + } + } + + private void rotateHead(float horz, float vert) { + float y; + float x; + if (pony.isSleeping) { + y = 1.4F; + x = 0.1F; + } else { + y = horz / (float) (180 / Math.PI); + x = vert / (float) (180 / Math.PI); + } + x = Math.min(x, 0.5F); + x = Math.max(x, -0.5F); + + rotate(x, y); + } + + protected ModelPony getPony() { + return pony; + } + + protected abstract void position(float posX, float posY, float posZ); + + protected abstract void rotate(float rotX, float rotY); + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/IPonyPart.java b/src/main/java/com/brohoof/minelittlepony/model/part/IPonyPart.java new file mode 100644 index 00000000..8f25c018 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/IPonyPart.java @@ -0,0 +1,15 @@ +package com.brohoof.minelittlepony.model.part; + +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.renderer.AniParams; + +public interface IPonyPart { + + void init(ModelPony pony, float yOffset, float stretch); + + void animate(PonyData data, AniParams ani); + + void render(PonyData data, float scale); + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java new file mode 100644 index 00000000..063d887a --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java @@ -0,0 +1,228 @@ +package com.brohoof.minelittlepony.model.part; + +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.model.BodyPart; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.model.PonyModelConstants; +import com.brohoof.minelittlepony.renderer.AniParams; +import com.brohoof.minelittlepony.renderer.CompressiveRendering; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.util.MathHelper; + +public class PegasusWings implements IPonyPart, PonyModelConstants { + + private ModelPony pony; + + public ModelRenderer[] leftWing; + public ModelRenderer[] rightWing; + + public ModelRenderer[] leftWingExt; + public ModelRenderer[] rightWingExt; + + public CompressiveRendering compressiveLeftWing; + public CompressiveRendering compressiveRightWing; + + @Override + public void init(ModelPony pony, float yOffset, float stretch) { + this.pony = pony; + + this.leftWing = new ModelRenderer[3]; + this.rightWing = new ModelRenderer[3]; + this.leftWingExt = new ModelRenderer[6]; + this.rightWingExt = new ModelRenderer[6]; + this.compressiveLeftWing = new CompressiveRendering(pony); + this.compressiveRightWing = new CompressiveRendering(pony); + + for (int i = 0; i < leftWing.length; i++) { + this.leftWing[i] = new ModelRenderer(pony, 56, 16); + this.leftWing[i].mirror = true; + this.compressiveLeftWing.addCompressed(this.leftWing[i]); + } + for (int i = 0; i < rightWing.length; i++) { + this.rightWing[i] = new ModelRenderer(pony, 56, 16); + this.compressiveRightWing.addCompressed(this.rightWing[i]); + } + for (int i = 0; i < leftWingExt.length; i++) { + this.leftWingExt[i] = new ModelRenderer(pony, 56, 19); + this.leftWingExt[i].mirror = true; + this.compressiveLeftWing.addExpanded(this.leftWingExt[i]); + } + for (int i = 0; i < rightWingExt.length; i++) { + this.rightWingExt[i] = new ModelRenderer(pony, 56, 19); + this.compressiveRightWing.addExpanded(this.rightWingExt[i]); + } + + this.compressiveLeftWing.setChance(2); + this.compressiveRightWing.setChance(2); + + 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; + this.leftWing[1].addBox(4.0F, 5.0F, 4.0F, 2, 8, 2, stretch); + this.leftWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); + this.leftWing[1].rotateAngleX = ROTATE_90; + this.leftWing[2].addBox(4.0F, 5.0F, 6.0F, 2, 6, 2, stretch); + this.leftWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); + this.leftWing[2].rotateAngleX = ROTATE_90; + this.rightWing[0].addBox(-6.0F, 5.0F, 2.0F, 2, 6, 2, stretch); + this.rightWing[0].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); + this.rightWing[0].rotateAngleX = ROTATE_90; + this.rightWing[1].addBox(-6.0F, 5.0F, 4.0F, 2, 8, 2, stretch); + this.rightWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); + this.rightWing[1].rotateAngleX = ROTATE_90; + this.rightWing[2].addBox(-6.0F, 5.0F, 6.0F, 2, 6, 2, stretch); + this.rightWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); + this.rightWing[2].rotateAngleX = ROTATE_90; + this.leftWingExt[0].addBox(0.0F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F); + this.leftWingExt[0].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.leftWingExt[1].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F); + this.leftWingExt[1].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.leftWingExt[2].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F); + this.leftWingExt[2].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.leftWingExt[3].addBox(0.0F, 5.0F, 2.0F, 1, 8, 2, stretch); + this.leftWingExt[3].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.leftWingExt[4].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F); + this.leftWingExt[4].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.leftWingExt[5].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.2F); + this.leftWingExt[5].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, LEFT_WING_EXT_RP_Z); + this.rightWingExt[0].addBox(0.0F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F); + this.rightWingExt[0].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + this.rightWingExt[1].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F); + this.rightWingExt[1].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + this.rightWingExt[2].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F); + this.rightWingExt[2].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + this.rightWingExt[3].addBox(0.0F, 5.0F, 2.0F, 1, 8, 2, stretch); + this.rightWingExt[3].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + this.rightWingExt[4].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F); + this.rightWingExt[4].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + this.rightWingExt[5].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.2F); + this.rightWingExt[5].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, RIGHT_WING_EXT_RP_Z); + } + + @Override + public void animate(PonyData metadata, AniParams ani) { + + float bodySwingRotation = 0.0F; + if (pony.swingProgress > -9990.0F && (!metadata.getRace().hasHorn() || metadata.getGlowColor() == 0)) { + bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F; + } + for (int i = 0; i < this.leftWing.length; ++i) { + this.leftWing[i].rotateAngleY = bodySwingRotation * 0.2F; + } + for (int i = 0; i < this.rightWing.length; ++i) { + this.rightWing[i].rotateAngleY = bodySwingRotation * 0.2F; + } + if (pony.isSneak && !pony.isFlying) { + this.sneak(); + } else if (metadata.getRace().hasWings()) { + this.unsneak(ani.tick); + + } + + // Special + this.leftWingExt[1].rotateAngleX -= 0.85F; + this.leftWingExt[2].rotateAngleX -= 0.75F; + this.leftWingExt[3].rotateAngleX -= 0.5F; + this.leftWingExt[5].rotateAngleX -= 0.85F; + this.rightWingExt[1].rotateAngleX -= 0.85F; + this.rightWingExt[2].rotateAngleX -= 0.75F; + this.rightWingExt[3].rotateAngleX -= 0.5F; + this.rightWingExt[5].rotateAngleX -= 0.85F; + + } + + @Override + public void render(PonyData data, float scale) { + pony.transform(BodyPart.BODY); + if (data.getRace() != null && data.getRace().hasWings()) { + if (!pony.isFlying && !pony.isSneak) { + this.setExtendingWings(true); + + for (int k1 = 0; k1 < this.leftWing.length; ++k1) { + this.leftWing[k1].render(scale); + } + + for (int k1 = 0; k1 < this.rightWing.length; ++k1) { + this.rightWing[k1].render(scale); + } + } else { + this.setExtendingWings(false); + + for (int k1 = 0; k1 < this.leftWingExt.length; ++k1) { + this.leftWingExt[k1].render(scale); + } + + for (int i = 0; i < this.rightWingExt.length; ++i) { + this.rightWingExt[i].render(scale); + } + } + } + } + + private void setExtendingWings(boolean compress) { + this.compressiveLeftWing.setIsCompressed(compress); + this.compressiveRightWing.setIsCompressed(compress); + } + + public void setWingCompression(boolean pegasus) { + if (pegasus) { + this.compressiveLeftWing.init_Safe(); + this.compressiveRightWing.init_Safe(); + } else { + this.compressiveLeftWing.deInit_Safe(); + this.compressiveRightWing.deInit_Safe(); + } + } + + private void sneak() { + for (int i = 0; i < this.leftWingExt.length; ++i) { + this.leftWingExt[i].rotationPointY = LEFT_WING_RP_Y_SNEAK; + this.leftWingExt[i].rotationPointZ = LEFT_WING_RP_Z_SNEAK; + this.leftWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; + this.leftWingExt[i].rotateAngleZ = LEFT_WING_ROTATE_ANGLE_Z_SNEAK; + } + + for (int i = 0; i < this.leftWingExt.length; ++i) { + this.rightWingExt[i].rotationPointY = RIGHT_WING_RP_Y_SNEAK; + this.rightWingExt[i].rotationPointZ = RIGHT_WING_RP_Z_SNEAK; + this.rightWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; + this.rightWingExt[i].rotateAngleZ = RIGHT_WING_ROTATE_ANGLE_Z_SNEAK; + } + } + + private void unsneak(float tick) { + if (!pony.isFlying) { + for (int i = 0; i < this.leftWing.length; ++i) { + this.leftWing[i].rotationPointY = WING_FOLDED_RP_Y; + this.leftWing[i].rotationPointZ = WING_FOLDED_RP_Z; + } + + for (int i = 0; i < this.rightWing.length; ++i) { + this.rightWing[i].rotationPointY = WING_FOLDED_RP_Y; + this.rightWing[i].rotationPointZ = WING_FOLDED_RP_Z; + } + } else { + float WingRotateAngleZ = MathHelper.sin(tick * 0.536F) * 1.0F; + + for (int i = 0; i < this.leftWingExt.length; ++i) { + this.leftWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; + this.leftWingExt[i].rotateAngleZ = -WingRotateAngleZ - ROTATE_270 - 0.4F; + this.leftWingExt[i].rotationPointY = LEFT_WING_RP_Y_NOTSNEAK; + this.leftWingExt[i].rotationPointZ = LEFT_WING_RP_Z_NOTSNEAK; + } + + for (int i = 0; i < this.rightWingExt.length; ++i) { + this.rightWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; + this.rightWingExt[i].rotateAngleZ = WingRotateAngleZ + ROTATE_270 + 0.4F; + this.rightWingExt[i].rotationPointY = RIGHT_WING_RP_Y_NOTSNEAK; + this.rightWingExt[i].rotationPointZ = RIGHT_WING_RP_Z_NOTSNEAK; + } + } + } + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java b/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java new file mode 100644 index 00000000..3ec58d31 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java @@ -0,0 +1,48 @@ +package com.brohoof.minelittlepony.model.part; + +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.model.PonyModelConstants; + +import net.minecraft.client.model.ModelRenderer; + +public class PonyEars extends AbstractHeadPart implements PonyModelConstants { + + private ModelRenderer left; + private ModelRenderer right; + + @Override + public void init(ModelPony pony, float yOffset, float stretch) { + super.init(pony, yOffset, stretch); + this.left = new ModelRenderer(pony, 12, 16); + this.right = new ModelRenderer(pony, 12, 16); + this.right.mirror = true; + + this.left.addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); + this.left.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + this.right.addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); + this.right.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + } + + @Override + protected void position(float posX, float posY, float posZ) { + getPony().setRotationPoint(left, posX, posY, posZ); + getPony().setRotationPoint(right, posX, posY, posZ); + } + + @Override + protected void rotate(float rotX, float rotY) { + this.left.rotateAngleX = rotX; + this.left.rotateAngleY = rotY; + this.right.rotateAngleX = rotX; + this.right.rotateAngleY = rotY; + } + + @Override + public void render(PonyData data, float scale) { + super.render(data, scale); + left.render(scale); + right.render(scale); + } + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java b/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java new file mode 100644 index 00000000..4e8fdffd --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java @@ -0,0 +1,106 @@ +package com.brohoof.minelittlepony.model.part; + +import java.util.Map; + +import com.brohoof.minelittlepony.MineLittlePony; +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.PonyGender; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.model.PonyModelConstants; +import com.brohoof.minelittlepony.renderer.PlaneRenderer; +import com.google.common.collect.ImmutableMap; + +public class PonySnout extends AbstractHeadPart implements PonyModelConstants { + + private Map map = ImmutableMap. builder() + .put(PonyGender.MARE, new PlaneRenderer[10]) + .put(PonyGender.STALLION, new PlaneRenderer[5]) + .build(); + + @Override + public void init(ModelPony pony, float yOffset, float stretch) { + super.init(pony, yOffset, stretch); + + PlaneRenderer[] muzzle = map.get(PonyGender.MARE); + muzzle[0] = new PlaneRenderer(pony, 10, 14); + muzzle[1] = new PlaneRenderer(pony, 11, 13); + muzzle[2] = new PlaneRenderer(pony, 9, 14); + muzzle[3] = new PlaneRenderer(pony, 14, 14); + muzzle[4] = new PlaneRenderer(pony, 11, 12); + muzzle[5] = new PlaneRenderer(pony, 18, 7); + muzzle[6] = new PlaneRenderer(pony, 9, 14); + muzzle[7] = new PlaneRenderer(pony, 14, 14); + muzzle[8] = new PlaneRenderer(pony, 11, 12); + muzzle[9] = new PlaneRenderer(pony, 12, 12); + + muzzle[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, 0, stretch); + muzzle[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[1].addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, 0, stretch); + muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[2].addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); + muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[3].addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); + muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[4].addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 0, 1, stretch); + muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[5].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); + muzzle[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[6].addSidePlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); + muzzle[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[7].addSidePlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); + muzzle[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[8].addSidePlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); + muzzle[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + 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[0] = new PlaneRenderer(pony, 10, 13); + muzzle[1] = new PlaneRenderer(pony, 10, 13); + muzzle[2] = new PlaneRenderer(pony, 18, 7); + muzzle[3] = new PlaneRenderer(pony, 10, 13); + muzzle[4] = new PlaneRenderer(pony, 13, 13); + + muzzle[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, 0, stretch); + muzzle[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[1].addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); + muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[2].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); + muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[3].addSidePlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); + muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + muzzle[4].addSidePlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); + muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + } + + @Override + public void render(PonyData data, float scale) { + super.render(data, scale); + if (MineLittlePony.getConfig().getSnuzzles().get() && data.getGender() != null) { + PlaneRenderer[] muzzle = map.get(data.getGender()); + for (int i = 0; i < muzzle.length; i++) { + muzzle[i].render(scale); + } + } + } + + @Override + protected void position(float posX, float posY, float posZ) { + for (PlaneRenderer[] pr : map.values()) { + for (PlaneRenderer p : pr) { + getPony().setRotationPoint(p, posX, posY, posZ); + } + } + } + + @Override + protected void rotate(float rotX, float rotY) { + for (PlaneRenderer[] pr : map.values()) { + for (PlaneRenderer p : pr) { + p.rotateAngleX = rotX; + p.rotateAngleY = rotY; + } + } + } + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java b/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java new file mode 100644 index 00000000..f4b72a40 --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java @@ -0,0 +1,85 @@ +package com.brohoof.minelittlepony.model.part; + +import static net.minecraft.client.renderer.GlStateManager.*; + +import org.lwjgl.opengl.GL11; + +import com.brohoof.minelittlepony.PonyData; +import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.model.PonyModelConstants; +import com.brohoof.minelittlepony.renderer.HornGlowRenderer; + +import net.minecraft.client.model.ModelRenderer; + +public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants { + + private ModelRenderer horn; + private HornGlowRenderer[] hornglow; + + @Override + public void init(ModelPony pony, float yOffset, float stretch) { + super.init(pony, yOffset, stretch); + + this.horn = new ModelRenderer(pony, 0, 3); + this.hornglow = new HornGlowRenderer[2]; + for (int i = 0; i < hornglow.length; i++) { + this.hornglow[i] = new HornGlowRenderer(pony, 0, 3); + } + + this.horn.addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch); + this.horn.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + + this.hornglow[0].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch + 0.5F); + this.hornglow[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + this.hornglow[1].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 3, 1, stretch + 0.8F); + this.hornglow[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + } + + @Override + public void render(PonyData data, float scale) { + super.render(data, scale); + if (data.getRace() != null && data.getRace().hasHorn()) { + this.horn.render(scale); + if (getPony().heldItemRight != 0 && data.getGlowColor() != 0) { + GL11.glPushAttrib(24577); + disableTexture2D(); + disableLighting(); + enableBlend(); + + float var4 = (data.getGlowColor() >> 16 & 255) / 255.0F; + float green = (data.getGlowColor() >> 8 & 255) / 255.0F; + float blue = (data.getGlowColor() & 255) / 255.0F; + blendFunc(GL11.GL_SRC_ALPHA, 1); + + color(var4, green, blue, 0.4F); + this.hornglow[0].render(scale); + color(var4, green, blue, 0.2F); + this.hornglow[1].render(scale); + + enableTexture2D(); + enableLighting(); + disableBlend(); + popAttrib(); + } + } + } + + protected void position(float posX, float posY, float posZ) { + getPony().setRotationPoint(this.horn, posX, posY, posZ); + for (int i = 0; i < this.hornglow.length; i++) { + getPony().setRotationPoint(this.hornglow[i], posX, posY, posZ); + } + } + + protected void rotate(float rotX, float rotY) { + + this.horn.rotateAngleX = rotX + 0.5F; + this.horn.rotateAngleY = rotY; + + for (int i = 0; i < this.hornglow.length; i++) { + this.hornglow[i].rotateAngleX = rotX + 0.5F; + this.hornglow[i].rotateAngleY = rotY; + } + } + +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/pony/armor/pm_newPonyArmor.java b/src/main/java/com/brohoof/minelittlepony/model/pony/armor/pm_newPonyArmor.java index e5bfc8aa..b40723b3 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/pony/armor/pm_newPonyArmor.java +++ b/src/main/java/com/brohoof/minelittlepony/model/pony/armor/pm_newPonyArmor.java @@ -1,5 +1,6 @@ package com.brohoof.minelittlepony.model.pony.armor; +import com.brohoof.minelittlepony.model.part.PonyEars; import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv; import com.brohoof.minelittlepony.renderer.AniParams; @@ -18,6 +19,11 @@ public class pm_newPonyArmor extends pm_newPonyAdv { this.textureHeight = 32; } + @Override + protected void addParts() { + modelParts.add(new PonyEars()); + } + @Override public void animate(AniParams aniparams) { this.checkRainboom(aniparams.swing); @@ -33,7 +39,7 @@ public class pm_newPonyArmor extends pm_newPonyAdv { this.setLegs(aniparams.move, aniparams.swing, aniparams.tick); this.holdItem(); this.swingItem(this.swingProgress); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { 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); diff --git a/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java b/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java index bb84a0b3..39527a22 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java +++ b/src/main/java/com/brohoof/minelittlepony/model/pony/pm_newPonyAdv.java @@ -1,108 +1,51 @@ package com.brohoof.minelittlepony.model.pony; -import static net.minecraft.client.renderer.GlStateManager.*; +import static net.minecraft.client.renderer.GlStateManager.popMatrix; +import static net.minecraft.client.renderer.GlStateManager.pushMatrix; +import static net.minecraft.client.renderer.GlStateManager.rotate; +import static net.minecraft.client.renderer.GlStateManager.scale; +import static net.minecraft.client.renderer.GlStateManager.translate; import java.util.Random; -import org.lwjgl.opengl.GL11; - -import com.brohoof.minelittlepony.MineLittlePony; -import com.brohoof.minelittlepony.PonyGender; import com.brohoof.minelittlepony.PonySize; import com.brohoof.minelittlepony.model.ModelPony; +import com.brohoof.minelittlepony.model.PonyModelConstants; +import com.brohoof.minelittlepony.model.part.PegasusWings; +import com.brohoof.minelittlepony.model.part.PonyEars; +import com.brohoof.minelittlepony.model.part.PonySnout; +import com.brohoof.minelittlepony.model.part.UnicornHorn; import com.brohoof.minelittlepony.renderer.AniParams; import com.brohoof.minelittlepony.renderer.CompressiveRendering; -import com.brohoof.minelittlepony.renderer.HornGlowRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.util.MathHelper; -public class pm_newPonyAdv extends ModelPony { +public class pm_newPonyAdv extends ModelPony implements PonyModelConstants { - protected static final float HEAD_CENTRE_X = 0.0F; - protected static final float HEAD_CENTRE_Y = -1.0F; - protected static final float HEAD_CENTRE_Z = -2.0F; - protected static final float BODY_CENTRE_X = 0.0F; - protected static final float BODY_CENTRE_Y = 8.0F; - protected static final float BODY_CENTRE_Z = 6.0F; - protected static final float THIRDP_ARM_CENTRE_X = 0.0F; - protected static final float THIRDP_ARM_CENTRE_Y = 10.0F; - protected static final float THIRDP_ARM_CENTRE_Z = 0.0F; - protected static final float FIRSTP_ARM_CENTRE_X = -1.0F; - protected static final float FIRSTP_ARM_CENTRE_Y = 4.0F; - protected static final float FIRSTP_ARM_CENTRE_Z = 0.0F; - protected static final float HEAD_RP_X = 0.0F; - protected static final float HEAD_RP_Y = 0.0F; - protected static final float HEAD_RP_Z = 0.0F; - protected static final float BODY_RP_Y_SNEAK = 7.0F; - protected static final float BODY_RP_Y_NOTSNEAK = 0.0F; - protected static final float BODY_RP_Z_SNEAK = -4.0F; - protected static final float BODY_RP_Z_NOTSNEAK = 0.0F; - protected static final float FRONT_LEG_RP_Y_SNEAK = 7.0F; - protected static final float FRONT_LEG_RP_Y_NOTSNEAK = 8.0F; - protected static final float WING_FOLDED_RP_Y = 13.0F; - protected static final float WING_FOLDED_RP_Z = -3.0F; - protected static final float LEFT_WING_RP_Y_SNEAK = 10.5F; - protected static final float LEFT_WING_RP_Y_NOTSNEAK = 5.5F; - protected static final float LEFT_WING_RP_Z_SNEAK = 2.0F; - protected static final float LEFT_WING_RP_Z_NOTSNEAK = 3.0F; - protected static final float RIGHT_WING_RP_Y_SNEAK = 11.5F; - protected static final float RIGHT_WING_RP_Y_NOTSNEAK = 6.5F; - protected static final float RIGHT_WING_RP_Z_SNEAK = 2.0F; - protected static final float RIGHT_WING_RP_Z_NOTSNEAK = 3.0F; - protected static final float TAIL_RP_X = 0.0F; - protected static final float TAIL_RP_Y = 0.8F; - protected static final float TAIL_RP_Z = 0.0F; - protected static final float TAIL_RP_Z_SNEAK = 10.0F; - protected static final float TAIL_RP_Z_NOTSNEAK = 14.0F; - protected static final float LEFT_WING_EXT_RP_X = 4.5F; - protected static final float LEFT_WING_EXT_RP_Y = 5.0F; - protected static final float LEFT_WING_EXT_RP_Z = 6.0F; - protected static final float RIGHT_WING_EXT_RP_X = -4.5F; - protected static final float RIGHT_WING_EXT_RP_Y = 5.0F; - protected static final float RIGHT_WING_EXT_RP_Z = 6.0F; - protected static final float BODY_ROTATE_ANGLE_X_SNEAK = 0.4F; - protected static final float BODY_ROTATE_ANGLE_X_NOTSNEAK = 0.0F; - protected static final float EXT_WING_ROTATE_ANGLE_X = 2.5F; - protected static final float LEFT_WING_ROTATE_ANGLE_Z_SNEAK = -6.0F; - protected static final float RIGHT_WING_ROTATE_ANGLE_Z_SNEAK = 6.0F; - protected static final float SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F; - protected static final float ROTATE_270 = 4.712F; - protected static final float ROTATE_90 = 1.571F; - protected static final float RIDING_SHIFT_Y = -10.0F; - protected static final float RIDING_SHIFT_Z = -10.0F; - - protected boolean rainboom; - protected final float Pi = 3.1415927F; - private float WingRotateAngleZ; - protected float NeckRotX = 0.166F; - public int tailstop = 0; + public boolean rainboom; public ModelRenderer bipedCape; - public ModelRenderer[] headpiece;// horn? ears? - public HornGlowRenderer[] hornglow; + public PlaneRenderer[] Bodypiece; public PlaneRenderer[] VillagerBagPiece; public PlaneRenderer VillagerApron; public PlaneRenderer VillagerTrinket; public PlaneRenderer[] BodypieceNeck; - public PlaneRenderer[] MuzzleFemale; - public PlaneRenderer[] MuzzleMale; public ModelRenderer SteveArm; public ModelRenderer unicornarm; public PlaneRenderer[] Tail; - public ModelRenderer[] LeftWing; - public ModelRenderer[] RightWing; - public ModelRenderer[] LeftWingExt; - public ModelRenderer[] RightWingExt; - public CompressiveRendering CompressiveLeftWing; - public CompressiveRendering CompressiveRightWing; - @Override - public void init(float yOffset, float stretch) { - this.initTextures(); - this.initPositions(yOffset, stretch); + public pm_newPonyAdv() { + addParts(); + } + + protected void addParts() { + modelParts.add(new PonyEars()); + modelParts.add(new PonySnout()); + modelParts.add(new UnicornHorn()); + modelParts.add(new PegasusWings()); } @Override @@ -137,50 +80,32 @@ public class pm_newPonyAdv extends ModelPony { this.BodypieceNeck[k1].rotateAngleY = bodySwingRotation * 0.2F; } - for (k1 = 0; k1 < this.LeftWing.length; ++k1) { - this.LeftWing[k1].rotateAngleY = bodySwingRotation * 0.2F; + int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; + if (tailstop <= 1) { + tailstop = 0; } - for (k1 = 0; k1 < this.RightWing.length; ++k1) { - this.RightWing[k1].rotateAngleY = bodySwingRotation * 0.2F; - } - - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; - } - - for (k1 = 0; k1 < this.tailstop; ++k1) { + for (k1 = 0; k1 < tailstop; ++k1) { this.Tail[k1].rotateAngleY = bodySwingRotation; } this.setLegs(aniparams.move, aniparams.swing, aniparams.tick); this.holdItem(); this.swingItem(this.swingProgress); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); - this.animatePegasusWingsSneaking(); this.sneakLegs(); this.setHead(0.0F, 6.0F, -2.0F); this.sneakTail(); } else { this.adjustBody(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); - if (this.metadata.getRace().hasWings()) { - this.animatePegasusWingsNotSneaking(aniparams.tick); - } this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; this.swingArms(aniparams.tick); this.setHead(0.0F, 0.0F, 0.0F); - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; - } - for (k1 = 0; k1 < this.tailstop; ++k1) { + for (k1 = 0; k1 < tailstop; ++k1) { this.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(aniparams.move); @@ -195,13 +120,8 @@ public class pm_newPonyAdv extends ModelPony { } if (this.rainboom) { - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; - } - for (k1 = 0; k1 < this.tailstop; ++k1) { + for (k1 = 0; k1 < tailstop; ++k1) { this.Tail[k1].rotationPointY += 6.0F; ++this.Tail[k1].rotationPointZ; } @@ -230,37 +150,12 @@ public class pm_newPonyAdv extends ModelPony { } protected void checkRainboom(float swing) { - if (this.metadata.getRace().hasWings() && this.isFlying && swing >= 0.9999F) { - this.rainboom = true; - } else { - this.rainboom = false; - } - + this.rainboom = this.metadata.getRace() != null && this.metadata.getRace().hasWings() && this.isFlying && swing >= 0.9999F; } protected void setHead(float posX, float posY, float posZ) { this.setRotationPoint(this.bipedHead, posX, posY, posZ); this.setRotationPoint(this.bipedHeadwear, posX, posY, posZ); - - int j6; - for (j6 = 0; j6 < this.headpiece.length; ++j6) { - this.setRotationPoint(this.headpiece[j6], posX, posY, posZ); - } - - for (j6 = 0; j6 < this.hornglow.length; ++j6) { - this.setRotationPoint(this.hornglow[j6], posX, posY, posZ); - } - - if (this.metadata.getGender() == PonyGender.STALLION) { - for (j6 = 0; j6 < this.MuzzleMale.length; ++j6) { - this.setRotationPoint(this.MuzzleMale[j6], posX, posY, posZ); - } - } else { - for (j6 = 0; j6 < this.MuzzleFemale.length; ++j6) { - this.setRotationPoint(this.MuzzleFemale[j6], posX, posY, posZ); - } - } - } protected void rotateHead(float horz, float vert) { @@ -284,34 +179,8 @@ public class pm_newPonyAdv extends ModelPony { this.bipedHead.rotateAngleY = headRotateAngleY; this.bipedHead.rotateAngleX = headRotateAngleX; - int i; - if (this.metadata.getGender() == PonyGender.STALLION) { - for (i = 0; i < this.MuzzleMale.length; ++i) { - this.MuzzleMale[i].rotateAngleY = headRotateAngleY; - this.MuzzleMale[i].rotateAngleX = headRotateAngleX; - } - } else { - for (i = 0; i < this.MuzzleFemale.length; ++i) { - this.MuzzleFemale[i].rotateAngleY = headRotateAngleY; - this.MuzzleFemale[i].rotateAngleX = headRotateAngleX; - } - } - - this.headpiece[0].rotateAngleY = headRotateAngleY; - this.headpiece[0].rotateAngleX = headRotateAngleX; - this.headpiece[1].rotateAngleY = headRotateAngleY; - this.headpiece[1].rotateAngleX = headRotateAngleX; - this.headpiece[2].rotateAngleY = headRotateAngleY; - this.headpiece[2].rotateAngleX = headRotateAngleX; - this.hornglow[0].rotateAngleY = headRotateAngleY; - this.hornglow[0].rotateAngleX = headRotateAngleX; - this.hornglow[1].rotateAngleY = headRotateAngleY; - this.hornglow[1].rotateAngleX = headRotateAngleX; this.bipedHeadwear.rotateAngleY = headRotateAngleY; this.bipedHeadwear.rotateAngleX = headRotateAngleX; - this.headpiece[2].rotateAngleX = headRotateAngleX + 0.5F; - this.hornglow[0].rotateAngleX = headRotateAngleX + 0.5F; - this.hornglow[1].rotateAngleX = headRotateAngleX + 0.5F; } protected void setLegs(float move, float swing, float tick) { @@ -319,9 +188,6 @@ public class pm_newPonyAdv extends ModelPony { this.adjustLegs(); } - /** - * @param tick - */ protected void rotateLegs(float move, float swing, float tick) { float rightArmRotateAngleX; float leftArmRotateAngleX; @@ -383,7 +249,7 @@ public class pm_newPonyAdv extends ModelPony { float sinBodyRotateAngleYFactor = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; float cosBodyRotateAngleYFactor = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; float legOutset = 4.0F; - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { legOutset = 0.0F; } @@ -392,8 +258,7 @@ public class pm_newPonyAdv extends ModelPony { } if (this.rainboom) { - this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + - 2.0F; + this.bipedRightArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F; this.SteveArm.rotationPointZ = sinBodyRotateAngleYFactor + 2.0F; this.bipedLeftArm.rotationPointZ = 0.0F - sinBodyRotateAngleYFactor + 2.0F; } else { @@ -419,13 +284,12 @@ public class pm_newPonyAdv extends ModelPony { } protected void swingTailZ(float move, float swing) { - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; + int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; + if (tailstop <= 1) { + tailstop = 0; } - for (int j = 0; j < this.tailstop; ++j) { + for (int j = 0; j < tailstop; ++j) { if (this.rainboom) { this.Tail[j].rotateAngleZ = 0.0F; } else { @@ -437,13 +301,12 @@ public class pm_newPonyAdv extends ModelPony { protected void swingTailX(float tick) { float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F; - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; + int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; + if (tailstop <= 1) { + tailstop = 0; } - for (int l6 = 0; l6 < this.tailstop; ++l6) { + for (int l6 = 0; l6 < tailstop; ++l6) { this.Tail[l6].rotateAngleX += sinTickFactor; } @@ -466,19 +329,15 @@ public class pm_newPonyAdv extends ModelPony { float f28 = MathHelper.sin(swingProgress * 3.1415927F); float f33 = f28 * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0 && this.heldItemRight != 0) { - this.unicornarm.rotateAngleX = (float) (this.unicornarm.rotateAngleX - - (f22 * 1.2D + f33)); + this.unicornarm.rotateAngleX = (float) (this.unicornarm.rotateAngleX - (f22 * 1.2D + f33)); this.unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; this.unicornarm.rotateAngleZ = f28 * -0.4F; } else { - this.bipedRightArm.rotateAngleX = (float) (this.bipedRightArm.rotateAngleX - - (f22 * 1.2D + f33)); + this.bipedRightArm.rotateAngleX = (float) (this.bipedRightArm.rotateAngleX - (f22 * 1.2D + f33)); this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; this.bipedRightArm.rotateAngleZ = f28 * -0.4F; - this.SteveArm.rotateAngleX = (float) (this.SteveArm.rotateAngleX - - (f22 * 1.2D + f33)); - this.SteveArm.rotateAngleY += this.bipedBody.rotateAngleY * - 2.0F; + this.SteveArm.rotateAngleX = (float) (this.SteveArm.rotateAngleX - (f22 * 1.2D + f33)); + this.SteveArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; this.SteveArm.rotateAngleZ = f28 * -0.4F; } } @@ -535,7 +394,7 @@ public class pm_newPonyAdv extends ModelPony { protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) { for (int k3 = 0; k3 < this.BodypieceNeck.length; ++k3) { - this.BodypieceNeck[k3].rotateAngleX = this.NeckRotX + rotateAngleX; + this.BodypieceNeck[k3].rotateAngleX = NECK_ROT_X + rotateAngleX; this.BodypieceNeck[k3].rotationPointY = rotationPointY; this.BodypieceNeck[k3].rotationPointZ = rotationPointZ; } @@ -554,13 +413,12 @@ public class pm_newPonyAdv extends ModelPony { } protected void sneakTail() { - this.tailstop = 0; - this.tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; - if (this.tailstop <= 1) { - this.tailstop = 0; + int tailstop = this.Tail.length - this.metadata.getTail().getSize() * 5; + if (tailstop <= 1) { + tailstop = 0; } - for (int i7 = 0; i7 < this.tailstop; ++i7) { + for (int i7 = 0; i7 < tailstop; ++i7) { this.setRotationPoint(this.Tail[i7], TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK); this.Tail[i7].rotateAngleX = 0.0F; } @@ -575,7 +433,7 @@ public class pm_newPonyAdv extends ModelPony { float headPosX; float headPosY; float headPosZ; - if (this.issneak) { + if (this.isSneak) { headPosY = 2.0F; headPosZ = -1.0F; headPosX = 1.0F; @@ -625,65 +483,7 @@ public class pm_newPonyAdv extends ModelPony { this.unicornarm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F; } - protected void animatePegasusWingsSneaking() { - int k5; - for (k5 = 0; k5 < this.LeftWingExt.length; ++k5) { - this.LeftWingExt[k5].rotationPointY = LEFT_WING_RP_Y_SNEAK; - this.LeftWingExt[k5].rotationPointZ = LEFT_WING_RP_Z_SNEAK; - this.LeftWingExt[k5].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; - this.LeftWingExt[k5].rotateAngleZ = LEFT_WING_ROTATE_ANGLE_Z_SNEAK; - } - - for (k5 = 0; k5 < this.LeftWingExt.length; ++k5) { - this.RightWingExt[k5].rotationPointY = RIGHT_WING_RP_Y_SNEAK; - this.RightWingExt[k5].rotationPointZ = RIGHT_WING_RP_Z_SNEAK; - this.RightWingExt[k5].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; - this.RightWingExt[k5].rotateAngleZ = RIGHT_WING_ROTATE_ANGLE_Z_SNEAK; - } - - } - - protected void animatePegasusWingsNotSneaking(float tick) { - int l5; - if (!this.isFlying) { - for (l5 = 0; l5 < this.LeftWing.length; ++l5) { - this.LeftWing[l5].rotationPointY = WING_FOLDED_RP_Y; - this.LeftWing[l5].rotationPointZ = WING_FOLDED_RP_Z; - } - - for (l5 = 0; l5 < this.RightWing.length; ++l5) { - this.RightWing[l5].rotationPointY = WING_FOLDED_RP_Y; - this.RightWing[l5].rotationPointZ = WING_FOLDED_RP_Z; - } - } else { - this.WingRotateAngleZ = MathHelper.sin(tick * 0.536F) * 1.0F; - - for (l5 = 0; l5 < this.LeftWingExt.length; ++l5) { - this.LeftWingExt[l5].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; - this.LeftWingExt[l5].rotateAngleZ = -this.WingRotateAngleZ - ROTATE_270 - 0.4F; - this.LeftWingExt[l5].rotationPointY = LEFT_WING_RP_Y_NOTSNEAK; - this.LeftWingExt[l5].rotationPointZ = LEFT_WING_RP_Z_NOTSNEAK; - } - - for (l5 = 0; l5 < this.RightWingExt.length; ++l5) { - this.RightWingExt[l5].rotateAngleX = EXT_WING_ROTATE_ANGLE_X; - this.RightWingExt[l5].rotateAngleZ = this.WingRotateAngleZ + ROTATE_270 + 0.4F; - this.RightWingExt[l5].rotationPointY = RIGHT_WING_RP_Y_NOTSNEAK; - this.RightWingExt[l5].rotationPointZ = RIGHT_WING_RP_Z_NOTSNEAK; - } - } - - } - protected void fixSpecialRotations() { - this.LeftWingExt[1].rotateAngleX -= 0.85F; - this.LeftWingExt[2].rotateAngleX -= 0.75F; - this.LeftWingExt[3].rotateAngleX -= 0.5F; - this.LeftWingExt[5].rotateAngleX -= 0.85F; - this.RightWingExt[1].rotateAngleX -= 0.85F; - this.RightWingExt[2].rotateAngleX -= 0.75F; - this.RightWingExt[3].rotateAngleX -= 0.5F; - this.RightWingExt[5].rotateAngleX -= 0.85F; this.Bodypiece[9].rotateAngleX += 0.5F; this.Bodypiece[10].rotateAngleX += 0.5F; this.Bodypiece[11].rotateAngleX += 0.5F; @@ -691,43 +491,10 @@ public class pm_newPonyAdv extends ModelPony { this.Bodypiece[13].rotateAngleX += 0.5F; } - /** - * @param move - */ protected void fixSpecialRotationPoints(float move) {} - public void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) { - aPlaneRenderer.rotationPointX += shiftX; - aPlaneRenderer.rotationPointY += shiftY; - aPlaneRenderer.rotationPointZ += shiftZ; - } - - public void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) { - aRenderer.rotationPointX += shiftX; - aRenderer.rotationPointY += shiftY; - aRenderer.rotationPointZ += shiftZ; - } - - public void setRotationPoint(HornGlowRenderer aRenderer, float setX, float setY, float setZ) { - aRenderer.rotationPointX = setX; - aRenderer.rotationPointY = setY; - aRenderer.rotationPointZ = setZ; - } - - public void setRotationPoint(PlaneRenderer aPlaneRenderer, float setX, float setY, float setZ) { - aPlaneRenderer.rotationPointX = setX; - aPlaneRenderer.rotationPointY = setY; - aPlaneRenderer.rotationPointZ = setZ; - } - - public void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) { - aRenderer.rotationPointX = setX; - aRenderer.rotationPointY = setY; - aRenderer.rotationPointZ = setZ; - } - @Override - public void render(AniParams aniparams) { + public void render() { if (this.isRiding && !this.isArmour) { translate(0.0F, -0.56F, -0.46F); } @@ -741,7 +508,7 @@ public class pm_newPonyAdv extends ModelPony { } if (this.metadata.getSize() == PonySize.FOAL) { - if (this.issneak && !this.isFlying && !this.isArmour) { + if (this.isSneak && !this.isFlying && !this.isArmour) { translate(0.0F, -0.12F, 0.0F); } @@ -753,7 +520,7 @@ public class pm_newPonyAdv extends ModelPony { translate(0.0F, 0.76F, 0.0F); scale(0.9F, 0.9F, 0.9F); this.renderHead(); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, -0.01F, 0.15F); } @@ -770,7 +537,7 @@ public class pm_newPonyAdv extends ModelPony { pushMatrix(); translate(0.0F, 0.89F, 0.0F); scale(0.6F, 0.41F, 0.6F); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, 0.12F, 0.0F); } @@ -792,7 +559,7 @@ public class pm_newPonyAdv extends ModelPony { translate(0.0F, 0.0F, -0.1F); } - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, 0.15F, 0.0F); } @@ -800,7 +567,7 @@ public class pm_newPonyAdv extends ModelPony { popMatrix(); pushMatrix(); translate(0.0F, -0.15F, -0.07F); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, 0.0F, -0.05F); } @@ -827,7 +594,7 @@ public class pm_newPonyAdv extends ModelPony { pushMatrix(); translate(0.0F, -0.15F, 0.01F); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, 0.05F, 0.0F); } @@ -836,7 +603,7 @@ public class pm_newPonyAdv extends ModelPony { pushMatrix(); translate(0.0F, -0.19F, -0.01F); scale(1.0F, 1.1F, 1.0F); - if (this.issneak && !this.isFlying) { + if (this.isSneak && !this.isFlying) { translate(0.0F, -0.06F, -0.04F); } @@ -868,50 +635,11 @@ public class pm_newPonyAdv extends ModelPony { this.renderTail(); this.renderLegs(); } - } protected void renderHead() { this.bipedHead.render(this.scale); - this.headpiece[0].render(this.scale); - this.headpiece[1].render(this.scale); - if (MineLittlePony.getConfig().getSnuzzles().get()) { - int red; - if (this.metadata.getGender() == PonyGender.STALLION) { - for (red = 0; red < this.MuzzleMale.length; ++red) { - this.MuzzleMale[red].render(this.scale); - } - } else { - for (red = 0; red < this.MuzzleFemale.length; ++red) { - this.MuzzleFemale[red].render(this.scale); - } - } - } - this.bipedHeadwear.render(this.scale); - if (this.metadata.getRace().hasHorn()) { - this.headpiece[2].render(this.scale); - if (this.heldItemRight != 0 && this.metadata.getGlowColor() != 0) { - GL11.glPushAttrib(24577); - disableTexture2D(); - disableLighting(); - enableBlend(); - float var4 = (this.metadata.getGlowColor() >> 16 & 255) / 255.0F; - float green = (this.metadata.getGlowColor() >> 8 & 255) / 255.0F; - float blue = (this.metadata.getGlowColor() & 255) / 255.0F; - blendFunc(GL11.GL_SRC_ALPHA, 1); - color(var4, green, blue, 0.4F); - this.hornglow[0].render(this.scale); - color(var4, green, blue, 0.2F); - this.hornglow[1].render(this.scale); - - enableTexture2D(); - enableLighting(); - disableBlend(); - popAttrib(); - } - } - } protected void renderNeck() { @@ -926,8 +654,7 @@ public class pm_newPonyAdv extends ModelPony { if (this.textureHeight == 64) { this.bipedBodyWear.render(this.scale); } - int k1; - for (k1 = 0; k1 < this.Bodypiece.length; ++k1) { + for (int k1 = 0; k1 < this.Bodypiece.length; ++k1) { this.Bodypiece[k1].render(this.scale); } @@ -946,30 +673,6 @@ public class pm_newPonyAdv extends ModelPony { // } //@formatter:on - if (this.metadata.getRace().hasWings()) { - if (!this.isFlying && !this.issneak) { - this.setExtendingWings(true); - - for (k1 = 0; k1 < this.LeftWing.length; ++k1) { - this.LeftWing[k1].render(this.scale); - } - - for (k1 = 0; k1 < this.RightWing.length; ++k1) { - this.RightWing[k1].render(this.scale); - } - } else { - this.setExtendingWings(false); - - for (k1 = 0; k1 < this.LeftWingExt.length; ++k1) { - this.LeftWingExt[k1].render(this.scale); - } - - for (k1 = 0; k1 < this.RightWingExt.length; ++k1) { - this.RightWingExt[k1].render(this.scale); - } - } - } - } protected void renderTail() { @@ -999,54 +702,20 @@ public class pm_newPonyAdv extends ModelPony { protected void initTextures() { this.Tail = new PlaneRenderer[21]; - this.headpiece = new ModelRenderer[3]; - this.hornglow = new HornGlowRenderer[2]; - this.MuzzleFemale = new PlaneRenderer[10]; - this.MuzzleMale = new PlaneRenderer[5]; + this.Bodypiece = new PlaneRenderer[14]; this.VillagerBagPiece = new PlaneRenderer[14]; this.BodypieceNeck = new PlaneRenderer[4]; - this.LeftWing = new ModelRenderer[3]; - this.RightWing = new ModelRenderer[3]; - this.LeftWingExt = new ModelRenderer[6]; - this.RightWingExt = new ModelRenderer[6]; this.initHeadTextures(); - this.initMuzzleTextures(); this.initBodyTextures(); this.initLegTextures(); this.initTailTextures(); - this.initWingTextures(); } protected void initHeadTextures() { this.bipedCape = new ModelRenderer(this, 0, 0).setTextureSize(64, 32); this.bipedHead = new ModelRenderer(this, 0, 0); - this.headpiece[0] = new ModelRenderer(this, 12, 16); - this.headpiece[1] = new ModelRenderer(this, 12, 16); - this.headpiece[1].mirror = true; - this.headpiece[2] = new ModelRenderer(this, 0, 3); - this.hornglow[0] = new HornGlowRenderer(this, 0, 3); - this.hornglow[1] = new HornGlowRenderer(this, 0, 3); this.bipedHeadwear = new ModelRenderer(this, 32, 0); - this.boxList.remove(this.headpiece[2]); - } - - protected void initMuzzleTextures() { - this.MuzzleFemale[0] = new PlaneRenderer(this, 10, 14); - this.MuzzleFemale[1] = new PlaneRenderer(this, 11, 13); - this.MuzzleFemale[2] = new PlaneRenderer(this, 9, 14); - this.MuzzleFemale[3] = new PlaneRenderer(this, 14, 14); - this.MuzzleFemale[4] = new PlaneRenderer(this, 11, 12); - this.MuzzleFemale[5] = new PlaneRenderer(this, 18, 7); - this.MuzzleFemale[6] = new PlaneRenderer(this, 9, 14); - this.MuzzleFemale[7] = new PlaneRenderer(this, 14, 14); - this.MuzzleFemale[8] = new PlaneRenderer(this, 11, 12); - this.MuzzleFemale[9] = new PlaneRenderer(this, 12, 12); - this.MuzzleMale[0] = new PlaneRenderer(this, 10, 13); - this.MuzzleMale[1] = new PlaneRenderer(this, 10, 13); - this.MuzzleMale[2] = new PlaneRenderer(this, 18, 7); - this.MuzzleMale[3] = new PlaneRenderer(this, 10, 13); - this.MuzzleMale[4] = new PlaneRenderer(this, 13, 13); } protected void initBodyTextures() { @@ -1148,275 +817,130 @@ public class pm_newPonyAdv extends ModelPony { this.Tail[20] = new PlaneRenderer(this, 32, 0); } - protected void initWingTextures() { - this.LeftWing[0] = new ModelRenderer(this, 56, 16); - this.LeftWing[0].mirror = true; - this.LeftWing[1] = new ModelRenderer(this, 56, 16); - this.LeftWing[1].mirror = true; - this.LeftWing[2] = new ModelRenderer(this, 56, 16); - this.LeftWing[2].mirror = true; - this.RightWing[0] = new ModelRenderer(this, 56, 16); - this.RightWing[1] = new ModelRenderer(this, 56, 16); - this.RightWing[2] = new ModelRenderer(this, 56, 16); - this.LeftWingExt[0] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[0].mirror = true; - this.LeftWingExt[1] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[1].mirror = true; - this.LeftWingExt[2] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[2].mirror = true; - this.LeftWingExt[3] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[3].mirror = true; - this.LeftWingExt[4] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[4].mirror = true; - this.LeftWingExt[5] = new ModelRenderer(this, 56, 19); - this.LeftWingExt[5].mirror = true; - this.RightWingExt[0] = new ModelRenderer(this, 56, 19); - this.RightWingExt[1] = new ModelRenderer(this, 56, 19); - this.RightWingExt[2] = new ModelRenderer(this, 56, 19); - this.RightWingExt[3] = new ModelRenderer(this, 56, 19); - this.RightWingExt[4] = new ModelRenderer(this, 56, 19); - this.RightWingExt[5] = new ModelRenderer(this, 56, 19); - this.compressWings(); - } - protected void initPositions(float yOffset, float stretch) { this.initHeadPositions(yOffset, stretch); - this.initMuzzlePositions(yOffset, stretch); this.initBodyPositions(yOffset, stretch); this.initLegPositions(yOffset, stretch); this.initTailPositions(yOffset, stretch); - this.initWingPositions(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.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); - this.headpiece[0].addBox(-4.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); - this.headpiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.headpiece[1].addBox(2.0F + HEAD_CENTRE_X, -6.0F + HEAD_CENTRE_Y, 1.0F + HEAD_CENTRE_Z, 2, 2, 2, stretch); - this.headpiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.headpiece[2].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, - stretch); - this.headpiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.hornglow[0].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, - stretch + 0.5F); - this.hornglow[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.hornglow[1].addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 3, 1, - stretch + 0.8F); - this.hornglow[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - 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.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); } - protected void initMuzzlePositions(float yOffset, float stretch) { - this.MuzzleFemale[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 4, 2, 0, stretch); - this.MuzzleFemale[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[1].addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 2, 1, 0, stretch); - this.MuzzleFemale[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[2].addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); - this.MuzzleFemale[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[3].addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch); - this.MuzzleFemale[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[4].addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 2, 0, 1, stretch); - this.MuzzleFemale[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[5].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); - this.MuzzleFemale[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[6].addSidePlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); - this.MuzzleFemale[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[7].addSidePlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch); - this.MuzzleFemale[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[8].addSidePlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); - this.MuzzleFemale[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleFemale[9].addSidePlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch); - this.MuzzleFemale[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleMale[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 4, 3, 0, stretch); - this.MuzzleMale[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleMale[1].addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); - this.MuzzleMale[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleMale[2].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch); - this.MuzzleMale[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleMale[3].addSidePlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); - this.MuzzleMale[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.MuzzleMale[4].addSidePlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, - -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch); - this.MuzzleMale[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - } - 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); - this.Bodypiece[0].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); + this.Bodypiece[0].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[1].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); + this.Bodypiece[1].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 8, 8, stretch); this.Bodypiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 8, 0, 12, stretch); + this.Bodypiece[2].addTopPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 12, stretch); this.Bodypiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 8, 0, 8, stretch); + this.Bodypiece[3].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 8, 0, 8, stretch); this.Bodypiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[4].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); + this.Bodypiece[4].addSidePlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[5].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, - 0, 8, 4, stretch); + this.Bodypiece[5].addSidePlane(4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 0, 8, 4, stretch); this.Bodypiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); + this.Bodypiece[6].addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); this.Bodypiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, - 8, 4, 0, stretch); + this.Bodypiece[7].addBackPlane(-4.0F + BODY_CENTRE_X, 0.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 8, 4, 0, stretch); this.Bodypiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, - 4.0F + BODY_CENTRE_Z, 8, 0, 4, stretch); + this.Bodypiece[8].addBottomPlane(-4.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 8, 0, 4, stretch); this.Bodypiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, - 2, 0, 6, stretch); + this.Bodypiece[9].addTopPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); this.Bodypiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, - 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); + this.Bodypiece[10].addBottomPlane(-1.0F + BODY_CENTRE_X, 4.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 2, 0, 6, stretch); this.Bodypiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[11].addSidePlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, - 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); + this.Bodypiece[11].addSidePlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[12].addSidePlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, - 0, 2, 6, stretch); + this.Bodypiece[12].addSidePlane(1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 2.0F + BODY_CENTRE_Z, 0, 2, 6, stretch); this.Bodypiece[12].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, - 8.0F + BODY_CENTRE_Z, 2, 2, 0, stretch); + this.Bodypiece[13].addBackPlane(-1.0F + BODY_CENTRE_X, 2.0F + BODY_CENTRE_Y, 8.0F + BODY_CENTRE_Z, 2, 2, 0, stretch); this.Bodypiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[0].addSidePlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); + this.VillagerBagPiece[0].addSidePlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[1].addSidePlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); + this.VillagerBagPiece[1].addSidePlane(-4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[2].addSidePlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); + this.VillagerBagPiece[2].addSidePlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[3].addSidePlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); + this.VillagerBagPiece[3].addSidePlane(7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 0, 6, 8, stretch); this.VillagerBagPiece[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); + this.VillagerBagPiece[4].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[5].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); + this.VillagerBagPiece[5].addTopPlane(2.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[6].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, - -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); + this.VillagerBagPiece[6].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -2.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[7].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, - -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); + this.VillagerBagPiece[7].addBottomPlane(2.0F + BODY_CENTRE_X, 1.0F + BODY_CENTRE_Y, -13.0F + BODY_CENTRE_Z, 8, 0, 3, stretch); this.VillagerBagPiece[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[8].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); + this.VillagerBagPiece[8].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[9].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); + this.VillagerBagPiece[9].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, -4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[10].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); + this.VillagerBagPiece[10].addBackPlane(-7.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[10].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[11].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, - 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); + this.VillagerBagPiece[11].addBackPlane(4.0F + BODY_CENTRE_X, -5.0F + BODY_CENTRE_Y, 4.0F + BODY_CENTRE_Z, 3, 6, 0, stretch); this.VillagerBagPiece[11].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[12].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, - -1.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); + this.VillagerBagPiece[12].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, -1.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerBagPiece[13].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, - 0.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); + this.VillagerBagPiece[13].addTopPlane(-4.0F + BODY_CENTRE_X, -4.5F + BODY_CENTRE_Y, 0.0F + BODY_CENTRE_Z, 8, 0, 1, stretch); this.VillagerBagPiece[13].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerApron.addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - -9.0F + BODY_CENTRE_Z, 8, 10, 0, stretch); + this.VillagerApron.addBackPlane(-4.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 8, 10, 0, stretch); this.VillagerApron.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.VillagerTrinket.addBackPlane(-2.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, - -9.0F + BODY_CENTRE_Z, 4, 5, 0, stretch); + this.VillagerTrinket.addBackPlane(-2.0F + BODY_CENTRE_X, -4.0F + BODY_CENTRE_Y, -9.0F + BODY_CENTRE_Z, 4, 5, 0, stretch); this.VillagerTrinket.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.BodypieceNeck[0].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, - -8.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); + this.BodypieceNeck[0].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); this.BodypieceNeck[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, - -4.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); + this.BodypieceNeck[1].addBackPlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -4.8F + BODY_CENTRE_Z, 4, 4, 0, stretch); this.BodypieceNeck[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.BodypieceNeck[2].addSidePlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, - -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); + this.BodypieceNeck[2].addSidePlane(-2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.BodypieceNeck[3].addSidePlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, - -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); + this.BodypieceNeck[3].addSidePlane(2.0F + BODY_CENTRE_X, -6.8F + BODY_CENTRE_Y, -8.8F + BODY_CENTRE_Z, 0, 4, 4, stretch); this.BodypieceNeck[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); - this.BodypieceNeck[0].rotateAngleX = this.NeckRotX; - this.BodypieceNeck[1].rotateAngleX = this.NeckRotX; - this.BodypieceNeck[2].rotateAngleX = this.NeckRotX; - this.BodypieceNeck[3].rotateAngleX = this.NeckRotX; + this.BodypieceNeck[0].rotateAngleX = NECK_ROT_X; + this.BodypieceNeck[1].rotateAngleX = NECK_ROT_X; + this.BodypieceNeck[2].rotateAngleX = NECK_ROT_X; + this.BodypieceNeck[3].rotateAngleX = NECK_ROT_X; } protected void initLegPositions(float yOffset, float stretch) { - this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, - 4, - 12, 4, stretch); + this.bipedRightArm.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); this.bipedRightArm.setRotationPoint(-3.0F, 8.0F + yOffset, 0.0F); if (bipedRightArmwear != null) { - 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.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(-2.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); + 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); this.bipedLeftArmwear.setRotationPoint(3.0F, 8.0F + yOffset, 0.0F); } - this.bipedRightLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, - 4, 12, 4, stretch); + this.bipedRightLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); this.bipedRightLeg.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F); if (bipedRightLegwear != null) { - this.bipedRightLegwear.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.bipedRightLegwear.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.bipedRightLegwear.setRotationPoint(-3.0F, 0.0F + yOffset, 0.0F); } - this.bipedLeftLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, - 4, 12, 4, stretch); + this.bipedLeftLeg.addBox(-2.0F + THIRDP_ARM_CENTRE_X, -6.0F + THIRDP_ARM_CENTRE_Y, -2.0F + THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch); if (this.bipedLeftLegwear != null) { - this.bipedLeftLegwear.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.bipedLeftLegwear.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.SteveArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, stretch); this.SteveArm.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F); - this.unicornarm.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, - 12, 4, stretch + .25f); + this.unicornarm.addBox(-2.0F + FIRSTP_ARM_CENTRE_X, -6.0F + FIRSTP_ARM_CENTRE_Y, -2.0F + FIRSTP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25f); this.unicornarm.setRotationPoint(-5.0F, 2.0F + yOffset, 0.0F); } @@ -1465,113 +989,15 @@ public class pm_newPonyAdv extends ModelPony { this.Tail[20].setRotationPoint(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); } - protected void initWingPositions(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; - this.LeftWing[1].addBox(4.0F, 5.0F, 4.0F, 2, 8, 2, stretch); - this.LeftWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); - this.LeftWing[1].rotateAngleX = ROTATE_90; - this.LeftWing[2].addBox(4.0F, 5.0F, 6.0F, 2, 6, 2, stretch); - this.LeftWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); - this.LeftWing[2].rotateAngleX = ROTATE_90; - this.RightWing[0].addBox(-6.0F, 5.0F, 2.0F, 2, 6, 2, stretch); - this.RightWing[0].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); - this.RightWing[0].rotateAngleX = ROTATE_90; - this.RightWing[1].addBox(-6.0F, 5.0F, 4.0F, 2, 8, 2, stretch); - this.RightWing[1].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); - this.RightWing[1].rotateAngleX = ROTATE_90; - this.RightWing[2].addBox(-6.0F, 5.0F, 6.0F, 2, 6, 2, stretch); - this.RightWing[2].setRotationPoint(HEAD_RP_X, WING_FOLDED_RP_Y + yOffset, WING_FOLDED_RP_Z); - this.RightWing[2].rotateAngleX = ROTATE_90; - this.LeftWingExt[0].addBox(0.0F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F); - this.LeftWingExt[0].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.LeftWingExt[1].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F); - this.LeftWingExt[1].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.LeftWingExt[2].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F); - this.LeftWingExt[2].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.LeftWingExt[3].addBox(0.0F, 5.0F, 2.0F, 1, 8, 2, stretch); - this.LeftWingExt[3].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.LeftWingExt[4].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F); - this.LeftWingExt[4].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.LeftWingExt[5].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.2F); - this.LeftWingExt[5].setRotationPoint(LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + yOffset, - LEFT_WING_EXT_RP_Z); - this.RightWingExt[0].addBox(0.0F, 6.0F, 0.0F, 1, 8, 2, stretch + 0.1F); - this.RightWingExt[0].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - this.RightWingExt[1].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, stretch - 0.2F); - this.RightWingExt[1].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - this.RightWingExt[2].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, stretch - 0.1F); - this.RightWingExt[2].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - this.RightWingExt[3].addBox(0.0F, 5.0F, 2.0F, 1, 8, 2, stretch); - this.RightWingExt[3].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - this.RightWingExt[4].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, stretch + 0.3F); - this.RightWingExt[4].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - this.RightWingExt[5].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, stretch + 0.2F); - this.RightWingExt[5].setRotationPoint(RIGHT_WING_EXT_RP_X, RIGHT_WING_EXT_RP_Y + yOffset, - RIGHT_WING_EXT_RP_Z); - } - @Override public void renderCape(float scale) { this.bipedCape.render(scale); } - protected void compressWings() { - this.CompressiveLeftWing = new CompressiveRendering(this); - this.CompressiveRightWing = new CompressiveRendering(this); - this.CompressiveLeftWing.addCompressed(this.LeftWing[0]); - this.CompressiveLeftWing.addCompressed(this.LeftWing[1]); - this.CompressiveLeftWing.addCompressed(this.LeftWing[2]); - this.CompressiveRightWing.addCompressed(this.RightWing[0]); - this.CompressiveRightWing.addCompressed(this.RightWing[1]); - this.CompressiveRightWing.addCompressed(this.RightWing[2]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[0]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[1]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[2]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[3]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[4]); - this.CompressiveLeftWing.addExpanded(this.LeftWingExt[5]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[0]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[1]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[2]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[3]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[4]); - this.CompressiveRightWing.addExpanded(this.RightWingExt[5]); - this.CompressiveLeftWing.setChance(2); - this.CompressiveRightWing.setChance(2); - } - @Override public ModelRenderer getRandomModelBox(Random par1Random) { Object part = this.boxList.get(par1Random.nextInt(this.boxList.size())); - return part instanceof ModelRenderer ? (ModelRenderer) part - : ((CompressiveRendering) part).getARenderer(par1Random); - } - - public void setExtendingWings(boolean isCompressed) { - this.CompressiveLeftWing.setIsCompressed(isCompressed); - this.CompressiveRightWing.setIsCompressed(isCompressed); - } - - public void setHasWings_Compression(boolean pegasus) { - if (pegasus) { - this.CompressiveLeftWing.init_Safe(); - this.CompressiveRightWing.init_Safe(); - } else { - this.CompressiveLeftWing.deInit_Safe(); - this.CompressiveRightWing.deInit_Safe(); - } + return part instanceof ModelRenderer ? (ModelRenderer) part : ((CompressiveRendering) part).getARenderer(par1Random); } } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/HornGlowRenderer.java b/src/main/java/com/brohoof/minelittlepony/renderer/HornGlowRenderer.java index ab8bd46c..3ae6f64f 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/HornGlowRenderer.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/HornGlowRenderer.java @@ -1,236 +1,53 @@ package com.brohoof.minelittlepony.renderer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.TextureOffset; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.Tessellator; -import org.lwjgl.opengl.GL11; - import com.brohoof.minelittlepony.model.ModelHornGlow; -public class HornGlowRenderer { - public float textureWidth; - public float textureHeight; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.model.TextureOffset; + +public class HornGlowRenderer extends ModelRenderer { + private int textureOffsetX; private int textureOffsetY; - public float rotationPointX; - public float rotationPointY; - public float rotationPointZ; - public float rotateAngleX; - public float rotateAngleY; - public float rotateAngleZ; - private boolean compiled; - private int displayList; - public boolean mirror; - public boolean showModel; - public boolean isHidden; - public List cubeList; - public List childModels; - public final String boxName; private ModelBase baseModel; public HornGlowRenderer(ModelBase par1ModelBase, String par2Str) { - this.textureWidth = 64.0F; - this.textureHeight = 32.0F; - this.compiled = false; - this.displayList = 0; - this.mirror = false; - this.showModel = true; - this.isHidden = false; - this.cubeList = new ArrayList(); + super(par1ModelBase, par2Str); this.baseModel = par1ModelBase; - this.boxName = par2Str; - this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight); } public HornGlowRenderer(ModelBase par1ModelBase) { - this(par1ModelBase, (String) null); + this(par1ModelBase, null); } public HornGlowRenderer(ModelBase par1ModelBase, int par2, int par3) { this(par1ModelBase); - this.setTextureOffset(par2, par3); - } + this.setTextureSize(par2, par3); - public void addChild(HornGlowRenderer par1ModelRenderer) { - if (this.childModels == null) { - this.childModels = new ArrayList(); - } - - this.childModels.add(par1ModelRenderer); - } - - public HornGlowRenderer setTextureOffset(int par1, int par2) { - this.textureOffsetX = par1; - this.textureOffsetY = par2; - return this; } public HornGlowRenderer addBox(String par1Str, float par2, float par3, float par4, int par5, int par6, int par7) { par1Str = this.boxName + "." + par1Str; TextureOffset var8 = this.baseModel.getTextureOffset(par1Str); this.setTextureOffset(var8.textureOffsetX, var8.textureOffsetY); - this.cubeList.add((new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, - par6, par7, 0.0F)).func_78244_a(par1Str)); + this.cubeList.add((new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).setBoxName(par1Str)); return this; } public HornGlowRenderer addBox(float par1, float par2, float par3, int par4, int par5, int par6) { - this.cubeList.add(new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, - par5, par6, 0.0F)); + this.cubeList.add(new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F)); return this; } public void addBox(float par1, float par2, float par3, int par4, int par5, int par6, float par7) { - this.cubeList.add(new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, - par5, par6, par7)); + this.cubeList.add(new ModelHornGlow(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7)); } - public void setRotationPoint(float par1, float par2, float par3) { - this.rotationPointX = par1; - this.rotationPointY = par2; - this.rotationPointZ = par3; - } - - public void render(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - Iterator var2; - HornGlowRenderer var3; - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { - GL11.glCallList(this.displayList); - if (this.childModels != null) { - var2 = this.childModels.iterator(); - - while (var2.hasNext()) { - var3 = var2.next(); - var3.render(par1); - } - } - } else { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, - this.rotationPointZ * par1); - GL11.glCallList(this.displayList); - if (this.childModels != null) { - var2 = this.childModels.iterator(); - - while (var2.hasNext()) { - var3 = var2.next(); - var3.render(par1); - } - } - - GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, - -this.rotationPointZ * par1); - } - } else { - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - - GL11.glCallList(this.displayList); - if (this.childModels != null) { - var2 = this.childModels.iterator(); - - while (var2.hasNext()) { - var3 = var2.next(); - var3.render(par1); - } - } - - GL11.glPopMatrix(); - } - } - - } - - public void renderWithRotation(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - GL11.glCallList(this.displayList); - GL11.glPopMatrix(); - } - - } - - public void postRender(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, - this.rotationPointZ * par1); - } - } else { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - } - } - - } - - private void compileDisplayList(float par1) { - this.displayList = GLAllocation.generateDisplayLists(1); - GL11.glNewList(this.displayList, 4864); - Tessellator var2 = Tessellator.getInstance(); - for (ModelHornGlow var4 : cubeList) { - var4.render(var2, par1); - } - - GL11.glEndList(); - this.compiled = true; - } - - public HornGlowRenderer setTextureSize(int par1, int par2) { - this.textureWidth = par1; - this.textureHeight = par2; + @Override + public ModelRenderer setTextureOffset(int x, int y) { + this.textureOffsetX = x; + this.textureOffsetY = y; return this; } } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java index 4d4b4179..4f1fef54 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPony.java @@ -58,26 +58,19 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender thePony.checkSkin(); this.playerModel = this.getModel(player); this.mainModel = this.playerModel.getModel(); - this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel - .getModel().heldItemRight = currentItemStack == null ? 0 : 1; + this.playerModel.getModel().heldItemRight = currentItemStack == null ? 0 : 1; this.playerModel.apply(thePony.metadata); if (currentItemStack != null && player.getItemInUseCount() > 0) { EnumAction yOrigin = currentItemStack.getItemUseAction(); if (yOrigin == EnumAction.BLOCK) { - this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel - .getModel().heldItemRight = 3; + this.playerModel.getModel().heldItemRight = 3; } else if (yOrigin == EnumAction.BOW) { - this.playerModel.getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel - .getModel().aimedBow = true; + this.playerModel.getModel().aimedBow = true; } } - this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = player - .isSneaking(); - this.playerModel - .getArmor().modelArmorChestplate.isFlying = this.playerModel.getArmor().modelArmor.isFlying = this.playerModel.getModel().isFlying = thePony - .isPegasusFlying(player); - // , this.renderManager.worldObj); + this.playerModel.getModel().isSneak = player.isSneaking(); + this.playerModel.getModel().isFlying = thePony.isPegasusFlying(player); if (MineLittlePony.getConfig().getShowScale().get()) { if (this.playerModel != PMAPI.human) { @@ -102,20 +95,15 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender yOrigin1 -= 0.125D; } - this.playerModel.getArmor().modelArmorChestplate.isSleeping = this.playerModel.getArmor().modelArmor.isSleeping = this.playerModel - .getModel().isSleeping = player.isPlayerSleeping(); - this.playerModel.getArmor().modelArmorChestplate.swingProgress = this.playerModel.getArmor().modelArmor.swingProgress = this.playerModel - .getModel().swingProgress; - this.playerModel.getArmor().modelArmorChestplate.isVillager = this.playerModel.getArmor().modelArmor.isVillager = this.playerModel - .getModel().isVillager = false; + this.playerModel.getModel().isSleeping = player.isPlayerSleeping(); + this.playerModel.getModel().swingProgress = getSwingProgress(player, partialTicks); + this.playerModel.getModel().isVillager = false; super.doRender(player, x, yOrigin1, z, yaw, partialTicks); - this.playerModel - .getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel.getModel().aimedBow = false; - this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false; - this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel - .getModel().heldItemRight = 0; + this.playerModel.getModel().aimedBow = false; + this.playerModel.getModel().isSneak = false; + this.playerModel.getModel().heldItemRight = 0; } @AppendInsns("renderLivingAt") diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java index c91ac5d3..2f836c26 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyMob.java @@ -6,7 +6,6 @@ import com.brohoof.minelittlepony.PonyRace; import com.brohoof.minelittlepony.TailLengths; import com.brohoof.minelittlepony.model.ModelPony; import com.brohoof.minelittlepony.model.PlayerModel; -import com.brohoof.minelittlepony.model.pony.pm_newPonyAdv; import com.brohoof.minelittlepony.renderer.layer.LayerHeldPonyItem; import com.brohoof.minelittlepony.renderer.layer.LayerPonyArmor; import com.brohoof.minelittlepony.renderer.layer.LayerPonySkull; @@ -40,46 +39,38 @@ public abstract class RenderPonyMob extends RenderLiving public void doRender(EntityLiving entity, double xPosition, double yPosition, double zPosition, float yaw, float partialTicks) { ItemStack heldItem = entity.getHeldItem(); - this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel - .getModel().heldItemRight = heldItem == null - ? 0 : 1; + this.playerModel.getModel().heldItemRight = heldItem == null ? 0 : 1; - this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false; - this.playerModel - .getArmor().modelArmorChestplate.isFlying = this.playerModel.getArmor().modelArmor.isFlying = this.playerModel.getModel().isFlying = false; - - if (this.playerModel.getModel() instanceof pm_newPonyAdv) { - ((pm_newPonyAdv) this.playerModel.getModel()).setHasWings_Compression(false); - } + this.playerModel.getModel().isSneak = false; + this.playerModel.getModel().isFlying = false; if (entity instanceof EntitySkeleton) { - switch (entity.getEntityId() % 3) { + switch (entity.getUniqueID().hashCode() % 3) { case 0: case 1: - this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.UNICORN); + this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN); break; case 2: - this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.EARTH); + this.playerModel.getModel().metadata.setRace(PonyRace.EARTH); } } else { - this.playerModel.getArmor().modelArmor.metadata.setRace(PonyRace.EARTH); + this.playerModel.getModel().metadata.setRace(PonyRace.EARTH); } if (entity instanceof EntityPigZombie) { - this.playerModel.getArmor().modelArmor.metadata.setGender(PonyGender.STALLION); + this.playerModel.getModel().metadata.setGender(PonyGender.STALLION); } else { - this.playerModel.getArmor().modelArmor.metadata.setGender(PonyGender.MARE); + this.playerModel.getModel().metadata.setGender(PonyGender.MARE); } if (entity instanceof EntitySkeleton) { - this.playerModel.getModel().metadata.setTail(TailLengths.FULL); - } else { this.playerModel.getModel().metadata.setTail(TailLengths.STUB); + } else { + this.playerModel.getModel().metadata.setTail(TailLengths.FULL); } - this.playerModel.getArmor().modelArmorChestplate.isSleeping = this.playerModel.getArmor().modelArmor.isSleeping = this.playerModel - .getModel().isSleeping = false; + this.playerModel.getModel().isSleeping = false; if (MineLittlePony.getConfig().getShowScale().get()) { this.shadowSize = 0.4F; } @@ -90,11 +81,9 @@ public abstract class RenderPonyMob extends RenderLiving } super.doRender(entity, xPosition, yOrigin, zPosition, yaw, partialTicks); - this.playerModel - .getArmor().modelArmorChestplate.aimedBow = this.playerModel.getArmor().modelArmor.aimedBow = this.playerModel.getModel().aimedBow = false; - this.playerModel.getArmor().modelArmorChestplate.issneak = this.playerModel.getArmor().modelArmor.issneak = this.playerModel.getModel().issneak = false; - this.playerModel.getArmor().modelArmorChestplate.heldItemRight = this.playerModel.getArmor().modelArmor.heldItemRight = this.playerModel - .getModel().heldItemRight = 0; + this.playerModel.getModel().aimedBow = false; + this.playerModel.getModel().isSneak = false; + this.playerModel.getModel().heldItemRight = 0; } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java index 90223486..02ecf17a 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java @@ -1,10 +1,9 @@ package com.brohoof.minelittlepony.renderer; -import org.lwjgl.opengl.GL11; - import com.brohoof.minelittlepony.PonyManager; import com.brohoof.minelittlepony.model.PMAPI; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.entity.EntityLivingBase; @@ -26,7 +25,7 @@ public class RenderPonySkeleton extends RenderPonyMob { @Override protected void preRenderCallback(EntitySkeleton skeleton, float partialTicks) { if (skeleton.getSkeletonType() == 1) { - GL11.glScalef(1.2F, 1.2F, 1.2F); + GlStateManager.scale(1.2F, 1.2F, 1.2F); } } @@ -37,7 +36,6 @@ public class RenderPonySkeleton extends RenderPonyMob { @Override protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) { - return skeleton.getSkeletonType() == 1 ? PonyManager.WITHER_SKELETON - : PonyManager.SKELETON; + return skeleton.getSkeletonType() == 1 ? PonyManager.WITHER_SKELETON : PonyManager.SKELETON; } } diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java index 6beb75ac..6f3927b5 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonyVillager.java @@ -1,11 +1,10 @@ package com.brohoof.minelittlepony.renderer; -import org.lwjgl.opengl.GL11; - import com.brohoof.minelittlepony.MineLittlePony; import com.brohoof.minelittlepony.Pony; import com.brohoof.minelittlepony.model.PMAPI; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.util.ResourceLocation; @@ -28,7 +27,7 @@ public class RenderPonyVillager extends RenderPonyMob { } } - GL11.glScalef(0.9375F, 0.9375F, 0.9375F); + GlStateManager.scale(0.9375F, 0.9375F, 0.9375F); } @Override diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/ScalableModelRenderer.java b/src/main/java/com/brohoof/minelittlepony/renderer/ScalableModelRenderer.java deleted file mode 100644 index 79e8cccc..00000000 --- a/src/main/java/com/brohoof/minelittlepony/renderer/ScalableModelRenderer.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.brohoof.minelittlepony.renderer; - -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import com.brohoof.minelittlepony.model.ScalableModelBox; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.TextureOffset; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.Tessellator; - -public class ScalableModelRenderer extends ModelRenderer { - public float textureWidth; - public float textureHeight; - private int textureOffsetX; - private int textureOffsetY; - public float rotationPointX; - public float rotationPointY; - public float rotationPointZ; - public float rotateAngleX; - public float rotateAngleY; - public float rotateAngleZ; - private boolean compiled; - private int displayList; - public boolean mirror; - public boolean showModel; - public boolean isHidden; - public List cubeList; - public List childModels; - public final String boxName; - private ModelBase baseModel; - public float offsetX; - public float offsetY; - public float offsetZ; - - @SuppressWarnings("unchecked") - public ScalableModelRenderer(ModelBase par1ModelBase, String par2Str) { - super(par1ModelBase); - this.textureWidth = 64.0F; - this.textureHeight = 32.0F; - this.showModel = true; - this.cubeList = new ArrayList(); - this.baseModel = par1ModelBase; - par1ModelBase.boxList.add(this); - this.boxName = par2Str; - this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight); - } - - public ScalableModelRenderer(ModelBase par1ModelBase) { - this(par1ModelBase, (String) null); - } - - public ScalableModelRenderer(ModelBase par1ModelBase, int par2, int par3) { - this(par1ModelBase); - this.setTextureOffset(par2, par3); - } - - public void addChild(ScalableModelRenderer par1ModelRenderer) { - if (this.childModels == null) { - this.childModels = new ArrayList(); - } - - this.childModels.add(par1ModelRenderer); - } - - @Override - public ScalableModelRenderer setTextureOffset(int par1, int par2) { - this.textureOffsetX = par1; - this.textureOffsetY = par2; - return this; - } - - @Override - public ScalableModelRenderer addBox(String par1Str, float par2, float par3, float par4, int par5, int par6, - int par7) { - par1Str = this.boxName + "." + par1Str; - TextureOffset var8 = this.baseModel.getTextureOffset(par1Str); - this.setTextureOffset(var8.textureOffsetX, var8.textureOffsetY); - this.cubeList.add((new ScalableModelBox(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, - par6, par7, 0.0F)).func_78244_a(par1Str)); - return this; - } - - @Override - public ScalableModelRenderer addBox(float par1, float par2, float par3, int par4, int par5, int par6) { - this.cubeList.add(new ScalableModelBox(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, - par5, par6, 0.0F)); - return this; - } - - @Override - public void addBox(float par1, float par2, float par3, int par4, int par5, int par6, float par7) { - this.cubeList.add(new ScalableModelBox(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, - par5, par6, par7)); - } - - @Override - public void setRotationPoint(float par1, float par2, float par3) { - this.rotationPointX = par1; - this.rotationPointY = par2; - this.rotationPointZ = par3; - } - - @Override - public void render(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); - int var2; - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - } else { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, - this.rotationPointZ * par1); - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - - GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, - -this.rotationPointZ * par1); - } - } else { - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - - GL11.glPopMatrix(); - } - - GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); - } - - } - - public void render(float par1, float scaleX, float scaleY, float scaleZ) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); - int var2; - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { - GL11.glPushMatrix(); - GL11.glScalef(scaleX, scaleY, scaleZ); - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - - GL11.glPopMatrix(); - } else { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, - this.rotationPointZ * par1); - GL11.glPushMatrix(); - GL11.glScalef(scaleX, scaleY, scaleZ); - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - - GL11.glPopMatrix(); - GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, - -this.rotationPointZ * par1); - } - } else { - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - - GL11.glPushMatrix(); - GL11.glScalef(scaleX, scaleY, scaleZ); - GL11.glCallList(this.displayList); - if (this.childModels != null) { - for (var2 = 0; var2 < this.childModels.size(); ++var2) { - this.childModels.get(var2).render(par1); - } - } - - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); - } - - } - - @Override - public void renderWithRotation(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - GL11.glCallList(this.displayList); - GL11.glPopMatrix(); - } - - } - - @Override - public void postRender(float par1) { - if (!this.isHidden && this.showModel) { - if (!this.compiled) { - this.compileDisplayList(par1); - } - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, - this.rotationPointZ * par1); - } - } else { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - if (this.rotateAngleZ != 0.0F) { - GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); - } - } - } - - } - - private void compileDisplayList(float par1) { - this.displayList = GLAllocation.generateDisplayLists(1); - GL11.glNewList(this.displayList, 4864); - Tessellator var2 = Tessellator.getInstance(); - - for (int var3 = 0; var3 < this.cubeList.size(); ++var3) { - this.cubeList.get(var3).render(var2, par1); - } - - GL11.glEndList(); - this.compiled = true; - } - - @Override - public ScalableModelRenderer setTextureSize(int par1, int par2) { - this.textureWidth = par1; - this.textureHeight = par2; - return this; - } -} diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyArmor.java b/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyArmor.java index 3f4ca4da..a369d015 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyArmor.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyArmor.java @@ -63,7 +63,7 @@ public class LayerPonyArmor implements LayerRenderer { boolean isLegs = armorSlot == 3; ModelPony modelbase = isLegs ? pony.getArmor().modelArmorChestplate : pony.getArmor().modelArmor; - modelbase.setModelAttributes(this.renderer.getMainModel()); + modelbase.setModelAttributes(this.pony.getModel()); modelbase.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks); modelbase = getArmorModel(entitylivingbaseIn, itemstack, armorSlot, modelbase); prepareToRender((pm_newPonyArmor) modelbase, armorSlot); diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyCape.java b/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyCape.java index dc714f32..6fe83df7 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyCape.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/layer/LayerPonyCape.java @@ -48,18 +48,18 @@ public class LayerPonyCape implements LayerRenderer { } else if (model.getModel().metadata.getSize() == PonySize.LARGE) { translate(0.0F, -0.14F, -0.1F); scale(1.15F, 1.2F, 1.2F); - if (model.getModel().issneak && !model.getModel().isFlying) { + if (model.getModel().isSneak && !model.getModel().isFlying) { translate(0.0F, 0.03F, 0.0F); } } else if (model.getModel().metadata.getSize() == PonySize.PRINCESS) { translate(0.0F, -0.09F, 0.0F); scale(1.0F, 1.0F, 1.0F); - if (model.getModel().issneak && !model.getModel().isFlying) { + if (model.getModel().isSneak && !model.getModel().isFlying) { translate(0.0F, 0.03F, 0.0F); } } - if (model.getModel().issneak && !model.getModel().isFlying) { + if (model.getModel().isSneak && !model.getModel().isFlying) { translate(0.0F, 0.4F, -0.12F); } double d = clientPlayer.prevChasingPosX + (clientPlayer.chasingPosX - clientPlayer.prevChasingPosX) * scale diff --git a/src/main/java/com/brohoof/minelittlepony/util/MineLPObf.java b/src/main/java/com/brohoof/minelittlepony/util/MineLPObf.java deleted file mode 100644 index e2609004..00000000 --- a/src/main/java/com/brohoof/minelittlepony/util/MineLPObf.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.brohoof.minelittlepony.util; - -import com.mumfrey.liteloader.core.runtime.Obf; - -public class MineLPObf extends Obf { - - public static final MineLPObf isJumping = new MineLPObf("field_70703_bu", "aW", "isJumping"); - public static final MineLPObf ARMOR_TEXTURE_RES_MAP = new MineLPObf("field_177191_j", "j", "ARMOR_TEXTURE_RES_MAP"); - - protected MineLPObf(String seargeName, String obfName, String mcpName) { - super(seargeName, obfName, mcpName); - } - - protected MineLPObf(String seargeName, String obfName) { - super(seargeName, obfName, seargeName); - } -} diff --git a/src/main/java/com/brohoof/minelittlepony/util/MineLPPrivateFields.java b/src/main/java/com/brohoof/minelittlepony/util/MineLPPrivateFields.java deleted file mode 100644 index 66a6ade5..00000000 --- a/src/main/java/com/brohoof/minelittlepony/util/MineLPPrivateFields.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.brohoof.minelittlepony.util; - -import java.util.Map; - -import com.mumfrey.liteloader.core.runtime.Obf; -import com.mumfrey.liteloader.util.PrivateFields; - -import net.minecraft.client.renderer.entity.layers.LayerArmorBase; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; - -public class MineLPPrivateFields extends PrivateFields { - public static final MineLPPrivateFields isJumping = new MineLPPrivateFields( - EntityLivingBase.class, MineLPObf.isJumping); - public static final MineLPPrivateFields> ARMOR_TEXTURE_RES_MAP = new MineLPPrivateFields>( - LayerArmorBase.class, MineLPObf.ARMOR_TEXTURE_RES_MAP); - - protected MineLPPrivateFields(Class

owner, Obf obf) { - super(owner, obf); - } - -} diff --git a/src/main/java/com/brohoof/minelittlepony/util/MineLPRData.java b/src/main/java/com/brohoof/minelittlepony/util/MineLPRData.java deleted file mode 100644 index f857f876..00000000 --- a/src/main/java/com/brohoof/minelittlepony/util/MineLPRData.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.brohoof.minelittlepony.util; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import com.brohoof.minelittlepony.util.MineLPLogger; -import com.brohoof.minelittlepony.util.MineLPReflection; - -public class MineLPRData { - public boolean installed = false; - public boolean compatible = false; - public HashMap> classes = new HashMap>(); - public HashMap> constructors = new HashMap>(); - public HashMap methods = new HashMap(); - public HashMap fields = new HashMap(); - public HashMap objects = new HashMap(); - - public Object getInstance(String constructorName, Object... params) { - try { - if (this.constructors.containsKey(constructorName)) { - Constructor e = this.constructors.get(constructorName); - if (params != null && params.length != 0) { - return e.newInstance(params); - } - - return e.newInstance(); - } - - MineLPLogger.error("Unknown requested constructor \"%s\"", constructorName); - } catch (Exception var4) { - var4.printStackTrace(); - MineLPLogger.error("Error when trying to get constructor \"%s\"", constructorName); - } - - return null; - } - - public boolean isInstance(String className, Object object) { - return this.getClass(className).isInstance(object); - } - - public Object getField(String fieldName, Object object) { - try { - if (this.fields.containsKey(fieldName)) { - Field e = this.fields.get(fieldName); - return e.get(object); - } - - MineLPLogger.error("Unknown requested field \"%s\"", fieldName); - } catch (Exception var4) { - var4.printStackTrace(); - MineLPLogger.error("Error when trying to get field \"%s\"", fieldName); - } - - return null; - } - - public boolean setField(String fieldName, Object object, Object value) { - try { - if (this.fields.containsKey(fieldName)) { - Field e = this.fields.get(fieldName); - e.set(object, value); - return true; - } - MineLPLogger.error("Unknown requested field \"%s\"", fieldName); - return false; - } catch (Exception var5) { - var5.printStackTrace(); - MineLPLogger.error("Error when trying to set field \"%s\"", fieldName); - return false; - } - } - - public Object invokeMethod(String methodName, Object object, Object... params) { - try { - if (this.methods.containsKey(methodName)) { - Method e = this.methods.get(methodName); - return params != null ? e.invoke(object, params) : e.invoke(object); - } - MineLPLogger.error("Unknown requested method \"%s\"", methodName); - return null; - } catch (Exception var5) { - var5.printStackTrace(); - MineLPLogger.error("Method \"%s\" failed to be invoked", methodName); - MineLPLogger.error("Types: " + MineLPReflection.getStringFromTypes(MineLPReflection.getTypesFromObjects(params))); - MineLPLogger.error("Values: " + params); - return null; - } - } - - public Class getClass(String className) { - return this.classes.containsKey(className) ? this.classes.get(className) : null; - } - - public Constructor getConstructor(String constructorName) { - return this.constructors.containsKey(constructorName) ? this.constructors.get(constructorName) : null; - } - - public Method getMethod(String methodName) { - return this.methods.containsKey(methodName) ? this.methods.get(methodName) : null; - } - - public Field getField(String fieldName) { - return this.fields.containsKey(fieldName) ? this.fields.get(fieldName) : null; - } - - public Object getObject(String objectName) { - Object object = null; - if (this.objects.containsKey(objectName)) { - object = this.objects.get(objectName); - } - - if (object == null) { - MineLPLogger.error("Object \"%s\" is NULL", objectName); - } - - return object; - } - - public void putClass(String className, Class clazz) { - this.classes.put(className, clazz); - } - - public void putConstructor(String constructorName, Constructor constructor) { - this.constructors.put(constructorName, constructor); - } - - public void putMethod(String methodName, Method method) { - this.methods.put(methodName, method); - } - - public void putField(String fieldName, Field field) { - this.fields.put(fieldName, field); - } - - public void putObject(String objectName, Object object) { - this.objects.put(objectName, object); - } - - public void removeClass(String className) { - this.classes.remove(className); - } - - public void removeConstructor(String constructorName) { - this.constructors.remove(constructorName); - } - - public void removeMethod(String methodName) { - this.methods.remove(methodName); - } - - public void removeField(String fieldName) { - this.fields.remove(fieldName); - } - - public void removeObject(String objectName) { - this.objects.remove(objectName); - } - - public boolean hasClass(String className) { - return this.classes.containsKey(className); - } - - public boolean hasConstructor(String constructorName) { - return this.constructors.containsKey(constructorName); - } - - public boolean hasMethod(String methodName) { - return this.methods.containsKey(methodName); - } - - public boolean hasField(String fieldName) { - return this.fields.containsKey(fieldName); - } - - public boolean hasObject(String objectName) { - return this.objects.containsKey(objectName); - } - - public boolean removeNullData() { - boolean nullDataPresent = false; - nullDataPresent |= this.removeNullData(this.classes); - nullDataPresent |= this.removeNullData(this.constructors); - nullDataPresent |= this.removeNullData(this.methods); - nullDataPresent |= this.removeNullData(this.fields); - return nullDataPresent; - } - - private boolean removeNullData(Map map) { - // boolean nullDataPresent = false; - Iterator var3 = map.keySet().iterator(); - - while (var3.hasNext()) { - Object key = var3.next(); - if (map.get(key) == null) { - this.constructors.remove(key); - // nullDataPresent = true; - } - } - - return false; - } -} diff --git a/src/main/java/com/brohoof/minelittlepony/util/MineLPReflection.java b/src/main/java/com/brohoof/minelittlepony/util/MineLPReflection.java deleted file mode 100644 index 74ed1c25..00000000 --- a/src/main/java/com/brohoof/minelittlepony/util/MineLPReflection.java +++ /dev/null @@ -1,318 +0,0 @@ -package com.brohoof.minelittlepony.util; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import com.brohoof.minelittlepony.util.MineLPLogger; -import com.brohoof.minelittlepony.util.MineLPRData; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderBiped; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; - -// TODO Don't use reflection during rendering -public class MineLPReflection { - public static MineLPRData forgeAPI; - - public static void preCall() {} - - private static boolean reflectForgeAPI(MineLPRData data) { - MineLPLogger.info("Checking ForgeAPI..."); - final String frgPkg = "net.minecraftforge.client."; - Class ItemRenderType = getClass(frgPkg + "IItemRenderer$ItemRenderType"); - Class ItemRendererHelper = getClass(frgPkg + "IItemRenderer$ItemRendererHelper"); - Class IItemRenderer = getClass(frgPkg + "IItemRenderer"); - Class MinecraftForgeClient = getClass(frgPkg + "MinecraftForgeClient"); - Class ForgeHooksClient = getClass(frgPkg + "ForgeHooksClient"); - Class[] reflectedForgeAPIClasses = new Class[] { - ItemRenderType, - ItemRendererHelper, - IItemRenderer, - MinecraftForgeClient, - ForgeHooksClient, - RenderBiped.class - }; - data.installed = false; - int var9 = reflectedForgeAPIClasses.length; - byte o = 0; - if (o < var9) { - Class enumConstants = reflectedForgeAPIClasses[o]; - if (enumConstants == null) { - return false; - } - data.installed = true; - } - data.putClass("ForgeHooksClient", ForgeHooksClient); - data.putClass("IItemRenderer", IItemRenderer); - data.putClass("MinecraftForgeClient", MinecraftForgeClient); - data.putClass("IItemRenderer$ItemRenderType", ItemRenderType); - data.putClass("IItemRenderer$ItemRendererHelper", ItemRendererHelper); - Method m; - data.putMethod("ForgeHooksClient.getArmorModel", m = getMethod(ForgeHooksClient, "getArmorModel", EntityLivingBase.class, ItemStack.class, Integer.TYPE, ModelBiped.class)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("ForgeHooksClient.getArmorTexture", - m = getMethod(ForgeHooksClient, "getArmorTexture", Entity.class, ItemStack.class, String.class, Integer.TYPE, String.class)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("ForgeHooksClient.orientBedCamera", m = getMethod(ForgeHooksClient, "orientBedCamera", Minecraft.class, EntityLivingBase.class)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("ForgeHooksClient.setRenderPass", m = getMethod(ForgeHooksClient, "setRenderPass", Integer.TYPE)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("ForgeHooksClient.onDrawBlockHighlight", m = getMethod(ForgeHooksClient, "onDrawBlockHighlight", - RenderGlobal.class, EntityPlayer.class, MovingObjectPosition.class, Integer.TYPE, ItemStack.class, Float.TYPE)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("ForgeHooksClient.dispatchRenderLast", m = getMethod(ForgeHooksClient, "dispatchRenderLast", RenderGlobal.class, Float.TYPE)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("MinecraftForgeClient.getItemRenderer", - m = getMethod(MinecraftForgeClient, "getItemRenderer", ItemStack.class, ItemRenderType)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("IItemRenderer.shouldUseRenderHelper", - m = getMethod(IItemRenderer, "shouldUseRenderHelper", ItemRenderType, ItemStack.class, ItemRendererHelper)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("Item.getRenderPasses", m = getMethod(Item.class, "getRenderPasses", Integer.TYPE)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("RenderBiped.getArmorResource", - m = getMethod(RenderBiped.class, "getArmorResource", Entity.class, ItemStack.class, Integer.TYPE, String.class)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("Entity.canRiderInteract", m = getMethod(Entity.class, "canRiderInteract", new Class[0])); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - data.putMethod("RenderGlobal.drawBlockDamageTexture", - m = getMethod(RenderGlobal.class, "drawBlockDamageTexture", Tessellator.class, EntityLivingBase.class, Float.TYPE)); - if (m == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Method " + stringMethod(m)); - Object[] enumConstants1 = ItemRenderType.getEnumConstants(); - Object o1; - data.putObject("IItemRenderer$ItemRenderType.ENTITY", o1 = enumConstants1[0]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRenderType.EQUIPPED", o1 = enumConstants1[1]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRenderType.EQUIPPED_FIRST_PERSON", o1 = enumConstants1[2]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRenderType.INVENTORY", o1 = enumConstants1[3]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRenderType.FIRST_PERSON_MAP", o1 = enumConstants1[4]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - enumConstants1 = ItemRendererHelper.getEnumConstants(); - data.putObject("IItemRenderer$ItemRendererHelper.ENTITY_ROTATION", o1 = enumConstants1[0]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRendererHelper.ENTITY_BOBBING", o1 = enumConstants1[1]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRendererHelper.EQUIPPED_BLOCK", o1 = enumConstants1[2]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRendererHelper.BLOCK_3D", o1 = enumConstants1[3]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - data.putObject("IItemRenderer$ItemRendererHelper.INVENTORY_BLOCK", o1 = enumConstants1[4]); - if (o1 == null) { - return false; - } - MineLPLogger.debug("ForgeAPI Object " + o1.toString()); - if (forgeAPI.removeNullData()) { - MineLPLogger.warn("ForgeAPI reflection returned some nulls"); - } - return true; - } - - public static Class getClass(String className) { - try { - return Class.forName(className); - } catch (Exception var2) { - return null; - } - } - - public static Constructor getConstructor(Class clazz, Class... types) { - try { - Constructor e = null; - - try { - if (types != null && types.length != 0) { - e = clazz.getConstructor(types); - } else { - e = clazz.getConstructor(new Class[0]); - } - } catch (Exception var4) { - - } - - return e; - } catch (Exception var5) { - MineLPLogger.error("Failed to match Constructor for class \"%s\"", new Object[] { clazz.getName() }); - var5.printStackTrace(); - return null; - } - } - - public static Field getField(Class clazz, String fieldName) { - - try { - Field f = null; - - try { - f = clazz.getField(fieldName); - } catch (Exception var5) { - f = null; - } - - if (f == null) { - f = clazz.getDeclaredField(fieldName); - } - - f.setAccessible(true); - return f; - } catch (Exception e) { - MineLPLogger.error("Failed to match Field \"%s\" in %s", new Object[] { fieldName, clazz.getName() }); - e.printStackTrace(); - } - - return null; - } - - public static Method getMethod(Class clazz, String methodName, Class... types) { - try { - Method e = null; - - try { - e = clazz.getMethod(methodName, types); - } catch (Exception var5) { - - } - - if (e == null) { - if (types != null && types.length != 0) { - e = clazz.getDeclaredMethod(methodName, types); - } else { - e = clazz.getDeclaredMethod(methodName, new Class[0]); - } - } - - e.setAccessible(true); - return e; - } catch (Exception var6) { - MineLPLogger.error("Failed to match method \"%s\" in %s", new Object[] { methodName, clazz.getName() }); - MineLPLogger.error("Types: " + getStringFromTypes(types)); - var6.printStackTrace(); - return null; - } - } - - public static String getStringFromTypes(Class... types) { - String temp = ""; - temp = temp + "("; - boolean first = true; - Class[] var3 = types; - int var4 = types.length; - - for (int var5 = 0; var5 < var4; ++var5) { - Class c = var3[var5]; - if (!first) { - temp = temp + ","; - } else { - first = false; - } - - temp = temp + c.getName(); - } - - temp = temp + ")"; - return temp; - } - - public static Class[] getTypesFromObjects(Object... objects) { - Class[] types = new Class[objects.length]; - - for (int i = 0; i < objects.length; ++i) { - types[i] = objects[i].getClass(); - } - - return types; - } - - public static String stringMethod(Method m) { - return Modifier.toString(m.getModifiers()) + " " - + (m.getReturnType() != null ? m.getReturnType().getName() : "void") + " " + m.getName() - + getStringFromTypes(m.getParameterTypes()) - + (m.getExceptionTypes().length > 0 ? " throws " + getStringFromTypes(m.getExceptionTypes()) : ""); - } - - static { - MineLPLogger.info("Checking compatibilities..."); - forgeAPI = new MineLPRData(); - forgeAPI.compatible = reflectForgeAPI(forgeAPI); - MineLPLogger.info("Compatibility Check Done!"); - if (forgeAPI.installed) { - MineLPLogger.info("ForgeAPI " + (forgeAPI.compatible ? "Installed and Compatible" : "Installed but Incompatible")); - } - - } -}