MCPcopy Create free account
hub / github.com/boxbeam/RedLib / getPath

Method getPath

src/redempt/redlib/misc/Path.java:19–31  ·  view source on GitHub ↗

Get the locations between the start and end location @param start The start location @param end The end location @param step The step size to use @return A list of all the locations between the locations

(Location start, Location end, double step)

Source from the content-addressed store, hash-verified

17 * @return A list of all the locations between the locations
18 */
19 public static List<Location> getPath(Location start, Location end, double step) {
20 List<Location> locs = new ArrayList<>();
21 locs.add(start);
22 Vector v = end.clone().subtract(start).toVector();
23 v = v.normalize().multiply(step);
24 Location current = start.clone();
25 while (current.distance(end) > step) {
26 locs.add(current.clone());
27 current = current.add(v);
28 }
29 locs.add(end);
30 return locs;
31 }
32
33 /**
34 * Get the locations between the start and end location

Callers 3

onPickBlockMethod · 0.95
directPathfindMethod · 0.95
getPathMethod · 0.95

Calls 7

subtractMethod · 0.80
normalizeMethod · 0.80
distanceMethod · 0.80
getDirectionMethod · 0.80
addMethod · 0.45
cloneMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected