This commit is contained in:
RePixelatedMC
2024-10-29 13:36:32 +01:00
parent 537b0f8dd6
commit fd38f0d127
2 changed files with 7 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RollingSequence;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import com.volmit.iris.util.scheduling.Queue;
import com.volmit.iris.util.scheduling.ShurikenQueue;
@@ -76,7 +77,7 @@ public class IrisMerger {
*/
@Deprecated
public void generateVanillaUnderground(int cx, int cz, Engine engine) {
if (engine.getMemoryWorld() == null)
if (engine.getMemoryWorld() == null && useGenerator)
throw new IllegalStateException("MemoryWorld is null. Ensure that it has been initialized.");
if (engine.getWorld().realWorld() == null)
return;
@@ -102,6 +103,9 @@ public class IrisMerger {
Chunk chunk = bukkit.getChunkAt(cx, cz);
Chunk ichunk = engine.getWorld().realWorld().getChunkAt(cx, cz);
if (!chunk.isLoaded())
J.s(chunk::load);
int totalHeight = bukkit.getMaxHeight() - bukkit.getMinHeight();
int minHeight = Math.abs(bukkit.getMinHeight());
@@ -198,7 +202,7 @@ public class IrisMerger {
}
}
}
J.s(chunk::unload);
mergeDuration.put(p.getMilliseconds());
Iris.info("Vanilla merge average in: " + Form.duration(mergeDuration.getAverage(), 8));
} catch (Exception e) {
@@ -256,10 +260,6 @@ public class IrisMerger {
if (!chunk.isGenerated())
throw new IllegalStateException("Chunk is not generated!");
if (!chunk.isLoaded()) {
chunk.load();
}
int minHeight = chunk.getWorld().getMinHeight();
int maxHeight = chunk.getWorld().getMaxHeight();
int totalHeight = Math.abs(minHeight) + maxHeight;

View File

@@ -385,7 +385,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@EventHandler
private void onChunkGeneration(ChunkLoadEvent event) {
if (engine == null ||!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger() || engine.getMemoryWorld() == null)
if (engine == null ||!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger())
return;
engine.getMerger().generateVanillaUnderground(event.getChunk().getX(), event.getChunk().getZ(), engine);
}