auto formatting

This commit is contained in:
rycbar0 2022-10-03 20:13:11 +02:00
parent fc65f22feb
commit 3a5608566e
6 changed files with 65 additions and 60 deletions

View File

@ -26,9 +26,9 @@ import baritone.api.process.IBuilderProcess;
import baritone.api.process.PathingCommand; import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType; import baritone.api.process.PathingCommandType;
import baritone.api.schematic.FillSchematic; import baritone.api.schematic.FillSchematic;
import baritone.api.schematic.SubstituteSchematic;
import baritone.api.schematic.ISchematic; import baritone.api.schematic.ISchematic;
import baritone.api.schematic.IStaticSchematic; import baritone.api.schematic.IStaticSchematic;
import baritone.api.schematic.SubstituteSchematic;
import baritone.api.schematic.format.ISchematicFormat; import baritone.api.schematic.format.ISchematicFormat;
import baritone.api.utils.BetterBlockPos; import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.RayTraceUtils; import baritone.api.utils.RayTraceUtils;
@ -42,8 +42,8 @@ import baritone.utils.BaritoneProcessHelper;
import baritone.utils.BlockStateInterface; import baritone.utils.BlockStateInterface;
import baritone.utils.PathingCommandContext; import baritone.utils.PathingCommandContext;
import baritone.utils.schematic.MapArtSchematic; import baritone.utils.schematic.MapArtSchematic;
import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.SchematicSystem; import baritone.utils.schematic.SchematicSystem;
import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.format.defaults.LitematicaSchematic; import baritone.utils.schematic.format.defaults.LitematicaSchematic;
import baritone.utils.schematic.litematica.LitematicaHelper; import baritone.utils.schematic.litematica.LitematicaHelper;
import baritone.utils.schematic.schematica.SchematicaHelper; import baritone.utils.schematic.schematica.SchematicaHelper;
@ -183,6 +183,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
/** /**
* Builds the with index 'i' given schematic placement. * Builds the with index 'i' given schematic placement.
*
* @param i index reference to the schematic placement list. * @param i index reference to the schematic placement list.
*/ */
@Override @Override

View File

@ -61,36 +61,6 @@ public final class LitematicaSchematic extends StaticSchematic {
fillInSchematic(); fillInSchematic();
} }
/**
* @param s axis.
* @return the lowest coordinate of that axis of the schematic.
*/
private int getMinOfSchematic(String s) {
int n = Integer.MAX_VALUE;
for (String subReg : getRegions(nbt)) {
n = Math.min(n, getMinOfSubregion(nbt, subReg, s));
}
return n;
}
/**
* reads the file data.
*/
private void fillInSchematic() {
for (String subReg : getRegions(nbt)) {
NBTTagList usedBlockTypes = nbt.getCompoundTag("Regions").getCompoundTag(subReg).getTagList("BlockStatePalette", 10);
IBlockState[] blockList = getBlockList(usedBlockTypes);
int bitsPerBlock = getBitsPerBlock(usedBlockTypes.tagCount());
long regionVolume = getVolume(nbt, subReg);
long[] blockStateArray = getBlockStates(nbt, subReg);
LitematicaBitArray bitArray = new LitematicaBitArray(bitsPerBlock, regionVolume, blockStateArray);
writeSubregionIntoSchematic(nbt, subReg, blockList, bitArray);
}
}
/** /**
* @return Array of subregion names. * @return Array of subregion names.
*/ */
@ -203,6 +173,36 @@ public final class LitematicaSchematic extends StaticSchematic {
z < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("z")); z < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("z"));
} }
/**
* @param s axis.
* @return the lowest coordinate of that axis of the schematic.
*/
private int getMinOfSchematic(String s) {
int n = Integer.MAX_VALUE;
for (String subReg : getRegions(nbt)) {
n = Math.min(n, getMinOfSubregion(nbt, subReg, s));
}
return n;
}
/**
* reads the file data.
*/
private void fillInSchematic() {
for (String subReg : getRegions(nbt)) {
NBTTagList usedBlockTypes = nbt.getCompoundTag("Regions").getCompoundTag(subReg).getTagList("BlockStatePalette", 10);
IBlockState[] blockList = getBlockList(usedBlockTypes);
int bitsPerBlock = getBitsPerBlock(usedBlockTypes.tagCount());
long regionVolume = getVolume(nbt, subReg);
long[] blockStateArray = getBlockStates(nbt, subReg);
LitematicaBitArray bitArray = new LitematicaBitArray(bitsPerBlock, regionVolume, blockStateArray);
writeSubregionIntoSchematic(nbt, subReg, blockList, bitArray);
}
}
/** /**
* Writes the file data in to the IBlockstate array. * Writes the file data in to the IBlockstate array.
* *

View File

@ -67,11 +67,7 @@ public final class LitematicaHelper {
* @return the world coordinates of the schematic origin. This can but does not have to be the minimum corner. * @return the world coordinates of the schematic origin. This can but does not have to be the minimum corner.
*/ */
public static Vec3i getOrigin(int i) { public static Vec3i getOrigin(int i) {
int x,y,z; return DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getOrigin();
x=DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getOrigin().getX();
y=DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getOrigin().getY();
z=DataManager.getSchematicPlacementManager().getAllSchematicsPlacements().get(i).getOrigin().getZ();
return new Vec3i(x,y,z);
} }
/** /**

View File

@ -22,9 +22,11 @@ import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager;
public class DataManager { public class DataManager {
public static final DataManager INSTANCE = new DataManager(); public static final DataManager INSTANCE = new DataManager();
private final SchematicPlacementManager schematicPlacementManager = new SchematicPlacementManager(); private final SchematicPlacementManager schematicPlacementManager = new SchematicPlacementManager();
private static DataManager getInstance() { private static DataManager getInstance() {
return INSTANCE; return INSTANCE;
} }
public static SchematicPlacementManager getSchematicPlacementManager() { public static SchematicPlacementManager getSchematicPlacementManager() {
return getInstance().schematicPlacementManager; return getInstance().schematicPlacementManager;
} }

View File

@ -23,9 +23,11 @@ import net.minecraft.util.Rotation;
public class SchematicPlacement extends SchematicPlacementUnloaded { public class SchematicPlacement extends SchematicPlacementUnloaded {
private Rotation rotation; private Rotation rotation;
private Mirror mirror; private Mirror mirror;
public Rotation getRotation() { public Rotation getRotation() {
return this.rotation; return this.rotation;
} }
public Mirror getMirror() { public Mirror getMirror() {
return this.mirror; return this.mirror;
} }

View File

@ -24,15 +24,19 @@ import java.io.File;
public class SchematicPlacementUnloaded { public class SchematicPlacementUnloaded {
protected String name = "?"; protected String name = "?";
@Nullable protected File schematicFile; @Nullable
protected File schematicFile;
protected BlockPos origin = BlockPos.ORIGIN; protected BlockPos origin = BlockPos.ORIGIN;
public String getName() { public String getName() {
return this.name; return this.name;
} }
@Nullable @Nullable
public File getSchematicFile() { public File getSchematicFile() {
return this.schematicFile; return this.schematicFile;
} }
public BlockPos getOrigin() { public BlockPos getOrigin() {
return this.origin; return this.origin;
} }