Social Icons

Monday 3 September 2012

[TUT] Quick AutoSoup [TuT]


AutoSoup.

So, What is AutoSoup used for?
AutoSoup is used to automatically switch to soup, and heal you.(Used mostly in KitPVP servers)

KitPvP? What is that?
KitPvP is a PVP server that uses a plugin that makes soup instantly heal you.

Pros:
Allows you to instantly heal your self.
NC bypassed.
Wont get killed.

Cons:
Looks suspicious when you don't die.
Lag with cause you to get kicked.(Drops items to quickly. Hacking?)
Will not auto refill.
If not used properly, it can throw your sword.

Step one:
Make a new class and extend Thread. (This will allow us to create proper delay without freezing the game.)

Code:
public class AutoSoup extends Thread{
}


Step two:
In your new class, make a void called "run" (This is the code your thread will run)
Code:
public class AutoSoup extends Thread{
      public void run(){
      }
}


Step 3:
Create a new int inside of run(), followed by a for loop.
Code:
public class AutoSoup extends Thread{
      public void run(){
            int sl = 0; Creates a new int.
            for (int in = 44; in >= 9; in--) Cycles thru your inventory.
            {
            }
      }
}


Step 4:
Inside your for loop, create and define a new ItemStack and an Item.
Code:
public class AutoSoup extends Thread{
      public void run(){
            int sl = 0; Creates a new int.
            for (int in = 44; in >= 9; in--) Cycles thru your inventory.
            {
                ItemStack itemstack = Main.mc.thePlayer.inventorySlots.getSlot(in).getStack(); Gets the item in the "in" slot.
                Item g = Item.bowlSoup; Defines g as bowlSoup.
            }
      }
}


Step 5:
Create a boolean(itemstack.getItem() ==g), and an if statement.
Code:
public class AutoSoup extends Thread{
      public void run(){
            int sl = 0; Creates a new int.
            for (int in = 44; in >= 9; in--) Cycles thru your inventory.
            {
                ItemStack itemstack = Main.mc.thePlayer.inventorySlots.getSlot(in).getStack(); Gets the item in the "in" slot.
                Item g = Item.bowlSoup; Defines g as bowlSoup.
                boolean flag = itemstack1.getItem() ==g; if itemstack1.getItem() is bowlSoup, will return true.
                if (flag) if flag ^ is true..
                {
                    sl = l1; //sl will equal that slot.
                }
            }
      }
}


Step 6:
Switch, use, and trow your soup.
Code:
[code]public class AutoSoup extends Thread{
      public void run(){
            int sl = 0; Creates a new int.
            for (int in = 44; in >= 9; in--) Cycles thru your inventory.
            {
                ItemStack itemstack = Main.mc.thePlayer.inventorySlots.getSlot(in).getStack(); Gets the item in the "in" slot.
                Item g = Item.bowlSoup; Defines g as bowlSoup.
                boolean flag = itemstack1.getItem() ==g; if itemstack1.getItem() is bowlSoup, will return true.
                if (flag) if flag ^ is true..
                {
                    sl = l1; //sl will equal that slot.
                }
            }
            if(sl >= 36 && sl <= 44) If sl is in your hotBar.
            {
                sl -= 36;
                Main.mc.getSendQueue().addToSendQueue(new Packet16BlockItemSwitch(k1)); Switches slots server sided.
                Main.mc.getSendQueue().addToSendQueue(new Packet15Place(-1, -1, -1, 255, Main.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F)); Uses the soup.
                try {
                    Thread.sleep(5); Adds delay.
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Main.mc.getSendQueue().addToSendQueue(new Packet14BlockDig(4, 0, 0, 0, 0)); Throws the bowl.
                Main.mc.getSendQueue().addToSendQueue(new Packet16BlockItemSwitch(Main.mc.thePlayer.inventory.currentItem)); Switches back server sided.
                return; Returns.
            }else If soup is NOT in your hot bar.
            {
                Main.mc.playerController.windowClick(0, 38, 0, false, Main.mc.thePlayer);
                Main.mc.playerController.windowClick(0, sl, 0, true, Main.mc.thePlayer);
                Main.mc.playerController.windowClick(0, 38, 0, false, Main.mc.thePlayer); Puts soup in your Hotbar.
                Main.mc.playerController.windowClick(0, 38, 0, false, Main.mc.thePlayer);
                Main.mc.getSendQueue().addToSendQueue(new Packet16BlockItemSwitch(2)); Switches to the soup.
                try {
                    Thread.sleep(5); Adds delay.
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Main.mc.getSendQueue().addToSendQueue(new Packet15Place(-1, -1, -1, 255, Main.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F)); Uses the soup.
                try {
                    Thread.sleep(5); Adds delay.
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                Main.mc.getSendQueue().addToSendQueue(new Packet14BlockDig(4, 0, 0, 0, 0)); Throws the soup.
                Main.mc.getSendQueue().addToSendQueue(new Packet16BlockItemSwitch(Main.mc.thePlayer.inventory.currentItem)); Switches back to your current slot.
            }
      }
}

Step 7:
Now how do I call this? Simple.
Code:
    Thread as = new AutoSoup();
        as.start();

Tip: Only call it if your health is under the maximum.
Super pro tip: Use a simple tick delay so you dont flood the server with packets.


To all the MadBros..
The reason I am posting this is because I have given this code to a few people, and if anybody is going to make this public code, its going to be the creator.


Want to make the code better?
Post below and I will add it in the code.

4 comments:

  1. Can upload the class file?

    ReplyDelete
  2. When I try and make this file. I get loads of errors like "Main" Cannot be resolved and things like that.

    ReplyDelete