[TuT]Basic Console tutorial.
About
Well here's a tutorial for a basic Console hack, i like this because you can use it in single player with commands still, i got this tutorial from here in HF, but it was abit hard to follow so i thought id make my own which hopfully people will understand as soon as they have gone though my thread.
Open GuiChat
Open the GuiChat.java and Copy the whole thing, as a base for your console.
Heres me selecting some of it, but you must copy paste(ctrl + c/ctrl v) all of it

[spoiler]
Code:
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
public class GuiChat extends GuiScreen
{
protected String message;
private int updateCounter;
private static final String allowedCharacters;
public GuiChat()
{
message = " ";
updateCounter = 0;
}
public void initGui()
{
Keyboard.enableRepeatEvents(true);
}
public void onGuiClosed()
{
Keyboard.enableRepeatEvents(false);
}
public void updateScreen()
{
updateCounter++;
}
protected void keyTyped(char c, int i)
{
if (i == 1)
{
mc.displayGuiScreen(null);
return;
}
if (i == 28)
{
String s = message.trim();
String s2 = message.replace("`" , "§");
if (s.length() > 0)
{
String s1 = message.trim();
if (!mc.lineIsCommand(s1))
{
mc.thePlayer.sendChatMessage(s2);
}
}
mc.displayGuiScreen(null);
return;
}
if (i == 14 && message.length() > 0)
{
message = message.substring(0, message.length() - 1);
}
if ((allowedCharacters.indexOf(c) >= 0 || c > ' ') && message.length() < 100)
{
message += c;
}
}
public void drawScreen(int i, int j, float f)
{
drawRect(2, height - 14, width - 2, height - 2, 0x800);
drawString(fontRenderer, (new StringBuilder()).append("> ").append(message).append((updateCounter / 6) % 2 != 0 ? "" : "_").toString(), 4, height - 12, 0xe0e0e0);
super.drawScreen(i, j, f);
}
protected void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
if (k != 0)
{
return;
}
if (mc.ingameGUI.field_933_a == null)
{
return;
}
if (message.length() > 0 && !message.endsWith(" "))
{
message += " ";
}
message += mc.ingameGUI.field_933_a;
byte byte0 = 100;
if (message.length() > byte0)
{
message = message.substring(0, byte0);
}
}
static
{
allowedCharacters = ChatAllowedCharacters.allowedCharacters;
}
}
[/spoiler]
Console class file
Now we have to create a console class file!
If your in eclipse find the little "C" with a plus on it, or go file, new, class, and name it "GuiConsole"
Now copying
Now copy GuiChat into your GuiConsole classfile, and change where it says GuiChat

becomes

[spoiler]
Code:
public class GuiConsole extends GuiScreen
{
protected String message;
private int updateCounter;
private static final String allowedCharacters;
public GuiConsole()
[/spoiler]
Stop Sending to the sever
Find the following code and change it,

becomes

[spoiler]
Code:
if(i == 28)
{
String s = message.trim();
mc.displayGuiScreen(null);
return;
}
[/spoiler]
Adding your toggles
Now we can add our toggles, look in the screen shot for where to put them(you put them in like you would a chat command!)

[spoiler][/code] if(i == 28)
{
String s = message.trim();
if(s.startsWith("lol"))
{
hacks.Aimbot = !hacks.Aimbot;
}
mc.displayGuiScreen(null);
return;
}[/code][/spoiler]
Console looking better
You can change the color of your console, and the ">" aswell, heres where it is(In your GuiConsole.java class)

[spoiler]
Code:
public void drawScreen(int i, int j, float f)
{
drawRect(2, height - 14, width - 2, height - 2, 0x800);
drawString(fontRenderer, (new StringBuilder()).append("> ").append(message).append((updateCounter / 6) % 2 != 0 ? "" : "_").toString(), 4, height - 12, 0xe0e0e0);
super.drawScreen(i, j, f);
}
[/spoiler]
Console looking better 2
Now change the color, you can see the color value is "0xe0e0e0", change that to any value from the following site
Color values and change the text of "> " to "Console: ", gives a better look

[spoiler]
Code:
public void drawScreen(int i, int j, float f)
{
drawRect(2, height - 14, width - 2, height - 2, 0x800);
drawString(fontRenderer, (new StringBuilder()).append("Console: ").append(message).append((updateCounter / 6) % 2 != 0 ? "" : "_").toString(), 4, height - 12, 0xA9A9A9);
super.drawScreen(i, j, f);
}
[/spoiler]
Opening your console
There are a few ways of doing this, i will list 1 for you guys
Opening your console - Part 1
Go to GuiIngame.java, go down to the bottom and find this,

[spoiler]
Code:
if (mc.gameSettings.showDebugInfo)
[/spoiler]
Opening your console - Part 2
Im going to asume you have keybinds working. if not ill make a tutorial on that, so now go to where i took a screen shot and under this is where youll put your console opening code!:

now, heres the code you'll need:

[spoiler]
Code:
if(checkKey(Keyboard.KEY_GRAVE))//its this key = "`" like a COD console in PC
{
mc.displayGuiScreen(new GuiConsole());
}
[/spoiler]
Opening your console - Part 3
You can change the key to anything, heres a list of java keys!
KeyInput (jME API)
I suggest grave because its easyest.
Finished Code
You have just made your console, here is the final code for your console, and then your toggle to open it!
GuiConsole.java:
[spoiler]
Code:
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
public class GuiConsole1 extends GuiScreen
{
protected String message;
private int updateCounter;
private static final String allowedCharacters;
public GuiConsole1()
{
message = " ";
updateCounter = 0;
}
public void initGui()
{
Keyboard.enableRepeatEvents(true);
}
public void onGuiClosed()
{
Keyboard.enableRepeatEvents(false);
}
public void updateScreen()
{
updateCounter++;
}
protected void keyTyped(char c, int i)
{
if (i == 1)
{
mc.displayGuiScreen(null);
return;
}
if(i == 28)
{
String s = message.trim();
//We will be using this space later.
mc.displayGuiScreen(null);
return;
}
if (i == 14 && message.length() > 0)
{
message = message.substring(0, message.length() - 1);
}
if ((allowedCharacters.indexOf(c) >= 0 || c > ' ') && message.length() < 100)
{
message += c;
}
}
public void drawScreen(int i, int j, float f)
{
drawRect(2, height - 14, width - 2, height - 2, 0x800);
drawString(fontRenderer, (new StringBuilder()).append("> ").append(message).append((updateCounter / 6) % 2 != 0 ? "" : "_").toString(), 4, height - 12, 0xe0e0e0);
super.drawScreen(i, j, f);
}
protected void mouseClicked(int i, int j, int k)
{
super.mouseClicked(i, j, k);
if (k != 0)
{
return;
}
if (mc.ingameGUI.field_933_a == null)
{
return;
}
if (message.length() > 0 && !message.endsWith(" "))
{
message += " ";
}
message += mc.ingameGUI.field_933_a;
byte byte0 = 100;
if (message.length() > byte0)
{
message = message.substring(0, byte0);
}
}
static
{
allowedCharacters = ChatAllowedCharacters.allowedCharacters;
}
}
[/spoiler]
The toggle key for opening it:
In GuiIngame.java
[spoiler]
Code:
if(checkKey(Keyboard.KEY_GRAVE))
{
mc.displayGuiScreen(new GuiConsole());
}
[/spoiler]
Credit
Me, writing it up in a clean, easy to follow, version
nbcomix - For showing me(in a tutorial he posted) on how to do it, even thought it was confusing, so i re-wrote it.