Posted August 26, 201411 yr How would I make and item that I could set the color with a hex value. (Like leather armor does.). I have a basic item using a gray scale texture what would I need to add. Notice! I have looking in ItemArmor and at how grass does it but no luck with it. Not asking for the code just a step in the right direction.
August 26, 201411 yr there is a method for items called "getColorFromItemStack" you then return the hex value you want (or the decimal conversion if it, but I find it easier to just use 0xFFFFFF or the likes) the two params are itemstack and renderpass Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 26, 201411 yr Author That's the thing that does nothing even if you tell it to return a hex code no matter what.
August 26, 201411 yr Odd, because it works for me: public class ItemCrossbowRepater extends Item { //A weapon that will use the player's stamina reserves to fire weak arrows //It has different functions with different effects //Will be reworked hard when a proper leveling system is created //See notes on this. private IIcon[] icons = new IIcon[2]; public ItemCrossbowRepater() { setFull3D(); setMaxDamage(0); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister ir) { /*for (int i = 0;i < textures.length; i++) { textures[i] = ir.registerIcon(Rot.MODID+":"+"relicLife_"+i); }*/ icons[0] = ir.registerIcon(Rot.MODID+":"+"cbr"); icons[1] = ir.registerIcon(Rot.MODID+":"+"cbr_overLay"); } @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack par1ItemStack, int par2) { if (par2 == 0)return 0xFFFFFF; else { switch (par1ItemStack.getItemDamage()) { case 0: return 0xFFFFFF; case 1: return 0xFF622E; case 2: return 0x4DC9FF; case 3 : return 0xFFE263; default: return 0xFFFFFF; } } } @Override @SideOnly(Side.CLIENT) public boolean requiresMultipleRenderPasses() { return true; } @Override public int getRenderPasses(int metadata) { // TODO Auto-generated method stub return 2; } @Override public IIcon getIcon(ItemStack stack, int pass) { // TODO Auto-generated method stub return icons[pass]; } Maybe it only works with multiple render passed items? Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 26, 201411 yr Author I will post code when I get back from school. Maybe its because I don't have an over lay.
August 26, 201411 yr Author That crashes my game with a null pointer here icons[0] = ir.registerIcon(Main.MODID+":"+"ingot"); Code is at https://github.com/chibill/Additional-Weapons-Armor
August 26, 201411 yr @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister ir) { icons = new IIcon[2]; icons[0] = ir.registerIcon(Main.MODID+":"+"ingot"); icons[1] = ir.registerIcon(Main.MODID+":"+"ingot"); } define the array as the size you want also I wonder if you can trick it by not using two by overriding @Override public int getRenderPasses(int metadata) { return 1; } so it only does one pass, that way it will most likely be less hungry for double rendering for no reason Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 27, 201411 yr Author Still getting on NPE on icons[0] = ir.registerIcon(Main.MODID+":"+"ingot");
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.