Jump to content

Recommended Posts

Posted

Hi all,

 

As the title states, I am trying to add text to the tooltip that appears when you hover over an item in the inventory.

I have done a fair bit of Googling, but can't seem to find a clean demonstration or tutorial of how to do it.

 

Any help would be greatly appreciated!

Posted

@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List) {
    par3List.add("Whatever string you want to display here");
}

 

Which you probably could have figured out by looking at the classes of any item that displays tooltip information.  Like ItemRecord.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

For mod items, that works great!

 

However, I have an array of information, basically for each item I have some text that I need it to display to the user. Think how Thaumcraft show's their icons over an item (bad example considering I just want to add some text to the general tooltip)

I have figured how to do individual item rendering, but well, again, that is just for mod items, and that permanently displays instead of only when I hover over it ;/

 

To elaborate with an example, I need to have the word 'Burnable' in the Birch log tooltip

Posted

Taking a look at Thaumcraft's source (JD GUI is awesome) I can't figure out how everything works, but it looks like he has a general look-up function that takes an item ID and checks it against various recipes (arcane, crucible, etc.) and generates a list of essence types (stored as a list of Enum values).

 

For something more like adding "burnable" to it, ASM might be your best bet.

 

Note: the Reflections API is not for the faint of heart.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'm very familiar with reflection, sadly not with ASM, thanks though, I'll go look into that :) Thanks for the help Draco18s! :)

 

Just to show how unfamiliar I am:

I was pretty sure they referred to the same thing. @..@

 

There is an ItemTooltipEvent now, you might want to use that.

 

Oh sweet, how about that.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.