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 Everyone!

 

I want to make the vanilla Items (and others) showing a small Icon when you hover over them. But with the ItemTooltipEvent, I don't get the required Objects to do this. I need a gui object to call drawTexturedModalRect.

 

How can I get this object? Or is there another way?

 

Thanks in advance!

  • Author

I now solved it... To be honest, it's very easy.

 

ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

int x = Mouse.getEventX() / scaledresolution.getScaleFactor();
int y = (mc.displayHeight - Mouse.getEventY()) / scaledresolution.getScaleFactor();

  • Author

In the ItemTooltipEvent I first create a Gui object. Then I set the zLevel to 300 and draw some textured rectangles (drawTexturedModalRect). Then I call the drawString method of the gui object with the zLevel still set to 300, but the text is rendered below the previous drawn picture and even below the Items in the container.

  • Author

This here is the code to render a single char:

GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
        GL11.glVertex3f(this.posX + f2, this.posY, 0.0F);
        GL11.glTexCoord2f(f / 128.0F, (f1 + 7.99F) / 128.0F);
        GL11.glVertex3f(this.posX - f2, this.posY + 7.99F, 0.0F);
        GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, f1 / 128.0F);
        GL11.glVertex3f(this.posX + f3 - 1.0F + f2, this.posY, 0.0F);
        GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F);
        GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F);

 

As you can see there is 0.0F as the z coordinate, so the zLevel variable has no effect.

Instead, you have to use GL11.glTranslate(0.0F, 0.0F, zLevel);

 

Now it works.

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.