Posted January 31, 201510 yr Hello, I need to set invisible the held item in-game-time (eg. on Right-Click event) and, obviously, restore its visibility. Thanks in advance ... ...
January 31, 201510 yr I recommed to use an empty texture. Using NBT: @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) //Only called for hand held items { if(stack.stackTagCompound != null && stack.stackTagCompound.getBoolean("isInvisible")) return Empty_Texture; else return Normal_Texture; } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setBoolean("isInvisible", True); }else{ stack.stackTagCompound = null; } return stack; }
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.