Краш из-за настроек в главном меню.

Версия Minecraft
1.7.10
48
1
Всем привет.
Крашится игра после открытия настроек в главном меню.

Вот кейсы:
Java:
    @Override
    protected void actionPerformed(GuiButton button)
    {
        switch (button.id)
        {
            case 0:
                this.mc.shutdown();
                break;
            case 1:
                this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
                break;
            case 2:
                this.serverList.connectToSelected(this);
                break;
        }
    }


Отрисовка кнопки:


Код:
        this.buttonList.add(new GuiButtonCrystal(1, 2, this.height - 15 - 20 * 2 - 2, leftWidth, 20, "Настройки"));


Класс с отрисовкой кнопок:

Java:
package test.client.gui;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public final class GuiButtonCrystal extends GuiButton
{
    public GuiButtonCrystal(int id, int x, int y, int width, int height, String text)
    {
        super(id, x, y, width, height, text);
    }

    public GuiButtonCrystal(int id, int x, int y, String text)
    {
        super(id, x, y, text);
    }

    @Override
    public void drawButton(Minecraft mc, int x, int y)
    {
        if (this.visible)
        {
            FontRenderer fr = mc.fontRenderer;
            boolean changed = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            if (changed)
            {
                drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0x90000000);
                this.drawCenteredString(fr, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0x00FF00);
            }
            else
            {
                drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0x60000000);
                this.drawCenteredString(fr, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xFFFFFF);
            }
            this.mouseDragged(mc, x, y);
        }
    }
}
 
ох, точно.
извиняюсь, забыл тупо..
---- Minecraft Crash Report ----
// Oops.

Time: 07.08.18 19:01
Description: Updating screen events

java.lang.NullPointerException: Updating screen events
at net.minecraft.client.settings.GameSettings.sendSettingsToServer(GameSettings.java:1157)
at net.minecraft.client.settings.GameSettings.saveOptions(GameSettings.java:1139)
at net.minecraft.client.gui.GuiOptions.actionPerformed(SourceFile:101)
at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:225)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:296)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:268)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1640)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:973)
at net.minecraft.client.Minecraft.run(Minecraft.java:898)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
 
Эм.. Хз, в ваниле такой же код и все работает.
По идеи, это должно нормально работать.
Типо если ты на сервере - ты отправляешь данные, хотя хз зачем.
Если ты не на сервере - то mc.player это нулл и отправка не вызывается.
 
Назад
Сверху