

public Obsidian obby;
private void startGame() throws LWJGLException
{
obby = new Obsidian();
//this will call the code in the next code snippet "public Obsidian()"
}
package com.obsidian;
//Imagine a shit ton of imports here
public final class Obsidian
{
private final HackHandler hckh;
private final KeyboardHandler kmang;
private final ClickGui cgui;
//Declared files. The format goes ClassName nameForClass
public Obsidian()
{
//This section is where my client 'boots up' if you can imagine that.
//I've cut down most of the thingss in this file to keep it at a bare minimum for understanding purposes.
hckh = new HackHandler();
kmang = new KeyboardHandler();
cguis = new ClickGuiScreen(minecraft);//Just a GuiScreen. Ignore the click in the name.
//These three lines allow me to call these files and their contents in a non static manor from other locations in my client.
//Below are the 'getters' for these variables.
}
public void tick() //Called on every in-game tick
{
if (!O.disabled) //Boolean in O.java. If it's true the client ceases to function (this code is used elsewhere, but this section it only disables screen rendering)
{
getClickGuiScreen().draw(); //Will render our screen using out variable getter
if (getWrap().getWorld() != null)
{
Iterator i = Wrap.getInstance().getIterator();
while (i.hasNext())
{
HackBase hb = (HackBase) i.next();
if (hb.isRunning())
{
hb.onUpdate(); //Runs the onUpdate function in HackBase. This will be implemented into our hacks later.
}
}
}
}
}
public HackHandler getHackHandler()
{
return hckh;
//Using this, I can call Obsidian.getHackHandler().aimbot.enabled = true to modify the states and variables of the Aimbot hack which is loaded inside HackHandler
//This concept can be used for the below.
}
public ClickGui getClickGui()
{
return cgui;
}
public ClickGuiScreen getClickGuiScreen()
{
return cguis;
}
public Wrap getWrap()
{
return Wrap.getInstance(); //The getInstance code is in my wrap class but imagine it's like the above.
}
public KeyboardHandler getKeyboard()
{
return kmang;
}
}
//In wrap.java
public Iterator getIterator()
{
return getHackHandler().getHackList().iterator();
}
//In HackHandler.java (will be explained later)
public List<HackBase> getHackList()
{
return hacks;
}
package com.obsidian;
//imagine many imports here
public class HackBase
{
public boolean enabled;
public String name;
public int key;
public int page;
public Minecraft mc = Minecraft.getMinecraft();
public HackBase(String name, int key)
{
this.name = name;
this.key = key;
}
public HackBase(String name, int key, int page)
{
this.name = name;
this.key = key;
this.page = page;
}
public void toggle()
{
enabled = !enabled; //Toggles the mod state.
if(enabled) // When the state is enabled, the onEnable function is called
{
onEnable();
onEnableBase();
//I have base enabled separate from onEnables because I'm lazy and one handles default mechanics while the other is where I add things in my hack classes
}
else // When the state is disabled (not enabled), the onDisable function is called
{
onDisable();
onDisableBase();
}
}
public void setKey(int key)
{
this.key = key;
}
//A getter section for the current mod.
public String getName()
{
return name;
}
public int getKey()
{
return key;
}
public int getPage()
{
return page;
}
public int getCurrentPage()
{
return ClickGuiScreen.page;
}
public boolean isRunning()
{
return enabled;
}
public void onEnable(){}
public void onDisable(){}
public void onEnableBase(){enabled = true;}
public void onDisableBase(){enabled = false;}
//The following voids are empty. Why? Because we will use them when we make hacks that EXTEND this file.
public void onUpdate(){}; //Called on every in-game tick
public void rightClick(){} //Called when the user right clicks with the mouse. Holding the mouse does not fire this function after the initial click.
public void leftClick(){} //Called when the user left clicks with the mouse. Holding the mouse does not fire this function after the initial click.
public void onBlockClick(int x, int y, int z){} //Called when a block is clicked. The x,y,z parameters are the block that has been placed coordinates in the world.
public void onBlockPlace(int x, int y, int z){} //Called when a block is placed. The x,y,z parameters are the block that has been placed coordinates in the world.
public void renderEntities() {} //Called when rendering Entities
public void onRespawn() {} //Called when respawning
public void chatMessage(String par1Str) {} //Called when a chat message is recived
public void onEntityHit(Entity e){} //Called when a entity is hit. The entity hit is passed to the parameter e.
}
package com.obsidian.**********bat;
//I placed this code inside my hacks package. Then inside that package I made a combat package. This class lies within the combat package
//imports.
public class FastHeal extends HackBase //Hey look. Our hackbase.
{
public Minecraft mc = Wrap.getInstance().getMinecraft();
public FastHeal(String name, int key, int page)
{
super("Fastheal", Keyboard.KEY_X, 2);
//Remember the base?
//Here we fill in the name, key, and page with the code here. Super reffers to the class it extends, which is in this case, Hackbase
}
@override //Overriding the code (which was empty) from the hackbase
public void onUpdate()
{
//if this function (below) returns true, >shitty heal code<.
if(shouldHeal())
{
for(int i=0;i<60;i++)//Method here is shitty since this loop will cause different results for everyone due to how fast they can process.
{
try
{
mc.thePlayer.sendQueue.addToSendQueue(new Packet10Flying(false));
//Shut up. It worked fine on vanilla servers.
}catch(Exception ex){}
}
}
}
private boolean shouldHeal()
{
//Not all code needs to be extended from the base. Here we have a boolean which is found / used only in this file. It returns true if given requirements are all met. Otherwise, it returns false.
if(!mc.thePlayer.capabilities.isCreativeMode && !mc.thePlayer.isDead && !mc.thePlayer.isBurning() && mc.thePlayer.getFoodStats().getFoodLevel() >= 16)
{
return true;
}
return false;
}
}
package com.obsidian;
//moar imports.
public class HackHandler
{
public ArrayList<HackBase> hacks = new ArrayList<HackBase>();
//We have a list of items which are HackBases. How does that work? Remember the forge. They all have different properties, but retain the same shape.
//Since they all are HackBase objects with some extra code, we make a list of HackBases.
public FastHeal fastheal = new FastHeal("FastHeal", Keyboard.KEY_X, 2);
//Look familiar?
public HackHandler()
{
System.out.println("Loading hack list...");
addHack(fastheal);//Calls the addHack function with fastheal as a parameter.
System.out.println("Hack list loaded! Hacks loaded: " + hacks.size());
//This is called from out ClientName.java. I posted that section up a bit.
}
public void addHack(final HackBase hb)
{
//Adds the HackBase object to the arraylist 'hacks'.
hacks.add(hb);
}
public List<HackBase> getHackList()
{
//gets the arraylistt of hacks.
return hacks;
}
public void handleDefaults()
{
System.out.println("Loading default Obsidian methods...");
//If you wanted to, you could set certain hacks to true here.
//Some of my favorites would be nofall, tracers, nametags, etc.
}
}
package com.obsidian;
//Imports
public class KeyboardHandler
{
public Minecraft mc = Wrap.getInstance().getMinecraft();
public void onKeyPressed()
{
int key = Keyboard.getEventKey();
if (key == Keyboard.KEY_UP) //My GUI is bound to the up key
{
Obsidian.getObsidian().getClickGuiScreen().enabled = !Obsidian.getObsidian().getClickGuiScreen().enabled; //Toggle my GUI enabled state.
//I have my GUI as a hack in a way. So remember the hack code? Throw in your GUI code into onUpdate() and it'll behave nicely.
mc.displayGuiScreen(new ClickGui(Obsidian.getObsidian().manager));
//you can ignore this line. This is darkstorm_'s API implementation.
}
handlePages(key); //Since my client uses pages, I threw in this void which reads the keys that are pressed.
for (HackBase hb : Obsidian.getObsidian().getHackHandler().getHackList())
{
if (hb.getPage() == ClickGuiScreen.page && key == hb.getKey()) //The check for page being = to the hack's assigned page is so I could have pages of hacks which all use the same keybind.
{
hb.toggle();
}
}
}
private void handlePages(int key)
{
//All of the Keyboard.KEY_KEYNAME return as integers. Think of them as a much better checkkeys. If you didn't get the joke, just note they return as integers...
if (key == Keyboard.KEY_D)//if key's value is = to KEY_D's value, turn the page. It's a simple and easy way to use keybinds to do things.
{
ClickGuiScreen.page = ClickGuiScreen.page + 1;
if (ClickGuiScreen.page == 7)
{
ClickGuiScreen.page = 1;
}
}
if (key == Keyboard.KEY_Q)
{
ClickGuiScreen.page = ClickGuiScreen.page - 1;
if (ClickGuiScreen.page == 0)
{
ClickGuiScreen.page = 6;
}
}
}
}
//In minecraft.java
//After
if (this.currentScreen != null)
{
this.currentScreen.handleKeyboardInput();
}
//but before
if (Keyboard.getEventKey() == 1)
{
this.displayInGameMenu();
}
//////////////
if(!O.disabled){obby.getKeyboard().onKeyPressed();}//Calls the KeyboardHandler's onKeyPressed.
/// So it looks like
if (this.currentScreen != null)
{
this.currentScreen.handleKeyboardInput();
}
else
{
if(!O.disabled){obby.getKeyboard().onKeyPressed();}
if (Keyboard.getEventKey() == 1)
{
this.displayInGameMenu();
}
///This is all inside "public void runTick()"
