Posted February 14, 201411 yr comment_84288 Hello, I am trying to make colored armor but I cant get it working, even though it renders the color in the item, it does not when you wear it. package org.zaet.api.armor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import org.zaet.api.ZaetRegistry; public class ColoredArmor extends ItemArmor { public static final int helm = 0, chest = 1, legs = 2, boots = 3; public String folder; public String armorName; public int color; public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab) { super(material, render, type); this.color = color; this.folder = folder; this.armorName = armorName; setTextureName(folder + ":" + armorName + "_" + type); setUnlocalizedName(folder + "_" + armorName + "_" + type + color); setCreativeTab(tab); } @Override public void registerIcons(IIconRegister r) { this.itemIcon = r.registerIcon(folder + ":" + armorName + "_" + armorType); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { switch(this.armorType) { case helm: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; case chest: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; case legs: return folder + ":" + "textures/armor/" + armorName + "_2" + ".png"; case boots: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; default: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; } } @Override public boolean hasColor(ItemStack item) { return true; } @Override public int getColor(ItemStack item) { return ZaetRegistry.getColorHexCode(color); } @Override public int getColorFromItemStack(ItemStack item, int unUsed) { return getColor(null); } } Does anyone have any ideas?
February 14, 201411 yr comment_84334 Hmm. Looks like what you have is right.... I managed to get it working. Not sure what I have that you don't. https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/item/ItemArtifactArmor.java Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 14, 201411 yr comment_84339 @Override public void registerIcons(IIconRegister par1IconRegister) { } This is empty. Why ?
February 14, 201411 yr Author comment_84347 That only affects the Item icon, not the armor texture. I haven't done the Item Textures.
February 14, 201411 yr Author comment_84349 Updated the OP with an image and updated code package org.zaet.api.armor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import org.zaet.api.ZaetRegistry; public class ColoredArmor extends ItemArmor { public static final int helm = 0, chest = 1, legs = 2, boots = 3; public String folder; public String armorName; public int color; public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab) { super(material, render, type); this.color = color; this.folder = folder; this.armorName = armorName; setTextureName(folder + ":" + armorName + "_" + type); setUnlocalizedName(folder + "_" + armorName + "_" + type + color); setCreativeTab(tab); } @Override public void registerIcons(IIconRegister r) { this.itemIcon = r.registerIcon(folder + ":" + armorName + "_" + armorType); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { switch(this.armorType) { case helm: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; case chest: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; case legs: return folder + ":" + "textures/armor/" + armorName + "_2" + ".png"; case boots: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; default: return folder + ":" + "textures/armor/" + armorName + "_1" + ".png"; } } @Override public boolean hasColor(ItemStack item) { return true; } @Override public int getColor(ItemStack item) { return ZaetRegistry.getColorHexCode(color); } @Override public int getColorFromItemStack(ItemStack item, int unUsed) { return getColor(null); } }
February 14, 201411 yr comment_84350 public ColoredArmor(int color, String folder, String armorName, ArmorMaterial material, int render, int type, CreativeTabs tab) { super(material, render, type); Only leather armor use color, how did you initialize your armor ?
February 14, 201411 yr Author comment_84354 ZaetRegistry.registerColoredArmor("zaet", "dyeArmor", ArmorMaterial.CLOTH, tabZaetMech); public static void registerColoredArmor(String folder, String name, ArmorMaterial material, CreativeTabs creativeTabs) { for(int i = 0; i < 16; i++) { for(int x = 0; x < 4; x++) { Item armor = new ColoredArmor(i, folder, name, material, 0, x, creativeTabs); GameRegistry.registerItem(armor, armor.getUnlocalizedName()); } }
February 14, 201411 yr Author comment_84367 ZaetRegistry.registerColoredArmor("zaet", "dyeArmor", ArmorMaterial.CLOTH, tabZaetMech); public static void registerColoredArmor(String folder, String name, ArmorMaterial material, CreativeTabs creativeTabs) { for(int i = 0; i < 16; i++) { for(int x = 0; x < 4; x++) { Item armor = new ColoredArmor(i, folder, name, material, 0, x, creativeTabs); GameRegistry.registerItem(armor, armor.getUnlocalizedName()); } } I assume CLOTH is leather
February 15, 201411 yr comment_84522 I assume CLOTH is leather It is. Minecraft is weird like that sometimes. Like diamond picks using ToolMaterial.EMERALD. Anyway, I have no idea.... Actually wait. I do. Your PNGs. Do you have a regular and an overlay texture? I assume so. The regular is the one that gets colorized. The overlay is then rendered after with no color adjustment. I think that might be your problem. And yes, it's a total nuisance. But that's how the armor renderer was written. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 15, 201411 yr Author comment_84528 I want my whole armor to be colored, not like Leather with the stripe
February 15, 201411 yr comment_84572 Yes. But my point is that the "overlay" layer needs to be transparent. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 15, 201411 yr comment_84578 Not easily. You'd probably have to write your own renderer. Just swap your pngs and it'll work. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.