This commit is contained in:
Leijurv 2018-12-02 19:56:35 -08:00
parent 3cb1984892
commit d2413e1677
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
3 changed files with 9 additions and 8 deletions

View File

@ -21,7 +21,6 @@ import baritone.api.Settings;
import baritone.api.pathing.goals.Goal; import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.movement.IMovement; import baritone.api.pathing.movement.IMovement;
import baritone.api.utils.BetterBlockPos; import baritone.api.utils.BetterBlockPos;
import net.minecraft.world.World;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; 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 * Cuts off this path at the loaded chunk border, and returns the resulting path. Default
* implementation just returns this path, without the intended functionality. * implementation just returns this path, without the intended functionality.
* <p>
* The argument is supposed to be a BlockStateInterface LOL LOL LOL LOL LOL
* *
* @return The result of this cut-off operation * @return The result of this cut-off operation
*/ */
default IPath cutoffAtLoadedChunks(World world) { default IPath cutoffAtLoadedChunks(Object bsi) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -433,7 +433,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
Optional<IPath> path = calcResult.getPath(); Optional<IPath> path = calcResult.getPath();
if (Baritone.settings().cutoffAtLoadBoundary.get()) { if (Baritone.settings().cutoffAtLoadBoundary.get()) {
path = path.map(p -> { path = path.map(p -> {
IPath result = p.cutoffAtLoadedChunks(context.world()); IPath result = p.cutoffAtLoadedChunks(context.bsi());
if (result instanceof CutoffPath) { if (result instanceof CutoffPath) {
logDebug("Cutting off path at edge of loaded chunks"); 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.calc.IPath;
import baritone.api.pathing.goals.Goal; import baritone.api.pathing.goals.Goal;
import baritone.pathing.path.CutoffPath; import baritone.pathing.path.CutoffPath;
import baritone.utils.BlockStateInterface;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.EmptyChunk;
public abstract class PathBase implements IPath { public abstract class PathBase implements IPath {
@Override @Override
public IPath cutoffAtLoadedChunks(World world) { public PathBase cutoffAtLoadedChunks(Object bsi0) {
BlockStateInterface bsi = (BlockStateInterface) bsi0;
for (int i = 0; i < positions().size(); i++) { for (int i = 0; i < positions().size(); i++) {
BlockPos pos = positions().get(i); BlockPos pos = positions().get(i);
if (world.getChunk(pos) instanceof EmptyChunk) { if (!bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
return new CutoffPath(this, i); return new CutoffPath(this, i);
} }
} }
@ -38,7 +38,7 @@ public abstract class PathBase implements IPath {
} }
@Override @Override
public IPath staticCutoff(Goal destination) { public PathBase staticCutoff(Goal destination) {
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get(); int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
if (length() < min) { if (length() < min) {
return this; return this;