need stronger pesticides, bugs keep multiplying

This commit is contained in:
rycbar0 2022-10-03 02:35:25 +02:00
parent 3e75cc7408
commit fdfeeb2ffa
3 changed files with 34 additions and 19 deletions

View File

@ -189,10 +189,15 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
String name = LitematicaHelper.getName(i); String name = LitematicaHelper.getName(i);
try { try {
LitematicaSchematic schematic1 = new LitematicaSchematic(CompressedStreamTools.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath())),false); LitematicaSchematic schematic1 = new LitematicaSchematic(CompressedStreamTools.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath())),false);
LitematicaSchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i); try {
Vec3i correctedOrigin = LitematicaHelper.getCorrectedOrigin(schematic2, i); LitematicaSchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i);
Vec3i correctedOrigin = LitematicaHelper.getCorrectedOrigin(schematic2, i);
//Vec3i correctedOrigin = new Vec3i(0,4,0);
build(name, schematic2, correctedOrigin); build(name, schematic2, correctedOrigin);
} catch (IndexOutOfBoundsException e) {
logDirect("BlackMagicFuckery summoned a Balrog. This foe is beyond any of you. ");
}
} catch (IOException e) { } catch (IOException e) {
logDirect("Schematic File could not be loaded"); logDirect("Schematic File could not be loaded");
} }

View File

