Jump to content

ScreenGui does nothing


Jaffaaaaa

Recommended Posts

I'm trying to make a gui to edit values and settings using a command, but the gui just does nothing apart from showing me the "init gui" message I put i the initGui() method.

package xyz.jaffaaaa.zealotmanager;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ChatComponentText;

public class GuiHandler extends GuiScreen {

    private GuiButton reset;

    private ZealotManager zm;
    public GuiHandler(ZealotManager zm) {
        this.zm=zm;
    }

    @Override
    public void initGui() {
        super.initGui();
        this.buttonList.clear();
        Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("init gui"));
        this.buttonList.add(reset = new GuiButton(0, this.width / 2 - 100, this.height / 2, "Reset Counters"));
    }

    @Override
    protected void actionPerformed(GuiButton button) {
        if (button == reset) {
            zm.counter.zealotsSinceLastEye = 0;
            zm.counter.totalEyes = 0;
            zm.counter.totalZealots = 0;
        }
    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        super.drawScreen(mouseX, mouseY, partialTicks);
        drawDefaultBackground();
    }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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