Posted June 26, 201411 yr I have an item That I wish to change texture on right click and depending on the length that the right click is held for I want the item to change to a differnt colour. (kind of like the bow) I have written the following but the icons are invisible public class AcornHarvester extends CustomItem{ public AcornHarvester(){ super(); setUnlocalizedName("AcornHarvester"); this.maxStackSize = 1; this.setMaxDamage(10); this.setNoRepair(); } private IIcon[] iconArray; public void registerIcons(IIconRegister iconRegister){ iconArray = new IIcon[14]; iconArray[0] = iconRegister.registerIcon("mymodsid:acornHarvestRedOpen"); iconArray[1] = iconRegister.registerIcon("mymodsid:acornHarvestRedClosed"); iconArray[2] = iconRegister.registerIcon("mymodsid:acornHarvestWhiteOpen"); iconArray[3] = iconRegister.registerIcon("mymodsid:acornHarvestWhiteClosed"); iconArray[4] = iconRegister.registerIcon("mymodsid:acornHarvestBlueOpen"); iconArray[5] = iconRegister.registerIcon("mymodsid:acornHarvestBlueClosed"); iconArray[6] = iconRegister.registerIcon("mymodsid:acornHarvestBlackOpen"); iconArray[7] = iconRegister.registerIcon("mymodsid:acornHarvestBlackClosed"); iconArray[8] = iconRegister.registerIcon("mymodsid:acornHarvestYellowOpen"); iconArray[9] = iconRegister.registerIcon("mymodsid:acornHarvestYellowClosed"); iconArray[10] = iconRegister.registerIcon("mymodsid:acornHarvestGreenOpen"); iconArray[11] = iconRegister.registerIcon("mymod:acornHarvestGreenClosed"); iconArray[12] = iconRegister.registerIcon("mymod:acornHarvestPinkOpen"); iconArray[13] = iconRegister.registerIcon("mymod:acornHarvestPinkClosed"); } //How long it takes to use or consume an item public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 72000; } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if (itemStack != null && itemStack.getItem() == CommonProxy.acornHarvester){ itemStack.damageItem(1, player); } return itemStack; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if (usingItem == null) { return itemIcon; } int ticksInUse = stack.getMaxItemUseDuration() - useRemaining; if (ticksInUse > 28) { return iconArray[13]; } else if (ticksInUse > 26) { return iconArray[12]; } else if (ticksInUse > 24) { return iconArray[11]; } else if (ticksInUse > 22) { return iconArray[10]; } else if (ticksInUse > 20) { return iconArray[9]; } else if (ticksInUse > 18) { return iconArray[8]; } else if (ticksInUse > 16) { return iconArray[7]; } else if (ticksInUse > 14) { return iconArray[6]; } else if (ticksInUse > 12) { return iconArray[5]; } else if (ticksInUse > 10) { return iconArray[4]; } else if (ticksInUse > { return iconArray[3]; } else if (ticksInUse > 6) { return iconArray[2]; } else if (ticksInUse > 4) { return iconArray[1]; } else if (ticksInUse > 2) { return iconArray[0]; } else { return itemIcon; } } Where in my CustomItem class I have public class CustomItem extends Item { public CustomItem() { super(); setMaxStackSize(64); } @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(MyMod.modid + ":" + this.getUnlocalizedName().substring(5)); } } The texture shows up if I get rid of the registerIcon array and getIcon methods. Any help is appreciated
June 26, 201411 yr Author And in my Common Proxy I register the item in the following way public static Item acornHarvester; //this method passes stuff to the main mod class public void preInit(){ registerItems(); } public void registerItems(){ acornHarvester = new AcornHarvester(); this.registerEachItem(acornHarvester, "acornHarvester", "Acorn Harvester"); } public void registerEachItem(Item item, String unlocalizedItemName, String displayName){ item.setUnlocalizedName(unlocalizedItemName); GameRegistry.registerItem(item, displayName); item.setCreativeTab(this.mymodTab); } This file is very large for my mod so I took a bunch out to keep it relevant
June 26, 201411 yr Author Currently in the inventory I get Minecrafts purple and black missing texture texture but when I select the item nothing appears in hand
June 26, 201411 yr Hi Show us the error log? It should have a line something like "texture not found". A few things to try This link shows where the files should go http://greyminecraftcoder.blogspot.com.au/2013/12/overview-of-forge-and-what-it-can-do.html If you still can't find it, this might help http://www.minecraftforge.net/forum/index.php/topic,18371.msg92948.html#msg92948 Keep in mind that the upper/lower case must match exactly. -TGG
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.