Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

@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.

  • Author

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

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.

  • Author

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.