testserver/patches/server/0081-Do-not-load-chunks-for...

43 lines
2.2 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00: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
2022-06-07 19:55:39 +00:00
index 235b01e23a8997d0d65de3655b3b3ff50a204c06..c48e097464977dbec22d1370c3393ba1fe105137 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
2022-06-07 19:55:39 +00:00
@@ -477,7 +477,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
2021-06-12 02:24:43 +00: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 12:02:28 +00:00
+ // Paper start
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
2021-06-12 02:24:43 +00:00
+ if (blockState == null) {
+ return BlockPathTypes.BLOCKED;
2021-06-11 12:02:28 +00:00
+ } else {
+ // Paper end
2021-06-12 02:24:43 +00:00
if (blockState.is(Blocks.CACTUS)) {
2021-06-11 12:02:28 +00:00
return BlockPathTypes.DANGER_CACTUS;
2021-06-12 02:24:43 +00:00
}
2022-06-07 19:55:39 +00:00
@@ -493,6 +498,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
2021-06-12 02:24:43 +00:00
if (world.getFluidState(pos).is(FluidTags.WATER)) {
2021-06-11 12:02:28 +00:00
return BlockPathTypes.WATER_BORDER;
}
+ } // Paper
}
}
}
2022-06-07 19:55:39 +00:00
@@ -502,7 +508,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
2021-06-11 12:02:28 +00:00
}
2021-06-12 02:24:43 +00:00
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
- BlockState blockState = world.getBlockState(pos);
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
2021-06-12 02:24:43 +00:00
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
Block block = blockState.getBlock();
Material material = blockState.getMaterial();
if (blockState.isAir()) {