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

Hello,

is there something such as an event that is being called when the tooltip / name next to an item or the item itself is being rendered?

I would like to add some additional information and graphics to it.

 

Thanks in advance,

Busti

 

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Hello,

is there something such as an event that is being called when the tooltip / name next to an item or the item itself is being rendered?

I would like to add some additional information and graphics to it.

 

Thanks in advance,

Busti

 

There is an event to manipulate the content of the tooltip called

ItemTooltipEvent

.

I dunno if you're able to render anything on it, though, as it gets called before the tooltip gets drawn...

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

That might work but it isn't ideal as I would like to render an Icon next to the item.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Check out RenderGameOverlayEvent event.

 

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderHotBar(RenderGameOverlayEvent event)
{
	if(event.type==ElementType.HOTBAR) renderCrazyExtraStuff();

}

  • Author

This could work... I will have a look into it.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Check out RenderGameOverlayEvent event.

 

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderHotBar(RenderGameOverlayEvent event)
{
	if(event.type==ElementType.HOTBAR) renderCrazyExtraStuff();

}

 

That event doesn't deal with tooltips at all...

 

Busti: There's sadly no real event for rendering a tooltip, so you're stuck with the ItemTooltipEvent and manipulating its content.

You may be able to hack something together with the

DrawScreenEvent

, which fires if any Gui is open: You'd need to empty the list in

ItemTooltipEvent

, get the Gui, get the Gui slots, check if there's your item in one of the slots, check if the mouse hovers that item, draw your custom tooltip. But this would be pretty expensive, especially on render, where the event gets called every frame...

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

I had a look into it and it contains every screen overlay. E.g. the XP bar or the boss bar. Sadly it is not what I need right now. But it is good to know that it exists.

 

It looks like it would be really expensive to render such a tooltip without a coremod but I don't want to do that right now...

I wonder how Thaumcraft does it.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

I had a look into it and it contains every screen overlay. E.g. the XP bar or the boss bar. Sadly it is not what I need right now. But it is good to know that it exists.

 

It looks like it would be really expensive to render such a tooltip without a coremod but I don't want to do that right now...

I wonder how Thaumcraft does it.

 

Well, Azanor said the following on a topic for an Item Tooltip Rendering hook suggestion:

I would love a hook like this myself. I'm currently using some creative reflection and such to render icons above the normal tooltip for some items, but would like a more generic way to do it.

 

Unfortunately Thaumcraft isn't open source... so maybe ask him?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

If it works with reflection I might be able to do it. But reflection can be very slow.

Good find though.

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

An Item can specify a custom FontRenderer (Item.getFontRenderer). Make a custom font renderer that can react to special symbols (unicode stuff) and translate them to icons.

 

Damn, this one was out of the box! Props, will be useful.

1.7.10 is no longer supported by forge, you are on your own.

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.