diff --git a/src/api/java/baritone/api/process/IBuilderProcess.java b/src/api/java/baritone/api/process/IBuilderProcess.java
index 9063b9900..dc17d0419 100644
--- a/src/api/java/baritone/api/process/IBuilderProcess.java
+++ b/src/api/java/baritone/api/process/IBuilderProcess.java
@@ -58,6 +58,8 @@ public interface IBuilderProcess extends IBaritoneProcess {
void buildOpenSchematic();
+ void buildOpenLitematic();
+
void pause();
boolean isPaused();
diff --git a/src/main/java/baritone/command/defaults/DefaultCommands.java b/src/main/java/baritone/command/defaults/DefaultCommands.java
index e998dcc97..901fda713 100644
--- a/src/main/java/baritone/command/defaults/DefaultCommands.java
+++ b/src/main/java/baritone/command/defaults/DefaultCommands.java
@@ -43,6 +43,7 @@ public final class DefaultCommands {
new RepackCommand(baritone),
new BuildCommand(baritone),
new SchematicaCommand(baritone),
+ new LitematicaCommand(baritone),
new ComeCommand(baritone),
new AxisCommand(baritone),
new ForceCancelCommand(baritone),
diff --git a/src/main/java/baritone/command/defaults/LitematicaCommand.java b/src/main/java/baritone/command/defaults/LitematicaCommand.java
new file mode 100644
index 000000000..56360331e
--- /dev/null
+++ b/src/main/java/baritone/command/defaults/LitematicaCommand.java
@@ -0,0 +1,60 @@
+/*
+ * 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 baritone.command.defaults;
+
+import baritone.api.IBaritone;
+import baritone.api.command.Command;
+import baritone.api.command.argument.IArgConsumer;
+import baritone.api.command.exception.CommandException;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+public class LitematicaCommand extends Command {
+
+ public LitematicaCommand(IBaritone baritone) {
+ super(baritone, "litematica");
+ }
+
+ @Override
+ public void execute(String label, IArgConsumer args) throws CommandException {
+ args.requireMax(0);
+ baritone.getBuilderProcess().buildOpenLitematic();
+ }
+
+ @Override
+ public Stream tabComplete(String label, IArgConsumer args) {
+ return Stream.empty();
+ }
+
+ @Override
+ public String getShortDesc() {
+ return "Builds the loaded schematic";
+ }
+
+ @Override
+ public List getLongDesc() {
+ return Arrays.asList(
+ "Builds the schematic currently open in Litematica.",
+ "",
+ "Usage:",
+ "> litematica"
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java
index 1766af623..437c2c8d9 100644
--- a/src/main/java/baritone/process/BuilderProcess.java
+++ b/src/main/java/baritone/process/BuilderProcess.java
@@ -44,9 +44,13 @@ import baritone.utils.PathingCommandContext;
import baritone.utils.schematic.MapArtSchematic;
import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.SchematicSystem;
+import baritone.utils.schematic.litematica.LitematicaHelper;
import baritone.utils.schematic.schematica.SchematicaHelper;
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;
@@ -176,6 +180,24 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
}
+ @Override
+ public void buildOpenLitematic() {
+ if (LitematicaHelper.isLitematicaPresent()) {
+ SchematicPlacementManager placementManager = DataManager.getSchematicPlacementManager();
+ List placementList = placementManager.getAllSchematicsPlacements();
+ if (placementList.size()>0) {
+ String name = LitematicaHelper.getName(placementList,0);
+ File schemFile = LitematicaHelper.getSchematicFile(placementList,0);
+ Vec3i origin = LitematicaHelper.getOrigin(placementList,0);
+
+ build(name, schemFile, origin);
+ } else {
+ logDirect("No schematic currently open");
+ }
+ logDirect("Litematica is not present");
+ }
+ }
+
public void clearArea(BlockPos corner1, BlockPos corner2) {
BlockPos origin = new BlockPos(Math.min(corner1.getX(), corner2.getX()), Math.min(corner1.getY(), corner2.getY()), Math.min(corner1.getZ(), corner2.getZ()));
int widthX = Math.abs(corner1.getX() - corner2.getX()) + 1;
diff --git a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java
new file mode 100644
index 000000000..825332583
--- /dev/null
+++ b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java
@@ -0,0 +1,74 @@
+/*
+ * 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 baritone.utils.schematic.litematica;
+
+import com.github.lunatrius.schematica.Schematica;
+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;
+import java.util.List;
+
+public enum LitematicaHelper { ;
+ public static boolean isLitematicaPresent() {
+ try {
+ Class.forName(Schematica.class.getName());
+ return true;
+ } catch (ClassNotFoundException | NoClassDefFoundError ex) {
+ return false;
+ }
+ }
+ public static String getName(List placementList, int i) {
+ return placementList.get(i).getName();
+ }
+ public static Vec3i getOrigin(List placementList, int i) {
+ int x,y,z;
+ x=placementList.get(i).getOrigin().getX();
+ y=placementList.get(i).getOrigin().getY();
+ z=placementList.get(i).getOrigin().getZ();
+ return new Vec3i(x,y,z);
+ }
+ public static File getSchematicFile(List placementList, int i) {
+ return placementList.get(i).getSchematicFile();
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+