RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Path.java
1package com.osroyale.game.world.pathfinding.path;
2
3import com.osroyale.game.world.entity.mob.movement.Movement;
4import com.osroyale.game.world.position.Position;
5
6import java.util.Deque;
7
46
47public class Path {
48
50 private final Deque<Position> moves;
51
57 public Path(Deque<Position> moves) {
58 this.moves = moves;
59 }
60
67 return moves.getFirst();
68 }
69
76 return moves.peekLast();
77 }
78
84 public boolean isPossible() {
85 return moves != null && !moves.isEmpty();
86 }
87
93 public Deque<Position> getMoves() {
94 return moves;
95 }
96
102 public Position poll() {
103 return moves.pollFirst();
104 }
105
106 public void addSteps(final Movement movement) {
107 movement.reset();
108 while (!moves.isEmpty()) {
109 final Position next = moves.poll();
110 if (next == null) break;
111
112 movement.addStep(next.getX(), next.getY());
113 }
114 movement.finish();
115 }
116
117}