@ -62,7 +62,7 @@ public final class LitematicaSchematic extends StaticSchematic {
} }
private int getMinOfSchematic(String s) { private int getMinOfSchematic(String s) {
int n = 0; int n = Integer.MAX_VALUE;
for (String subReg : getRegions(nbt)) { for (String subReg : getRegions(nbt)) {
n = Math.min(n, getMinOfSubregion(nbt, subReg, s)); n = Math.min(n, getMinOfSubregion(nbt, subReg, s));
} }

View File

@ -59,9 +59,14 @@ public final class LitematicaHelper {
return DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getMirror(); return DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getMirror();
} }
public static Vec3i getCorrectedOrigin(LitematicaSchematic schematic, int i) { public static Vec3i getCorrectedOrigin(LitematicaSchematic schematic, int i) {
int x = LitematicaHelper.getOrigin(i).getX() + schematic.getMinimumCorner().getX(); int x = LitematicaHelper.getOrigin(i).getX();
int y = LitematicaHelper.getOrigin(i).getY() + schematic.getMinimumCorner().getY(); int y = LitematicaHelper.getOrigin(i).getY();
int z = LitematicaHelper.getOrigin(i).getZ() + schematic.getMinimumCorner().getZ(); int z = LitematicaHelper.getOrigin(i).getZ();
int mx = schematic.getMinimumCorner().getX();
int my = schematic.getMinimumCorner().getY();
int mz = schematic.getMinimumCorner().getZ();
int sx = (schematic.getX() - 1) * -1;
int sz = (schematic.getZ() - 1) * -1;
Vec3i correctedOrigin; Vec3i correctedOrigin;
Mirror mirror = LitematicaHelper.getMirror(i); Mirror mirror = LitematicaHelper.getMirror(i);
Rotation rotation = LitematicaHelper.getRotation(i); Rotation rotation = LitematicaHelper.getRotation(i);
@ -72,32 +77,32 @@ public final class LitematicaHelper {
case LEFT_RIGHT: case LEFT_RIGHT:
switch ((mirror.ordinal()*2+rotation.ordinal())%4) { switch ((mirror.ordinal()*2+rotation.ordinal())%4) {
case 1: case 1:
correctedOrigin = new Vec3i(x - schematic.getX()+1, y, z - schematic.getZ()+1); correctedOrigin = new Vec3i(x + (sz - mz), y + my, z + (sx - mx));
break; break;
case 2: case 2:
correctedOrigin = new Vec3i(x, y, z - schematic.getZ()+1); correctedOrigin = new Vec3i(x + mx, y + my, z + (sz - mz));
break; break;
case 3: case 3:
correctedOrigin = new Vec3i(x, y, z); correctedOrigin = new Vec3i(x + mz, y + my, z + mx);
break; break;
default: default:
correctedOrigin = new Vec3i(x - schematic.getX()+1, y, z); correctedOrigin = new Vec3i(x + (sx - mx), y + my, z + mz);
break; break;
} }
break; break;
default: default:
switch (rotation) { switch (rotation) {
case CLOCKWISE_90: case CLOCKWISE_90:
correctedOrigin = new Vec3i(x - schematic.getX()+1, y, z); correctedOrigin = new Vec3i(x + (sz - mz), y + my, z + mz);
break; break;
case CLOCKWISE_180: case CLOCKWISE_180:
correctedOrigin = new Vec3i(x - schematic.getX()+1, y, z - schematic.getZ()+1); correctedOrigin = new Vec3i(x + (sx - mx), y + my, z + (sz - mz));
break; break;
case COUNTERCLOCKWISE_90: case COUNTERCLOCKWISE_90:
correctedOrigin = new Vec3i(x, y, z - schematic.getZ()+1); correctedOrigin = new Vec3i(x + mz, y + my, z + (sx - mx));
break; break;
default: default:
correctedOrigin = new Vec3i(x, y, z); correctedOrigin = new Vec3i(x + mx, y + my, z + mz);
break; break;
} }
} }
@ -122,18 +127,23 @@ public final class LitematicaHelper {
for (int zCounter=0; zCounter<schemIn.getZ(); zCounter++) { for (int zCounter=0; zCounter<schemIn.getZ(); zCounter++) {
for (int xCounter=0; xCounter<schemIn.getX(); xCounter++) { for (int xCounter=0; xCounter<schemIn.getX(); xCounter++) {
Vec3i xyzHolder = new Vec3i(xCounter, yCounter, zCounter); Vec3i xyzHolder = new Vec3i(xCounter, yCounter, zCounter);
//System.out.println(String.format("In: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ())); System.out.println(String.format("In: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ()));
xyzHolder = LitematicaHelper.doMirroring(xyzHolder, schemIn.getX() - 1, schemIn.getZ() - 1, LitematicaHelper.getMirror(i)); xyzHolder = LitematicaHelper.doMirroring(xyzHolder, schemIn.getX() - 1, schemIn.getZ() - 1, LitematicaHelper.getMirror(i));
//System.out.println(String.format("Mirror: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ())); System.out.println(String.format("Mirror: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ()));
for (int turns = 0; turns < LitematicaHelper.getRotation(i).ordinal(); turns++) { for (int turns = 0; turns < LitematicaHelper.getRotation(i).ordinal(); turns++) {
if ((turns%2)==0) { if ((turns%2)==0) {
xyzHolder = LitematicaHelper.rotate(xyzHolder, schemIn.getX() - 1, schemIn.getZ() - 1); xyzHolder = LitematicaHelper.rotate(xyzHolder, schemIn.getX() - 1, schemIn.getZ() - 1);
} else { } else {
xyzHolder = LitematicaHelper.rotate(xyzHolder, schemIn.getZ() - 1, schemIn.getX() - 1); xyzHolder = LitematicaHelper.rotate(xyzHolder, schemIn.getZ() - 1, schemIn.getX() - 1);
} }
//System.out.println(String.format("Turned: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ())); System.out.println(String.format("Turned: %s, sizeX=%S, sizeZ=%s",xyzHolder,schemIn.getX(),schemIn.getZ()));
}
IBlockState state = schemIn.getDirect(xCounter, yCounter, zCounter);
try {
state.withMirror(LitematicaHelper.getMirror(i)).withRotation(LitematicaHelper.getRotation(i));
} catch (NullPointerException e) {
System.out.println("nullpointerexception aka schemblock that is void");
} }
IBlockState state = schemIn.getDirect(xCounter, yCounter, zCounter).withMirror(LitematicaHelper.getMirror(i)).withRotation(LitematicaHelper.getRotation(i));
tempSchem.setDirect(xyzHolder.getX(), xyzHolder.getY(), xyzHolder.getZ(), state); tempSchem.setDirect(xyzHolder.getX(), xyzHolder.getY(), xyzHolder.getZ(), state);
} }
} }