Posted April 6, 201411 yr So I recently started with modding, and I wondered how to show these buttons on screen, like this: I guess it has something to do with net.minecraft.client.gui, but I couldn't really find out how. Thanks in advance!
April 6, 201411 yr If you're using 1.7.2, there is Forge RenderGameOverlayEvent event. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
April 6, 201411 yr Subscribe to it in your event handler (probably init or postinit) and handle the event when it fires. P.S. Do you have any ideas how to work with events? If not there are some tutorials available - google is your friend. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
April 6, 201411 yr Author I know how to listen in on the event, but I want the buttons to appear on screen when a key is pressed, and remove them with the another key. How should I make the buttons appear by listening in on an event which basically just allows me to get the x and y position of the rendered element?
April 6, 201411 yr I know how to listen in on the event, but I want the buttons to appear on screen when a key is pressed, and remove them with the another key. How should I make the buttons appear by listening in on an event which basically just allows me to get the x and y position of the rendered element? I'm guessing you don't realize why these events exist. Look at the code in GuiIngameForge for some clues as to when and why this (and its subevents) are fired. You should understand that these events occur while rendering the screen you see in game. Your little icons at the top of said screen would be rendered at such a time. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
April 6, 201411 yr Author I can see that RenderGameOverlayEvent is posted when the GUI is updated. But how can I actually render my precious little icons? (by listening to RenderGameOverlayEvent, or in another way) Would you please, please give me a code example?
April 6, 201411 yr It should be the same code that you use for a normal GUI. I'm too lazy to post a code example, but this is what it looks like if you haven't done GUIs before. I like to make mods, just like you. Here's one worth checking out
April 7, 201411 yr Author I searched for some tutorials on the subject, and they all tell me to do something like this: TextureManager e = Minecraft.getMinecraft().renderEngine; e.bindTexture(new ResourceLocation(TheOnePower.MODID, "textures/gui/spirit.png") ); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.addVertexWithUV(0, 0, 0, 0, 0);//bottom left texture t.addVertexWithUV(0, 64, 0, 0, 0);//top left t.addVertexWithUV(64, 64, 0, 1, 1);//top right t.addVertexWithUV(64, 0, 0, 64, 0);//bottom right t.draw(); But there's nothing happening. What's wrong in here?
April 7, 201411 yr Just so you know RenderGameOverlayEvent is what let's you draw on the screen without a tickhandler Creator of Jobo's ModLoader If I helped you could you please click the thank you button and applaud my karma.
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.