From d2413e1677dd2546edf67cc269411aea0c2f9b9c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 2 Dec 2018 19:56:35 -0800 Subject: [PATCH] lol --- src/api/java/baritone/api/pathing/calc/IPath.java | 5 +++-- src/main/java/baritone/behavior/PathingBehavior.java | 2 +- src/main/java/baritone/utils/pathing/PathBase.java | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/api/java/baritone/api/pathing/calc/IPath.java b/src/api/java/baritone/api/pathing/calc/IPath.java index 8f0cb68e..63c01101 100644 --- a/src/api/java/baritone/api/pathing/calc/IPath.java +++ b/src/api/java/baritone/api/pathing/calc/IPath.java @@ -21,7 +21,6 @@ import baritone.api.Settings; import baritone.api.pathing.goals.Goal; import baritone.api.pathing.movement.IMovement; import baritone.api.utils.BetterBlockPos; -import net.minecraft.world.World; import java.util.HashSet; import java.util.List; @@ -119,10 +118,12 @@ public interface IPath { /** * Cuts off this path at the loaded chunk border, and returns the resulting path. Default * implementation just returns this path, without the intended functionality. + *

+ * The argument is supposed to be a BlockStateInterface LOL LOL LOL LOL LOL * * @return The result of this cut-off operation */ - default IPath cutoffAtLoadedChunks(World world) { + default IPath cutoffAtLoadedChunks(Object bsi) { throw new UnsupportedOperationException(); } diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 856dd6a4..0d88dbe1 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -433,7 +433,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior, Optional path = calcResult.getPath(); if (Baritone.settings().cutoffAtLoadBoundary.get()) { path = path.map(p -> { - IPath result = p.cutoffAtLoadedChunks(context.world()); + IPath result = p.cutoffAtLoadedChunks(context.bsi()); if (result instanceof CutoffPath) { logDebug("Cutting off path at edge of loaded chunks"); diff --git a/src/main/java/baritone/utils/pathing/PathBase.java b/src/main/java/baritone/utils/pathing/PathBase.java index 15d0e7bc..129e0735 100644 --- a/src/main/java/baritone/utils/pathing/PathBase.java +++ b/src/main/java/baritone/utils/pathing/PathBase.java @@ -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 baritone.utils.BlockStateInterface; 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(World world) { + public PathBase cutoffAtLoadedChunks(Object bsi0) { + BlockStateInterface bsi = (BlockStateInterface) bsi0; for (int i = 0; i < positions().size(); i++) { BlockPos pos = positions().get(i); - if (world.getChunk(pos) instanceof EmptyChunk) { + if (!bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) { return new CutoffPath(this, i); } } @@ -38,7 +38,7 @@ public abstract class PathBase implements IPath { } @Override - public IPath staticCutoff(Goal destination) { + public PathBase staticCutoff(Goal destination) { int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get(); if (length() < min) { return this;