Posted May 28, 201411 yr 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! http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 28, 201411 yr Author Thank you! But I now need to know, where the tooltip is rendered to adjust the position of the Icons. How can I find this out? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 28, 201411 yr Author Actually I was inspired by thaumcraft... But the problem is, that Azanor didn't made his code publicy available. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 28, 201411 yr 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(); http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 29, 201411 yr Author Well, I now need to render some text showed on my rendered picture. The problem is, that the zLevel setting seems not to work, because the text is rendered under the items although the zLevel is set to 300. How can I solve this problem? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 29, 201411 yr 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. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 29, 201411 yr Author The drawString method just draws the pictures of the text, right? So why isn't it influenced by the zLevel? Or how can you do this? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
May 30, 201411 yr 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. http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
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.