Use toString like for schematica

This commit is contained in:
ZacSharp
2024-07-30 01:29:24 +02:00
parent e71547b9ef
commit 1a0cca794c
2 changed files with 11 additions and 12 deletions

View File

@@ -229,12 +229,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (LitematicaHelper.isLitematicaPresent()) {
//if java.lang.NoSuchMethodError is thrown see comment in SchematicPlacementManager
if (LitematicaHelper.hasLoadedSchematic(i)) {
String name = LitematicaHelper.getName(i);
try {
Tuple<IStaticSchematic, Vec3i> schematic = LitematicaHelper.getSchematic(i);
Vec3i correctedOrigin = schematic.getB();
ISchematic schematic2 = applyMapArtAndSelection(correctedOrigin, schematic.getA());
build(name, schematic2, correctedOrigin);
build(schematic.getA().toString(), schematic2, correctedOrigin);
} catch (Exception e) {
logDirect("Schematic File could not be loaded.");
}

View File

@@ -68,14 +68,6 @@ public final class LitematicaHelper {
return DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i);
}
/**
* @param i index of the Schematic in the schematic placement list.
* @return the name of the requested schematic.
*/
public static String getName(int i) {
return getPlacement(i).getName();
}
private static Vec3i transform(Vec3i in, Mirror mirror, Rotation rotation) {
int x = in.getX();
int z = in.getZ();
@@ -131,7 +123,7 @@ public final class LitematicaHelper {
StaticSchematic schematic = new StaticSchematic(states);
subRegions.put(pos.offset(mx, my, mz), schematic);
}
LitematicaPlacementSchematic composite = new LitematicaPlacementSchematic();
LitematicaPlacementSchematic composite = new LitematicaPlacementSchematic(placement.getName());
for (Map.Entry<Vec3i, StaticSchematic> entry : subRegions.entrySet()) {
Vec3i pos = entry.getKey().offset(-minX, -minY, -minZ);
composite.put(entry.getValue(), pos.getX(), pos.getY(), pos.getZ());
@@ -140,8 +132,11 @@ public final class LitematicaHelper {
}
private static class LitematicaPlacementSchematic extends CompositeSchematic implements IStaticSchematic {
public LitematicaPlacementSchematic() {
private final String name;
public LitematicaPlacementSchematic(String name) {
super(0, 0, 0);
this.name = name;
}
@Override
@@ -151,5 +146,10 @@ public final class LitematicaHelper {
}
return null;
}
@Override
public String toString() {
return name;
}
}
}