Expand Pathfinding API with more options

This commit is contained in:
MiniDigger 2020-05-16 15:15:11 +02:00 committed by Aikar
parent dde6548136
commit 52564b1f89
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 93 additions and 4 deletions

View file

@ -13,10 +13,10 @@ You can use EntityPathfindEvent to cancel new pathfinds from overriding your cur
diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..8b90a9053f4e3165ef7541a36938929967989696
index 0000000000000000000000000000000000000000..e2a6f9c3881ff9d7373ac30e60009200432555aa
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
@@ -0,0 +1,170 @@
@@ -0,0 +1,212 @@
+package com.destroystokyo.paper.entity;
+
+import org.bukkit.Location;
@ -157,6 +157,48 @@ index 0000000000000000000000000000000000000000..8b90a9053f4e3165ef7541a369389299
+ boolean moveTo(@NotNull PathResult path, double speed);
+
+ /**
+ * Checks if this pathfinder allows passing through closed doors.
+ *
+ * @return if this pathfinder allows passing through closed doors
+ */
+ boolean canOpenDoors();
+
+ /**
+ * Allows this pathfinder to pass through closed doors, or not
+ *
+ * @param canOpenDoors if the mob can pass through closed doors, or not
+ */
+ void setCanOpenDoors(boolean canOpenDoors);
+
+ /**
+ * Checks if this pathfinder allows passing through open doors.
+ *
+ * @return if this pathfinder allows passing through open doors
+ */
+ boolean canPassDoors();
+
+ /**
+ * Allows this pathfinder to pass through open doors, or not
+ *
+ * @param canPassDoors if the mob can pass through open doors, or not
+ */
+ void setCanPassDoors(boolean canPassDoors);
+
+ /**
+ * Checks if this pathfinder assumes that the mob can float
+ *
+ * @return if this pathfinder assumes that the mob can float
+ */
+ boolean canFloat();
+
+ /**
+ * Makes this pathfinder assume that the mob can float, or not
+ *
+ * @param canFloat if the mob can float, or not
+ */
+ void setCanFloat(boolean canFloat);
+
+ /**
+ * Represents the result of a pathfinding calculation
+ */
+ interface PathResult {