Paper/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch
Aikar 64ed429884
(FIRST 1.16.3): Update Paper to 1.16.3
This is a pretty tiny update with very little changed. Recommended to update
from 1.16.2 ASAP as 1.16.2 is now no longer supported.

Plugins should mostly remain working as the NMS revision did not change.
2020-09-10 19:47:58 -04:00

21 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 19 Dec 2016 23:07:42 -0500
Subject: [PATCH] Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 3ffa6b22dde89e26aea4b8e5ce0cd5db92dc9310..d39ce9c1816aaa33478dcd623056488ca21411f3 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -127,7 +127,7 @@ public abstract class NavigationAbstract {
// Paper start - Pathfind event
boolean copiedSet = false;
for (BlockPosition possibleTarget : set) {
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), // Paper - don't path out of world border
MCUtil.toLocation(getEntity().world, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
if (!copiedSet) {
copiedSet = true;