Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.70 KB | None | 0 0
  1. public Flight() {
  2. super("Flight", 33, Category.MOVEMENT, "Allows you to fly like a bird");
  3. this.damaged = false;
  4. this.hasReached = false;
  5. this.boosted = false;
  6. this.level = 0;
  7. this.timer = new TimerUtils();
  8. }
  9.  
  10. @Override
  11. public void setup() {
  12. final ArrayList<String> options = new ArrayList<String>();
  13. options.add("Hypixel");
  14. options.add("HypixelDamage");
  15. options.add("Vanilla");
  16. Emilio.instance.sm.rSetting(new Setting("Mode", this, "HypixelFast", options));
  17. Emilio.instance.sm.rSetting(new Setting("HypixelSpeed", this, 0.95, 0.0, 1.0, false));
  18. Emilio.instance.sm.rSetting(new Setting("Timer", this, 1.0, 1.0, 8.0, false));
  19. Emilio.instance.sm.rSetting(new Setting("FastTime", this, 100.0, 0.0, 1000.0, true));
  20. Emilio.instance.sm.rSetting(new Setting("Damage", this, true));
  21. }
  22.  
  23. @Override
  24. public void onEnable() {
  25. super.onEnable();
  26. this.timer.reset();
  27. this.mode = Emilio.instance.sm.getSettingByName(this, "Mode").getValString();
  28. if (Flight.mc.thePlayer == null) {
  29. return;
  30. }
  31. if (Emilio.instance.sm.getSettingByName(this, "Damage").getValBoolean()) {
  32. this.damagePlayer();
  33. }
  34. Flight.mc.timer.timerSpeed = 1.0f;
  35. if (this.mode.equalsIgnoreCase("Hypixel")) {
  36. this.canboost = true;
  37. double motionY = 0.40123128;
  38. this.timervalue = 1.0f;
  39. if (Flight.mc.thePlayer.onGround) {
  40. if ((Flight.mc.thePlayer.moveForward != 0.0f || Flight.mc.thePlayer.moveStrafing != 0.0f) && Flight.mc.thePlayer.isCollidedVertically) {
  41. if (Flight.mc.thePlayer.isPotionActive(Potion.jump)) {
  42. motionY += (Flight.mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1f;
  43. }
  44. Flight.mc.thePlayer.motionY = motionY;
  45. }
  46. this.level = 1;
  47. this.moveSpeed = 0.1;
  48. this.hypixelboost = true;
  49. this.lastDist = 0.0;
  50. }
  51. this.timer.reset();
  52. }
  53. }
  54.  
  55. @Override
  56. public void onDisable() {
  57. super.onDisable();
  58. this.damaged = false;
  59. Flight.mc.timer.timerSpeed = 1.0f;
  60. Flight.mc.thePlayer.motionX = 0.0;
  61. Flight.mc.thePlayer.motionZ = 0.0;
  62. Flight.mc.thePlayer.motionY = 0.0;
  63. Flight.mc.gameSettings.keyBindJump.pressed = false;
  64. this.prevBoost = System.currentTimeMillis();
  65. this.boosted = false;
  66. this.timer.reset();
  67. }
  68.  
  69. @EventTarget
  70. public void onUpdate(final EventPlayerUpdate e) {
  71. this.mode = Emilio.instance.sm.getSettingByName(this, "Mode").getValString();
  72. final double speed = 5.5;
  73. this.setDisplayName(String.valueOf(this.getName()) + EnumChatFormatting.GRAY + " " + this.mode);
  74. if (this.mode.toLowerCase().contains("Hypixel")) {
  75. Flight.mc.thePlayer.motionY = 0.0;
  76. }
  77. if (e.isPre()) {
  78. if (this.mode.equalsIgnoreCase("HypixelDamage")) {
  79. ++this.counter;
  80. if (this.counter == 1) {
  81. Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 8.0E-6, Flight.mc.thePlayer.posZ);
  82. }
  83. else if (this.counter == 2) {
  84. Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY - 8.0E-6, Flight.mc.thePlayer.posZ);
  85. this.counter = 0;
  86. }
  87. if (this.damaged) {
  88. Flight.mc.timer.timerSpeed = 34.0f;
  89. }
  90. else {
  91. Flight.mc.timer.timerSpeed = 1.0f;
  92. }
  93. }
  94. else if (this.mode.equalsIgnoreCase("Hypixel")) {
  95. if (!this.boosted) {
  96. Flight.mc.timer.timerSpeed = Emilio.instance.sm.getSettingByName(this, "Timer").getValFloat();
  97. this.boosted = true;
  98. }
  99. else if (this.timer.hasReached(Emilio.instance.sm.getSettingByName(this, "FastTime").getValInt())) {
  100. Flight.mc.timer.timerSpeed = 1.0f;
  101. MoveUtils.setMotion(null, 0.0);
  102. }
  103. final double xDist = Flight.mc.thePlayer.posX - Flight.mc.thePlayer.prevPosX;
  104. final double zDist = Flight.mc.thePlayer.posZ - Flight.mc.thePlayer.prevPosZ;
  105. this.lastDist = Math.sqrt(xDist * xDist + zDist * zDist);
  106. if (this.canboost && this.hypixelboost) {
  107. this.timervalue += (float)(this.decreasing2 ? -0.01 : 0.05);
  108. if (this.timervalue >= 1.4) {
  109. this.decreasing2 = true;
  110. }
  111. if (this.timervalue <= 0.9) {
  112. this.decreasing2 = false;
  113. }
  114. if (this.timer.hasReached(2000.0)) {
  115. this.canboost = false;
  116. }
  117. }
  118. if (Flight.mc.gameSettings.keyBindJump.isKeyDown()) {
  119. Flight.mc.thePlayer.setPositionAndUpdate(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 0.4, Flight.mc.thePlayer.posZ);
  120. Flight.mc.thePlayer.motionY = 0.8;
  121. final EntityPlayerSP thePlayer3;
  122. final EntityPlayerSP thePlayer = thePlayer3 = Flight.mc.thePlayer;
  123. thePlayer3.motionX *= 0.1;
  124. final EntityPlayerSP thePlayer4;
  125. final EntityPlayerSP thePlayer2 = thePlayer4 = Flight.mc.thePlayer;
  126. thePlayer4.motionZ *= 0.1;
  127. }
  128. if (Flight.mc.thePlayer.ticksExisted % 2 == 0) {
  129. Flight.mc.thePlayer.setPosition(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + MathUtils.getRandomInRange(1.2354235325235235E-14, 1.2354235325235233E-13), Flight.mc.thePlayer.posZ);
  130. }
  131. Flight.mc.thePlayer.motionY = 0.0;
  132. }
  133. }
  134. }
  135.  
  136. @EventTarget
  137. public void onMove(final EventMotion e) {
  138. final float yaw = Flight.mc.thePlayer.rotationYaw;
  139. double strafe = Flight.mc.thePlayer.movementInput.moveStrafe;
  140. double forward = Flight.mc.thePlayer.movementInput.moveForward;
  141. final double mx = -Math.sin(Math.toRadians(yaw));
  142. final double mz = Math.cos(Math.toRadians(yaw));
  143. if (this.mode.equalsIgnoreCase("Vanilla")) {
  144. if (Flight.mc.gameSettings.keyBindForward.isKeyDown() || Flight.mc.gameSettings.keyBindBack.isKeyDown() || Flight.mc.gameSettings.keyBindRight.isKeyDown() || Flight.mc.gameSettings.keyBindLeft.isKeyDown()) {
  145. MoveUtils.setMotion(e, 2.0);
  146. }
  147. Flight.mc.thePlayer.capabilities.isFlying = false;
  148. Flight.mc.thePlayer.motionY = 0.085;
  149. Flight.mc.thePlayer.jumpMovementFactor = 2.0f;
  150. if (Flight.mc.gameSettings.keyBindJump.isKeyDown()) {
  151. final EntityPlayerSP thePlayer3;
  152. final EntityPlayerSP thePlayer = thePlayer3 = Flight.mc.thePlayer;
  153. ++thePlayer3.motionY;
  154. }
  155. if (Flight.mc.gameSettings.keyBindSneak.isKeyDown()) {
  156. final EntityPlayerSP thePlayer4;
  157. final EntityPlayerSP thePlayer2 = thePlayer4 = Flight.mc.thePlayer;
  158. --thePlayer4.motionY;
  159. }
  160. }
  161. else if (this.mode.equalsIgnoreCase("Hypixel")) {
  162. if (forward == 0.0 && strafe == 0.0) {
  163. e.setX(0.0);
  164. e.setZ(0.0);
  165. }
  166. if (forward != 0.0 && strafe != 0.0) {
  167. forward *= Math.sin(0.7853981633974483);
  168. strafe *= Math.cos(0.7853981633974483);
  169. }
  170. if (this.level != 1 || (Flight.mc.thePlayer.moveForward == 0.0f && Flight.mc.thePlayer.moveStrafing == 0.0f)) {
  171. if (this.level == 2) {
  172. this.level = 3;
  173. this.moveSpeed *= 2.1499999;
  174. }
  175. else if (this.level == 3) {
  176. this.level = 4;
  177. double difference;
  178. if (MoveUtils.getSpeedEffect() > 0) {
  179. difference = 1.5 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * (this.lastDist - MathUtils.getBaseMovementSpeed());
  180. }
  181. else {
  182. difference = 1.0 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * (this.lastDist - MathUtils.getBaseMovementSpeed());
  183. }
  184. this.moveSpeed = this.lastDist - difference;
  185. }
  186. else {
  187. if (Flight.mc.theWorld.getCollidingBoundingBoxes(Flight.mc.thePlayer, Flight.mc.thePlayer.getEntityBoundingBox().offset(0.0, Flight.mc.thePlayer.motionY, 0.0)).size() > 0 || Flight.mc.thePlayer.isCollidedVertically) {
  188. this.level = 1;
  189. }
  190. this.moveSpeed = this.lastDist - this.lastDist / (159.99999 - Emilio.instance.sm.getSettingByName(this, "HypixelSpeed").getValDouble() * 20.0);
  191. }
  192. }
  193. else {
  194. this.level = 2;
  195. final double boost = Flight.mc.thePlayer.isPotionActive(Potion.moveSpeed) ? 1.706 : 2.034;
  196. this.moveSpeed = boost * MathUtils.getBaseMovementSpeed() - 0.01;
  197. }
  198. this.moveSpeed = Math.max(this.moveSpeed, MathUtils.getBaseMovementSpeed());
  199. e.setX(forward * this.moveSpeed * mx + strafe * this.moveSpeed * mz);
  200. e.setZ(forward * this.moveSpeed * mz - strafe * this.moveSpeed * mx);
  201. if (forward == 0.0 && strafe == 0.0) {
  202. e.setX(0.0);
  203. e.setZ(0.0);
  204. }
  205. if (this.timer.hasReached(1700.0) && this.hypixelboost) {
  206. this.hypixelboost = false;
  207. }
  208. }
  209. }
  210.  
  211. @EventTarget
  212. public void onSend(final EventSendPacket ep) {
  213. }
  214.  
  215. @EventTarget
  216. public void onRecieve(final EventRecievePacket e) {
  217. if (e.getPacket() instanceof S00PacketKeepAlive && this.mode.equalsIgnoreCase("Vanilla")) {
  218. e.setCancelled(true);
  219. }
  220. }
  221.  
  222. public void damagePlayer() {
  223. for (int i = 0; i <= (Flight.mc.thePlayer.isPotionActive(Potion.jump) ? 140 : 70); ++i) {
  224. Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 0.05, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
  225. Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
  226. Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY + 1.0E-5, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, false));
  227. }
  228. Flight.mc.thePlayer.sendQueue.getNetworkManager().sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(Flight.mc.thePlayer.posX, Flight.mc.thePlayer.posY, Flight.mc.thePlayer.posZ, Flight.mc.thePlayer.rotationYaw, Flight.mc.thePlayer.rotationPitch, true));
  229. }
  230. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement