diff --git a/src/main/java/baritone/builder/DependencyGraphScaffoldingOverlay.java b/src/main/java/baritone/builder/DependencyGraphScaffoldingOverlay.java index b0a81fb24..7e746d1c5 100644 --- a/src/main/java/baritone/builder/DependencyGraphScaffoldingOverlay.java +++ b/src/main/java/baritone/builder/DependencyGraphScaffoldingOverlay.java @@ -337,7 +337,7 @@ public class DependencyGraphScaffoldingOverlay { if (!Main.STRICT_Y || positions.isEmpty()) { throw new IllegalStateException(); } - if (y == -1) { + if (y == -1) { // TODO won't work in 1.17+ lol y = BetterBlockPos.YfromLong(positions.iterator().nextLong()); if (y == -1) { throw new IllegalStateException(); @@ -376,7 +376,7 @@ public class DependencyGraphScaffoldingOverlay { if (component.positions.isEmpty()) { throw new IllegalStateException(); } - int y = Main.STRICT_Y ? component.y() : -1; + Integer y = Main.STRICT_Y ? component.y() : null; for (CollapsedDependencyGraphComponent out : component.outgoingEdges) { if (Main.STRICT_Y && out.y() < y) { throw new IllegalStateException(); diff --git a/src/main/java/baritone/builder/Scaffolder.java b/src/main/java/baritone/builder/Scaffolder.java index b34acb831..d12fc5d22 100644 --- a/src/main/java/baritone/builder/Scaffolder.java +++ b/src/main/java/baritone/builder/Scaffolder.java @@ -55,12 +55,12 @@ public class Scaffolder { this.rootComponents = calcRoots(); } - public static Scaffolder run(PlaceOrderDependencyGraph graph, IScaffolderStrategy strategy) { + public static Output run(PlaceOrderDependencyGraph graph, IScaffolderStrategy strategy) { Scaffolder scaffolder = new Scaffolder(graph, strategy); while (scaffolder.rootComponents.size() > 1) { scaffolder.loop(); } - return scaffolder; + return scaffolder.new Output(); } private List calcRoots() { @@ -121,39 +121,39 @@ public class Scaffolder { } } - public void enableAncillaryScaffoldingAndRecomputeRoot(LongList positions) { - System.out.println("TODO: should ancillary scaffolding even recompute the components? that scaffolding doesn't NEED to part of any component, and having all components be mutable even after the scaffolder is done is sketchy"); - getRoot(); - enable(positions); - getRoot(); - } - - public CollapsedDependencyGraphComponent getRoot() { // TODO this should probably return a new class that is not mutable in-place - if (rootComponents.size() != 1) { - throw new IllegalStateException(); // this is okay because this can only possibly be called after Scaffolder.run is completed + public class Output { + public void enableAncillaryScaffoldingAndRecomputeRoot(LongList positions) { + getRoot(); + enable(positions); + getRoot(); + throw new UnsupportedOperationException("TODO: should ancillary scaffolding even recompute the components? that scaffolding doesn't NEED to part of any component, and having all components be mutable even after the scaffolder is done is sketchy"); } - CollapsedDependencyGraphComponent root = rootComponents.get(0); - if (!root.getIncoming().isEmpty() || root.deleted()) { - throw new IllegalStateException(); + + public CollapsedDependencyGraphComponent getRoot() { // TODO this should probably return a new class that is not mutable in-place + if (rootComponents.size() != 1) { + throw new IllegalStateException(); // this is okay because this can only possibly be called after Scaffolder.run is completed + } + CollapsedDependencyGraphComponent root = rootComponents.get(0); + if (!root.getIncoming().isEmpty() || root.deleted()) { + throw new IllegalStateException(); + } + return root; } - return root; - } + public boolean real(long pos) { + return overlayGraph.real(pos); + } - // TODO should Scaffolder return a different class? "CompletedScaffolding" or something that has these methods as non-delegate, as well as getRoot returning a immutable equivalent of CollapsedDependencyGraphComponent? - public boolean real(long pos) { - return overlayGraph.real(pos); - } + public void forEachReal(Bounds.BoundsLongConsumer consumer) { + overlayGraph.forEachReal(consumer); + } - public void forEachReal(Bounds.BoundsLongConsumer consumer) { - overlayGraph.forEachReal(consumer); - } + public LongSets.UnmodifiableSet scaffolding() { + return overlayGraph.scaffolding(); + } - public LongSets.UnmodifiableSet scaffolding() { - return overlayGraph.scaffolding(); - } - - public boolean air(long pos) { - return overlayGraph.air(pos); + public boolean air(long pos) { + return overlayGraph.air(pos); + } } } diff --git a/src/main/java/baritone/builder/SolverEngineHarness.java b/src/main/java/baritone/builder/SolverEngineHarness.java index cbd8647ed..465c5b419 100644 --- a/src/main/java/baritone/builder/SolverEngineHarness.java +++ b/src/main/java/baritone/builder/SolverEngineHarness.java @@ -33,7 +33,7 @@ public class SolverEngineHarness { private final ISolverEngine engine; private final PackedBlockStateCuboid blocks; private final PlaceOrderDependencyGraph graph; - private final Scaffolder scaffolder; + private final Scaffolder.Output scaffolder; public SolverEngineHarness(ISolverEngine engine, PackedBlockStateCuboid blocks, IScaffolderStrategy scaffolderStrategy) { this.engine = engine;