Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039)

… patch and methods to make more sense with Mojang mappings
This commit is contained in:
Jason 2021-12-05 15:32:02 -08:00 committed by GitHub
parent 7c8fdc1fb6
commit fd263ef962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 166 additions and 163 deletions

View file

@ -5,7 +5,7 @@ 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
index be29c3a361415064c418256d5c0eca9e5a7cefd2..c33fda773ec071d27e924461a30a2938db35c231 100644
index 9e4d43b5846ebebf9169ad906db68804292e7fe0..e23679b8c2bc35de82cb3245f35b53b44058f53d 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -453,7 +453,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@ -14,7 +14,7 @@ index be29c3a361415064c418256d5c0eca9e5a7cefd2..c33fda773ec071d27e924461a30a2938
pos.set(i + l, j + m, k + n);
- BlockState blockState = world.getBlockState(pos);
+ // Paper start
+ BlockState blockState = world.getTypeIfLoaded(pos);
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
+ if (blockState == null) {
+ return BlockPathTypes.BLOCKED;
+ } else {
@ -35,7 +35,7 @@ index be29c3a361415064c418256d5c0eca9e5a7cefd2..c33fda773ec071d27e924461a30a2938
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
- BlockState blockState = world.getBlockState(pos);
+ BlockState blockState = world.getTypeIfLoaded(pos); // Paper
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
Block block = blockState.getBlock();
Material material = blockState.getMaterial();