Jump to content

pop up window/gui


7804364

Recommended Posts

Ok i want to hit like the "u" key and a small little window with grey background and some text to pop up, ive followed any tutorials but none really helped for 1.8, i was wondering if someone can maybe point me in the right direction?

Link to comment
Share on other sites

Ok i want to hit like the "u" key and a small little window with grey background and some text to pop up, ive followed any tutorials but none really helped for 1.8, i was wondering if someone can maybe point me in the right direction?

This is really easy. Do a GuyOverlay that only displays a grey/textured rectangle when the 'u' key is pressed. I did it like this and it works great.

To get a GuyOverlay working, youll have to creat a new class that has the following few things in it:

 

public class YourOverlay extends Gui{

 

        public YOurOverlay(Minecraft mc){

        this.mc = mc; 

        }

 

@SubscribeEvent(priority = EventPriority.NORMAL)

        public void renderOverlay(RenderGameOverlayEvent event){

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

        int k = scaledresolution.getScaledWidth();

        int l = scaledresolution.getScaledHeight();

if (event.type != ElementType.ALL) {

return;

}

if (Keyboard.isKeyDown(Keyboard.KEY_U)){

GL11.glPushMatrix();

                        //Your code here (Youll have to use k as width and l as height!!)

                        GL11.glPopMatrix();

              }

      }

 

}

 

Then youll have to define a new field in your ClientProxy and register the YourOverlay-class like this in your ClientProxy :

        private final Minecraft mc = Minecraft.getMinecraft();

 

MinecraftForge.EVENT_BUS.register(new YourOverlay(mc));

 

Link to comment
Share on other sites

Ok i want to hit like the "u" key and a small little window with grey background and some text to pop up, ive followed any tutorials but none really helped for 1.8, i was wondering if someone can maybe point me in the right direction?

This is really easy. Do a GuyOverlay that only displays a grey/textured rectangle when the 'u' key is pressed. I did it like this and it works great.

To get a GuyOverlay working, youll have to creat a new class that has the following few things in it:

 

public class YourOverlay extends Gui{

 

        public YOurOverlay(Minecraft mc){

        this.mc = mc; 

        }

 

@SubscribeEvent(priority = EventPriority.NORMAL)

        public void renderOverlay(RenderGameOverlayEvent event){

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

        int k = scaledresolution.getScaledWidth();

        int l = scaledresolution.getScaledHeight();

if (event.type != ElementType.ALL) {

return;

}

if (Keyboard.isKeyDown(Keyboard.KEY_U)){

GL11.glPushMatrix();

                        //Your code here (Youll have to use k as width and l as height!!)

                        GL11.glPopMatrix();

              }

      }

 

}

 

Then youll have to define a new field in your ClientProxy and register the YourOverlay-class like this in your ClientProxy :

        private final Minecraft mc = Minecraft.getMinecraft();

 

MinecraftForge.EVENT_BUS.register(new YourOverlay(mc));

 

How do i setup a client proxie?

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.