Posted March 20, 201510 yr So I am trying to make an item that will change textures when it changes modes, and it crashes when I try. I took a similar code from the bow pullback I have used, but it is not working because there are some bow specific properties that I tried to replace but it wasn't right. How can I make it so when it changes modes, it changes textures Icon code @SideOnly(Side.CLIENT) private IIcon[] iconArray; @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_standby"); this.iconArray = new IIcon[iconString.length()]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray = par1IconRegister.registerIcon(this.getIconString() + "_" + iconArray); } } public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(usingItem.stackTagCompound.getInteger("mode")==0){ return iconArray[0]; } else if(usingItem.stackTagCompound.getInteger("mode")==2){ return iconArray[2]; } else if(usingItem.stackTagCompound.getInteger("mode")==1){ return iconArray[1]; } return itemIcon; } Thank you
March 20, 201510 yr Author It works when I use this in a bow @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_standby"); this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray = par1IconRegister.registerIcon(this.getIconString() + "_" + bowPullIconNameArray); } } And can you at least be helpful and tell me what is wrong...
March 20, 201510 yr Author Ok, thanks, My formatting is not like that in the code the copy paste must have messed it up. Also I have never used any of this Icon stuff before. I am sorry, I am new to forge coding and it does not help me learn by telling me that I suck at what I am trying to learn
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.