Jump to content

1.13.2 GuiScreen button click


Recommended Posts

Hello,

 

I am porting a mod from 1.12.2 to 1.13.2. Since actionPeformed is no longer a thing in GuiScreen for 1.13.2 I have looked around the forums to see what the alternative is.

 

Ive come along the following:

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

public class Gui extends GuiScreen {

    protected void initGui() {
        GuiButton button = new GuiButton(0, 200, 15, "Ok") {
            public void onClick(double mouseX, double mouseY) {
                System.out.println("x");
            }
        };
        this.buttons.add(button);
    }
}

 

Sadly I cannot get the onClick to fire once I click on the button. The GUI opens fine and the button is there I just can't wrap my head around it I am pretty sure I am missing something simple.

 

Thanks in advance.

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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