diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 437c2c8d9..cd1a19b8b 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -50,7 +50,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import fi.dy.masa.litematica.data.DataManager; import fi.dy.masa.litematica.schematic.placement.SchematicPlacement; -import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import net.minecraft.block.*; import net.minecraft.block.properties.IProperty; @@ -182,9 +181,8 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil @Override public void buildOpenLitematic() { - if (LitematicaHelper.isLitematicaPresent()) { - SchematicPlacementManager placementManager = DataManager.getSchematicPlacementManager(); - List placementList = placementManager.getAllSchematicsPlacements(); + if (LitematicaHelper.isLitematicaPresent()) { //TODO Investigate why true even without litematica being present + List placementList = DataManager.getSchematicPlacementManager().getAllSchematicPlacements(); if (placementList.size()>0) { String name = LitematicaHelper.getName(placementList,0); File schemFile = LitematicaHelper.getSchematicFile(placementList,0); @@ -194,6 +192,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil } else { logDirect("No schematic currently open"); } + } else { logDirect("Litematica is not present"); } } diff --git a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java index 825332583..c97a46b71 100644 --- a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java +++ b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java @@ -17,9 +17,8 @@ package baritone.utils.schematic.litematica; -import com.github.lunatrius.schematica.Schematica; +import fi.dy.masa.litematica.Litematica; import fi.dy.masa.litematica.schematic.placement.SchematicPlacement; -import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager; import net.minecraft.util.math.Vec3i; import java.io.File; @@ -28,7 +27,7 @@ import java.util.List; public enum LitematicaHelper { ; public static boolean isLitematicaPresent() { try { - Class.forName(Schematica.class.getName()); + Class.forName(Litematica.class.getName()); return true; } catch (ClassNotFoundException | NoClassDefFoundError ex) { return false; diff --git a/src/main/java/fi/dy/masa/litematica/Litematica.java b/src/main/java/fi/dy/masa/litematica/Litematica.java new file mode 100644 index 000000000..46f4e02ae --- /dev/null +++ b/src/main/java/fi/dy/masa/litematica/Litematica.java @@ -0,0 +1,21 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package fi.dy.masa.litematica; + +public class Litematica { +} diff --git a/src/main/java/fi/dy/masa/litematica/data/DataManager.java b/src/main/java/fi/dy/masa/litematica/data/DataManager.java new file mode 100644 index 000000000..b590eb2e8 --- /dev/null +++ b/src/main/java/fi/dy/masa/litematica/data/DataManager.java @@ -0,0 +1,31 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package fi.dy.masa.litematica.data; + +import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager; + +public class DataManager { + public static final DataManager INSTANCE = new DataManager(); + private final SchematicPlacementManager schematicPlacementManager = new SchematicPlacementManager(); + private static DataManager getInstance() { + return INSTANCE; + } + public static SchematicPlacementManager getSchematicPlacementManager() { + return getInstance().schematicPlacementManager; + } +} diff --git a/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacement.java b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacement.java new file mode 100644 index 000000000..0407dff09 --- /dev/null +++ b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacement.java @@ -0,0 +1,22 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package fi.dy.masa.litematica.schematic.placement; + +public class SchematicPlacement extends SchematicPlacementUnloaded { + +} diff --git a/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementManager.java b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementManager.java new file mode 100644 index 000000000..c30ab149d --- /dev/null +++ b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementManager.java @@ -0,0 +1,29 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package fi.dy.masa.litematica.schematic.placement; + +import java.util.ArrayList; +import java.util.List; + +public class SchematicPlacementManager { + private final List schematicPlacements = new ArrayList<>(); + + public List getAllSchematicPlacements() { + return schematicPlacements; + } +} diff --git a/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementUnloaded.java b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementUnloaded.java new file mode 100644 index 000000000..707aaf78c --- /dev/null +++ b/src/main/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementUnloaded.java @@ -0,0 +1,39 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package fi.dy.masa.litematica.schematic.placement; + +import net.minecraft.util.math.BlockPos; + +import javax.annotation.Nullable; +import java.io.File; + +public class SchematicPlacementUnloaded { + protected String name = "?"; + @Nullable protected File schematicFile; + protected BlockPos origin = BlockPos.ORIGIN; + public String getName() { + return this.name; + } + @Nullable + public File getSchematicFile() { + return this.schematicFile; + } + public BlockPos getOrigin() { + return this.origin; + } +}