Social Icons

Saturday, 5 May 2012

How to make your first hack client


Have a normal brain
Have JDK installed (Video tutorial: Java Programming Tutorial - 1 - Installing the JDK - YouTube)
Basic Java knowledge

What you'll need:

Eclipse (Download link:
Minecraft Coders Pack (Download link: MCP Releases - Minecraft Coder Pack)

MCP = Minecraft Coders Pack
Credits: Nick ~ checkKey function

Do a clean force-update of your Minecraft to allow effective and stable decompiling
Navigate to your ".minecraft" folder in your AppData (Press 'START' then 'RUN' then type '%appdata%\.minecraft').
Extract MCP and run "cleanup.bat" and then "updatemcp.bat", this will update all the tools you will need to decompile and recompile your client with.
Go back to your '.minecraft' folder and copy and paste the 'bin' and 'resources' folders into the MCP 'jars' folder.
Run 'decompile.bat' afterwards, a 'src' & 'eclipse' folder should appear.
Set your eclipse workspace to your MCP 'eclipse' folder.
Time to get coding! In eclipse, set the workspace to the following folder. 'Client' > 'src' > 'net.minecraft.src', this will be our directory for creating our hacks.
Navigate to the class file you see called ''.
What we're going to do here is create our hotkey & overlay base. But before we can do that, we're going to need to import the keyboard.
Where you see the other "imports" at the top, import the keyboard via:
import org.lwjgl.input.Keyboard;

What this does is "call/declare" a raw Keyboard interface. This can be used to poll the current state of the keys, or read all the keyboard presses / releases since the last read.
Next we need to create our check keystates function. We first need to declare our keystates, we can do this via:
private boolean keyStates[];
Place this right under the class parenthesis.

What we've done is declared a new boolean, which is a true/false variable. In this case, any object that is placed between the brackets, applies with the true/false system.
Now we have to declare an instance of our boolean, in the initialization of the class, place:
keyStates = new boolean [256];
This means, our boolean, can be true/false for any of these numbers between 0 and 256.

Now for our actual check keystate code. Place this under the initialization, after the ending parenthesis.

Typing it out helps you understand what each statement does.
Now that you've done your hotkeys, you can do the GUI. Press 'CTRL' + 'F' and search for 'debug'. Create simple else statement at the bottom of the if.

Here is where we are going to put our actual toggle codes. Toggling is split up into two parts, part one, where the hotkeys are pressed, part two, where the overlay is created.
Scroll back to the top where you declared your 'keyStates' boolean. Now create another boolean for high jump.

What this did was create a true/false variable for the hack.
Now to do our toggle. Simply use the checkKey statement, then do the following:

Next, we have to draw onscreen whether our hack is on or off.
We can use fontrenderer, to draw a text overlay such as below.

At the moment, all we have created is a toggle, we now have to code the actual hack. Navigate to '' and find the 'jump()' function. Add a simple if statement.

You have successfully created your first hacked client. To get the class files, goto your MCP folder then run 'recompile.bat' then 'reobfuscate.bat'. In the 'reobf' folder you will have the class files you can drag and drop into your 'minecraft.jar'.
(Remember to delete the META-INF folder)

1 comment: