diff --git a/Spigot-API-Patches/0145-Mob-Pathfinding-API.patch b/Spigot-API-Patches/0145-Mob-Pathfinding-API.patch index 6a2e4fdc51..8408100069 100644 --- a/Spigot-API-Patches/0145-Mob-Pathfinding-API.patch +++ b/Spigot-API-Patches/0145-Mob-Pathfinding-API.patch @@ -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 { diff --git a/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch b/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch index 3c7a1dc79e..23c2b858be 100644 --- a/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch @@ -7,10 +7,10 @@ Implements Pathfinding API for mobs diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java new file mode 100644 -index 0000000000000000000000000000000000000000..f68a07cb9636787f5ae337d8a2ba9798eaa645a5 +index 0000000000000000000000000000000000000000..af1bac9680028130e99c5e7130f258c196b33275 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java -@@ -0,0 +1,111 @@ +@@ -0,0 +1,141 @@ +package com.destroystokyo.paper.entity; + +import net.minecraft.server.EntityInsentient; @@ -80,6 +80,36 @@ index 0000000000000000000000000000000000000000..f68a07cb9636787f5ae337d8a2ba9798 + return entity.getNavigation().setDestination(pathEntity, speed); + } + ++ @Override ++ public boolean canOpenDoors() { ++ return entity.getNavigation().getPathfinder().getPathfinder().shouldOpenDoors(); ++ } ++ ++ @Override ++ public void setCanOpenDoors(boolean canOpenDoors) { ++ entity.getNavigation().getPathfinder().getPathfinder().setShouldOpenDoors(canOpenDoors); ++ } ++ ++ @Override ++ public boolean canPassDoors() { ++ return entity.getNavigation().getPathfinder().getPathfinder().shouldPassDoors(); ++ } ++ ++ @Override ++ public void setCanPassDoors(boolean canPassDoors) { ++ entity.getNavigation().getPathfinder().getPathfinder().setShouldPassDoors(canPassDoors); ++ } ++ ++ @Override ++ public boolean canFloat() { ++ return entity.getNavigation().getPathfinder().getPathfinder().shouldFloat(); ++ } ++ ++ @Override ++ public void setCanFloat(boolean canFloat) { ++ entity.getNavigation().getPathfinder().getPathfinder().setShouldFloat(canFloat); ++ } ++ + public class PaperPathResult implements com.destroystokyo.paper.entity.PaperPathfinder.PathResult { + + private final PathEntity path; @@ -226,6 +256,23 @@ index b1db95daa976f61da07a37ec1787ef49785e016a..18cdd2a6f290bf1f00db58efdb9a42f8 private final int m; public int d = -1; public float e; +diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java +index af3b09f59a38020c1a45403526fca81c1da144d5..477b762e9c0c51cb3f387f70ba7ec9d35dc04132 100644 +--- a/src/main/java/net/minecraft/server/PathfinderAbstract.java ++++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java +@@ -11,9 +11,9 @@ public abstract class PathfinderAbstract { + protected int d; + protected int e; + protected int f; +- protected boolean g; +- protected boolean h; +- protected boolean i; ++ protected boolean g; public boolean shouldPassDoors() { return g; } public void setShouldPassDoors(boolean b) { g = b; } // Paper - obfhelper ++ protected boolean h; public boolean shouldOpenDoors() { return h; } public void setShouldOpenDoors(boolean b) { h = b; } // Paper - obfhelper ++ protected boolean i; public boolean shouldFloat() { return i; } public void setShouldFloat(boolean b) { i = b; } // Paper - obfhelper + + public PathfinderAbstract() {} + diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java index 90e63fbf292488732434ed9cf20645d8306eb21d..c89bc7024b650c3b6d2c551f0e4e156975570cca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java