Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void tick() {
- if (!isMounted) { return; }
- if (tick == 0) {
- final Location start = player.getLocation();
- final Location end = start.clone().add(start.getDirection().multiply(20));
- this.x0 = start.getX();
- this.y0 = start.getY();
- this.z0 = start.getZ();
- this.x1 = end.getX();
- this.y1 = end.getY();
- this.z1 = end.getZ();
- }
- double x = (x1 - x0) / TERMINAL_TIME;
- double y = - GRAVITY * tick + ((y1 - y0 + GRAVITY * TERMINAL_TIME * TERMINAL_TIME) / TERMINAL_TIME);
- double z = (z1 - z0) / TERMINAL_TIME;
- player.getBukkitPlayer().setVelocity(new Vector(x, y, z));
- if (++tick >= TERMINAL_TIME) {
- this.isMounted = false;
- tick = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement