From 235bbdbb4156f5a8fea574193170a22d93267545 Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Thu, 3 Sep 2015 16:27:29 -0500 Subject: Rewrite of Injector. Added chainmaille, cloth, clasps. --- src/main/java/gmail/Lance5057/TinkersDefense.java | 61 ++++++++++---- .../java/gmail/Lance5057/armor/items/Sheath.java | 71 +++++++++++++++-- .../gmail/Lance5057/armor/parts/Item_Cloth.java | 52 ++++++++++++ .../Lance5057/armor/parts/Item_Glowthread.java | 52 ++++++++++++ .../gmail/Lance5057/armor/parts/Item_Thread.java | 52 ++++++++++++ .../Lance5057/armor/renderers/ModelSheath.java | 92 +++++++++++++++------- src/main/java/gmail/Lance5057/items/Injector.java | 69 ++++++---------- .../java/gmail/Lance5057/items/TD_Patterns.java | 4 +- .../java/gmail/Lance5057/proxy/ClientProxy.java | 2 +- src/main/java/parts/Item_Cloth.java | 52 ------------ src/main/java/parts/Item_Glowthread.java | 52 ------------ src/main/java/parts/Item_Thread.java | 52 ------------ src/main/java/utilities/InjectorLocations.java | 5 ++ 13 files changed, 364 insertions(+), 252 deletions(-) create mode 100644 src/main/java/gmail/Lance5057/armor/parts/Item_Cloth.java create mode 100644 src/main/java/gmail/Lance5057/armor/parts/Item_Glowthread.java create mode 100644 src/main/java/gmail/Lance5057/armor/parts/Item_Thread.java delete mode 100644 src/main/java/parts/Item_Cloth.java delete mode 100644 src/main/java/parts/Item_Glowthread.java delete mode 100644 src/main/java/parts/Item_Thread.java create mode 100644 src/main/java/utilities/InjectorLocations.java (limited to 'src/main/java') diff --git a/src/main/java/gmail/Lance5057/TinkersDefense.java b/src/main/java/gmail/Lance5057/TinkersDefense.java index 6a184ce..7c500c9 100644 --- a/src/main/java/gmail/Lance5057/TinkersDefense.java +++ b/src/main/java/gmail/Lance5057/TinkersDefense.java @@ -3,13 +3,13 @@ package gmail.Lance5057; import static net.minecraft.util.EnumChatFormatting.DARK_RED; import static net.minecraft.util.EnumChatFormatting.GOLD; import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; -import parts.Item_Cloth; -import parts.Item_Glowthread; -import parts.Item_Thread; import gmail.Lance5057.armor.items.ChainArmor; import gmail.Lance5057.armor.items.ClothArmor; import gmail.Lance5057.armor.items.Sheath; import gmail.Lance5057.armor.items.TinkerArmor; +import gmail.Lance5057.armor.parts.Item_Cloth; +import gmail.Lance5057.armor.parts.Item_Glowthread; +import gmail.Lance5057.armor.parts.Item_Thread; import gmail.Lance5057.blocks.AeonSteelBlock; import gmail.Lance5057.blocks.CrestMount; import gmail.Lance5057.blocks.DogbeariumBlock; @@ -35,23 +35,19 @@ import gmail.Lance5057.modifiers.shields.modifierCrestofLegends; import gmail.Lance5057.modifiers.shields.modifierCrestofMirrors; import gmail.Lance5057.network.PacketHandler; import gmail.Lance5057.proxy.CommonProxy; -import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; import gmail.Lance5057.tileentities.TileEntity_CrestMount; +import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; import gmail.Lance5057.tileentities.TileEntity_JewelersBench; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -129,7 +125,8 @@ public class TinkersDefense { public static ToolCore tool_roundShield; public static ToolCore tool_heaterShield; public static ToolCore tool_wrench; - + public static ToolCore tool_sheath; + public static Block block_CrestMount; public static Block block_ArmorAnvil; public static Block block_JewelersBench; @@ -137,7 +134,7 @@ public class TinkersDefense { public static Item item_TinkerArmor; public static Item item_ChainArmor; public static Item item_ClothArmor; - public static Item item_Sheath; + public static Item item_thread; public static Item item_glowthread; @@ -150,6 +147,9 @@ public class TinkersDefense { public static Item partRivet; public static Item partArmorplate; + public static Item partClasp; + public static Item partCloth; + public static Item partChainmaille; public static Injector tcInject; @@ -297,14 +297,17 @@ public class TinkersDefense { tool_heaterShield = new HeaterShield(); tool_wrench = new TinkerWrench(); + tool_sheath = new Sheath(); GameRegistry.registerItem(tool_roundShield, "Round Shield"); GameRegistry.registerItem(tool_heaterShield, "Heater Shield"); GameRegistry.registerItem(tool_wrench, "Tinker Wrench"); + GameRegistry.registerItem(tool_sheath, "Sheath"); TConstructRegistry.addItemToDirectory("Round Shield", tool_roundShield); TConstructRegistry.addItemToDirectory("Heater Shield", tool_heaterShield); TConstructRegistry.addItemToDirectory("Tinker Wrench", tool_wrench); + TConstructRegistry.addItemToDirectory("Tinker Sheath", tool_wrench); GameRegistry.registerItem(item_thread = new Item_Thread(), "thread"); GameRegistry.registerItem(item_glowthread = new Item_Glowthread(), @@ -341,8 +344,8 @@ public class TinkersDefense { 1).setUnlocalizedName("Cloth_Armor"); GameRegistry.registerItem(item_ClothArmor,"Cloth Armor"); - item_Sheath = new Sheath().setUnlocalizedName("Sheath"); - GameRegistry.registerItem(item_Sheath, "Sheath"); + //tool_Sheath = new Sheath().setUnlocalizedName("Sheath"); + // network.registerMessage(messageHandler, requestMessageType, // discriminator, side); @@ -357,18 +360,31 @@ public class TinkersDefense { StencilBuilder.registerStencil(50, woodPattern, 0); // rivets StencilBuilder.registerStencil(51, woodPattern, 1); // clasp StencilBuilder.registerStencil(52, woodPattern, 2); // armorplate + StencilBuilder.registerStencil(53, woodPattern, 3); // cloth + StencilBuilder.registerStencil(54, woodPattern, 4); // chainmaille PatternBuilder.instance.addToolPattern(woodPattern); partRivet = new DynamicToolPart("_rivets", "Rivets"); GameRegistry.registerItem(partRivet, "RivetPart"); + + partClasp = new DynamicToolPart("_clasp", "Clasp"); + GameRegistry.registerItem(partClasp, "ClaspPart"); partArmorplate = new DynamicToolPart("_armorplate", "Armor Plate"); GameRegistry.registerItem(partArmorplate, "ArmorPlatePart"); + + partCloth = new DynamicToolPart("_cloth", "Cloth"); + GameRegistry.registerItem(partCloth, "clothPart"); + partChainmaille = new DynamicToolPart("_chainmaille", "Chainmaille"); + GameRegistry.registerItem(partChainmaille, "chainmaillePart"); + buildParts(partRivet, 0); - // buildParts(clasp, 1); + buildParts(partClasp, 1); buildParts(partArmorplate, 2); + buildParts(partCloth, 3); + buildParts(partChainmaille, 4); PatternBuilder pb = PatternBuilder.instance; @@ -563,8 +579,11 @@ public class TinkersDefense { TConstructRegistry.addToolRecipe(tool_wrench, TinkerTools.handGuard, TinkerTools.toolRod, TinkerTools.binding); + + //Armor + TConstructRegistry.addToolRecipe(tool_sheath, partArmorplate,TinkerTools.toolRod, partCloth, partClasp); - tcInject = new Injector(0); + tcInject = new Injector(0,TinkerTools.broadsword); GameRegistry.registerItem(tcInject, "debugger"); } @@ -705,5 +724,17 @@ public class TinkersDefense { fluidAmount); } } + + public static int[] hexToRGB(String hex) + { + int color[] = new int[3]; + + color[0] = Integer.parseUnsignedInt(hex.substring(0, 2), 16); + color[1] = Integer.parseUnsignedInt(hex.substring(2, 4), 16); + color[2] = Integer.parseUnsignedInt(hex.substring(4, 6), 16); + + return color; + } + +} -} \ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/armor/items/Sheath.java b/src/main/java/gmail/Lance5057/armor/items/Sheath.java index 92b5695..9806905 100644 --- a/src/main/java/gmail/Lance5057/armor/items/Sheath.java +++ b/src/main/java/gmail/Lance5057/armor/items/Sheath.java @@ -1,21 +1,25 @@ package gmail.Lance5057.armor.items; +import gmail.Lance5057.armor.renderers.ModelSheath; 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.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import tconstruct.library.accessory.AccessoryCore; +import tconstruct.library.accessory.IAccessory; import tconstruct.library.accessory.IAccessoryModel; +import tconstruct.library.tools.ToolCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class Sheath extends AccessoryCore implements IAccessoryModel +public class Sheath extends ToolCore implements IAccessoryModel,IAccessory { - public Sheath() { - super("tinkersdefense:textures/armor/Sheath/_sheath_base"); + public Sheath() + { + super(0); } @Override @@ -28,7 +32,12 @@ public class Sheath extends AccessoryCore implements IAccessoryModel @SideOnly(Side.CLIENT) public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - return ClientProxy.sheath; + String color[] = new String[10]; + + for(int i = 0; i<10; i++) + color[i] = Integer.toHexString(this.getColorFromItemStack(itemStack, i)); + + return new ModelSheath(color); } @Override @@ -46,4 +55,56 @@ public class Sheath extends AccessoryCore implements IAccessoryModel return texture; } + @Override + public Item getAccessoryItem() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDefaultFolder() { + // TODO Auto-generated method stub + return "Armor/Sheath"; + } + + @Override + public String getEffectSuffix() { + return "_sheath_effect"; + } + + @Override + public Item getHeadItem() { + // TODO Auto-generated method stub + return null; + } + + @SideOnly(Side.CLIENT) + @Override + public int getPartAmount() { + return 4; + } + + @Override + public String getIconSuffix(int partType) { + switch (partType) { + case 0: + return "_sheath_base"; + case 1: + return "_shield_base_broken"; //useless + case 2: + return "_sheath_filigree"; + case 3: + return "_sheath_belt"; + case 4: + return "_sheath_clasp"; + default: + return ""; + } + } + + @Override + public String[] getTraits() { + return new String[] { "sheath", "cosmetic" }; + } + } diff --git a/src/main/java/gmail/Lance5057/armor/parts/Item_Cloth.java b/src/main/java/gmail/Lance5057/armor/parts/Item_Cloth.java new file mode 100644 index 0000000..4090ad8 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/parts/Item_Cloth.java @@ -0,0 +1,52 @@ +package gmail.Lance5057.armor.parts; + +import gmail.Lance5057.TinkersDefense; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class Item_Cloth extends Item +{ + public IIcon[] icons = new IIcon[16]; + public static final String[] colors = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "grey", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; + + public Item_Cloth() + { + super(); + this.setHasSubtypes(true); + this.setUnlocalizedName("Cloth"); + this.setCreativeTab(TinkersDefense.tabName); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < 16; i ++) { + this.icons[i] = reg.registerIcon("tinkersdefense:" + colors[i] + "_cloth" ); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + if (meta > 15) + meta = 0; + + return this.icons[meta]; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 16; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); + } +} diff --git a/src/main/java/gmail/Lance5057/armor/parts/Item_Glowthread.java b/src/main/java/gmail/Lance5057/armor/parts/Item_Glowthread.java new file mode 100644 index 0000000..91be026 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/parts/Item_Glowthread.java @@ -0,0 +1,52 @@ +package gmail.Lance5057.armor.parts; + +import gmail.Lance5057.TinkersDefense; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class Item_Glowthread extends Item +{ + public IIcon[] icons = new IIcon[16]; + public static final String[] colors = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "grey", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; + + public Item_Glowthread() + { + super(); + this.setHasSubtypes(true); + this.setUnlocalizedName("GlowThread"); + this.setCreativeTab(TinkersDefense.tabName); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < 16; i ++) { + this.icons[i] = reg.registerIcon("tinkersdefense:" + colors[i] + "_glowthread" ); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + if (meta > 15) + meta = 0; + + return this.icons[meta]; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 16; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); + } +} diff --git a/src/main/java/gmail/Lance5057/armor/parts/Item_Thread.java b/src/main/java/gmail/Lance5057/armor/parts/Item_Thread.java new file mode 100644 index 0000000..434d827 --- /dev/null +++ b/src/main/java/gmail/Lance5057/armor/parts/Item_Thread.java @@ -0,0 +1,52 @@ +package gmail.Lance5057.armor.parts; + +import gmail.Lance5057.TinkersDefense; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class Item_Thread extends Item +{ + public IIcon[] icons = new IIcon[16]; + public static final String[] colors = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "grey", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; + + public Item_Thread() + { + super(); + this.setHasSubtypes(true); + this.setUnlocalizedName("Thread"); + this.setCreativeTab(TinkersDefense.tabName); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < 16; i ++) { + this.icons[i] = reg.registerIcon("tinkersdefense:" + colors[i] + "_thread" ); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + if (meta > 15) + meta = 0; + + return this.icons[meta]; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 16; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); + } +} diff --git a/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java b/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java index 3a1760c..0f86778 100644 --- a/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java +++ b/src/main/java/gmail/Lance5057/armor/renderers/ModelSheath.java @@ -1,5 +1,6 @@ package gmail.Lance5057.armor.renderers; +import gmail.Lance5057.TinkersDefense; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @@ -14,52 +15,83 @@ import cpw.mods.fml.client.FMLClientHandler; * Created using Tabula 4.1.1 */ public class ModelSheath extends ModelBiped { - public ModelRenderer shape9; - public ModelRenderer shape10; + public ModelRenderer sheath; + public ModelRenderer belt; + + String Color[]; + int rgbColors[]; - public ModelSheath() { + public ModelSheath(String color[] /*4*/) { 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); + this.belt = new ModelRenderer(this, 16, 0); + this.belt.setRotationPoint(-4.5F, 0.0F, 0.5F); + this.belt.addBox(0.0F, 0.0F, -3.0F, 1, 12, 5, 0.0F); + this.setRotateAngle(belt, 0.0F, 0.0F, -0.7853981633974483F); + this.sheath = new ModelRenderer(this, 0, 0); + this.sheath.setRotationPoint(-0.3F, 3.5F, 2.0F); + this.sheath.addBox(-3.0F, 0.0F, 0.0F, 6, 24, 2, 0.0F); + this.setRotateAngle(sheath, 0.0F, 0.0F, -0.45F); + + Color = color; } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - this.shape10.render(f5); + GL11.glPushMatrix(); + + //Sheath Base GL11.glPushMatrix(); - GL11.glColor3d(0, 0, 1.0); - 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); + rgbColors = TinkersDefense.hexToRGB(Color[1]); + GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); + + GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); + GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); + GL11.glScaled(0.65D, 0.65D, 0.5D); + GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); + GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); + + this.sheath.render(f5); GL11.glPopMatrix(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_filigree.png")); + //Belt GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_belt.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[2]); + GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); + + this.belt.render(f5); + GL11.glPopMatrix(); - - GL11.glColor3d(1.0, 1.0, 0); - this.shape10.render(f5); - 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); + //Buckle + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_clasp.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[3]); + GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); + + this.belt.render(f5); GL11.glPopMatrix(); + //Filigree + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_filigree.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[0]); + GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); + + GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); + GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); + GL11.glScaled(0.65D, 0.65D, 0.5D); + GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); + GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); + + this.sheath.render(f5); GL11.glPopMatrix(); + + GL11.glPopMatrix(); } /** diff --git a/src/main/java/gmail/Lance5057/items/Injector.java b/src/main/java/gmail/Lance5057/items/Injector.java index a95a260..c1e5eb9 100644 --- a/src/main/java/gmail/Lance5057/items/Injector.java +++ b/src/main/java/gmail/Lance5057/items/Injector.java @@ -2,7 +2,10 @@ package gmail.Lance5057.items; import gmail.Lance5057.TinkersDefense; +import java.io.File; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -13,66 +16,44 @@ import tconstruct.tools.TinkerTools; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; public class Injector extends ToolCore { - public Injector(int baseDamage) { + ToolCore tool; + + public Injector(int baseDamage, ToolCore tool) { super(baseDamage); + this.tool = tool; } - String[] heads; - String[] accessorys; - String[] handles; - String[] extras; + List heads = new ArrayList(); + List accessorys= new ArrayList(); + List handles = new ArrayList(); + List extras = new ArrayList(); protected void loadHeads(IIconRegister iconRegister) - { - heads = new String[9]; - accessorys = new String[10]; - handles = new String[2]; - - heads[0] = "_tapered_blade"; - heads[1] = "_dull_blade"; - heads[2] = "_glass_blade"; - heads[3] = "_plumed_blade"; - heads[4] = "_spiked_blade"; - heads[5] = "_widebase_blade"; - heads[6] = "_mace_blade"; - heads[7] = "_elusive_blade"; - heads[8] = "_repulsive_blade"; - - accessorys[0] = "_straight_guard"; - accessorys[1] = "_basket_guard"; - accessorys[2] = "_curved_guard"; - accessorys[3] = "_extended_guard"; - accessorys[4] = "_legendary_guard"; - accessorys[5] = "_queens_guard"; - accessorys[6] = "_square_guard"; - accessorys[7] = "_no_guard"; - accessorys[8] = "_elusive_guard"; - accessorys[9] = "_repulsive_guard"; - - handles[0] = "_ornate_handle"; - handles[1] = "_thick_handle"; - + { IIcon origHead = TinkerTools.broadsword.headIcons.get(-1); IIcon origAccessory = TinkerTools.broadsword.accessoryIcons.get(-1); IIcon origHandle = TinkerTools.broadsword.handleIcons.get(-1); - - for(int i = 0; i entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + heads[i]; + icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + heads.get(i); //toolIcons[i] = icon; headStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); } - addIcons(headStrings, headIcons, iconRegister, heads[i], false); + addIcons(headStrings, headIcons, iconRegister, heads.get(i), false); for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + accessorys[i]; + icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + accessorys.get(i); //toolIcons[i] = icon; accessoryStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); } - addIcons(accessoryStrings, accessoryIcons, iconRegister, accessorys[i], false); + addIcons(accessoryStrings, accessoryIcons, iconRegister, accessorys.get(i), false); for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + handles[i]; + icon += TinkerTools.broadsword.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + handles.get(i); //toolIcons[i] = icon; handleStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); } - addIcons(handleStrings, handleIcons, iconRegister, handles[i], false); + addIcons(handleStrings, handleIcons, iconRegister, handles.get(i), false); for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j 15) - meta = 0; - - return this.icons[meta]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 16; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); - } -} diff --git a/src/main/java/parts/Item_Glowthread.java b/src/main/java/parts/Item_Glowthread.java deleted file mode 100644 index 163d481..0000000 --- a/src/main/java/parts/Item_Glowthread.java +++ /dev/null @@ -1,52 +0,0 @@ -package parts; - -import gmail.Lance5057.TinkersDefense; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class Item_Glowthread extends Item -{ - public IIcon[] icons = new IIcon[16]; - public static final String[] colors = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "grey", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; - - public Item_Glowthread() - { - super(); - this.setHasSubtypes(true); - this.setUnlocalizedName("GlowThread"); - this.setCreativeTab(TinkersDefense.tabName); - } - - @Override - public void registerIcons(IIconRegister reg) { - for (int i = 0; i < 16; i ++) { - this.icons[i] = reg.registerIcon("tinkersdefense:" + colors[i] + "_glowthread" ); - } - } - - @Override - public IIcon getIconFromDamage(int meta) { - if (meta > 15) - meta = 0; - - return this.icons[meta]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 16; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); - } -} diff --git a/src/main/java/parts/Item_Thread.java b/src/main/java/parts/Item_Thread.java deleted file mode 100644 index 3ea504b..0000000 --- a/src/main/java/parts/Item_Thread.java +++ /dev/null @@ -1,52 +0,0 @@ -package parts; - -import gmail.Lance5057.TinkersDefense; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class Item_Thread extends Item -{ - public IIcon[] icons = new IIcon[16]; - public static final String[] colors = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "grey", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; - - public Item_Thread() - { - super(); - this.setHasSubtypes(true); - this.setUnlocalizedName("Thread"); - this.setCreativeTab(TinkersDefense.tabName); - } - - @Override - public void registerIcons(IIconRegister reg) { - for (int i = 0; i < 16; i ++) { - this.icons[i] = reg.registerIcon("tinkersdefense:" + colors[i] + "_thread" ); - } - } - - @Override - public IIcon getIconFromDamage(int meta) { - if (meta > 15) - meta = 0; - - return this.icons[meta]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 16; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return colors[stack.getItemDamage()] + "_" + this.getUnlocalizedName(); - } -} diff --git a/src/main/java/utilities/InjectorLocations.java b/src/main/java/utilities/InjectorLocations.java new file mode 100644 index 0000000..572b2fd --- /dev/null +++ b/src/main/java/utilities/InjectorLocations.java @@ -0,0 +1,5 @@ +package utilities; + +public class InjectorLocations { + +} -- cgit v1.2.3