diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-09-03 16:27:29 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-09-03 16:27:29 -0500 |
| commit | 235bbdbb4156f5a8fea574193170a22d93267545 (patch) | |
| tree | b6c43a7bb8e32d55e6d0c71bd8e84aff0e2e5098 /src/main/java/gmail/Lance5057/armor | |
| parent | 21c92007da84b33e44afcac5eecd48760cf1b107 (diff) | |
Rewrite of Injector. Added chainmaille, cloth, clasps.
Diffstat (limited to 'src/main/java/gmail/Lance5057/armor')
5 files changed, 284 insertions, 35 deletions
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(); } /** |
