Advertisement
Olivki

asddasd

Jun 29th, 2014
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.41 KB | None | 0 0
  1. package se.proxus.mods.list.movement;
  2.  
  3. import net.minecraft.src.EntityOtherPlayerMP;
  4.  
  5. import org.lwjgl.input.Keyboard;
  6.  
  7. import se.proxus.Gallium;
  8. import se.proxus.events.EventHandler;
  9. import se.proxus.events.list.player.EventUpdate;
  10. import se.proxus.hooks.Player;
  11. import se.proxus.mods.Mod;
  12. import se.proxus.mods.ModCategory;
  13. import se.proxus.tools.Colours;
  14. import se.proxus.tools.Location;
  15.  
  16. public class Freecam extends Mod {
  17.  
  18.     private EntityOtherPlayerMP player;
  19.  
  20.     public Freecam(final Gallium client) {
  21.     super("Freecam", ModCategory.MOVEMENT, false, client);
  22.     }
  23.  
  24.     @Override
  25.     public void init() {
  26.     setDescription("Makes you sneaky, like a asian.");
  27.     registerSetting(0, 1.0F, "Speed", 10.0D, true, false, false);
  28.     registerSetting(1, true, "TP Back", 0.0D, true, false, false);
  29.     registerSetting(2, true, "Distance TP", 0.0D, true, false, false);
  30.     }
  31.  
  32.     @Override
  33.     public void onEnable() {
  34.     getClient().getEvents().registerListener(this);
  35.     Player player = getClient().getPlayer();
  36.     setPlayer(new EntityOtherPlayerMP(getClient().getMinecraft().theWorld,
  37.         getClient().getPlayer().getUsername()));
  38.     getPlayer().setPositionAndRotation(player.getX(), player.getY() - 1.6D,
  39.         player.getZ(), player.getYaw(), player.getPitch());
  40.     getPlayer().inventory = player.getInventory();
  41.     getClient().getMinecraft().theWorld.addEntityToWorld(-1, getPlayer());
  42.     getClient().getMinecraft().thePlayer.noClip = true;
  43.     }
  44.  
  45.     @Override
  46.     public void onDisable() {
  47.     getClient().getEvents().unregisterListener(this);
  48.     if (getPlayer() == null)
  49.         return;
  50.     Player player = getClient().getPlayer();
  51.     if ((Boolean) getSetting(1)) {
  52.         player.setPositionAndAngles(getPlayer().posX,
  53.             getPlayer().posY + 1.6D, getPlayer().posZ,
  54.             getPlayer().rotationYaw, getPlayer().rotationPitch);
  55.         player.addMessage(Colours.GREY
  56.             + "TP Back Setting is on, teleporting back.");
  57.     }
  58.     if ((Boolean) getSetting(2)
  59.         && Location.entityToLocation(getPlayer()).distanceTo(
  60.             player.getLocation()) > 9) {
  61.         player.setPositionAndAngles(getPlayer().posX,
  62.             getPlayer().posY + 1.6D, getPlayer().posZ,
  63.             getPlayer().rotationYaw, getPlayer().rotationPitch);
  64.         player.addMessage(Colours.GREY
  65.             + "You're to far away from the freecam entity, teleporting you back.");
  66.     }
  67.     getClient().getMinecraft().theWorld.removeEntityFromWorld(-1);
  68.     setPlayer(null);
  69.     getClient().getMinecraft().thePlayer.noClip = false;
  70.     }
  71.  
  72.     @EventHandler
  73.     public void onEventUpdate(final EventUpdate event) {
  74.     getClient().getPlayer().setMotionX(0.0D);
  75.     getClient().getPlayer().setMotionY(0.0D);
  76.     getClient().getPlayer().setMotionZ(0.0D);
  77.     getClient().getMinecraft().thePlayer.onGround = false;
  78.     getClient().getMinecraft().thePlayer.jumpMovementFactor = (Float) getSetting(0) / 2;
  79.     if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)
  80.         && getClient().getMinecraft().inGameHasFocus)
  81.         getClient().getPlayer().setMotionY(
  82.             getClient().getPlayer().getMotionY()
  83.                 + (Float) getSetting(0) / 2 + 0.2F);
  84.     if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)
  85.         && getClient().getMinecraft().inGameHasFocus)
  86.         getClient().getPlayer().setMotionY(
  87.             getClient().getPlayer().getMotionY()
  88.                 - (Float) getSetting(0));
  89.     event.setCancelled(true);
  90.     }
  91.  
  92.     public EntityOtherPlayerMP getPlayer() {
  93.     return player;
  94.     }
  95.  
  96.     public void setPlayer(final EntityOtherPlayerMP player) {
  97.     this.player = player;
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement