Koolade446 Posted December 22, 2021 Posted December 22, 2021 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. Quote
Trhod177 Posted December 22, 2021 Posted December 22, 2021 you need to use RenderSystem.setShaderColor and RenderSystem.setShaderTexture Quote
Koolade446 Posted December 22, 2021 Author Posted December 22, 2021 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. Quote
Trhod177 Posted December 22, 2021 Posted December 22, 2021 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/ Quote
Recommended Posts
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.