diff --git a/src/main/java/com/volmit/iris/core/tools/IrisWorlds.java b/src/main/java/com/volmit/iris/core/tools/IrisWorlds.java
deleted file mode 100644
index 505ae581a..000000000
--- a/src/main/java/com/volmit/iris/core/tools/IrisWorlds.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2021 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.volmit.iris.core.tools;
-
-import com.volmit.iris.Iris;
-import com.volmit.iris.engine.framework.IrisAccess;
-import com.volmit.iris.engine.framework.IrisAccessProvider;
-import com.volmit.iris.util.collection.KMap;
-import com.volmit.iris.util.plugin.VolmitSender;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-
-@SuppressWarnings("ALL")
-public class IrisWorlds {
- private static final KMap provisioned = new KMap<>();
-
- public static void register(World w, IrisAccess p) {
- provisioned.put(w.getUID().toString(), p);
- }
-
- public static boolean isIrisWorld(World world) {
- if (world == null) {
- return false;
- }
-
- if (provisioned.containsKey(world.getUID().toString())) {
- return true;
- }
-
- return world.getGenerator() instanceof IrisAccess || world.getGenerator() instanceof IrisAccessProvider;
- }
-
- public static IrisAccess access(World world) {
- if (isIrisWorld(world)) {
- if (provisioned.containsKey(world.getUID().toString())) {
- return provisioned.get(world.getUID().toString());
- }
-
- return world.getGenerator() instanceof IrisAccessProvider ? (((IrisAccessProvider) world.getGenerator()).getAccess()) : ((IrisAccess) world.getGenerator());
- }
-
- return null;
- }
-
- public static boolean evacuate(World world) {
- for (World i : Bukkit.getWorlds()) {
- if (!i.getName().equals(world.getName())) {
- for (Player j : world.getPlayers()) {
- new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world.");
- j.teleport(i.getSpawnLocation());
- }
-
- return true;
- }
- }
-
- return false;
- }
-
- public static boolean evacuate(World world, String m) {
- for (World i : Bukkit.getWorlds()) {
- if (!i.getName().equals(world.getName())) {
- for (Player j : world.getPlayers()) {
- new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world. " + m);
- j.teleport(i.getSpawnLocation());
- }
-
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java b/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java
deleted file mode 100644
index 63256bc7c..000000000
--- a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2021 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.volmit.iris.engine;
-
-import com.volmit.iris.Iris;
-import com.volmit.iris.core.IrisSettings;
-import com.volmit.iris.core.project.loader.IrisData;
-import com.volmit.iris.engine.framework.Engine;
-import com.volmit.iris.engine.framework.EngineCompound;
-import com.volmit.iris.engine.framework.EngineData;
-import com.volmit.iris.engine.framework.EngineTarget;
-import com.volmit.iris.engine.object.basic.IrisPosition;
-import com.volmit.iris.engine.object.common.IrisWorld;
-import com.volmit.iris.engine.object.dimensional.IrisDimension;
-import com.volmit.iris.engine.object.dimensional.IrisDimensionIndex;
-import com.volmit.iris.util.atomics.AtomicRollingSequence;
-import com.volmit.iris.util.collection.KList;
-import com.volmit.iris.util.collection.KMap;
-import com.volmit.iris.util.documentation.BlockCoordinates;
-import com.volmit.iris.util.documentation.ChunkCoordinates;
-import com.volmit.iris.util.format.C;
-import com.volmit.iris.util.format.Form;
-import com.volmit.iris.util.hunk.Hunk;
-import com.volmit.iris.util.parallel.MultiBurst;
-import com.volmit.iris.util.scheduling.PrecisionStopwatch;
-import lombok.Getter;
-import lombok.Setter;
-import org.bukkit.block.Biome;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.command.CommandSender;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.world.WorldSaveEvent;
-import org.bukkit.generator.BlockPopulator;
-
-import java.io.File;
-import java.util.List;
-
-public class IrisEngineCompound implements EngineCompound {
- @Getter
- private final IrisWorld world;
-
- private final AtomicRollingSequence wallClock;
-
- private Engine defaultEngine;
-
- @Getter
- private final EngineData engineMetadata;
-
- private final Engine[] engines;
-
- @Getter
- private final MultiBurst burster;
-
- @Getter
- private final KList populators;
-
- @Getter
- private final IrisDimension rootDimension;
-
- @Getter
- private final int threadCount = -1;
-
- @Getter
- @Setter
- private boolean studio;
-
- public IrisEngineCompound(IrisWorld world, IrisDimension rootDimension, IrisData data, int maximumThreads) {
- wallClock = new AtomicRollingSequence(32);
- this.rootDimension = rootDimension;
- Iris.info("Initializing Engine Composite for " + world.name());
- this.world = world;
- engineMetadata = EngineData.load(getEngineMetadataFile());
- engineMetadata.setDimension(rootDimension.getLoadKey());
- engineMetadata.setLastVersion(Iris.instance.getDescription().getVersion());
-
- saveEngineMetadata();
- populators = new KList<>();
-
- if (rootDimension.getDimensionalComposite().isEmpty()) {
- burster = null;
- // TODO: WARNING HEIGHT
- engines = new Engine[]{new IrisEngine(new EngineTarget(world, rootDimension, data, 256, maximumThreads), this, 0)};
- defaultEngine = engines[0];
- } else {
- double totalWeight = 0D;
- engines = new Engine[rootDimension.getDimensionalComposite().size()];
- burster = engines.length > 1 ? new MultiBurst("Iris Compound " + rootDimension.getName(), IrisSettings.get().getConcurrency().getEngineThreadPriority(), engines.length) : null;
- int threadDist = (Math.max(2, maximumThreads - engines.length)) / engines.length;
-
- if ((threadDist * engines.length) + engines.length > maximumThreads) {
- Iris.warn("Using " + ((threadDist * engines.length) + engines.length) + " threads instead of the configured " + maximumThreads + " maximum thread count due to the requirements of this dimension!");
- }
-
- for (IrisDimensionIndex i : rootDimension.getDimensionalComposite()) {
- totalWeight += i.getWeight();
- }
-
- int buf = 0;
-
- for (int i = 0; i < engines.length; i++) {
- IrisDimensionIndex index = rootDimension.getDimensionalComposite().get(i);
- IrisDimension dimension = data.getDimensionLoader().load(index.getDimension());
- // TODO: WARNING HEIGHT
- engines[i] = new IrisEngine(new EngineTarget(world, dimension, data.copy(), (int) Math.floor(256D * (index.getWeight() / totalWeight)), index.isInverted(), threadDist), this, i);
- engines[i].setMinHeight(buf);
- buf += engines[i].getHeight();
-
- if (index.isPrimary()) {
- defaultEngine = engines[i];
- }
- }
-
- if (defaultEngine == null) {
- defaultEngine = engines[0];
- }
- }
-
- for (Engine i : engines) {
- if (i instanceof BlockPopulator) {
- populators.add((BlockPopulator) i);
- }
- }
-
- Iris.instance.registerListener(this);
- }
-
- public List getStrongholdPositions() {
- return engineMetadata.getStrongholdPositions();
- }
-
- @EventHandler
- public void on(WorldSaveEvent e) {
- if (world != null && e.getWorld().equals(world)) {
- save();
- }
- }
-
- public void printMetrics(CommandSender sender) {
- KMap totals = new KMap<>();
- KMap weights = new KMap<>();
- double masterWallClock = wallClock.getAverage();
-
- for (int i = 0; i < getSize(); i++) {
- Engine e = getEngine(i);
- KMap timings = e.getMetrics().pull();
- double totalWeight = 0;
- double wallClock = e.getMetrics().getTotal().getAverage();
-
- for (double j : timings.values()) {
- totalWeight += j;
- }
-
- for (String j : timings.k()) {
- weights.put(e.getName() + "[" + e.getIndex() + "]." + j, (wallClock / totalWeight) * timings.get(j));
- }
-
- totals.put(e.getName() + "[" + e.getIndex() + "]", wallClock);
- }
-
- double mtotals = 0;
-
- for (double i : totals.values()) {
- mtotals += i;
- }
-
- for (String i : totals.k()) {
- totals.put(i, (masterWallClock / mtotals) * totals.get(i));
- }
-
- double v = 0;
-
- for (double i : weights.values()) {
- v += i;
- }
-
- for (String i : weights.k()) {
- weights.put(i, weights.get(i) / v);
- }
-
- sender.sendMessage("Total: " + C.BOLD + C.WHITE + Form.duration(masterWallClock, 0));
-
- for (String i : totals.k()) {
- sender.sendMessage(" Engine " + C.UNDERLINE + C.GREEN + i + C.RESET + ": " + C.BOLD + C.WHITE + Form.duration(totals.get(i), 0));
- }
-
- sender.sendMessage("Details: ");
-
- for (String i : weights.sortKNumber().reverse()) {
- String befb = C.UNDERLINE + "" + C.GREEN + "" + i.split("\\Q[\\E")[0] + C.RESET + C.GRAY + "[";
- String num = C.GOLD + i.split("\\Q[\\E")[1].split("]")[0] + C.RESET + C.GRAY + "].";
- String afb = C.ITALIC + "" + C.AQUA + i.split("\\Q]\\E")[1].substring(1) + C.RESET + C.GRAY;
-
- sender.sendMessage(" " + befb + num + afb + ": " + C.BOLD + C.WHITE + Form.pc(weights.get(i), 0));
- }
- }
-
- private File getEngineMetadataFile() {
- return new File(world.worldFolder(), "iris/engine-metadata.json");
- }
-
- @ChunkCoordinates
- @Override
- public void generate(int x, int z, Hunk blocks, Hunk postblocks, Hunk biomes, boolean multicore) {
- recycle();
- PrecisionStopwatch p = PrecisionStopwatch.start();
- if (engines.length == 1 && !getEngine(0).getTarget().isInverted()) {
- engines[0].generate(x, z, blocks, biomes, multicore);
- } else {
- int i;
- int offset = 0;
-
- for (i = 0; i < engines.length; i++) {
- Engine engine = engines[i];
- int doffset = offset;
- int height = engine.getTarget().getHeight();
- Hunk cblock = Hunk.newArrayHunk(16, height, 16);
- Hunk cbiome = Hunk.newArrayHunk(16, height, 16);
-
- if (engine.getTarget().isInverted()) {
- cblock = cblock.invertY();
- cbiome = cbiome.invertY();
- }
-
- engine.generate(x, z, cblock, cbiome, multicore);
- blocks.insert(0, doffset, 0, cblock);
- biomes.insert(0, doffset, 0, cbiome);
- offset += height;
- }
- }
-
- wallClock.put(p.getMilliseconds());
- }
-
- @Override
- public int getSize() {
- return engines.length;
- }
-
- @Override
- public Engine getEngine(int index) {
- return engines[index];
- }
-
- @Override
- public void saveEngineMetadata() {
- engineMetadata.save(getEngineMetadataFile());
- }
-
- @BlockCoordinates
- @Override
- public IrisData getData(int height) {
- return getEngineForHeight(height).getData();
- }
-
- //TODO: FAIL
- @Override
- public boolean isFailing() {
- return false;
- }
-
- @Override
- public Engine getDefaultEngine() {
- return defaultEngine;
- }
-
- @Override
- public void hotload() {
- for (int i = 0; i < getSize(); i++) {
- getEngine(i).hotload();
- }
- }
-}
diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java
deleted file mode 100644
index d41bb377b..000000000
--- a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2021 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.volmit.iris.engine.framework;
-
-import com.volmit.iris.Iris;
-import com.volmit.iris.core.IrisSettings;
-import com.volmit.iris.core.nms.INMS;
-import com.volmit.iris.core.pregenerator.PregenListener;
-import com.volmit.iris.core.pregenerator.PregenTask;
-import com.volmit.iris.core.project.loader.IrisData;
-import com.volmit.iris.engine.IrisEngineCompound;
-import com.volmit.iris.engine.data.chunk.MCATerrainChunk;
-import com.volmit.iris.engine.data.chunk.TerrainChunk;
-import com.volmit.iris.engine.framework.headless.HeadlessGenerator;
-import com.volmit.iris.engine.object.basic.IrisPosition;
-import com.volmit.iris.engine.object.biome.IrisBiome;
-import com.volmit.iris.engine.object.common.IrisWorld;
-import com.volmit.iris.engine.object.dimensional.IrisDimension;
-import com.volmit.iris.util.collection.KList;
-import com.volmit.iris.util.collection.KMap;
-import com.volmit.iris.util.data.B;
-import com.volmit.iris.util.format.C;
-import com.volmit.iris.util.format.Form;
-import com.volmit.iris.util.hunk.Hunk;
-import com.volmit.iris.util.io.ReactiveFolder;
-import com.volmit.iris.util.math.M;
-import com.volmit.iris.util.nbt.mca.NBTWorld;
-import com.volmit.iris.util.nbt.tag.CompoundTag;
-import com.volmit.iris.util.parallel.BurstExecutor;
-import com.volmit.iris.util.parallel.MultiBurst;
-import com.volmit.iris.util.plugin.VolmitSender;
-import com.volmit.iris.util.reflect.V;
-import com.volmit.iris.util.scheduling.ChronoLatch;
-import com.volmit.iris.util.scheduling.J;
-import com.volmit.iris.util.scheduling.Looper;
-import com.volmit.iris.util.scheduling.PrecisionStopwatch;
-import io.netty.util.internal.ConcurrentSet;
-import lombok.Getter;
-import org.bukkit.*;
-import org.bukkit.block.Biome;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.generator.BlockPopulator;
-import org.bukkit.generator.ChunkGenerator;
-
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class EngineCompositeGenerator extends ChunkGenerator implements IrisAccess {
- private static final BlockData ERROR_BLOCK = Material.RED_GLAZED_TERRACOTTA.createBlockData();
- private final AtomicReference compound = new AtomicReference<>();
- private final AtomicBoolean initialized;
- private final String dimensionQuery;
- private final boolean production;
- private final KList populators;
- private long mst = 0;
- private HeadlessGenerator headlessGenerator;
- private NBTWorld nbtWorld;
- private int generated = 0;
- private int lgenerated = 0;
- private final ChronoLatch hotloadcd;
- @Getter
- private double generatedPerSecond = 0;
- private ReactiveFolder hotloader = null;
- private IrisWorld cworld = null;
- private final Looper ticker;
- private final Looper cleaner;
- private int hotloaderMisses = 0;
- private long lastHotloadTime = 100;
-
- public EngineCompositeGenerator() {
- this(null, true);
- }
-
- public EngineCompositeGenerator(String query, boolean production) {
- super();
- ticker = new Looper() {
- @Override
- protected long loop() {
- PrecisionStopwatch p = PrecisionStopwatch.start();
- if (!tickHotloader()) {
- hotloaderMisses++;
- } else {
- hotloaderMisses = 0;
- }
- lastHotloadTime += p.getMilliseconds();
- lastHotloadTime /= 2;
-
- return 120 + (lastHotloadTime / 2) + Math.min(hotloaderMisses * 125, 1375);
- }
- };
- ticker.setPriority(Thread.MIN_PRIORITY);
- ticker.setName("Iris Project Manager");
-
- cleaner = new Looper() {
- @Override
- protected long loop() {
- if (getComposite() != null) {
- getComposite().clean();
- }
-
- return 10000;
- }
- };
- cleaner.setPriority(Thread.MIN_PRIORITY);
- cleaner.setName("Iris Parallax Manager");
- cleaner.start();
-
- if (isStudio()) {
- ticker.start();
- }
-
- hotloadcd = new ChronoLatch(3500);
- mst = M.ms();
- this.production = production;
- this.dimensionQuery = query;
- initialized = new AtomicBoolean(false);
- populators = new KList().qadd(new BlockPopulator() {
- @Override
- public void populate(World world, Random random, Chunk chunk) {
- if (compound.get() != null) {
- for (BlockPopulator i : compound.get().getPopulators()) {
- i.populate(world, random, chunk);
- }
- }
- }
- });
- }
-
- @Override
- public void hotload() {
- if (isStudio()) {
- Iris.proj.updateWorkspace();
- getData().dump();
- J.s(() -> {
- try {
- for (Player i : getTarget().getWorld().getPlayers()) {
- new VolmitSender(i, Iris.instance.getTag()).sendMessage("Dimension Hotloaded");
- i.playSound(i.getLocation(), Sound.BLOCK_COPPER_PLACE, 1f, 1.25f);
- }
- } catch (Throwable e) {
- Iris.reportError(e);
-
- }
- });
-
- getComposite().close();
- initialized.lazySet(false);
-
- if (cworld != null) {
- initialize(cworld);
- }
- }
- }
-
- public boolean tickHotloader() {
- if (getComposite() == null || isClosed()) {
- return false;
- }
-
- if (!initialized.get()) {
- return false;
- }
-
- try {
- if (hotloader != null) {
- return hotloader.check();
- }
- } catch (Throwable e) {
- Iris.reportError(e);
- }
-
- return false;
- }
-
- private synchronized IrisDimension getDimension(IrisWorld world) {
- String query = dimensionQuery;
- query = Iris.linkMultiverseCore.getWorldNameType(world.name(), query);
-
- IrisDimension dim = null;
-
- if (query == null) {
- File iris = new File(world.worldFolder(), "iris");
-
- if (iris.exists() && iris.isDirectory()) {
- for (File i : iris.listFiles()) {
- // Look for v1 location
- if (i.isDirectory() && i.getName().equals("dimensions")) {
- for (File j : i.listFiles()) {
- if (j.isFile() && j.getName().endsWith(".json")) {
- query = j.getName().replaceAll("\\Q.json\\E", "");
- Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!");
- throw new RuntimeException();
- }
- }
- }
-
- // Look for v2 location
- else if (i.isFile() && i.getName().equals("engine-metadata.json")) {
- EngineData metadata = EngineData.load(i);
- query = metadata.getDimension();
- break;
- }
- }
- }
- }
-
- if (query == null) {
- Iris.error("Cannot find iris dimension data for world: " + world.name() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
- query = IrisSettings.get().getGenerator().getDefaultWorldType();
- }
-
- dim = IrisData.loadAnyDimension(query);
-
- if (dim == null) {
- Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), query, false);
- dim = IrisData.loadAnyDimension(query);
-
- if (dim == null) {
- throw new RuntimeException("Cannot find dimension: " + query);
- } else {
- Iris.info("Download pack: " + query);
- }
- }
-
- if (production) {
- IrisDimension od = dim;
- dim = new IrisData(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
-
- if (dim == null) {
- Iris.info("Installing Iris pack " + od.getName() + " into world " + world.name() + "...");
- Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), od.getLoadKey(), world.worldFolder());
- dim = new IrisData(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
-
- if (dim == null) {
- throw new RuntimeException("Cannot find dimension: " + query);
- }
- }
- }
-
- return dim;
- }
-
- private synchronized IrisDimension getDimension(String world) {
- String query = dimensionQuery;
- IrisDimension dim = null;
-
- if (query == null) {
- File iris = new File(world + "/iris");
-
- if (iris.exists() && iris.isDirectory()) {
- for (File i : Objects.requireNonNull(iris.listFiles())) {
- // Look for v1 location
- if (i.isDirectory() && i.getName().equals("dimensions")) {
- for (File j : Objects.requireNonNull(i.listFiles())) {
- if (j.isFile() && j.getName().endsWith(".json")) {
- query = j.getName().replaceAll("\\Q.json\\E", "");
- Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!");
- throw new RuntimeException();
- }
- }
- }
-
- // Look for v2 location
- else if (i.isFile() && i.getName().equals("engine-metadata.json")) {
- EngineData metadata = EngineData.load(i);
- query = metadata.getDimension();
- break;
- }
- }
- }
- }
-
- if (query == null) {
- Iris.error("Cannot find iris dimension data for world: " + world + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
- query = IrisSettings.get().getGenerator().getDefaultWorldType();
- }
-
- dim = IrisData.loadAnyDimension(query);
-
- if (dim == null) {
- Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), query, false);
- dim = IrisData.loadAnyDimension(query);
-
- if (dim == null) {
- throw new RuntimeException("Cannot find dimension: " + query);
- } else {
- Iris.info("Download pack: " + query);
- }
- }
-
- if (production) {
- IrisDimension od = dim;
- dim = new IrisData(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
-
- if (dim == null) {
- Iris.info("Installing Iris pack " + od.getName() + " into world " + world + "...");
- Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), od.getLoadKey(), new File(world));
- dim = new IrisData(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey());
-
- if (dim == null) {
- throw new RuntimeException("Cannot find dimension: " + query);
- }
- }
- }
-
- Iris.info(world + " is configured to generate " + dim.getName() + "!");
-
- return dim;
- }
-
- public synchronized void initialize(IrisWorld world) {
- if (initialized.get()) {
- return;
- }
-
- try {
- initialized.set(true);
- IrisDimension dim = getDimension(world);
- IrisData data = production ? new IrisData(getDataFolder(world)) : dim.getLoader().copy();
- compound.set(new IrisEngineCompound(world, dim, data, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getEngineThreadCount())));
- compound.get().setStudio(!production);
- populators.clear();
- populators.addAll(compound.get().getPopulators());
- hotloader = new ReactiveFolder(data.getDataFolder(), (a, c, d) -> hotload());
- cworld = world;
-
- if (isStudio()) {
- dim.installDataPack(() -> data, Iris.instance.getDatapacksFolder());
- }
- } catch (Throwable e) {
- Iris.reportError(e);
- e.printStackTrace();
- Iris.error("FAILED TO INITIALIZE DIMENSION FROM " + world.toString());
- }
- }
-
- /**
- * Place strongholds in the world
- */
- public void placeStrongholds(World world) {
- EngineData metadata = getComposite().getEngineMetadata();
- // TODO: In nms class, not here. Also it doesnt work
- if (metadata.getStrongholdPositions() == null || metadata.getStrongholdPositions().size() == 0) {
-
- List strongholds = new ArrayList<>();
- Object nmsWorld = new V(world).invoke("getHandle");
- Object chunkProvider = new V(nmsWorld).invoke("getChunkProvider");
- Object chunkGenerator = new V(chunkProvider).invoke("getChunkGenerator");
- try {
- Class> clazz = Class.forName("net.minecraft.world.level.chunk.ChunkGenerator");
- Class> clazzSG = Class.forName("net.minecraft.world.level.levelgen.feature.StructureGenerator");
- Class> clazzBP = Class.forName("net.minecraft.core.BlockPosition");
- @SuppressWarnings("rawtypes") Constructor bpCon = clazzBP.getConstructor(int.class, int.class, int.class);
-
- //By default, we place 9 strongholds. One near 0,0 and 8 all around it at about 10_000 blocks out
- int[][] coords = {{0, 0}, {7000, -7000}, {10000, 0}, {7000, 7000}, {0, 10000}, {-7000, 7000}, {-10000, 0}, {-7000, -7000}, {0, -10000}};
-
- //Set of stronghold locations so we don't place 2 strongholds at the same location
- Set existing = new ConcurrentSet<>();
- Set> futures = new HashSet<>();
- for (int[] currCoords : coords) {
- //Create a NMS BlockPosition
- Object blockPosToTest = bpCon.newInstance(currCoords[0], 0, currCoords[1]);
- //Create a CompletableFuture so we can track once the sync code is complete
-
- CompletableFuture