mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-09 06:50:32 +08:00
b6925c36af
This is now default vanilla behavior Fixes #3644
21 lines
1.4 KiB
Diff
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 9330e65cbdf2f826528e3c891197fac7860306ec..b06c76a369f1dc9de8d782272c3ff0573af89361 100644
|
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
@@ -126,7 +126,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;
|