Advertisement
Corosus

make player move faster - no class mods

Jul 21st, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. //assuming thePlayer = your player reference
  2. //call this every player tick in your mod_ file (will force player to move forward really fast)
  3.  
  4. setRelVel(thePlayer,0.0F,(float)thePlayer.motionY,1.0F,0.7F);
  5.  
  6.  
  7. //now for the setRelVel function, just add it to your mod_ file
  8.  
  9.  
  10. public static void setRelVel(Entity entity, float x, float y, float z, float force)
  11. {
  12. setRelVel(entity,entity,x,y,z,force);
  13. }
  14.  
  15. public static void setRelVel(Entity entity, Entity entity2, float x, float y, float z, float force)
  16. {
  17. float f4 = 10F;
  18. float f5 = 0.0F;
  19. float f6 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f4;
  20. int i = (int)Math.floor((double)(f6 / 360F) + 0.5D);
  21. f6 = (f6 - (float)i * 360F) + 270F;
  22. if(z <= 0.0F && z < 0.0F)
  23. {
  24. f6 += 180F;
  25. }
  26. if(x > 0.0F)
  27. {
  28. f6 += 90F - z * 10F;
  29. } else
  30. if(x < 0.0F)
  31. {
  32. f6 += 270F + z * 10F;
  33. }
  34. float f7 = MathHelper.cos(-f6 * 0.01745329F - 3.141593F);
  35. float f8 = MathHelper.sin(-f6 * 0.01745329F - 3.141593F);
  36. float f9 = -MathHelper.cos(-f5 * 0.01745329F - 0.7853982F);
  37. float f10 = MathHelper.sin(-f5 * 0.01745329F - 0.7853982F);
  38. float f11 = f7 * f9;
  39. float f12 = f10;
  40. float f13 = f8 * f9;
  41. if(x == 0.0F && z == 0.0F)
  42. {
  43. entity2.setVelocity((float)entity2.motionX / 2.0F, y, (float)entity2.motionZ / 2.0F);
  44. } else
  45. {
  46. entity2.setVelocity(f11 * force * -1F, y, f13 * force);
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement