Paper/patches/server/0083-Do-not-load-chunks-for-Pathfinding.patch

43 Zeilen
2.2 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 31 Mar 2016 19:17:58 -0400
Subject: [PATCH] Do not load chunks for Pathfinding
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
2023-09-22 19:59:56 +02:00
index b7995e6159c865f8e2e7865f7eb51936a9720311..10503d6d8b6daf645cf4360ee289d5e25144c976 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
2023-06-07 20:49:17 +02:00
@@ -459,7 +459,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
2021-06-12 04:24:43 +02:00
for(int n = -1; n <= 1; ++n) {
if (l != 0 || n != 0) {
pos.set(i + l, j + m, k + n);
- BlockState blockState = world.getBlockState(pos);
2021-06-11 14:02:28 +02:00
+ // Paper start
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
2021-06-12 04:24:43 +02:00
+ if (blockState == null) {
+ return BlockPathTypes.BLOCKED;
2021-06-11 14:02:28 +02:00
+ } else {
+ // Paper end
2023-03-14 19:36:39 +01:00
if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) {
return BlockPathTypes.DANGER_OTHER;
2021-06-12 04:24:43 +02:00
}
2023-06-07 20:49:17 +02:00
@@ -475,6 +480,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) {
return BlockPathTypes.DAMAGE_CAUTIOUS;
2021-06-11 14:02:28 +02:00
}
+ } // Paper
}
}
}
2023-06-07 20:49:17 +02:00
@@ -484,7 +490,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
2021-06-11 14:02:28 +02:00
}
2021-06-12 04:24:43 +02:00
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
- BlockState blockState = world.getBlockState(pos);
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
2021-06-12 04:24:43 +02:00
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
Block block = blockState.getBlock();
if (blockState.isAir()) {
2023-06-07 20:49:17 +02:00
return BlockPathTypes.OPEN;