mirror of
https://github.com/PaperMC/Paper.git
synced 2024-10-30 07:19:58 +01:00
afe633df08
* convert API tests to mockito * convert server tests to mockito * add co-author
28 lines
1.8 KiB
Diff
28 lines
1.8 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
|
|
|
|
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.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
index bd782c8935db6e0aa3489725d3c4ee401f9bf242..bf89b3a484334ec23f96426bdcf29e54725512c3 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
|
@@ -157,7 +157,7 @@ public abstract class PathNavigation {
|
|
// Paper start - Pathfind event
|
|
boolean copiedSet = false;
|
|
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()) {
|
|
if (!copiedSet) {
|
|
copiedSet = true;
|