Jump to content

[1.7.10] Tooltips on gui, also change texture


IvanTune

Recommended Posts

Hello!

 

So I added tooltips to my gui so when a player hovers over a bar it displays sun intesity on solar panel. This all works fine, but what if I also want the texture to change on that area when player hovers mouse there.

 

What I did below works when mouse is hovered over, but if I pick up 1 of an item then the texture goes white. If I pick up 64 or 12 of an item then everything works, but this only happens when 1 item is picked up.

 

Here is what happens:

 

Any help is appriciated.

 

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

	super.drawScreen(x, y, f);
	this.drawToolTipsSunIntensity(x, y);
}

public void drawToolTipsSunIntensity(int mouseX, int mouseY) {
    int boxX = (this.width - this.xSize) / 2 + 28;
    int boxY = (this.height - this.ySize) / 2 + 6;

	int defaultX = 19;
	int defaultY = 48;

	if(mouseX > boxX && mouseX < boxX + defaultX && mouseY > boxY && mouseY < boxY + defaultY) {  

		List list = new ArrayList();                       
                           int currentPower = solarPanel.getSunIntensityPercent();
                           int rf = solarPanel.getCurrentRfgeneration();
                           list.add("\u00a7eSun Intensity:");
                           list.add(currentPower + "%");

                           Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
                           GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                           GL11.glDisable(2896);
                           drawTexturedModalRect(guiLeft + 29, guiTop + 7, 194, 62, 18, 47);       
                           
                           GuiScreen.drawRect(20, 22, 22, 22, 22);
                           this.drawHoveringText(list, mouseX, mouseY, fontRendererObj);
	}       
	else{	
            Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glDisable(2896);
            drawTexturedModalRect(guiLeft + 29, guiTop + 7, 176, 62, 18, 47);  		
	}
}

Link to comment
Share on other sites

Error is most certainy in superclass GuiContainer#drawScreen.

Where? I got nothing. Look there, some enable/disable stuff like RenderHelper.disableStandardItemLighting();

I have no clue what I am talking about, maybe it will point in right direction :x

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.