Jump to content

Recommended Posts

Posted

I never expected I would ever have to ask for help with item icons I thought I had them figured out. Then I tried to do something new and here I am...

 

Until recently I have been using getIconFromDamage() whenever I need to be able to switch between icons e.g.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1)
{
if (par1 == 0)
	return itemIcon0;
else if (par1 == 1)
	return itemIcon1;
else
	return itemIcon2;
}

But then I switched to nbt for storing item data which obviously broke this so i switched to

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false))
	return itemIcon2;
else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0)
	return itemIcon1;
else
	return itemIcon0;
}

But for some reason this dosnt work properly the item renders correctly in the players hand but in the inventory it tries to use the default icon (itemIcon) which in this case is null.

 

Can anyone tell me what im doing wrong?

I am the author of Draconic Evolution

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.