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

Hi

 

I'm trying to display a simple GUI, some buttons and a text box (if I can work out how to display one, lol).

 

At the moment I'm just trying to draw a background.... This isn't working....

 

I know the function to draw the background it being called (drawScreen()) as when I right click the block that triggers the GUI, the screen goes dark (the default background)

 

Can someone take a look and see where I'm going wrong?

 

According to the logs there are no errors when the GUI is triggered

 

The GUIScreen:

 

package net.tekkcraft.factions.gui;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;

import java.io.IOException;

/**
 * Created by jamie on 07/03/2017.
 */
public class FactionCoreGuiScreen extends GuiScreen {
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        this.drawDefaultBackground();
        mc.getTextureManager().bindTexture(new ResourceLocation("factionMod", "/textures/gui/core.png"));
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public boolean doesGuiPauseGame() {
        return false;
    }

    @Override
    public void initGui() {

    }

    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    }
}

 

5 minutes ago, jamiemac262 said:

"/textures/gui/core.png"

That slash at the beginning shouldn't be there, although that's not what's causing the problem in this case.

 

You bind a texture and then call super#drawScreen, but if you look at GuiScreen#drawScreen, you'll find that all it does is draw buttons and labels if any are present - your bound texture is never used. If you want to draw an image, you need to call Gui#drawTexturedModalRect (or a related method) yourself.

Well, you are never actually drawing the texture to the screen... use Gui#drawTexturedModalRect or a method close to that to draw it to the screen.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

thanks guys, that fixed it....

 

do either of you know if there's a way to stretch a background texture to a certain size?

 

the image I have is too small, I wanna stretch it to fill more of the screen

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.