another day another static world reference gone

This commit is contained in:
Leijurv 2018-11-10 09:37:23 -08:00
parent 232644feb0
commit 73d4e9bbb9
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 6 additions and 5 deletions

View File

@ -22,6 +22,7 @@ import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.movement.IMovement;
import baritone.api.utils.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
@ -120,7 +121,7 @@ public interface IPath {
*
* @return The result of this cut-off operation
*/
default IPath cutoffAtLoadedChunks() {
default IPath cutoffAtLoadedChunks(World world) {
throw new UnsupportedOperationException();
}

View File

@ -400,7 +400,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
Optional<IPath> path = calcResult.path;
if (Baritone.settings().cutoffAtLoadBoundary.get()) {
path = path.map(p -> {
IPath result = p.cutoffAtLoadedChunks();
IPath result = p.cutoffAtLoadedChunks(context.world());
if (result instanceof CutoffPath) {
logDebug("Cutting off path at edge of loaded chunks");

View File

@ -21,16 +21,16 @@ import baritone.api.BaritoneAPI;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.goals.Goal;
import baritone.pathing.path.CutoffPath;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.EmptyChunk;
public abstract class PathBase implements IPath {
@Override
public IPath cutoffAtLoadedChunks() {
public IPath cutoffAtLoadedChunks(World world) {
for (int i = 0; i < positions().size(); i++) {
BlockPos pos = positions().get(i);
if (Minecraft.getMinecraft().world.getChunk(pos) instanceof EmptyChunk) {
if (world.getChunk(pos) instanceof EmptyChunk) {
return new CutoffPath(this, i);
}
}