This commit is contained in:
Zoë Gidiere
2025-06-18 11:43:35 -06:00
parent 3f77b4a975
commit 46e603d681
233 changed files with 824 additions and 818 deletions

View File

@@ -1,44 +1,48 @@
package com.dfsek.terra.cli;
import com.dfsek.seismic.type.vector.Vector2Int;
import net.querz.mca.MCAUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import java.io.IOException;
import java.util.concurrent.Callable;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
import com.dfsek.seismic.type.vector.Vector2Int;
import com.dfsek.terra.cli.world.CLIWorld;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
//TODO auto pull in version
@Command(name = "TerraCLI", mixinStandardHelpOptions = true, version = "6.6.0",
description = "Generates a Terra World and saves it in minecraft region format.")
public final class TerraCLI implements Callable<Integer> {
@Option(names = { "-s", "--size"}, description = "Number of regions to generate.")
@Option(names = { "-s", "--size" }, description = "Number of regions to generate.")
private int size = 2;
@Option(names = { "-p", "--pack"}, description = "Config pack to use.")
@Option(names = { "-p", "--pack" }, description = "Config pack to use.")
private String pack = "OVERWORLD";
@Option(names = { "--seed"}, description = "Seed for world generation.")
@Option(names = { "--seed" }, description = "Seed for world generation.")
private long seed = 0;
@Option(names = { "--max-height"}, description = "Maximum height of the world.")
@Option(names = { "--max-height" }, description = "Maximum height of the world.")
private int maxHeight = 320;
@Option(names = { "--min-height"}, description = "Minimum height of the world.")
@Option(names = { "--min-height" }, description = "Minimum height of the world.")
private int minHeight = -64;
@Option(names = { "--no-save"}, description = "Don't save the world to disk.")
@Option(names = { "--no-save" }, description = "Don't save the world to disk.")
private boolean noSave = false;
public static void main(String... args) {
int exitCode = new CommandLine(new TerraCLI()).execute(args);
System.exit(exitCode);
}
@Override
public Integer call() {
Logger LOGGER = LoggerFactory.getLogger(TerraCLI.class);
@@ -70,9 +74,4 @@ public final class TerraCLI implements Callable<Integer> {
LOGGER.info("Done.");
return 0;
}
public static void main(String... args) {
int exitCode = new CommandLine(new TerraCLI()).execute(args);
System.exit(exitCode);
}
}

View File

@@ -1,5 +1,7 @@
package com.dfsek.terra.cli.world;
import com.dfsek.seismic.type.vector.Vector2Int;
import com.dfsek.seismic.type.vector.Vector3;
import com.google.common.collect.Streams;
import net.querz.mca.MCAFile;
import org.slf4j.Logger;
@@ -22,8 +24,6 @@ import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.util.generic.pair.Pair;
import com.dfsek.seismic.type.vector.Vector2Int;
import com.dfsek.seismic.type.vector.Vector3;
import com.dfsek.terra.api.world.ServerWorld;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
@@ -87,7 +87,7 @@ public class CLIWorld implements ServerWorld, NBTSerializable<Stream<Pair<Vector
try {
int num = amount.getAndIncrement();
CLIChunk chunk;
if (!noSave) {
if(!noSave) {
chunk = getChunkAt(finalX, finalZ);
} else {
chunk = new CLIChunk(Math.floorMod(finalX, 32), Math.floorMod(finalZ, 32), this);