[Tutorial]2024.3 How to make the background of the GUI not dark.

Started by dkrdjdi on

Topic category: User side tutorials

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial]2024.3 How to make the background of the GUI not dark.

If you followed this tutorial correctly,

the background should not turn dark when you open the GUI as shown in the image.

https://imgur.com/lvkxBcU

Step1

Create your custom GUI and go to the code editor.

 

Step2

Find that code.


    @Override
    public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
        this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
        super.render(guiGraphics, mouseX, mouseY, partialTicks);
        this.renderTooltip(guiGraphics, mouseX, mouseY);
    }

    @Override
    protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int gx, int gy) {
        RenderSystem.setShaderColor(1, 1, 1, 1);
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        RenderSystem.disableBlend();
    }


 

Remove the code to make it look like this.


    @Override
    public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
 
        super.render(guiGraphics, mouseX, mouseY, partialTicks);
        this.renderTooltip(guiGraphics, mouseX, mouseY);
    }

    @Override
    protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int gx, int gy) {
 
    }


 

Step3

Go to the last line and add the code.


@Override
   public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {

 

}


https://imgur.com/27Cw3xz

It should look like the image above.