mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-07 00:06:10 +00:00
Cleanup Code
This commit is contained in:
@@ -20,8 +20,6 @@ package com.volmit.iris.engine.headless;
|
||||
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.engine.data.mca.LoadFlags;
|
||||
import com.volmit.iris.engine.data.mca.MCAFile;
|
||||
import com.volmit.iris.engine.data.mca.MCAUtil;
|
||||
import com.volmit.iris.engine.data.mca.NBTWorld;
|
||||
import com.volmit.iris.engine.framework.EngineCompositeGenerator;
|
||||
@@ -35,14 +33,13 @@ import java.io.IOException;
|
||||
|
||||
@Data
|
||||
public class HeadlessGenerator {
|
||||
private static KList<Position2> EMPTYPOINTS = new KList<>();
|
||||
private static KList<Position2> EMPTYPOINTS = new KList<>();
|
||||
private final HeadlessWorld world;
|
||||
private final EngineCompositeGenerator generator;
|
||||
private final NBTWorld writer;
|
||||
private final MultiBurst burst;
|
||||
|
||||
public HeadlessGenerator(HeadlessWorld world)
|
||||
{
|
||||
public HeadlessGenerator(HeadlessWorld world) {
|
||||
this.world = world;
|
||||
burst = new MultiBurst("Iris Headless Generator", 9, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount()));
|
||||
writer = new NBTWorld(world.getWorld().worldFolder());
|
||||
@@ -52,40 +49,33 @@ public class HeadlessGenerator {
|
||||
generator.initialize(world.getWorld());
|
||||
}
|
||||
|
||||
public void generateChunk(int x, int z)
|
||||
{
|
||||
public void generateChunk(int x, int z) {
|
||||
generator.directWriteChunk(world.getWorld(), x, z, writer);
|
||||
}
|
||||
|
||||
public void generateRegion(int x, int z)
|
||||
{
|
||||
public void generateRegion(int x, int z) {
|
||||
generator.directWriteMCA(world.getWorld(), x, z, writer, burst);
|
||||
}
|
||||
|
||||
public void generateRegion(int x, int z, PregenListener listener)
|
||||
{
|
||||
public void generateRegion(int x, int z, PregenListener listener) {
|
||||
generator.directWriteMCA(world.getWorld(), x, z, writer, burst, listener);
|
||||
}
|
||||
|
||||
public File generateRegionToFile(int x, int z, PregenListener listener)
|
||||
{
|
||||
public File generateRegionToFile(int x, int z, PregenListener listener) {
|
||||
generateRegionToFile(x, z, listener);
|
||||
flush();
|
||||
return writer.getRegionFile(x, z);
|
||||
}
|
||||
|
||||
public void flush()
|
||||
{
|
||||
public void flush() {
|
||||
writer.flushNow();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
public void save() {
|
||||
writer.save();
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
public void close() {
|
||||
burst.shutdownAndAwait();
|
||||
generator.close();
|
||||
writer.close();
|
||||
|
||||
@@ -40,13 +40,11 @@ public class HeadlessWorld {
|
||||
private final IrisWorld world;
|
||||
private boolean studio = false;
|
||||
|
||||
public HeadlessWorld(String worldName, IrisDimension dimension, long seed)
|
||||
{
|
||||
public HeadlessWorld(String worldName, IrisDimension dimension, long seed) {
|
||||
this(worldName, dimension, seed, false);
|
||||
}
|
||||
|
||||
public HeadlessWorld(String worldName, IrisDimension dimension, long seed, boolean studio)
|
||||
{
|
||||
public HeadlessWorld(String worldName, IrisDimension dimension, long seed, boolean studio) {
|
||||
this.worldName = worldName;
|
||||
this.dimension = dimension;
|
||||
this.studio = studio;
|
||||
@@ -61,19 +59,16 @@ public class HeadlessWorld {
|
||||
world.worldFolder().mkdirs();
|
||||
new File(world.worldFolder(), "region").mkdirs();
|
||||
|
||||
if(!studio && !new File(world.worldFolder(), "iris").exists())
|
||||
{
|
||||
if (!studio && !new File(world.worldFolder(), "iris").exists()) {
|
||||
Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag("Headless")), dimension.getLoadKey(), world.worldFolder());
|
||||
}
|
||||
}
|
||||
|
||||
public HeadlessGenerator generate()
|
||||
{
|
||||
public HeadlessGenerator generate() {
|
||||
return new HeadlessGenerator(this);
|
||||
}
|
||||
|
||||
public World load()
|
||||
{
|
||||
public World load() {
|
||||
return new WorldCreator(worldName)
|
||||
.environment(dimension.getEnvironment())
|
||||
.seed(world.seed())
|
||||
@@ -85,8 +80,7 @@ public class HeadlessWorld {
|
||||
return new HeadlessWorld(world.getName(), IrisWorlds.access(world).getTarget().getDimension(), world.getSeed());
|
||||
}
|
||||
|
||||
public static HeadlessWorld from(String name, String dimension, long seed)
|
||||
{
|
||||
public static HeadlessWorld from(String name, String dimension, long seed) {
|
||||
return new HeadlessWorld(name, IrisDataManager.loadAnyDimension(dimension), seed);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user