Merge pull request #3803 from Entropy5/master

Litematica x BuildOnlySelection support
This commit is contained in:
leijurv
2023-01-27 23:34:35 -08:00
committed by GitHub

View File

@@ -157,7 +157,6 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (!format.isPresent()) {
return false;
}
ISchematic parsed;
try {
parsed = format.get().parse(new FileInputStream(schematic));
@@ -165,20 +164,22 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
e.printStackTrace();
return false;
}
if (Baritone.settings().mapArtMode.value) {
parsed = new MapArtSchematic((IStaticSchematic) parsed);
}
if (Baritone.settings().buildOnlySelection.value) {
parsed = new SelectionSchematic(parsed, origin, baritone.getSelectionManager().getSelections());
}
parsed = applyMapArtAndSelection(origin, (IStaticSchematic) parsed);
build(name, parsed, origin);
return true;
}
private ISchematic applyMapArtAndSelection(Vec3i origin, IStaticSchematic parsed) {
ISchematic schematic = parsed;
if (Baritone.settings().mapArtMode.value) {
schematic = new MapArtSchematic(parsed);
}
if (Baritone.settings().buildOnlySelection.value) {
schematic = new SelectionSchematic(schematic, origin, baritone.getSelectionManager().getSelections());
}
return schematic;
}
@Override
public void buildOpenSchematic() {
if (SchematicaHelper.isSchematicaPresent()) {
@@ -217,7 +218,8 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
try {
LitematicaSchematic schematic1 = new LitematicaSchematic(CompressedStreamTools.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath())), false);
Vec3i correctedOrigin = LitematicaHelper.getCorrectedOrigin(schematic1, i);
LitematicaSchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i);
ISchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i);
schematic2 = applyMapArtAndSelection(origin, (IStaticSchematic) schematic2);
build(name, schematic2, correctedOrigin);
} catch (IOException e) {
logDirect("Schematic File could not be loaded.");