Jump to content

RenderTooltipEvent ?


Busti

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.