Jump to content

[1.7.10] GUI: My renderToolTip call doesn't include extras from e.g. NEI/Waila


Tuhljin

Recommended Posts

I've got a custom GUI element that acts as a pseudo-item-slot, rendering an item icon and showing the item's tooltip when the cursor is over it. I use the renderToolTip in GuiScreen to do this as that seems to be how vanilla does it. It shows the tooltip as I'd expect for the most part, including whatever the item adds through the addInformation method.

 

The problem is that mods like NEI and Waila are supposed to add to the tooltip (such as one showing the mod the item comes from) but this is not added to my tooltips. I've done extensive searches in NEI to see where addInformation is called and so on to see if there's some other method for me to call instead of renderToolTip, but I don't see anything relevant. I'm quite sure I've got the right method, and yet it doesn't do for my custom GUI element what it does for vanilla Slots.

Link to comment
Share on other sites

GuiScreen.renderToolTip calls ItemStack.getTooltip which in turn calls ForgeEventFactory.onItemTooltip. I've stepped through it to make sure it's called, and it is, yet the result still isn't what I expected. Any idea what might be going wrong?

Link to comment
Share on other sites

Here's the relevant bit:

 

 

 

private GuiButtonPseudoSlot pSlots[] = new GuiButtonPseudoSlot[iNVENTORY_ROWS * INVENTORY_ROW_SIZE];

 

@Override

public void drawScreen(int x, int y, float p_73863_3_) {

super.drawScreen(x, y, p_73863_3_);

 

GL11.glPushMatrix();

GL11.glTranslatef((float)this.guiLeft, (float)this.guiTop, 0.0F);

 

for (int i = 0; i < pSlots.length; i++) {

GuiButtonPseudoSlot pSlot = pSlots[ i ];

if (pSlot.pointIsOver(x, y)) {

 

// This little section based on part of method drawScreen in GuiContainer.

GL11.glDisable(GL11.GL_LIGHTING);

GL11.glDisable(GL11.GL_DEPTH_TEST);

int j1 = pSlot.xPosition - this.guiLeft;

int k1 = pSlot.yPosition - this.guiTop;

GL11.glColorMask(true, true, true, false);

this.drawGradientRect(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433);

GL11.glColorMask(true, true, true, true);

GL11.glEnable(GL11.GL_LIGHTING);

GL11.glEnable(GL11.GL_DEPTH_TEST);

 

if (pSlot.stack != null) {

this.renderToolTip(pSlot.stack, x - guiLeft, y - guiTop + 10);

}

 

/*

ArrayList<String> lines = TjUtil.getMultiLineLocalizedString("Automagy.gui.filter.textFilterTooltip");

GL11.glPushMatrix();

GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);

drawScaledHoveringText(lines, x - guiLeft - 20, y - guiTop + 20, fontRendererObj);

GL11.glPopMatrix();

*/

}

}

 

GL11.glPopMatrix();

}

 

 

 

Edit: Somehow this was posted while I was still editing it. I wanted to put it in a spoiler but that doesn't seem to be working, and some of it's in italics for some reason (and I can't turn that off). Getting JavaScript errors when I try to do much editing. Something's wrong with the forums, it seems.

Link to comment
Share on other sites

The italics are caused by getting a value from an array with an index of i, for example, you have this:

GuiButtonPseudoSlot pSlot = pSlots[i];
if (pSlot.pointIsOver(x, y)) {...}

The forums sees the

[i.]

bit (no dot) as a italics sign, so it set's everything after that in italics.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

[quote name="Tuhljin" post="136305" timestamp="1420903085"]
Ah, BBCode, that makes sense. I actually work in BBCode all the time but forgot about it here. Guess I'm used to forums where it only shows when you hit a button for it. I edited the post to clean that up.
[/quote]

The 

tag is magic.

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.

Link to comment
Share on other sites

For the bbcode thingy: the

[nobbc][nobbc][/nobbc]

tag works wonders ;)

 

Haha, and here I see that I tried to cheat with the

[nobbc][code][/nobbc]

tag and it didn't work :D  I did

[nobbc]
[/nobbc][/code]

