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 really don't get it, how a GuiTextField is aligned in a GuiContainer.

I have overwritten the drawGuiContainerBackgroundLayer to display my Background Image as followed:

 

 

@Override
    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
    {
        mc.renderEngine.bindTexture(resourceLocation);

        GL11.glColor4f(1.0f,1.0f,1.0f,1.0f);

        int bgX = width/2-128;
        int bgY = height/2-28;

        this.drawTexturedModalRect(bgX, bgY, 0, 0, 256, 57);
    }

 

 

 

Background-Image:

uQbazEM.png

 

So the Background-Image is centered in Minecraft, as I wanted.

 

Now the problem:

When I initialize my GuiTextField like so:

tfFrequency = new GuiTextField(fontRendererObj, 0,0,tfWidth,tfHeight);

 

...the TextField is anywhere. Here is a Screenshot as it looks In-Game:

3Wyuxnr.png

 

So the coordinates 0/0 are up there. Why? Where do the coordinates of a GuiTextField start?

 

Thanks for every help and sorry for my bad english,

Julian

  • Author

Yeah, that's exactly what I thought, too, but if you would have read my Thread, you would know, that that's not the case. Please give a useful answer, or let it be.

 

Why is 0/0 not in the left top of the Minecraft-Screen or in the left top of the GUI-Background? It's just anywhere?!

 

With best regards,

Julian

if you got a problem tell us which version u are helps a lot.....

are u sure u got the arguments right? that 0,0 is the position?

  • Author

Hello, thanks for your answer.

 

I use Forge-Version 10.13.4.1448 for Minecraft 1.7.10 ;)

 

I just figured out, that when I overwrite the method "drawScreen()" in my GuiContainer-class and draw the GuiTextField in that method instead of drawing it in the "drawGuiContainerForegroundLayer"-method, the coordinates are right and everything is perfect. But why is 0/0 in the drawGuiContainerForegroundLayer-method on another place than 0/0 in the drawScreen-method?

 

Thanks for your answer!

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.