This commit is contained in:
RePixelatedMC
2024-07-29 20:16:15 +02:00
parent fe5bb67973
commit 7ae846af6f
8 changed files with 44 additions and 0 deletions
@@ -19,8 +19,12 @@
package com.volmit.iris.core.pregenerator; package com.volmit.iris.core.pregenerator;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.nms.IHeadless;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
import com.volmit.iris.core.pack.IrisPack; import com.volmit.iris.core.pack.IrisPack;
import com.volmit.iris.core.tools.IrisPackBenchmarking; import com.volmit.iris.core.tools.IrisPackBenchmarking;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KSet; import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
@@ -18,7 +18,9 @@
package com.volmit.iris.core.pregenerator; package com.volmit.iris.core.pregenerator;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.util.mantle.Mantle; import com.volmit.iris.util.mantle.Mantle;
import org.bukkit.World;
/** /**
* Represents something that is capable of generating in chunks or regions, or both * Represents something that is capable of generating in chunks or regions, or both
@@ -77,4 +79,6 @@ public interface PregeneratorMethod {
void generateChunk(int x, int z, PregenListener listener); void generateChunk(int x, int z, PregenListener listener);
Mantle getMantle(); Mantle getMantle();
World getWorld();
} }
@@ -26,8 +26,10 @@ import org.bukkit.World;
public class AsyncOrMedievalPregenMethod implements PregeneratorMethod { public class AsyncOrMedievalPregenMethod implements PregeneratorMethod {
private final PregeneratorMethod method; private final PregeneratorMethod method;
private final World world;
public AsyncOrMedievalPregenMethod(World world, int threads) { public AsyncOrMedievalPregenMethod(World world, int threads) {
this.world = world;
method = PaperLib.isPaper() ? new AsyncPregenMethod(world, threads) : new MedievalPregenMethod(world); method = PaperLib.isPaper() ? new AsyncPregenMethod(world, threads) : new MedievalPregenMethod(world);
} }
@@ -70,4 +72,9 @@ public class AsyncOrMedievalPregenMethod implements PregeneratorMethod {
public Mantle getMantle() { public Mantle getMantle() {
return method.getMantle(); return method.getMantle();
} }
@Override
public World getWorld() {
return world;
}
} }
@@ -177,4 +177,9 @@ public class AsyncPregenMethod implements PregeneratorMethod {
return null; return null;
} }
@Override
public World getWorld() {
return world;
}
} }
@@ -21,6 +21,7 @@ package com.volmit.iris.core.pregenerator.methods;
import com.volmit.iris.core.pregenerator.PregenListener; import com.volmit.iris.core.pregenerator.PregenListener;
import com.volmit.iris.core.pregenerator.PregeneratorMethod; import com.volmit.iris.core.pregenerator.PregeneratorMethod;
import com.volmit.iris.util.mantle.Mantle; import com.volmit.iris.util.mantle.Mantle;
import org.bukkit.World;
public class DummyPregenMethod implements PregeneratorMethod { public class DummyPregenMethod implements PregeneratorMethod {
@Override @Override
@@ -62,4 +63,9 @@ public class DummyPregenMethod implements PregeneratorMethod {
public Mantle getMantle() { public Mantle getMantle() {
return null; return null;
} }
@Override
public World getWorld() {
return null;
}
} }
@@ -9,6 +9,7 @@ import com.volmit.iris.core.pregenerator.PregeneratorMethod;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.util.mantle.Mantle; import com.volmit.iris.util.mantle.Mantle;
import com.volmit.iris.util.parallel.MultiBurst; import com.volmit.iris.util.parallel.MultiBurst;
import org.bukkit.World;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
@@ -18,8 +19,10 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
private final IHeadless headless; private final IHeadless headless;
private final Semaphore semaphore; private final Semaphore semaphore;
private final int max; private final int max;
private final World world;
public HeadlessPregenMethod(Engine engine) { public HeadlessPregenMethod(Engine engine) {
this.world = engine.getWorld().realWorld();
this.max = IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism()); this.max = IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism());
this.engine = engine; this.engine = engine;
this.headless = INMS.get().createHeadless(engine); this.headless = INMS.get().createHeadless(engine);
@@ -84,4 +87,9 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
public Mantle getMantle() { public Mantle getMantle() {
return engine.getMantle().getMantle(); return engine.getMantle().getMantle();
} }
@Override
public World getWorld() {
return world;
}
} }
@@ -71,4 +71,9 @@ public class HybridPregenMethod implements PregeneratorMethod {
public Mantle getMantle() { public Mantle getMantle() {
return inWorld.getMantle(); return inWorld.getMantle();
} }
@Override
public World getWorld() {
return world;
}
} }
@@ -134,4 +134,9 @@ public class MedievalPregenMethod implements PregeneratorMethod {
return null; return null;
} }
@Override
public World getWorld() {
return world;
}
} }