mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Expose canReach to mob pathfinding API (#10636)
This commit is contained in:
parent
dde797dbca
commit
58e7ac939f
@ -227,6 +227,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @return The closest point the path can get to the target location
|
+ * @return The closest point the path can get to the target location
|
||||||
+ */
|
+ */
|
||||||
+ @Nullable Location getFinalPoint();
|
+ @Nullable Location getFinalPoint();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Checks whether the final point can be reached
|
||||||
|
+ *
|
||||||
|
+ * @return whether the final point can be reached
|
||||||
|
+ * @see #getFinalPoint()
|
||||||
|
+ */
|
||||||
|
+ boolean canReachFinalPoint();
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||||
|
@ -132,6 +132,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public boolean canReachFinalPoint() {
|
||||||
|
+ return path.canReach();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ public List<Location> getPoints() {
|
+ public List<Location> getPoints() {
|
||||||
+ List<Location> points = new ArrayList<>();
|
+ List<Location> points = new ArrayList<>();
|
||||||
+ for (Node point : path.nodes) {
|
+ for (Node point : path.nodes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user