something is fishy with the getAllSchematicPlacements() methode but i want my progress saved
This commit is contained in:
parent
3a4168a661
commit
4ba3c883e6
2
scripts/proguard.pro
vendored
2
scripts/proguard.pro
vendored
@ -42,8 +42,10 @@
|
||||
|
||||
#try to keep usage of schematica in separate classes
|
||||
-keep class baritone.utils.schematic.schematica.**
|
||||
-keep class baritone.utils.schematic.litematica.**
|
||||
#proguard doesnt like it when it cant find our fake schematica classes
|
||||
-dontwarn baritone.utils.schematic.schematica.**
|
||||
-dontwarn baritone.utils.schematic.litematica.**
|
||||
|
||||
# copy all necessary libraries into tempLibraries to build
|
||||
|
||||
|
@ -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("No schematic currently open");
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user