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

The title lays it out. I'm pretty new to forge and 1.18 changed everything i know so yeah here goes

I created a menu GUI and bound it to a key all works well but the GUI just uses the default missing GUI texture from Minecraft even though i have a texture set.

Here's my code:

public class MenuUI extends Screen {

    private static final int WIDTH = 179;
    private static final int HEIGHT = 151;

    private final ResourceLocation Texture = new ResourceLocation(NoLifeSmpMod.ModID, "textures/gui/menu.png");

    protected MenuUI() {
        super(new TranslatableComponent("screen." + NoLifeSmpMod.ModID + ".Menu"));
    }

    @Override
    protected void init() {
        int relX = (this.width - WIDTH) / 2;
        int relY = (this.height - HEIGHT) / 2;

        addRenderableWidget(new Button(relX + 10, relY + 10, 160, 20, new TextComponent("Button test"), button -> sendMessage("Press recived")));
    }

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

    @Override
    public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
        int relX = (this.width - WIDTH) / 2;
        int relY = (this.height - HEIGHT) / 2;
        assert this.minecraft != null;
        this.minecraft.getTextureManager().bindForSetup(Texture);
        this.blit(poseStack, relX, relY, 0, 0, WIDTH, HEIGHT);
        super.render(poseStack, mouseX, mouseY, partialTicks);
    }

    public static void open() {
        Minecraft.getInstance().setScreen(new MenuUI());
    }
}

in the past I used 

this.minecraft.getTextureManager().bind(texture)

but that doesn't exist anymore so I assumed it had been replaced by 

this.minecraft.getTextureManager().bindForSetup()

Am I wrong? IDK please help me.

  • Author
8 hours ago, Trhod177 said:

you need to use

RenderSystem.setShaderColor

and

RenderSystem.setShaderTexture

I tried adding those to both my render and init methods and no dice. is there a way to register a GUI in 1.18? I'm doing this one a little different from how I would do GUI's in the past because 1.18 changed everything and the docs are pitiful. In the past, I would register and open a GUI like this
 

//Register
FMLModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, ...)

//Open
NetworkHooks.openGui.

But FMLModLoadingContext doesn't exist anymore in 1.18 so instead, I'm using the open method so I never registered it?

 

also never used the RenderSystem and Mojang insists on being annoying and naming their variables stupid things like p_98389 so i have no clue what the ints and floats in the method you gave me represent.

 

Thanks for any help.

RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);

and

RenderSystem.setShaderTexture(0, Texture);

and to register

MenuScreens.register(containerRegistrationClass.container.get(), screenclass::new);

also mojang dont name they variables that why its a byproduct of obfuscation i would recommend you use parchment mappings to give them all names

https://github.com/ParchmentMC/Librarian/blob/dev/docs/FORGEGRADLE.md
https://parchmentmc.org

https://discord.parchmentmc.org/

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.