another day another static world reference gone
This commit is contained in:
parent
232644feb0
commit
73d4e9bbb9
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user