diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java b/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java index dcaf8fef..a7e30700 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/resource/ImageLoader.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; import org.apache.commons.io.IOUtils; +import com.google.common.base.Throwables; import com.voxelmodpack.hdskins.DynamicTextureImage; import com.voxelmodpack.hdskins.ImageBufferDownloadHD; @@ -52,7 +53,7 @@ public class ImageLoader implements Callable { IOUtils.closeQuietly(in); } } catch (IOException e) { - e.printStackTrace(); + Throwables.propagate(e); } return null; } diff --git a/src/main/java/com/minelittlepony/MineLittlePony.java b/src/main/java/com/minelittlepony/MineLittlePony.java index ec4d61e4..971fc179 100644 --- a/src/main/java/com/minelittlepony/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/MineLittlePony.java @@ -8,6 +8,7 @@ import com.minelittlepony.hdskins.gui.GuiSkinsMineLP; import com.minelittlepony.hdskins.gui.RenderPonyModel; import com.minelittlepony.renderer.RenderPonyPigman; import com.minelittlepony.renderer.RenderPonySkeleton; +import com.minelittlepony.renderer.RenderPonyVex; import com.minelittlepony.renderer.RenderPonyVillager; import com.minelittlepony.renderer.RenderPonyZombie; import com.minelittlepony.renderer.RenderPonyZombieVillager; @@ -25,6 +26,7 @@ import net.minecraft.entity.monster.EntityHusk; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityStray; +import net.minecraft.entity.monster.EntityVex; import net.minecraft.entity.monster.EntityWitherSkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.EntityZombieVillager; @@ -102,6 +104,10 @@ public class MineLittlePony { ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm)); MineLPLogger.info("Skeletons are now ponies."); } + + if (this.config.illagers) { + ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm)); + } } diff --git a/src/main/java/com/minelittlepony/PonyConfig.java b/src/main/java/com/minelittlepony/PonyConfig.java index 94276322..39a3f159 100644 --- a/src/main/java/com/minelittlepony/PonyConfig.java +++ b/src/main/java/com/minelittlepony/PonyConfig.java @@ -26,6 +26,8 @@ public class PonyConfig implements Exposable { public boolean pigzombies = true; @Expose public boolean skeletons = true; + @Expose + public boolean illagers = true; public PonyLevel getPonyLevel() { if (ponylevel == null) diff --git a/src/main/java/com/minelittlepony/model/pony/ModelBreezie.java b/src/main/java/com/minelittlepony/model/pony/ModelBreezie.java new file mode 100644 index 00000000..01f04f8b --- /dev/null +++ b/src/main/java/com/minelittlepony/model/pony/ModelBreezie.java @@ -0,0 +1,216 @@ +package com.minelittlepony.model.pony; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumHandSide; +import net.minecraft.util.math.MathHelper; + +public class ModelBreezie extends ModelBiped { + + ModelRenderer neck; + ModelRenderer snuzzle; + ModelRenderer leftEar; + ModelRenderer rightEar; + ModelRenderer leftAntenna; + ModelRenderer rightAntenna; + ModelRenderer tail; + ModelRenderer tailStub; + ModelRenderer leftWing; + ModelRenderer rightWing; + + public ModelBreezie() { + textureWidth = 64; + textureHeight = 64; + + this.bipedHeadwear.showModel = false; + + bipedHead = new ModelRenderer(this, 0, 0); + bipedHead.addBox(0F, 0F, 0F, 6, 6, 6).setRotationPoint(-3F, -7F, -7F); + + bipedBody = new ModelRenderer(this, 2, 12); + bipedBody.addBox(0F, 0F, 0F, 6, 7, 14).setRotationPoint(-3F, 1F, -3F); + setRotation(bipedBody, -0.5235988F, 0F, 0F); + + bipedRightArm = new ModelRenderer(this, 36, 12); + bipedRightArm.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(-3F, 8F, -5F); + + bipedLeftArm = new ModelRenderer(this, 28, 12); + bipedLeftArm.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(1F, 8F, -5F); + + bipedLeftLeg = new ModelRenderer(this, 8, 12); + bipedLeftLeg.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(1F, 12F, 3F); + + bipedRightLeg = new ModelRenderer(this, 0, 12); + bipedRightLeg.addBox(0F, 0F, 0F, 2, 12, 2).setRotationPoint(-3F, 12F, 3F); + + neck = new ModelRenderer(this, 40, 0); + neck.addBox(0F, 0F, 0F, 2, 5, 2).setRotationPoint(-1F, -2F, -4F); + setRotation(neck, 0.0872665F, 0F, 0F); + + leftEar = new ModelRenderer(this, 28, 0); + leftEar.addBox(0F, 0F, 0F, 1, 1, 1).setRotationPoint(2F, -8F, -3F); + + rightEar = new ModelRenderer(this, 24, 0); + rightEar.addBox(0F, 0F, 0F, 1, 1, 1).setRotationPoint(-3F, -8F, -3F); + + leftAntenna = new ModelRenderer(this, 28, 2); + leftAntenna.addBox(0F, 0F, 0F, 1, 6, 1).setRotationPoint(1F, -12F, -4F); + setRotation(leftAntenna, -0.2617994F, 0F, 0F); + + rightAntenna = new ModelRenderer(this, 24, 2); + rightAntenna.addBox(0F, 0F, 0F, 1, 6, 1).setRotationPoint(-2F, -12F, -4F); + setRotation(rightAntenna, -0.2617994F, 0F, 0F); + + snuzzle = new ModelRenderer(this, 24, 9); + snuzzle.addBox(0F, 0F, 0F, 2, 2, 1).setRotationPoint(-1F, -3F, -8F); + + tailStub = new ModelRenderer(this, 40, 7); + tailStub.addBox(0F, 0F, 0F, 1, 1, 3).setRotationPoint(-0.5F, 8F, 8F); + + tail = new ModelRenderer(this, 32, 0); + tail.addBox(0F, 0F, 1F, 2, 9, 2).setRotationPoint(-1F, 7F, 10F); + + leftWing = new ModelRenderer(this, 0, 40); + leftWing.addBox(0F, -12F, 0F, 24, 24, 0); + leftWing.setRotationPoint(2F, 3F, 1F); + leftWing.setTextureSize(64, 32); + setRotation(leftWing, 0F, -0.6981317F, 0F); + + rightWing = new ModelRenderer(this, 0, 40); + rightWing.addBox(-24F, -12F, 0F, 24, 24, 0); + rightWing.setRotationPoint(-2F, 3F, 1F); + rightWing.setTextureSize(64, 32); + rightWing.mirror = true; + setRotation(rightWing, 0F, 0.6981317F, 0F); + + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + neck.render(f5); + leftEar.render(f5); + rightEar.render(f5); + leftAntenna.render(f5); + rightAntenna.render(f5); + snuzzle.render(f5); + tailStub.render(f5); + tail.render(f5); + leftWing.render(f5); + rightWing.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + @SuppressWarnings("incomplete-switch") + @Override + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { + + // this.bipedRightArm.rotationPointZ = 0.0F; + // this.bipedRightArm.rotationPointX = -5.0F; + // this.bipedLeftArm.rotationPointZ = 0.0F; + // this.bipedLeftArm.rotationPointX = 5.0F; + this.bipedRightArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount * 0.5F; + this.bipedLeftArm.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.bipedLeftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; + this.bipedRightLeg.rotateAngleY = 0.0F; + this.bipedLeftLeg.rotateAngleY = 0.0F; + this.bipedRightLeg.rotateAngleZ = 0.0F; + this.bipedLeftLeg.rotateAngleZ = 0.0F; + + if (this.isRiding) { + this.bipedRightArm.rotateAngleX += -((float) Math.PI / 5F); + this.bipedLeftArm.rotateAngleX += -((float) Math.PI / 5F); + this.bipedRightLeg.rotateAngleX = -1.4137167F; + this.bipedRightLeg.rotateAngleY = ((float) Math.PI / 10F); + this.bipedRightLeg.rotateAngleZ = 0.07853982F; + this.bipedLeftLeg.rotateAngleX = -1.4137167F; + this.bipedLeftLeg.rotateAngleY = -((float) Math.PI / 10F); + this.bipedLeftLeg.rotateAngleZ = -0.07853982F; + } + + this.bipedRightArm.rotateAngleY = 0; + this.bipedRightArm.rotateAngleZ = 0F; + + switch (this.leftArmPose) { + case EMPTY: + this.bipedLeftArm.rotateAngleY = 0.0F; + break; + case BLOCK: + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F; + this.bipedLeftArm.rotateAngleY = 0.5235988F; + break; + case ITEM: + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F); + this.bipedLeftArm.rotateAngleY = 0.0F; + } + + switch (this.rightArmPose) { + case EMPTY: + this.bipedRightArm.rotateAngleY = 0.0F; + break; + case BLOCK: + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F; + this.bipedRightArm.rotateAngleY = -0.5235988F; + break; + case ITEM: + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F); + this.bipedRightArm.rotateAngleY = 0.0F; + } + + if (this.swingProgress > 0.0F) { + EnumHandSide enumhandside = this.getMainHand(entityIn); + ModelRenderer modelrenderer = this.getArmForSide(enumhandside); + float f1 = this.swingProgress; + this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt(f1) * ((float) Math.PI * 2F)) * 0.2F; + + if (enumhandside == EnumHandSide.LEFT) { + this.bipedBody.rotateAngleY *= -1.0F; + } + + this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; + f1 = 1.0F - this.swingProgress; + f1 = f1 * f1; + f1 = f1 * f1; + f1 = 1.0F - f1; + float f2 = MathHelper.sin(f1 * (float) Math.PI); + float f3 = MathHelper.sin(this.swingProgress * (float) Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; + modelrenderer.rotateAngleX = (float) (modelrenderer.rotateAngleX - (f2 * 1.2D + f3)); + modelrenderer.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; + modelrenderer.rotateAngleZ += MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F; + } + + this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; + + if (this.rightArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) { + this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY; + this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY + 0.4F; + this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX; + } else if (this.leftArmPose == ModelBiped.ArmPose.BOW_AND_ARROW) { + this.bipedRightArm.rotateAngleY = -0.1F + this.bipedHead.rotateAngleY - 0.4F; + this.bipedLeftArm.rotateAngleY = 0.1F + this.bipedHead.rotateAngleY; + this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + this.bipedHead.rotateAngleX; + } + + } + +} diff --git a/src/main/java/com/minelittlepony/renderer/RenderPonySkeleton.java b/src/main/java/com/minelittlepony/renderer/RenderPonySkeleton.java index 27b8c802..117821ca 100644 --- a/src/main/java/com/minelittlepony/renderer/RenderPonySkeleton.java +++ b/src/main/java/com/minelittlepony/renderer/RenderPonySkeleton.java @@ -67,6 +67,7 @@ public class RenderPonySkeleton extends Rende public Stray(RenderManager rm) { super(rm); + this.addLayer(new LayerPonyStrayOverlay(this)); } @Override @@ -79,7 +80,6 @@ public class RenderPonySkeleton extends Rende public Wither(RenderManager rm) { super(rm); - this.addLayer(new LayerPonyStrayOverlay(this)); } @Override diff --git a/src/main/java/com/minelittlepony/renderer/RenderPonyVex.java b/src/main/java/com/minelittlepony/renderer/RenderPonyVex.java new file mode 100644 index 00000000..0e84a50e --- /dev/null +++ b/src/main/java/com/minelittlepony/renderer/RenderPonyVex.java @@ -0,0 +1,33 @@ +package com.minelittlepony.renderer; + +import com.minelittlepony.model.pony.ModelBreezie; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderBiped; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.monster.EntityVex; +import net.minecraft.util.ResourceLocation; + +/** + * AKA a breezie :D + */ +public class RenderPonyVex extends RenderBiped { + + private static final ResourceLocation VEX = new ResourceLocation("minelittlepony", "textures/entity/illager/vex_pony.png"); + private static final ResourceLocation VEX_CHARGING = new ResourceLocation("minelittlepony", "textures/entity/illager/vex_charging_pony.png"); + + public RenderPonyVex(RenderManager renderManagerIn) { + super(renderManagerIn, new ModelBreezie(), 0.3F); + } + + @Override + protected void preRenderCallback(EntityVex entitylivingbaseIn, float partialTickTime) { + GlStateManager.scale(0.4F, 0.4F, 0.4F); + } + + @Override + protected ResourceLocation getEntityTexture(EntityVex entity) { + return entity.func_190647_dj() ? VEX_CHARGING : VEX; + } + +} diff --git a/src/main/java/com/minelittlepony/renderer/RenderPonyZombie.java b/src/main/java/com/minelittlepony/renderer/RenderPonyZombie.java index f93ba01d..735e1578 100644 --- a/src/main/java/com/minelittlepony/renderer/RenderPonyZombie.java +++ b/src/main/java/com/minelittlepony/renderer/RenderPonyZombie.java @@ -17,7 +17,7 @@ import net.minecraft.util.ResourceLocation; public class RenderPonyZombie extends RenderPonyMob { private static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png"); - private static final ResourceLocation HUSK = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_husk_pony.png"); + private static final ResourceLocation HUSK = new ResourceLocation("minelittlepony", "textures/entity/zombie/husk_pony.png"); public RenderPonyZombie(RenderManager rendermanager) { super(rendermanager, PMAPI.zombie); diff --git a/src/main/java/com/minelittlepony/renderer/RenderPonyZombieVillager.java b/src/main/java/com/minelittlepony/renderer/RenderPonyZombieVillager.java new file mode 100644 index 00000000..050d1007 --- /dev/null +++ b/src/main/java/com/minelittlepony/renderer/RenderPonyZombieVillager.java @@ -0,0 +1,53 @@ +package com.minelittlepony.renderer; + +import com.minelittlepony.model.PMAPI; + +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.monster.EntityZombieVillager; +import net.minecraft.util.ResourceLocation; + +public class RenderPonyZombieVillager extends RenderPonyMob { + + private static final ResourceLocation GENERIC = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_villager_pony.png"); + private static final ResourceLocation FARMER = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_farmer_pony.png"); + private static final ResourceLocation LIBRARIAN = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_librarian_pony.png"); + private static final ResourceLocation PRIEST = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_priest_pony.png"); + private static final ResourceLocation SMITH = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_smith_pony.png"); + private static final ResourceLocation BUTCHER = new ResourceLocation("minelittlepony", "textures/entity/zombie_villager/zombie_butcher_pony.png"); + + public RenderPonyZombieVillager(RenderManager renderManager) { + super(renderManager, PMAPI.villager); + } + + @Override + protected ResourceLocation getEntityTexture(EntityZombieVillager villager) { + return getTexture(getTextureForVillager(villager)); + } + + private ResourceLocation getTextureForVillager(EntityZombieVillager villager) { + switch (villager.func_190736_dl()) { + case 0: + return FARMER; // applejack + case 1: + return LIBRARIAN; // twilight sparkle + case 2: + return PRIEST; // fluttershy + case 3: + return SMITH; // rarity + case 4: + return BUTCHER; // rainbow dash + case 5: + default: + return GENERIC; // pinkie pie + } + } + + @Override + protected void rotateCorpse(EntityZombieVillager villager, float p_77043_2_, float p_77043_3_, float partialTicks) { + if (villager.isConverting()) { + p_77043_3_ += (float) (Math.cos(villager.ticksExisted * 3.25D) * Math.PI * 0.25D); + } + + super.rotateCorpse(villager, p_77043_2_, p_77043_3_, partialTicks); + } +} diff --git a/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_charging_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_charging_pony.png new file mode 100644 index 00000000..04449211 Binary files /dev/null and b/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_charging_pony.png differ diff --git a/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_pony.png new file mode 100644 index 00000000..04449211 Binary files /dev/null and b/src/main/resources/assets/minelittlepony/textures/entity/illager/vex_pony.png differ