Advertisement
Corosus

Untitled

Mar 1st, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.99 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.src.Achievement;
  7. import net.minecraft.src.BaseMod;
  8. import net.minecraft.src.Entity;
  9. import net.minecraft.src.EntityPlayer;
  10. import net.minecraft.src.Item;
  11. import net.minecraft.src.MLProp;
  12. import net.minecraft.src.MathHelper;
  13. import net.minecraft.src.ModLoader;
  14. import net.minecraft.src.PlayerControllerSP;
  15. import net.minecraft.src.ScaledResolution;
  16. import net.minecraft.src.TileEntityMobSpawner;
  17. import net.minecraft.src.World;
  18. import org.lwjgl.input.Keyboard;
  19. import java.util.ArrayList;
  20. import java.util.Collection;
  21. import java.util.HashSet;
  22. import java.util.Iterator;
  23. import java.util.Random;
  24. import java.util.Set;
  25. import java.util.TreeSet;
  26. import java.util.Map;
  27. import java.util.HashMap;
  28.  
  29. public class mod_MovePlus extends BaseMod implements Runnable {
  30.  
  31. public static int spriteIndex;
  32. public static String modName = "MovePlus";
  33. public static World worldRef;
  34. public static EntityPlayer theplayer;
  35. public static Minecraft mc;
  36. public static int timeout;
  37. public static String msg;
  38. public static int color;
  39. public static int defaultColor = 16777215;
  40. public static int lastKey = 0;
  41. public static int[] keys;
  42. public static long[] keyTimes = new long[] {0L, 0L, 0L, 0L, 0L};
  43. public static boolean[] secondPress = new boolean[] {false, false, false, false, false};
  44. public static boolean dodged;
  45. public static boolean doubleJumped;
  46. public static boolean speedJumped;
  47. public static long landTime;
  48. public static boolean lastTickLanded;
  49. public static long tickCount = 0L;
  50. public static long timeCount = 0L;
  51. public static long prevTimeCount = 0L;
  52. public static boolean toggleKeyPressed = false;
  53. public static boolean dodgeToggle = true;
  54. @MLProp public static String toggleKey = "Z";
  55. @MLProp
  56. public static boolean useDoubleJump = true;
  57. @MLProp
  58. public static boolean useGroundDodge = true;
  59. @MLProp
  60. public static boolean useWallDodge = true;
  61. @MLProp
  62. public static boolean useBoostDodge = true;
  63. @MLProp
  64. public static boolean useSpeedJump = true;
  65. @MLProp
  66. public static boolean useAirControl = true;
  67. @MLProp
  68. public static float dodgeUpForce = 0.4F;
  69. @MLProp
  70. public static float doubleJumpForce = 0.5F;
  71. @MLProp
  72. public static float dodgeForce = 1.6F;
  73. public static float fwForce = 0.8F;
  74. @MLProp
  75. public static int dodgeMinDelayTime = 7;
  76. public static Achievement boostdodged;
  77. @MLProp
  78. public static boolean speedMining = false;
  79. @MLProp
  80. public static boolean dolphinSkills = false;
  81. @MLProp
  82. public static float dolphinSpeed = 0.2F;
  83. @MLProp
  84. public static float dolphinSpeedMax = 15.0F;
  85. @MLProp
  86. public static float airControlSpeed = 0.1F;
  87. @MLProp
  88. public static float airControlSpeedMax = 0.15F;
  89. @MLProp
  90. public static float speedJumpMax = 0.9F;
  91. public static boolean superMagicProperty = true;
  92. public static boolean ingui = false;
  93.  
  94.  
  95. public static int camIndex = 0;
  96.  
  97. public static int deathX = -1;
  98. public static int deathY = -1;
  99. public static int deathZ = -1;
  100.  
  101. public static int targX = 0;
  102. public static int targY = 0;
  103. public static int targZ = 0;
  104.  
  105. public static int savedX[];
  106. public static int savedY[];
  107. public static int savedZ[];
  108.  
  109. public static PathEntity path;
  110.  
  111. public static boolean pathFollowing = false;
  112.  
  113. public static long lastWorldTime;
  114. public static boolean coordToggle = false;
  115.  
  116.  
  117. //keep at bottom of var list
  118. public static boolean devFeatures = true;
  119. public static boolean useStamina = true;
  120. public static int exaustCounter;
  121. //public static boolean dev = true;
  122.  
  123. public void run() {
  124. try {
  125. while(true) {
  126. if(mc == null) {
  127. mc = ModLoader.getMinecraftInstance();
  128. }
  129.  
  130. if(mc == null) {
  131. Thread.sleep(50L);
  132. } else if(mc.thePlayer == null) {
  133. Thread.sleep(50L);
  134. } else {
  135. if (theplayer != null) {
  136. if (theplayer.isDead) {
  137. deathX = (int)theplayer.posX;
  138. deathY = (int)theplayer.posY;
  139. deathZ = (int)theplayer.posZ;
  140. }
  141. }
  142. worldRef = mc.theWorld;
  143. theplayer = mc.thePlayer;
  144. keys = new int[] {mc.gameSettings.keyBindForward.keyCode, mc.gameSettings.keyBindLeft.keyCode, mc.gameSettings.keyBindBack.keyCode, mc.gameSettings.keyBindRight.keyCode, mc.gameSettings.keyBindJump.keyCode};
  145. Thread.sleep(100L);
  146. }
  147. }
  148. } catch (Throwable var6) {
  149. var6.printStackTrace();
  150. }
  151. }
  152.  
  153. public mod_MovePlus() {
  154. ingui = false;
  155. ModLoader.SetInGameHook(this, true, false);
  156. ModLoader.SetInGUIHook(this, true, false);
  157. theplayer = null;
  158. (new Thread(this)).start();
  159. boostdodged = (new Achievement(456, "boostdodged", 0, 0, Item.feather, (Achievement)null)).registerAchievement();
  160. ModLoader.AddAchievementDesc(boostdodged, "Boost Dodge", "Perform a Boost Dodge.");
  161. //Block.blocksList[8] = (new BlockFlowing(8, Material.water)).setHardness(100.0F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange();
  162. }
  163.  
  164. public static void forceInit() {
  165. mc = ModLoader.getMinecraftInstance();
  166. worldRef = mc.theWorld;
  167. theplayer = mc.thePlayer;
  168. keys = new int[] {mc.gameSettings.keyBindForward.keyCode, mc.gameSettings.keyBindLeft.keyCode, mc.gameSettings.keyBindBack.keyCode, mc.gameSettings.keyBindRight.keyCode, mc.gameSettings.keyBindJump.keyCode};
  169. }
  170.  
  171. public static void displayMessage(String var0, int var1) {
  172. msg = var0;
  173. timeout = 85;
  174. color = var1;
  175. }
  176.  
  177. public static void displayMessage(String var0) {
  178. displayMessage(var0, defaultColor);
  179. }
  180.  
  181. public static void checkKey(int var0) {
  182. if(useSpeedJump && var0 == 4 && Keyboard.isKeyDown(keys[var0]) && !speedJumped && tickCount - landTime < 3L) {
  183. double var1 = theplayer.motionY;
  184. double var3 = Math.sqrt(theplayer.motionX * theplayer.motionX + theplayer.motionZ * theplayer.motionZ);
  185.  
  186. if(var3 < (double)speedJumpMax) {
  187. if (!useStamina || theplayer.getFoodStats().getFoodLevel() > 3) {
  188. performMove(keys[var0], false, false, true);
  189. tryExaust(1);
  190. }
  191. }
  192.  
  193. theplayer.motionY = var1;
  194. speedJumped = true;
  195. keyTimes[var0] = tickCount - 500L;
  196. }
  197.  
  198. if(useDoubleJump && var0 == 4 && secondPress[var0] && Keyboard.isKeyDown(keys[var0])) {
  199. if(!theplayer.onGround && !doubleJumped) {
  200. if(!doubleJumped) {
  201. if (!useStamina || theplayer.getFoodStats().getFoodLevel() > 3) {
  202. performMove(keys[var0], false, false);
  203. tryExaust(5);
  204. }
  205. }
  206.  
  207. if (!devFeatures) doubleJumped = true;
  208. }
  209.  
  210. secondPress[var0] = false;
  211. keyTimes[var0] = tickCount - 500L;
  212. }
  213.  
  214. if(tickCount - keyTimes[var0] < (long)dodgeMinDelayTime && secondPress[var0] && Keyboard.isKeyDown(keys[var0])) {
  215. if(useBoostDodge && Keyboard.isKeyDown(Keyboard.getKeyIndex("SPACE")) && keyTimes[var0] - keyTimes[4] - 500L < 5L && nearWall(theplayer)) {
  216. if (!useStamina || theplayer.getFoodStats().getFoodLevel() > 3) {
  217. theplayer.triggerAchievement(boostdodged);
  218. performMove(keys[var0], true, false);
  219. tryExaust(5);
  220. }
  221. } else if(dodgeToggle && useWallDodge && (theplayer.onGround || nearWall(theplayer))) {
  222. if (!useStamina || theplayer.getFoodStats().getFoodLevel() > 3) {
  223. performMove(keys[var0], false, false);
  224. tryExaust(5);
  225. }
  226. } else if(dodgeToggle && useGroundDodge && !dodged && !doubleJumped) {
  227. if (!useStamina || theplayer.getFoodStats().getFoodLevel() > 3) {
  228. performMove(keys[var0], false, true);
  229. tryExaust(5);
  230. }
  231. }
  232.  
  233. if (!devFeatures) dodged = true;
  234.  
  235. secondPress[var0] = false;
  236. keyTimes[var0] = tickCount - 500L;
  237. }
  238.  
  239. if(!Keyboard.isKeyDown(keys[var0]) && !secondPress[var0]) {
  240. secondPress[var0] = true;
  241. }
  242.  
  243. if(Keyboard.isKeyDown(keys[var0]) && secondPress[var0]) {
  244. secondPress[var0] = false;
  245. lastKey = keys[var0];
  246. keyTimes[var0] = tickCount;
  247. }
  248. }
  249.  
  250. public static void tryExaust(int inc) {
  251. if (useStamina && !worldRef.multiplayerWorld) {
  252. exaustCounter+=inc;
  253. if (exaustCounter >= 5) {
  254. exaustCounter = 0;
  255. theplayer.addExhaustion(1F);
  256. }
  257. }
  258. }
  259.  
  260. public static boolean nearWall(Entity var0) {
  261. return var0.worldObj.getCollidingBoundingBoxes(var0, var0.boundingBox.expand(0.2D, 0.0D, 0.2D)).size() > 0;
  262. }
  263.  
  264.  
  265.  
  266. public boolean OnTickInGame(float f, Minecraft var1) {
  267. //System.out.println("sdsda");
  268. //mc.fontRenderer.drawString(var1.thePlayer.health+"/20",4,20,0xFFFFF);
  269. if(!ingui) {
  270. this.OSDHook(var1, false);
  271. }
  272.  
  273. ingui = false;
  274. return true;
  275. }
  276.  
  277. public boolean OnTickInGUI(float f, Minecraft var1, GuiScreen gui) {
  278. if (ModLoader.getMinecraftInstance().thePlayer != null) {
  279. //long ticksRan = System.currentTimeMillis();
  280. if (!(gui instanceof GuiContainer) && gui != null) {
  281. ingui = true;
  282. //lastTickRun = 0;
  283. }
  284.  
  285. if (pathFollowing && path != null && lastWorldTime != worldRef.worldInfo.getWorldTime()) {
  286. this.displayMessage("Pathfinding");
  287. pathFollow();
  288. lastWorldTime = worldRef.worldInfo.getWorldTime();
  289. }
  290.  
  291. //OnTickInGame(f, var1);
  292. //System.out.println(gui);
  293. //playerTick(mc.thePlayer);
  294. }
  295.  
  296. return true;
  297. }
  298.  
  299. public static void airControl(Entity var0) {
  300. if(useAirControl && timeCount != worldRef.worldInfo.getWorldTime()) {
  301. float var1 = 0.0F;
  302. float var2 = 0.0F;
  303.  
  304. if(Keyboard.isKeyDown(mc.gameSettings.keyBindForward.keyCode)) {
  305. ++var1;
  306. } else if(Keyboard.isKeyDown(mc.gameSettings.keyBindLeft.keyCode)) {
  307. --var2;
  308. } else if(Keyboard.isKeyDown(mc.gameSettings.keyBindBack.keyCode)) {
  309. --var1;
  310. } else if(Keyboard.isKeyDown(mc.gameSettings.keyBindRight.keyCode)) {
  311. ++var2;
  312. }
  313.  
  314. double var3 = Math.sqrt(var0.motionX * var0.motionX + var0.motionZ * var0.motionZ);
  315.  
  316. if(dolphinSkills && theplayer.isInWater()) {
  317. if(var3 < (double)dolphinSpeedMax && var3 > 0.009999999776482582D && (var1 != 0.0F || var2 != 0.0F)) {
  318. setRelVel2(theplayer, var2, (float)var0.motionY, var1, dolphinSpeed);
  319. }
  320. } else if(useAirControl && !theplayer.onGround && var3 < (double)airControlSpeedMax && var3 > 0.009999999776482582D && (var1 != 0.0F || var2 != 0.0F)) {
  321. setRelVel(theplayer, var2, (float)var0.motionY, var1, airControlSpeed);
  322. }
  323. }
  324. }
  325.  
  326. public void pathFollow2() {
  327. Entity ent1 = theplayer;
  328.  
  329. if(path != null/* && this.rand.nextInt(100) != 0*/) {
  330. Vec3D var5 = path.getPosition(ent1);
  331. double var6 = (double)(ent1.width * 1.2); //override on path track distance
  332.  
  333. while(var5 != null && var5.squareDistanceTo(ent1.posX, var5.yCoord, ent1.posZ) < var6 * var6) {
  334. path.incrementPathIndex();
  335.  
  336. if(path.isFinished()) {
  337. var5 = null;
  338. path = null;
  339. //remove pf delay!
  340. //this.pathfindDelay = 50;
  341. } else {
  342. var5 = path.getPosition(ent1);
  343. }
  344. }
  345. }
  346. }
  347.  
  348. public void pathFollow() {
  349. Vec3D var5 = path.getPosition(theplayer);
  350. double var6 = (double)(theplayer.width * 1.2F);
  351.  
  352. while(var5 != null && var5.squareDistanceTo(theplayer.posX, var5.yCoord, theplayer.posZ) < var6 * var6) {
  353. path.incrementPathIndex();
  354.  
  355. if(path.isFinished()) {
  356. var5 = null;
  357. path = null;
  358. } else {
  359. var5 = path.getPosition(theplayer);
  360. }
  361. }
  362.  
  363. int var21 = MathHelper.floor_double(theplayer.boundingBox.minY + 0.5D);
  364. float angle = 0F;
  365.  
  366. if(var5 != null) {
  367. double var8 = var5.xCoord - theplayer.posX;
  368. double var10 = var5.zCoord - theplayer.posZ;
  369. double var12 = var5.yCoord - (double)var21;
  370. float var14 = (float)(Math.atan2(var10, var8) * 180.0D / 3.1415927410125732D) - 90.0F;
  371. float var15 = var14 - theplayer.rotationYaw;
  372.  
  373. for(angle = theplayer.moveSpeed; var15 < -180.0F; var15 += 360.0F) {
  374. ;
  375. }
  376.  
  377. while(var15 >= 180.0F) {
  378. var15 -= 360.0F;
  379. }
  380.  
  381. if(var15 > 30.0F) {
  382. var15 = 30.0F;
  383. }
  384.  
  385. if(var15 < -30.0F) {
  386. var15 = -30.0F;
  387. }
  388.  
  389. theplayer.rotationYaw += var15;
  390.  
  391. if(var12 > 0.0D || theplayer.handleWaterMovement() || theplayer.handleLavaMovement()) {
  392. theplayer.isJumping = true;
  393. }
  394.  
  395. if (theplayer.isJumping) {
  396. //this.A
  397. if (theplayer.onGround) {
  398. performMove(keys[4], false, false);
  399. }
  400. }
  401. }
  402.  
  403. //float speed = theplayer.cg;
  404. //theplayer.cg = 0.1F;
  405. theplayer.moveEntityWithHeading(0F,angle);
  406. //theplayer.moveEntityWithHeading(0F,angle);
  407. //theplayer.cg = speed;
  408. }
  409.  
  410. public void listEntities() {
  411. System.out.println("---------------");
  412. Map itemStrToCount = new HashMap();
  413.  
  414. for(int var33 = 0; var33 < worldRef.playerEntities.size(); ++var33) {
  415. Entity var4 = (Entity)worldRef.playerEntities.get(var33);
  416. String str;// = ((EntityItem)var4).item.getItemName();
  417. str = (var4).getClass().toString();
  418.  
  419. if (itemStrToCount.containsKey(str)) {
  420. itemStrToCount.put(str, (((Integer)itemStrToCount.get(str)).intValue()+1));
  421. } else {
  422. itemStrToCount.put(str, 1);
  423. }
  424.  
  425. /*if (var4 instanceof bg) {
  426. worldRef.g.remove(var4);
  427. }*/
  428. }
  429.  
  430. Set entries = itemStrToCount.entrySet();
  431. Iterator it = entries.iterator();
  432.  
  433. while (it.hasNext()) {
  434. Map.Entry entry = (Map.Entry) it.next();
  435. System.out.println(entry.getKey() + " --> " + entry.getValue());
  436. }
  437. }
  438.  
  439. //FALLDAMAGE NEGATING!
  440. //sendQueue.addToSendQueue(new Packet11PlayerPosition(motionX, -999D, -999D, motionZ, field_fall_hack ? true : onGround));
  441. //also set onGround = true?
  442.  
  443. //increase digspeed x10 for 30 seconds
  444. //mc.h.a(new add(ud.e.H, 30*20, 10));
  445. //mc.h.a(new ade(ud.l.H, 30*20, 10));
  446. //mc.h.a(new ade(ud.p.H, 30*20, 10));
  447.  
  448. public void OSDHook(Minecraft var1, boolean var2) {
  449. int var4;
  450. devFeatures = false;
  451. if (theplayer == null) {
  452. forceInit();
  453. }
  454.  
  455. //if (true) return;
  456. //dolphinSkills = false;
  457.  
  458. if(theplayer != null && !var2 && ((worldRef != null && !worldRef.multiplayerWorld) || superMagicProperty)) {
  459. boolean var3 = nearWall(theplayer);
  460.  
  461. if(Keyboard.isKeyDown(Keyboard.getKeyIndex(toggleKey))) {
  462. if(!toggleKeyPressed) {
  463. dodgeToggle = !dodgeToggle;
  464. toggleKeyPressed = true;
  465. displayMessage("Dodging: " + (dodgeToggle?"enabled":"disabled"));
  466. }
  467. } else if(Keyboard.isKeyDown(Keyboard.getKeyIndex("M"))) {
  468. if(!toggleKeyPressed) {
  469. //mc.h.a(new ade(ud.l.H, 30*20, 10));
  470. //mc.h.a(new ade(ud.p.H, 30*20, 10));
  471. coordToggle = !coordToggle;
  472. toggleKeyPressed = true;
  473. }
  474. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD0)) {
  475. if(!toggleKeyPressed) {
  476. try {
  477. mc.renderViewEntity = theplayer;
  478. } catch (Exception ex) {
  479. ex.printStackTrace();
  480. }
  481.  
  482. camIndex = 0;
  483. toggleKeyPressed = true;
  484. }
  485. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1)) {
  486. if(!toggleKeyPressed) {
  487. System.out.println(worldRef.playerEntities.size());
  488.  
  489. //int tryIndex = camIndex;
  490. if (camIndex >= worldRef.playerEntities.size()) {
  491. camIndex = 0;
  492. }
  493.  
  494. System.out.println("index: " + camIndex);
  495. System.out.println("name: " + ((EntityPlayer)worldRef.playerEntities.get(camIndex)).username);
  496.  
  497. try {
  498. if (worldRef.playerEntities.get(camIndex) instanceof EntityPlayer) {
  499. mc.renderViewEntity = (EntityLiving)worldRef.playerEntities.get(camIndex);
  500. }
  501. } catch (Exception ex) {
  502. ex.printStackTrace();
  503. }
  504.  
  505. camIndex++;
  506. toggleKeyPressed = true;
  507. }
  508. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD2)) {
  509. if(!toggleKeyPressed) {
  510. System.out.println(worldRef.playerEntities.size());
  511.  
  512. if (camIndex < 0) {
  513. camIndex = worldRef.playerEntities.size()-1;
  514. }
  515.  
  516. try {
  517. if (worldRef.playerEntities.get(camIndex) instanceof EntityPlayer) {
  518. mc.renderViewEntity = (EntityPlayer)worldRef.playerEntities.get(camIndex);
  519. }
  520. } catch (Exception ex) {
  521. ex.printStackTrace();
  522. }
  523.  
  524. camIndex--;
  525. toggleKeyPressed = true;
  526. }
  527. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4)) {
  528. if(!toggleKeyPressed) {
  529. //System.out.println(worldRef.playerEntities.size());
  530. targX = (int)theplayer.posX;
  531. targY = (int)theplayer.posY;
  532. targZ = (int)theplayer.posZ;
  533. toggleKeyPressed = true;
  534. }
  535. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5)) {
  536. if(!toggleKeyPressed) {
  537. //System.out.println(worldRef.playerEntities.size());
  538. targX = (int)theplayer.posX;
  539. targY = (int)theplayer.posY;
  540. targZ = (int)theplayer.posZ;
  541. toggleKeyPressed = true;
  542. }
  543. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD6)) {
  544. if(!toggleKeyPressed) {
  545. //System.out.println(worldRef.playerEntities.size());
  546. targX = (int)theplayer.posX;
  547. targY = (int)theplayer.posY;
  548. targZ = (int)theplayer.posZ;
  549. toggleKeyPressed = true;
  550. }
  551. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD7)) {
  552. if(!toggleKeyPressed) {
  553. //System.out.println(worldRef.playerEntities.size());
  554. targX = (int)theplayer.posX;
  555. targY = (int)theplayer.posY;
  556. targZ = (int)theplayer.posZ;
  557. toggleKeyPressed = true;
  558. }
  559. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD8)) {
  560. if(!toggleKeyPressed) {
  561. //System.out.println(worldRef.playerEntities.size());
  562. targX = (int)theplayer.posX;
  563. targY = (int)theplayer.posY;
  564. targZ = (int)theplayer.posZ;
  565. toggleKeyPressed = true;
  566. }
  567. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD9)) {
  568. if(!toggleKeyPressed) {
  569. //System.out.println(worldRef.playerEntities.size());
  570. targX = (int)theplayer.posX;
  571. targY = (int)theplayer.posY;
  572. targZ = (int)theplayer.posZ;
  573. toggleKeyPressed = true;
  574. }
  575. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_HOME)) {
  576. if(!toggleKeyPressed) {
  577. //System.out.println(worldRef.playerEntities.size());
  578. targX = 574;
  579. targY = 62;
  580. targZ = 103;
  581. toggleKeyPressed = true;
  582. }
  583. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_END)) {
  584. if(!toggleKeyPressed) {
  585. //System.out.println(worldRef.playerEntities.size());
  586. targX = deathX;
  587. targY = deathY;
  588. targZ = deathZ;
  589. //path = worldRef.a(theplayer, targX, targY, targZ, 512.0F);
  590. //System.out.println(path.b.length);
  591. //pathFollowing = true;
  592. toggleKeyPressed = true;
  593. }
  594. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_INSERT)) {
  595. if(!toggleKeyPressed) {
  596. //System.out.println(worldRef.playerEntities.size());
  597. path = worldRef.getEntityPathToXYZ(theplayer, targX, targY, targZ, 256.0F);
  598. pathFollowing = true;
  599. toggleKeyPressed = true;
  600. }
  601. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_DELETE)) {
  602. if(!toggleKeyPressed) {
  603. //System.out.println(worldRef.playerEntities.size());
  604. pathFollowing = false;
  605. toggleKeyPressed = true;
  606. }
  607. } else if (devFeatures && Keyboard.isKeyDown(Keyboard.KEY_PERIOD)) {
  608. if(!toggleKeyPressed) {
  609. int xx = (int)theplayer.posX+40;
  610. int yy = (int)theplayer.posY;
  611. int zz = (int)theplayer.posZ+40;
  612. int size = 20;
  613.  
  614. for (int xxx = xx-size; xxx < xx+size; xxx++) {
  615. for (int yyy = yy; yyy < 128; yyy++) {
  616. for (int zzz = zz-size; zzz < zz+size; zzz++) {
  617. worldRef.setBlockWithNotify(xxx, yyy, zzz, 3);
  618. }
  619. }
  620. }
  621.  
  622. toggleKeyPressed = true;
  623. }
  624. } else {
  625. toggleKeyPressed = false;
  626. }
  627.  
  628. if (pathFollowing && path != null && lastWorldTime != worldRef.worldInfo.getWorldTime()) {
  629. this.displayMessage("Pathfinding");
  630. pathFollow();
  631. lastWorldTime = worldRef.worldInfo.getWorldTime();
  632. }
  633.  
  634. if (coordToggle) {
  635. //displayMessage((new StringBuilder()).append("X: ").append((int)mc.renderViewEntity.o).append(" Y: ").append((int)mc.renderViewEntity.p).append(" Z: ").append((int)mc.renderViewEntity.q).toString());
  636. String coordmsg = (new StringBuilder()).append("X: ").append((int)mc.thePlayer.posX).append(" Y: ").append((int)mc.thePlayer.posY).append(" Z: ").append((int)mc.thePlayer.posZ).toString();
  637. String deathmsg = "";
  638.  
  639. if (deathX != -1) {
  640. deathmsg = new StringBuilder().append("Last Death, X: " + deathX + " Y: " + deathY + " Z: " + deathZ).toString();
  641. }
  642.  
  643. mc.fontRenderer.drawStringWithShadow(coordmsg, 3, 25, 0xffffff);
  644. mc.fontRenderer.drawStringWithShadow(deathmsg, 3, 45, 0xffffff);
  645. }
  646.  
  647. for(var4 = 0; var4 < keys.length; ++var4) {
  648. checkKey(var4);
  649. }
  650.  
  651. if(!theplayer.onGround || theplayer.isInWater() && false && theplayer.ridingEntity == null) {
  652. airControl(theplayer);
  653. }
  654.  
  655. if (!theplayer.onGround && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.keyCode)) {
  656. theplayer.motionY = 0.0F;
  657. }
  658.  
  659. //if (true) return;
  660. if ((theplayer.motionY < -0.5F && theplayer.motionY > -1.1F) && theplayer.ridingEntity == null && !theplayer.isInWater() && !theplayer.isInsideOfMaterial(Material.lava) && !theplayer.isInsideOfMaterial(Material.cactus) && !theplayer.isInsideOfMaterial(Material.water)) {
  661. //this.displayMessage("hmm?");
  662. theplayer.fallDistance = 0.0F;
  663.  
  664. if (theplayer instanceof EntityClientPlayerMP) {
  665. //theplayer.onGround = true;
  666. ((EntityClientPlayerMP)theplayer).sendQueue.addToSendQueue(new Packet11PlayerPosition(theplayer.motionX, -999D, -999D, theplayer.motionZ, true));
  667. }
  668. }
  669.  
  670. //this.displayMessage(new StringBuilder().append(theplayer.fallDistance + " - " + theplayer.motionY).toString());
  671. //if (true) return;
  672. /*List list = worldRef.getEntitiesWithinAABBExcludingEntity(theplayer, theplayer.boundingBox.expand(5.0D, 5.0D, 5.0D));
  673.  
  674. for(int count = 0; count < list.size(); ++count) {
  675. Entity var5 = (Entity)list.get(count);
  676.  
  677. if(var5 instanceof EntityLiving && !(var5 instanceof EntityPlayer)) {
  678.  
  679. //System.out.println(var5);
  680. mc.playerController.attackEntity(theplayer, var5);
  681. }
  682. }
  683.  
  684. for (int i = 0; i < this.worldRef.playerEntities.size(); i++) {
  685. EntityPlayer ent = (EntityPlayer)this.worldRef.playerEntities.get(i);
  686.  
  687. if(!ent.username.equals("Corosus")) {
  688. //theplayer.attackTargetEntityWithCurrentItem(theplayer);
  689. mc.playerController.attackEntity(theplayer, ent);
  690.  
  691. }
  692. }*/
  693.  
  694. /*if (theplayer.distanceWalkedModified > 15F && !theplayer.onGround) {
  695. theplayer.distanceWalkedModified = 0F;
  696. }*/
  697. /*float stepdist = 0F;
  698. try {
  699. stepdist = (float)Float.valueOf(ModLoader.getPrivateValue(Entity.class, theplayer, "b").toString()).floatValue();
  700. ModLoader.setPrivateValue(Entity.class, theplayer, "nextStepDistance", (int)theplayer.distanceWalkedModified+1);
  701.  
  702. } catch (Exception ex) {
  703. try {
  704. stepdist = (float)Float.valueOf(ModLoader.getPrivateValue(Entity.class, theplayer, "nextStepDistance").toString()).floatValue();
  705. ModLoader.setPrivateValue(Entity.class, theplayer, "nextStepDistance", (int)theplayer.distanceWalkedModified+1);
  706. } catch (Exception ex2) {
  707.  
  708. }
  709. }*/
  710.  
  711. //System.out.println(stepdist);
  712.  
  713. if(theplayer.onGround) {
  714. speedJumped = false;
  715. doubleJumped = false;
  716. dodged = false;
  717.  
  718. if(!lastTickLanded) {
  719. lastTickLanded = true;
  720. landTime = tickCount;
  721. }
  722. } else {
  723. lastTickLanded = false;
  724. }
  725.  
  726. prevTimeCount = timeCount;
  727. timeCount = worldRef.worldInfo.getWorldTime();
  728.  
  729. if(timeCount > prevTimeCount) {
  730. tickCount += timeCount - prevTimeCount;
  731. }
  732.  
  733. if(speedMining) {
  734. if(!worldRef.multiplayerWorld) {
  735. try {
  736. Object var9 = ModLoader.getPrivateValue(PlayerControllerSP.class, (PlayerControllerSP)ModLoader.getMinecraftInstance().playerController, "f");
  737. float var5 = Float.valueOf(var9.toString()).floatValue();
  738.  
  739. if(var5 > 0.01F) {
  740. var5 += 0.05F;
  741.  
  742. if(var5 > 1.0F) {
  743. var5 = 1.0F;
  744. }
  745.  
  746. ModLoader.setPrivateValue(PlayerControllerSP.class, (PlayerControllerSP)ModLoader.getMinecraftInstance().playerController, "f", Float.valueOf(var5));
  747. }
  748.  
  749. ModLoader.setPrivateValue(PlayerControllerSP.class, (PlayerControllerSP)ModLoader.getMinecraftInstance().playerController, "i", Integer.valueOf(0));
  750. } catch (Exception var7) {
  751. ;
  752. }
  753. } else if(!superMagicProperty) {
  754. ;
  755. }
  756. }
  757. }
  758.  
  759. if(timeout > 0 && msg != null) {
  760. ScaledResolution var8 = new ScaledResolution(var1.gameSettings, var1.displayWidth, var1.displayHeight);
  761. var4 = var8.getScaledWidth();
  762. int var10 = var8.getScaledHeight();
  763. int var6 = var1.fontRenderer.getStringWidth(msg);
  764. var1.fontRenderer.drawStringWithShadow(msg, 3, 105, 16777215);
  765. --timeout;
  766. }
  767. }
  768.  
  769. public String getVersion() {
  770. return "Version 2.1 for MC "+ModLoader.VERSION.substring(ModLoader.VERSION.indexOf(" ")+1);
  771. }
  772.  
  773. public void load() {
  774. }
  775.  
  776. public static void performMove(int var0, boolean var1, boolean var2) {
  777. performMove(var0, var1, var2, false);
  778. }
  779.  
  780. public static void performMove(int var0, boolean var1, boolean var2, boolean var3) {
  781. float var4 = dodgeUpForce;
  782. float var5 = dodgeForce;
  783.  
  784. if(var1) {
  785. var4 += 0.4F;
  786. }
  787.  
  788. if(var2) {
  789. var5 /= 2.0F;
  790. }
  791.  
  792. float var6 = 0.0F;
  793. float var7 = 0.0F;
  794.  
  795. if(var3) {
  796. if(Keyboard.isKeyDown(mc.gameSettings.keyBindForward.keyCode)) {
  797. ++var6;
  798. } else if(Keyboard.isKeyDown(mc.gameSettings.keyBindLeft.keyCode)) {
  799. --var7;
  800. } else if(Keyboard.isKeyDown(mc.gameSettings.keyBindBack.keyCode)) {
  801. --var6;
  802. } else {
  803. if(!Keyboard.isKeyDown(mc.gameSettings.keyBindRight.keyCode)) {
  804. return;
  805. }
  806.  
  807. ++var7;
  808. }
  809.  
  810. double var8 = Math.sqrt(theplayer.motionX * theplayer.motionX + theplayer.motionZ * theplayer.motionZ);
  811. setRelVel(theplayer, var7, 0.0F, var6, (float)var8 / 2.0F);
  812. } else {
  813. if(mc.gameSettings.keyBindForward.keyCode == var0) {
  814. setRelVel(theplayer, 0.0F, var4, 1.0F, var5);
  815. } else if(mc.gameSettings.keyBindLeft.keyCode == var0) {
  816. setRelVel(theplayer, -1.0F, var4, 0.0F + fwForce, var5);
  817. } else if(mc.gameSettings.keyBindBack.keyCode == var0) {
  818. setRelVel(theplayer, 0.0F, var4, -1.0F, var5);
  819. } else if(mc.gameSettings.keyBindRight.keyCode == var0) {
  820. setRelVel(theplayer, 1.0F, var4, 0.0F + fwForce, var5);
  821. } else if(mc.gameSettings.keyBindJump.keyCode == var0) {
  822. setRelVel(theplayer, var7, doubleJumpForce, var6, 0.0F);
  823. }
  824. }
  825. }
  826.  
  827. public static void setRelVel(Entity var0, float var1, float var2, float var3, float var4) {
  828. float var5 = 10.0F;
  829. float var6 = 0.0F;
  830. float var7 = var0.prevRotationYaw + (var0.rotationYaw - var0.prevRotationYaw) * var5;
  831. int var8 = (int)Math.floor((double)(var7 / 360.0F) + 0.5D);
  832. var7 = var7 - (float)var8 * 360.0F + 270.0F;
  833.  
  834. if(var3 <= 0.0F && var3 < 0.0F) {
  835. var7 += 180.0F;
  836. }
  837.  
  838. if(var1 > 0.0F) {
  839. var7 += 90.0F - var3 * 10.0F;
  840. } else if(var1 < 0.0F) {
  841. var7 += 270.0F + var3 * 10.0F;
  842. }
  843.  
  844. float var9 = MathHelper.cos(-var7 * 0.01745329F - 3.141593F);
  845. float var10 = MathHelper.sin(-var7 * 0.01745329F - 3.141593F);
  846. float var11 = -MathHelper.cos(-var6 * 0.01745329F - 0.7853982F);
  847. float var12 = MathHelper.sin(-var6 * 0.01745329F - 0.7853982F);
  848. float var13 = var9 * var11;
  849. float var15 = var10 * var11;
  850.  
  851. if(var1 == 0.0F && var3 == 0.0F) {
  852. setVel(var0, (float)var0.motionX / 2.0F, var2, (float)var0.motionZ / 2.0F);
  853. } else {
  854. setVel(var0, var13 * var4 * -1.0F, var2, var15 * var4);
  855. }
  856. }
  857.  
  858. public static void setRelVel2(Entity var0, float var1, float var2, float var3, float var4) {
  859. float var5 = 10.0F;
  860. float var6 = var0.prevRotationPitch + (var0.rotationPitch - var0.prevRotationPitch) * var5;
  861. float var7 = var0.prevRotationYaw + (var0.rotationYaw - var0.prevRotationYaw) * var5;
  862. int var8 = (int)Math.floor((double)(var7 / 360.0F) + 0.5D);
  863. var7 = var7 - (float)var8 * 360.0F + 270.0F;
  864. var6 = var6 - (float)var8 * 360.0F + 315.0F;
  865.  
  866. if(var3 <= 0.0F && var3 < 0.0F) {
  867. var7 += 180.0F;
  868. }
  869.  
  870. if(var1 > 0.0F) {
  871. var7 += 90.0F - var3 * 10.0F;
  872. } else if(var1 < 0.0F) {
  873. var7 += 270.0F + var3 * 10.0F;
  874. }
  875.  
  876. float var9 = MathHelper.cos(-var7 * 0.01745329F - 3.141593F);
  877. float var10 = MathHelper.sin(-var7 * 0.01745329F - 3.141593F);
  878. float var11 = -MathHelper.cos(-var6 * 0.01745329F - 0.7853982F);
  879. float var12 = MathHelper.sin(-var6 * 0.01745329F - 0.7853982F);
  880. float var13 = var9 * var11;
  881. float var15 = var10 * var11;
  882.  
  883. if(var1 == 0.0F && var3 == 0.0F) {
  884. setVel(var0, (float)var0.motionX / 2.0F, var2, (float)var0.motionZ / 2.0F);
  885. } else {
  886. setVel(var0, var13 * var4 * -1.0F, var12 * var4 * 5.0F, var15 * var4);
  887. }
  888. }
  889.  
  890. public static void setVel(Entity var0, float var1, float var2, float var3) {
  891. var0.motionX += (double)var1;
  892. var0.motionY = (double)var2;
  893. var0.motionZ += (double)var3;
  894. }
  895.  
  896. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement