From 08f88daf103c955b92eb29409cddca7647bfbfdb Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Thu, 4 Jun 2015 08:17:23 -0500 Subject: Added Event handler, crest modifiers, sheath --- .../java/gmail/Lance5057/armor/items/Sheath.java | 49 +++++++++ .../gmail/Lance5057/armor/items/TinkerArmor.java | 77 +++++++++++++++ .../Lance5057/armor/renderers/ModelSheath.java | 50 ++++++++++ .../armor/renderers/ModelTinkerArmor.java | 109 +++++++++++++++++++++ 4 files changed, 285 insertions(+) create mode 100644 src/main/java/gmail/Lance5057/armor/items/Sheath.java create mode 100644 src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java create mode 100644 src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java create mode 100644 src/main/java/gmail/Lance5057/armor/renderers/ModelTinkerArmor.java (limited to 'src/main/java/gmail/Lance5057/armor') diff --git a/src/main/java/gmail/Lance5057/armor/items/Sheath.java b/src/main/java/gmail/Lance5057/armor/items/Sheath.java new file mode 100644 index 0000000..c3563f1 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/items/Sheath.java @@ -0,0 +1,49 @@ +package gmail.Lance5057.armor.items; + +import gmail.Lance5057.proxy.ClientProxy; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import tconstruct.library.accessory.AccessoryCore; +import tconstruct.library.accessory.IAccessoryModel; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class Sheath extends AccessoryCore implements IAccessoryModel +{ + + public Sheath() { + super("tinkersdefense:textures/armor/Sheath"); + } + + @Override + public boolean canEquipAccessory(ItemStack item, int slot) + { + return slot == 3; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { + return ClientProxy.sheath; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, + String type) { + return "tinkersdefense:textures/armor/Sheath.png"; + } + + ResourceLocation texture = new ResourceLocation("tinkersdefense", "textures/armor/Sheath.png"); + + @Override + @SideOnly(Side.CLIENT) + public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot) + { + return texture; + } + +} diff --git a/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java b/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java new file mode 100644 index 0000000..ba0fc1b --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/items/TinkerArmor.java @@ -0,0 +1,77 @@ +package gmail.Lance5057.armor.items; + +import gmail.Lance5057.TinkersDefense; +import gmail.Lance5057.proxy.ClientProxy; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TinkerArmor extends ItemArmor { + public TinkerArmor(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) { + super(par2EnumArmorMaterial, par3, par4); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + String itemName = "tinkersdefense:textures/armor/Sheath"; + this.itemIcon = par1IconRegister.registerIcon(itemName); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, + String type) { + return "tinkersdefense:textures/armor/Sheath.png"; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, + ItemStack itemStack, int armorSlot) { + + return ClientProxy.sheath; +// ModelBiped armorModel = null; +// if (itemStack != null) { +// if (itemStack.getItem() instanceof TinkerArmor) { +// int type = ((ItemArmor) itemStack.getItem()).armorType; +// if (type == 1 || type == 3) { +// armorModel = TinkersDefense.proxy.getArmorModel(0); +// } else { +// armorModel = TinkersDefense.proxy.getArmorModel(1); +// } +// +// } +// if (armorModel != null) { +// armorModel.bipedHead.showModel = armorSlot == 0; +// armorModel.bipedHeadwear.showModel = armorSlot == 0; +// armorModel.bipedBody.showModel = armorSlot == 1 +// || armorSlot == 2; +// armorModel.bipedRightArm.showModel = armorSlot == 1; +// armorModel.bipedLeftArm.showModel = armorSlot == 1; +// armorModel.bipedRightLeg.showModel = armorSlot == 2 +// || armorSlot == 3; +// armorModel.bipedLeftLeg.showModel = armorSlot == 2 +// || armorSlot == 3; +// armorModel.isSneak = entityLiving.isSneaking(); +// armorModel.isRiding = entityLiving.isRiding(); +// armorModel.isChild = entityLiving.isChild(); +// armorModel.heldItemRight = entityLiving.getHeldItem() != null ? 1 +// : 0; +// +// if (entityLiving instanceof EntityPlayer) { +// armorModel.aimedBow = ((EntityPlayer) entityLiving) +// .getItemInUseDuration() > 2; +// } +// return armorModel; +// } +// } +// return armorModel; + } + +} \ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java b/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java new file mode 100644 index 0000000..3ca4395 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java @@ -0,0 +1,50 @@ +package gmail.Lance5057.armor.renderers; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import org.lwjgl.opengl.GL11; + +/** + * ModelBiped - Either Mojang or a mod author + * Created using Tabula 4.1.1 + */ +public class ModelSheath extends ModelBiped { + public ModelRenderer shape9; + public ModelRenderer shape10; + + public ModelSheath() { + this.textureWidth = 32; + this.textureHeight = 32; + this.shape10 = new ModelRenderer(this, 16, 0); + this.shape10.setRotationPoint(-4.5F, 0.0F, 0.5F); + this.shape10.addBox(0.0F, 0.0F, -3.0F, 1, 12, 5, 0.0F); + this.setRotateAngle(shape10, 0.0F, 0.0F, -0.7853981633974483F); + this.shape9 = new ModelRenderer(this, 0, 0); + this.shape9.setRotationPoint(-0.3F, 3.5F, 2.0F); + this.shape9.addBox(-3.0F, 0.0F, 0.0F, 6, 24, 2, 0.0F); + this.setRotateAngle(shape9, 0.0F, 0.0F, -0.45F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + this.shape10.render(f5); + GL11.glPushMatrix(); + GL11.glTranslatef(this.shape9.offsetX, this.shape9.offsetY, this.shape9.offsetZ); + GL11.glTranslatef(this.shape9.rotationPointX * f5, this.shape9.rotationPointY * f5, this.shape9.rotationPointZ * f5); + GL11.glScaled(0.65D, 0.65D, 0.5D); + GL11.glTranslatef(-this.shape9.offsetX, -this.shape9.offsetY, -this.shape9.offsetZ); + GL11.glTranslatef(-this.shape9.rotationPointX * f5, -this.shape9.rotationPointY * f5, -this.shape9.rotationPointZ * f5); + this.shape9.render(f5); + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} diff --git a/src/main/java/gmail/Lance5057/armor/renderers/ModelTinkerArmor.java b/src/main/java/gmail/Lance5057/armor/renderers/ModelTinkerArmor.java new file mode 100644 index 0000000..d97d7fb --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/renderers/ModelTinkerArmor.java @@ -0,0 +1,109 @@ +// Date: 1/19/2015 11:08:25 PM +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package gmail.Lance5057.armor.renderers; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTinkerArmor extends ModelBiped +{ + //fields + ModelRenderer BackPlate; + ModelRenderer BreastPlate; + ModelRenderer Plackart; + ModelRenderer PauldronL; + ModelRenderer ArmL; + ModelRenderer PauldronR; + ModelRenderer ArmR; + + public ModelTinkerArmor(float f) + { + super(f, 0, 64,64); + textureWidth = 64; + textureHeight = 64; + + BackPlate = new ModelRenderer(this, 0, 56); + BackPlate.addBox(-4F, 0F, 1F, 8, 5, 3); + BackPlate.setRotationPoint(0F, 0F, 0F); + BackPlate.setTextureSize(64, 32); + BackPlate.mirror = true; + setRotation(BackPlate, -0.0872665F, 0F, 0F); + this.bipedBody.addChild(BackPlate); + + BreastPlate = new ModelRenderer(this, 0, 32); + BreastPlate.addBox(-4F, -1F, -5F, 8, 6, 4); + BreastPlate.setRotationPoint(0F, 0F, 0F); + BreastPlate.setTextureSize(64, 32); + BreastPlate.mirror = true; + setRotation(BreastPlate, 0.4363323F, 0F, 0F); + this.bipedBody.addChild(BreastPlate); + + Plackart = new ModelRenderer(this, 0, 42); + Plackart.addBox(-4F, 5F, -3F, 8, 7, 6); + Plackart.setRotationPoint(0F, 0F, 0F); + Plackart.setTextureSize(64, 32); + Plackart.mirror = true; + setRotation(Plackart, 0F, 0F, 0F); + this.bipedBody.addChild(Plackart); + + PauldronL = new ModelRenderer(this, 28, 32); + PauldronL.addBox(1F, -2F, -3.5F, 5, 5, 7); + PauldronL.setRotationPoint(0F, 0F, 0F); + PauldronL.setTextureSize(64, 32); + PauldronL.mirror = true; + setRotation(PauldronL, 0F, 0F, -0.7853982F); + this.bipedLeftArm.addChild(PauldronL); + + ArmL = new ModelRenderer(this, 28, 44); + ArmL.addBox(-1F, -2F, -3F, 5, 10, 6); + ArmL.setRotationPoint(0F, 0F, 0F); + ArmL.setTextureSize(64, 32); + ArmL.mirror = true; + setRotation(ArmL, 0F, 0F, 0F); + this.bipedLeftArm.addChild(ArmL); + + PauldronR = new ModelRenderer(this, 28, 32); + PauldronR.mirror = true; + PauldronR.addBox(-6F, -2F, -3.5F, 5, 5, 7); + PauldronR.setRotationPoint(0F, 0F, 0F); + PauldronR.setTextureSize(64, 32); + PauldronR.mirror = true; + setRotation(PauldronR, 0F, 0F, 0.7853982F); + PauldronR.mirror = false; + this.bipedRightArm.addChild(PauldronR); + + ArmR = new ModelRenderer(this, 28, 44); + ArmR.mirror = true; + ArmR.addBox(-4F, -2F, -3F, 5, 10, 6); + ArmR.setRotationPoint(0F, 0F, 0F); + ArmR.setTextureSize(64, 32); + ArmR.mirror = true; + setRotation(ArmR, 0F, 0F, 0F); + ArmR.mirror = false; + this.bipedRightArm.addChild(ArmR); + } + + 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); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } + +} -- cgit v1.2.3