Not sure if this has been posted here before, but a quick refresher if it has.
Were gona make a new Gui Screen... Allowing us to display many things, anything from the info about our client to the enabled hacks, player name, etc...
To get started lets first create a new class. In that class, were gona have 3 methods.
Code:
public void initGui() {}
This allows us to initiate Gui features such as the buttons. Yeah we could put them in another method, but for purposes of keeping it tidy we can put it here.
As I said, we can put buttons on our new screen...
So lets do that.
In the void which we just created, lets add 2 buttons.
A buttonList is a button container - in plain English. What we do is take a button and add it into the container. So, we create a GuiSmallButton at specified x and y coordinates with a special ID code of 0 and the name "Back".
So, our button is pretty much useless right now. Aint it?
To make it a lil bit less useless, lets create a second void.
We create a protected void so that it only applies to this class. actionPerformed.. Is an action listener, which listens to GuiButton.
It works quite similarly to cases.. IE: case 1337: do this...
Except we can have anything in this.
To make our buttons more of.. A button, we create an if statement. If our parameter (par1GuiButton) is equal to the id code of the button then do this.
Code:
if (par1GuiButton.id == 0) {
this.mc.displayGuiScreen(new HookMainMenu());
}
What this code does is it displays my hook screen if the button is pressed.
If you want to exit the client, you can use a simple line.
Code:
else if (par1GuiButton.id == 1) {
this.mc.shutdown();
}
Lastly for this class, we have to create a drawScreen void.
You see, if we had all of our stuff in the initGui void, it'll be messy and the screen would constantly flicker back and forth between your gui and the old gui.
For the draw screen, do this...
Code:
public void drawScreen(int par1, int par2, float par3) { //Creates a method with 3 parameters.
this.drawDefaultBackground(); //Draws a default background (DIRT)
this.drawCenteredString(this.fontRenderer, "- Client Menu -", this.width / 2, this.height / 4 - 60 + 20, 16777215); //Fancy drawString
super.drawScreen(par1, par2, par3); //Super (override (superior)) so the void displays.
}
A final thing which we have to do is create a way to access this screen. Go to your place of your liking. Mines a MainMenu hook. Create a button (similar way to above). And then when the button is pressed, do something like this.
Code:
if (par1GuiButton.id == 15) {
this.mc.displayGuiScreen(new GuiClientMenu());
}
Obviously replacing the class name with yours and the button id.
Sorry for the sloppy code and tutorial, tired and its 00:34 so yup.
Ill.. pretend to be.. Bob Ross.
"Our custom screen.. Its.. A creation. Let it be what you want it to be. You want a button on there? Lets create a happy little button. Now you have to create a major decision. Where does your button live. Right there. Oh Whats that? You want few more? Why not add another 5, but lets change them; dont want them to look miserable now, do you. Let your imagination go wild and paint it for you. Sit back and enjoy." - Well.. thats.. pretty much me than Bob But hey.. Be creative!