Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
TODO: This doesn't prevent the pathfinder from using blocks outside the world border as nodes. We can fix this
by adding code to all overrides in:
NodeEvaluator:
public abstract BlockPathTypes getBlockPathType(BlockGetter world, int x, int y, int z);
to return BLOCKED if it is outside the world border.
This commit is contained in:
@@ -50,7 +50,7 @@
|
|||||||
+ // Paper start - EntityPathfindEvent
|
+ // Paper start - EntityPathfindEvent
|
||||||
+ boolean copiedSet = false;
|
+ boolean copiedSet = false;
|
||||||
+ for (BlockPos possibleTarget : positions) {
|
+ for (BlockPos possibleTarget : positions) {
|
||||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(),
|
+ if (!this.mob.getCommandSenderWorld().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border
|
||||||
+ io.papermc.paper.util.MCUtil.toLocation(this.mob.level(), possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
+ io.papermc.paper.util.MCUtil.toLocation(this.mob.level(), possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||||
+ if (!copiedSet) {
|
+ if (!copiedSet) {
|
||||||
+ copiedSet = true;
|
+ copiedSet = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user