something is fishy with the getAllSchematicPlacements() methode but i want my progress saved
This commit is contained in:
@@ -48,8 +48,6 @@ 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 it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -181,16 +179,24 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
|
||||
@Override
|
||||
public void buildOpenLitematic() {
|
||||
if (LitematicaHelper.isLitematicaPresent()) { //TODO Investigate why true even without litematica being present
|
||||
List<SchematicPlacement> placementList = DataManager.getSchematicPlacementManager().getAllSchematicPlacements();
|
||||
if (placementList.size()>0) {
|
||||
String name = LitematicaHelper.getName(placementList,0);
|
||||
File schemFile = LitematicaHelper.getSchematicFile(placementList,0);
|
||||
Vec3i origin = LitematicaHelper.getOrigin(placementList,0);
|
||||
logDirect("start building open litematic");
|
||||
if (LitematicaHelper.isLitematicaPresent()) {
|
||||
logDirect("litematica is present"); //TODO debug line remove
|
||||
if (LitematicaHelper.hasLoadedSchematic()) {
|
||||
logDirect("a schematic is present"); //TODO debug line remove
|
||||
String name = LitematicaHelper.getName(0);
|
||||
File schemFile = LitematicaHelper.getSchematicFile(0);
|
||||
Vec3i origin = LitematicaHelper.getOrigin(0);
|
||||
|
||||
build(name, schemFile, origin);
|
||||
boolean success = build(name, schemFile, origin);
|
||||
if (success) {
|
||||
logDirect(String.format("Building Schematic: %s\nOrigion: %s",name,origin));
|
||||
} else {
|
||||
logDirect("Couldn't load the schematic. That is strange.");
|
||||
//this should happen as invalid schematics should not be abel to be loaded in litematica in the first place
|
||||
}
|
||||
} else {
|
||||
logDirect("No schematic currently open");
|
||||
logDirect("No schematic currently loaded");
|
||||
}
|
||||
} else {
|
||||
logDirect("Litematica is not present");
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
package baritone.utils.schematic.litematica;
|
||||
|
||||
import fi.dy.masa.litematica.Litematica;
|
||||
import fi.dy.masa.litematica.data.DataManager;
|
||||
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 final class LitematicaHelper {
|
||||
public static boolean isLitematicaPresent() {
|
||||
try {
|
||||
Class.forName(Litematica.class.getName());
|
||||
@@ -33,18 +35,27 @@ public enum LitematicaHelper { ;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static String getName(List<SchematicPlacement> placementList, int i) {
|
||||
return placementList.get(i).getName();
|
||||
//TODO compact into one line when debugging is done
|
||||
public static boolean hasLoadedSchematic() {
|
||||
System.out.println("start checking for schematic"); //TODO debug line remove
|
||||
SchematicPlacementManager a = DataManager.getSchematicPlacementManager();
|
||||
System.out.println("manager aquired"); //TODO debug line remove
|
||||
List< SchematicPlacement> b = a.getAllSchematicPlacements();
|
||||
System.out.println("list aquired"); //TODO debug line remove
|
||||
return b.size()>0;
|
||||
}
|
||||
public static Vec3i getOrigin(List<SchematicPlacement> placementList, int i) {
|
||||
public static String getName(int i) {
|
||||
return DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getName();
|
||||
}
|
||||
public static Vec3i getOrigin(int i) {
|
||||
int x,y,z;
|
||||
x=placementList.get(i).getOrigin().getX();
|
||||
y=placementList.get(i).getOrigin().getY();
|
||||
z=placementList.get(i).getOrigin().getZ();
|
||||
x=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getX();
|
||||
y=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getY();
|
||||
z=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getZ();
|
||||
return new Vec3i(x,y,z);
|
||||
}
|
||||
public static File getSchematicFile(List<SchematicPlacement> placementList, int i) {
|
||||
return placementList.get(i).getSchematicFile();
|
||||
public static File getSchematicFile(int i) {
|
||||
return DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getSchematicFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package fi.dy.masa.litematica;
|
||||
|
||||
public class Litematica {
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package fi.dy.masa.litematica.schematic.placement;
|
||||
|
||||
public class SchematicPlacement extends SchematicPlacementUnloaded {
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package fi.dy.masa.litematica.schematic.placement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SchematicPlacementManager {
|
||||
private final List<SchematicPlacement> schematicPlacements = new ArrayList<>();
|
||||
|
||||
public List<SchematicPlacement> getAllSchematicPlacements() {
|
||||
return schematicPlacements;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user