[1.5.2][Решено] Не отображаются кнопки в гуи

183
1
4
День добрый. Трабл в том что в созданное гуи не добавляются кнопки (точнее просто не отображаются).
Файл гуи:
Код:
public class chooseGodGui extends GuiScreen
{
    
    public chooseGodGui(){
        super();
    }
    @Override
         public void initGui() {
            super.initGui();            
            this.buttonList.add(new GuiButton(1, width / 2 + 2, height / 2 + 2, 98, 20, "First" ));
            this.buttonList.add(new GuiButton(2, width / 2 + 100, height / 2 + 2, 98, 20, "Second" ));       
        }
    
    protected void actionPerformed(GuiButton guibutton)
    {
        
    }
  
    @Override
    public boolean doesGuiPauseGame()
    {
        return false;
    }
    protected void keyTyped(char par1, int par2){
        if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode)
        {
            this.mc.thePlayer.closeScreen();
        }
    }
    public void drawScreen(int par1, int par2, float par3){
        drawDefaultBackground();
        drawCenteredString(fontRenderer, "Test", width / 2, 45, 0x99FF00);
    }

}
Так это выглядит в игре:
dhFtYll.png

В чем ошибка?
 
771
5
Перед добавлением кнопок в initGui напиши buttonList.clear() и в drawScreen super вызов.
 
183
1
4
Majestic написал(а):
Перед добавлением кнопок в initGui напиши buttonList.clear() и в drawScreen super вызов.
Сделал как ты сказал, результат тот же, код ниже:
Код:
public class chooseGodGui extends GuiScreen
{
    
    public chooseGodGui(){
        super();
    }
         public void initGui() {   
            buttonList.clear();
            buttonList.add(new GuiButton(1, width / 2 + 2, height / 2 + 2, 98, 20, "First" ));
            buttonList.add(new GuiButton(2, width / 2 + 100, height / 2 + 2, 98, 20, "Second" ));       
        }
    
    protected void actionPerformed(GuiButton guibutton)
    {
        
    }
  
    public boolean doesGuiPauseGame()
    {
        return false;
    }
    protected void keyTyped(char par1, int par2){
        if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode)
        {
            this.mc.thePlayer.closeScreen();
        }
    }
    public void drawScreen(int par1, int par2, float par3){  
        super.initGui();
        drawDefaultBackground();
        drawCenteredString(fontRenderer, "Test", width / 2, 45, 0x99FF00);
    }

}
 
Сверху