Hello, I'm trying to make a GUI using Screen.
So far I've got
public class MyGUI extends Screen {
public MyGUI() {
super(null);
}
@Override
public void init(Minecraft p_init_1_, int p_init_2_, int p_init_3_) {
this.addButton(new Button(this.width/2-100, this.height/2-50,200, 100, "Click me!", (button) -> this.onClose()));
}
@Override
public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
this.renderBackground();
super.render(p_render_1_, p_render_2_, p_render_3_);
this.drawCenteredString(this.font, "Click the button!", this.width/2, this.height/2 + 70, 0xFFFFFF);
}
}
It opens the Screen when I right-click on my block. Right now it draws the background (i.e the screen darkens) but not the buttons/text, then proceeds to freeze the game after a few seconds / pressing Esc.
Thanks in advance!