and thought it would not find the paired open and not parse it (some forums do 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.

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • ChemsXpress (https://chemsxpress.com): ChemsXpress is a platform specializing in the distribution of research chemicals and related products. It offers a wide range of substances for scientific and laboratory use, catering to researchers and professionals. BubatzLand (https://bubatzland.com): BubatzLand focuses on providing high-quality cannabis products. The site offers a variety of strains, edibles, and related accessories, aiming to serve the needs of cannabis enthusiasts and medicinal users. HalluShroom (https://hallushroom.com): HalluShroom specializes in the sale of psychedelic mushrooms and related products. It caters to individuals interested in exploring the benefits and experiences associated with psilocybin and other psychedelic substances. HighAsch (https://highasch.com): HighAsch offers a diverse range of cannabis products, including flowers, concentrates, and edibles. The site aims to provide premium-quality products to both recreational and medicinal users. KetaminHaus (https://ketaminhaus.com): KetaminHaus provides ketamine and related products for research and therapeutic use. The platform focuses on ensuring the availability of high-quality, safe, and effective ketamine for various applications. KokainLabor (https://kokainlabor.com): KokainLabor offers cocaine and other related substances. The site targets individuals seeking high-purity products for personal or research purposes, emphasizing quality and safety. MDPHPWelt (https://mdphpwelt.com): MDPHPWelt specializes in the distribution of MDPHP and other similar research chemicals. It aims to supply researchers with high-quality substances for scientific and experimental use. NembutaLabor (https://nembutalabor.com): NembutaLabor provides Nembutal (pentobarbital) and related products. The site focuses on supplying these substances for research and veterinary purposes, ensuring high standards of quality and safety. NembutalQuelle (https://nembutalquelle.com): NembutalQuelle is dedicated to offering Nembutal and similar barbiturates. It caters to researchers and professionals who require these substances for scientific, medical, or veterinary applications. JBSaves Ltda Brazil (https://jbsavesltdabrazil.com): JBSaves Ltda Brazil is involved in the food and agricultural industry, providing a variety of products and services related to food processing, distribution, and agricultural practices. Bello Alimentos Ltda (https://belloalimentosltda.com): Bello Alimentos Ltda offers a wide range of food products. The site focuses on high-quality, nutritious, and safe food items, catering to consumers and businesses in the food industry. São Salvador Alimentos (https://saosalvadoralimentoss.com): São Salvador Alimentos specializes in the production and distribution of food products. The site provides a variety of options aimed at meeting the dietary needs and preferences of diverse consumers. WietWereld (https://wietwereld.com): WietWereld is a platform dedicated to the cannabis community. It offers information, products, and resources related to cannabis cultivation, consumption, and culture. 14. BeuhParadise (https://beuhparadis.com): BeuhParadise offers a range of cannabis products, including flowers, edibles, and concentrates. The site aims to provide high-quality cannabis products to recreational and medicinal users, emphasizing purity and potency. 15. WietWereld (https://wietwereld.com): WietWereld is a comprehensive resource for cannabis enthusiasts. It provides products, cultivation guides, and community forums for those interested in cannabis culture and cultivation. GrasOase (https://grasoase.com): GrasOase specializes in cannabis products and accessories. The site offers a variety of strains, seeds, and related items for cannabis users, focusing on quality and customer satisfaction. https://chemsxpress.com/ https://bubatzland.com/ https://hallushroom.com/ https://highasch.com/ https://ketaminhaus.com/ https://kokainlabor.com/ https://mdphpwelt.com/ https://nembutalabor.com/ https://nembutalquelle.com/ https://jbsavesltdabrazil.com/ https://belloalimentosltda.com/ https://saosalvadoralimentoss.com/ https://wietwereld.com https://beuhparadis.com https://wietwereld.com https://grasoase.com/
    • For Example I have an Main Mod that adds new Content to Minecraft. But I'm using custom Classes etc. and I want it so that is an api integrated in the Main Mod but can be download seperately like an Module. Is this possible? If you need more Information just comment what you need to know ^^
    • Delete the config of this mod (config folder) and test it again   If there is no change, try other builds  
    • Add the full crash-report or latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here
  • Topics

×
×
  • Create New...

Important Information

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