- 4
- 0
Сделал своё главное меню, задний фон отображается, кнопки появляются, всё четко, но когда нажимаю на кнопку ничего не происходит. Вот код, помогите, пожалуйста. Если что, версия 1.12.2
CODE:
public class MainMenu extends GuiScreen{
@Override
public void initGui() {
this.buttonList.add(new GuiButton(0, this.width / 2 - 350, this.height / 2 - 65, "Multiplayer"));
this.buttonList.add(new GuiButton(1, this.width / 2 - 400, this.height / 2 + 60, ""));
this.buttonList.add(new GuiButton(2, this.width / 2 - 450, this.height / 2 + 120, ""));
super.initGui();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialticks) {
//Рисуем задний фон и кнопки
mc.getTextureManager().bindTexture(new ResourceLocation("trustclient/guimainmenubackground.png"));
this.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, this.width, this.height, this.width, this.height);
super.drawScreen(mouseX, mouseY, partialticks);
}
@Override
protected void actionPerfomed(GuiButton button) throws IOException {
if(button.id == 0) {
this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if(button.id == 1) {
mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if(button.id == 2) {
mc.shutdown();
}
super.actionPerformed(button);
}
}