How to code hacked client modules

Discussion in 'Off-Topic' started by Oculus, Feb 18, 2016.

  1. Oculus

    Oculus Guest

    Before you read this, I would first like to say that I did not make this and I am only posting it here for ease of access. This tutorial was originally from the Team Avolition website.

    Prologue

    If you are not using an IDE (such as Eclipse), start using one. Now. This will help clear up compiler errors as most IDEs will give you suggestions on how to fix them. Also, a common error for programming newbies is case-issues. shouldsideberendered() is not the same as shouldSideBeRendered().

    Now, let’s start out with a simple sneak hack.

    Step I - Sneak Hack
    Difficulty: * (1/5)

    So, assuming you already have your toggle (if not, make one now), you are going to want to send a sneak packet to the server when you turn on sneak. The packet for this is Packet19EntityAction. So, we are going to want to send this packet with the ‘extra data’ being 1 (which tells the server that the action is a sneak action) whenever the sneak hack is toggled.

    sendPacket(19,1);


    For more info on how packets work, go to http://mc.kev009.com/Protocol.

    Now that you have your sneak hack send a sneak packet when you turn it on, players near you will see you sneaking when you turn it on. However, players who walk, teleport, or login into your area will not see you sneaking. In order to fix this, you must send the packet again on an entity teleport. How will you do this? I’ll leave that up to you to find out.
    Protip: Use ctrl+f and the file search to your advantage.

    Now that we have a basic sneak hack down, let’s move on to an Xray.

    Step II - Xray
    Difficulty: * (1/5)

    You will be using Block.java for most, if not all, of this Xray hack.
    Look at shouldSideBeRendered() in Block.java. This method obviously will return if a side of a block should be rendered. If a block is visible from one side, that side will be rendered. The game does this to reduce the lag caused by rendering the vertices of a block’s face. If a side of a block is hidden, the game won’t even bother rendering it. Because of the way the game handles whether or not the block should be rendered, it should be easy to change that. Take this pseudo-code for example.

    if(Xrayis enabled){
    if(Blockis an Xray block){
    //render block
    }
    //otherwise, don't render block
    }


    That’s all you need for a basic Xray. I’m not going to help you with a transparent Xray because I don’t want everyone having one (even though there are probably at least 5 ‘tutorials’ on HackForums).

    Now let’s try a Freecam. In my opinion, this is probably one of the most overthought hacks out there. It’s really easy, but people often overestimate its difficulty.

    Step III - Freecam
    Difficulty: * (1/5)

    Let’s look at how a player moves in multiplayer. Once you give the player a move command, it will move on your client and send a move packet to the server. All we have to do is find where in the client move packets are handled and add something to this effect:

    if(!Freecamis on){
    //send move packet
    }


    It’s that easy. Now you can either make the Freecam go back to the player position when it is turned off or leave it as is, but I prefer leaving it as is, because that way I can use Freecam to teleport short distances.

    Step IV - Fly
    Difficulty: (0/5)

    This used to be slightly harder to do, but now that Notch has added Fly to the game, you can just copy his code for use in your fly mod.
    Protip: Look in Capabilities.java for the capability to fly, and toggle it when you turn fly on or off.

    Step V - Nuker
    Difficulty: ** (2/5)

    I will not be providing any pseudocode for Nuker because if you do not understand how to program a Nuker after reading this, you shouldn’t have a Nuker.

    What you want to do with a Nuker is simply to pick a block within the player’s range and send the server a packet (Packet14BlockDig) telling it you hit that block. You can do this by either picking a random block, checking if it is an air block, and if it isn’t destroy it, or by systematically incrementing your x, y and z variables instead of picking a random block (I prefer this way because it looks pretty. :/). Keep doing this until Nuker is turned off or, if you are using option B for choosing a block to nuke, whenever you run out of blocks in the player’s range.

    Step VI - Speedy Gonzales
    Difficulty: *.5 (1.5/5)

    To make blocks break faster, you want to multiply the increment of the current break time in PlayerControllerMP by some amount. Then, you want to take off the variable that adds a delay to destroying blocks.
    May be elaborated soon.

    Step VII - MoveEntity Speed
    Difficulty: * (1/5)

    In EntityPlayer.java, find the method onLivingUpdate(). This method will execute every frame the entity exists in the world. Add something that will change the speedOnGround and speedInAir variables to a higher amount whenever your hack is enabled. For example:

    if(SpeedHackis enabled){
    makeVariablesHigher();
    }


    Step VIII - Fullbright
    Difficulty: (0/5)

    I will not be providing too much help for this one, just because it is already extremely easy.

    You will need Block.java for this hack. I assume you actually know how to use the search function in your IDE, so search for something involving the brightness of a block (The two methods I use return an Integer and a Float, hint hint.) and change it to a higher value whenever fullbright is on. Do you really need pseudocode? Well, okay then.

    if(Fullbrightis on){
    //return higher value
    }
    //otherwise, return the normal value


    NOTE: Notice this in my code:
    //otherwise, return the normal value

    This is often forgotten, and can result in incorrect lighting if you somehow manage to get past all the compiler errors.

    Step IX - Client-Sided Name Change (or any other client-sided chat change)
    Difficulty: * (1/5)

    You will need GuiIngame.java for this one. Before we begin, here is a quick crash course in some important String functions that we might be using.

    The String.replace(); command will, as stated at docs.oracle.com, "[return] a new string resulting from replacing all occurrences of oldChar in this string with newChar." (docs.oracle.com contains a very useful library of tools, I suggest checking it out if you are new to native Java functions).

    The String.replaceAll(); function "replaces each substring of this string that matches the given regular expression with the given replacement."

    The String.replaceFirst(); function "replaces the first substring of this string that matches the given regular expression with the given replacement."

    Now that you know this, which one will you use?

    Where will you put it (Protip: Use your IDE's search option)?

    Step X - Player Radar
    Difficulty: *.5 (1.5/5)

    The method getDistanceToEntity(); in Entity.java returns the entity's distance away from another entity. You can use this to get a player's distance away from you. You can also use the getEntitiesWithinAABB() method in World.java to get a list of entities of a certain type (Protip: Other players) that are within a certain distance of the player. The way I would do it is:

    newList = sortTheEntitiesOfListByDistance();
    for each entity in newList do the following {
    //append the entity & distance to a StringBuilder
    }
    StringBuilder.toString();

    There are probably easier ways out there, but this is just the way I do it.

    Step XI - Spider/Climb
    Difficulty: * (1/5)

    This hack is rather easy. Just go to EntityLiving and figure out where ladder motion is handled, and make the movement work if you are on a ladder or if your spider hack is on.

    //ladder movements while up against a block
    if(entity is on a ladder OR spider is enabled){
    //ladder thing
    }

    Step XII - Derp
    Difficulty: Herpa derp derp. (1/5)

    All derp mode does is spam random look packets and optionally the occasional swing arm packet. To do this, you will need to spam the packet Packet12PlayerLook with a random value for yaw and pitch. If you want to send the swing arm packet, you would need to use Packet18Animation.

    Step XIII - NoFall
    Difficulty: .5 (0.5/5)

    Think about how fall damage is applied. It calculates the fall damage by counting the time that you have been off the ground as soon as you hit the ground. Try to trick the server into thinking you never left the ground when it tries to calculate fall damage. That's about all I can say without spoonfeeding.

    Step XIV - Lines and Other LWJGL Functions
    Difficulty: ** (2/5)

    Get an idea of how Minecraft draws blocks by looking in this thread.
    The block renderer draws vertices to make up the cube. This is exactly what we will be doing for drawing tracer lines to players. Look in Tessellator.java. See any method that could draw a vertex? You will want to use that. The first point, your mouse's position, is easy to figure out. The second vertex, however, is a bit more difficult. I recall a quote from WhoopiGoldberg explaining this, and I couldn't have said it beter myself.
    Spoiler

    Don't understand it? Read it again. The reason this makes sense is because the player's cursor is (0,0,0) when drawing a vertex.

    Now that you have your points, simply use draw() and the vertex tool to draw your line.
    The most common mistake I've seen with people drawing the lines is that the lines are drawn on the screen, but they do not seem to be pointing to anything. They move as the entities move, but are not pointed to them. This is because you are drawing the line on a 2D plane. Try to put the code somewhere where a 3D object is drawn (hint hint).

    Step XV - NoRender
    Difficulty: Novice (0.5/5)

    The way I use NoRender is just to stop rendering items, animals and monsters in case somebody (yourself included) is spamming them. If you want to do this, NoRender will probably be the easiest addition to your client ever made.

    There are better ways out there to do this, but I enjoy this way because it is fast and easy to make.

    Open up EntityItem, along with any other entities you would like to hide when NoRender is on. Find a method that executes every frame the entity is there (something that executes on the Update of the entity, hint hint), and put the following:

    if(NoRenderis on){
    destroy the entity
    }

    I will not be providing any more help, simply because you should know how an entity is destroyed. If you don't, look at the EntitySnowball and see how it destroys itself when it hits the ground.

    Step XVI - Up/Down
    Difficulty: * (1/5)

    If you do not know how to make an Up/Down command, you are probably overthinking things. There is a method that sets the Location And Angles of the player. This method also sends a packet to the server.

    Step XVII - FastPlace
    Difficulty: Novice (0.5/5)

    I can provide a tutorial for FastPlace with only one phrase, and this is the only phrase I will say to help you:

    right click delay.

    You should know what to do now.


    Step XVIII - Kill Aura
    Difficulty: * (1/5)

    A basic kill aura just looks through all the entities in the loaded entity list (hint hint) and attacks them if they are within range. You can find the function to attack the entity in the player controller class.
     
  2. Sir-Teabag

    Sir-Teabag Forum Fanatic

    Joined:
    Sep 2, 2014
    Messages:
    5,388
    Likes Received:
    1,503
  3. Oculus

    Oculus Guest

    Thanks :)
     
  4. Oculus

    Oculus Guest

    Btw, Im not actually giving the code out due to it being spoonfeeding.
     
    • Like Like x 1
  5. Qurp

    Qurp Forum Enthusiast

    Joined:
    Feb 20, 2015
    Messages:
    846
    Likes Received:
    276
    I didnt read the entire thing but why post a thread about how to code hacked clients on the minetime forums?
     
  6. Logo

    Logo Canadian, Eh?
    Premium

    Joined:
    Dec 1, 2015
    Messages:
    1,032
    Likes Received:
    570
    This won't help anyone unless they actually know what they're doing.
     
    • Like Like x 2
    • Agree Agree x 1
  7. Oculus

    Oculus Guest

    Well, minetime is a hacking community and those who need to go a step further and create their own hacked client might find this useful if they have some java knowledge.
     
    • Like Like x 1
    • Agree Agree x 1
  8. gone

    gone Expert Member

    Joined:
    Dec 2, 2013
    Messages:
    1,400
    Likes Received:
    370
  9. Daniel

    Daniel Expert Member

    Joined:
    Jul 1, 2014
    Messages:
    2,659
    Likes Received:
    725
     
  10. gone

    gone Expert Member

    Joined:
    Dec 2, 2013
    Messages:
    1,400
    Likes Received:
    370
    Personally, I don't think that is sufficient referencing and it was just Copy and Paste it wasn't even edited.
     
  11. Oculus

    Oculus Guest

    If I gave the website url, wouldnt it be advertising though?
     
    • Winner Winner x 1
  12. Unflaws

    Unflaws Forum Enthusiast

    Joined:
    Jan 29, 2016
    Messages:
    663
    Likes Received:
    111
    This doesn't teach you how to code a module at all.
     
  13. gone

    gone Expert Member

    Joined:
    Dec 2, 2013
    Messages:
    1,400
    Likes Received:
    370
    Sort of... It's not going to literally give you all the code. It's just showing what you need to achieve the hack.
     
  14. gone

    gone Expert Member

    Joined:
    Dec 2, 2013
    Messages:
    1,400
    Likes Received:
    370
    I'd think it'd be fine to give credit by giving a link... That's not really advertising. ?
     

Share This Page

*/