Jump to content

[1.12.2] Can't replace Main Menu GUI


fabiani46

Recommended Posts

Hello.

My problem is that I created a new replacement for Main Menu GUI:
 

package hu.test.gui;

import java.io.IOException;

import hu.test.utils.References;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;

@SideOnly(Side.CLIENT)
public class GuiTestMainMenu extends GuiScreen {

	private static final ResourceLocation logo = new ResourceLocation(References.MOD_ID, "logo.png");
    private static final ResourceLocation background = new ResourceLocation(References.MOD_ID, "background.png");
	
    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        drawDefaultBackground();
        drawCenteredString(this.fontRenderer, "thi is a test", 10, 10, 0xc80000);
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void initGui() {
        super.initGui();
    }

    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
        super.actionPerformed(button);
    }
    
    @Override
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
        super.mouseClicked(mouseX, mouseY, mouseButton);
    }
	
}

And this is how I want to replace the MainMenu with mine.
 

@Mod.EventBusSubscriber
public static class EventHandlers
{
	@SideOnly(Side.CLIENT)
	@SubscribeEvent
	public void openGui(GuiOpenEvent event) {
		if (event.getGui() instanceof GuiOptions) {
				event.setGui(new GuiTestMainMenu());
				System.out.println("fastdqwefqwefqwefwqe");
		}
	}
}

The problem is that I experience no errors but I dont even see the log in the console.
What is the problem with my code?

Link to comment
Share on other sites

3 minutes ago, diesieben07 said:

Post updated code. Is your event handler being called?

@Mod.EventBusSubscriber
	  public static class EventHandlers
	  {
		@SubscribeEvent
		public void openGui(GuiOpenEvent event) {
			if (event.getGui() instanceof GuiMainMenu) {
					event.setGui(new GuiKodaikMainMenu());
					System.out.println("fastdqwefqwefqwefwqe");
			}
		}
}

how do i know if its called?
sorry i have little experience in modding
I used to code plugins not mods, i just learning :)

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.