Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. @Override
  2. public void tick() {
  3. if (!isMounted) { return; }
  4. if (tick == 0) {
  5. final Location start = armorStand.getLocation();
  6. final Location end = start.clone().add(start.getDirection().multiply(20));
  7. this.x0 = start.getX();
  8. this.y0 = start.getY();
  9. this.z0 = start.getZ();
  10. this.x1 = end.getX();
  11. this.y1 = end.getY();
  12. this.z1 = end.getZ();
  13. // armorStand.setPassenger(player.getBukkitPlayer());
  14. }
  15. double x = (((x1 - x0) / TERMINAL_TIME) * tick) + x0;
  16. double y = (- GRAVITY * tick * tick) + (((y1 - y0 + GRAVITY * TERMINAL_TIME * TERMINAL_TIME) / TERMINAL_TIME) * tick) + y0;
  17. double z = (((z1 - z0) / TERMINAL_TIME) * tick) + z0;
  18. final Location target = new Location(player.getWorld(), x, y, z);
  19. armorStand.teleport(target);
  20. System.out.println(target);
  21. if (++tick >= TERMINAL_TIME) {
  22. this.isMounted = false;
  23. this.armorStand.remove();
  24. // this.armorStand.eject();
  25. tick = 0;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement