From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar 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/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 @@ -0,0 +0,0 @@ public abstract class PathNavigation { private BlockPos targetPos; private int reachRange; private float maxVisitedNodesMultiplier = 1.0F; - private final PathFinder pathFinder; + private final PathFinder pathFinder; @Deprecated public PathFinder getPathfinder() { return this.pathFinder; } // Paper - OBFHELPER private boolean isStuck; public PathNavigation(Mob mob, Level world) { diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java @@ -0,0 +0,0 @@ public class PathFinder { private static final float FUDGING = 1.5F; private final Node[] neighbors = new Node[32]; private final int maxVisitedNodes; - private final NodeEvaluator nodeEvaluator; + private final NodeEvaluator nodeEvaluator; @Deprecated public NodeEvaluator getPathfinder() { return this.nodeEvaluator; } // Paper - OBFHELPER private static final boolean DEBUG = false; private final BinaryHeap openSet = new BinaryHeap(); 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java @@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { 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); + // Paper start + BlockState blockState = world.getTypeIfLoaded(pos); + if (blockState == null) { + return BlockPathTypes.BLOCKED; + } else { + // Paper end if (blockState.is(Blocks.CACTUS)) { return BlockPathTypes.DANGER_CACTUS; } @@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { if (world.getFluidState(pos).is(FluidTags.WATER)) { return BlockPathTypes.WATER_BORDER; } + } // Paper } } } @@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { } protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { - BlockState blockState = world.getBlockState(pos); + BlockState blockState = world.getTypeIfLoaded(pos); // Paper + if (blockState == null) return BlockPathTypes.BLOCKED; // Paper Block block = blockState.getBlock(); Material material = blockState.getMaterial(); if (blockState.isAir()) {