From 879bcdf8d803405314de9b19a227cfd561a55029 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:21:41 -0400 Subject: [PATCH 01/42] Update Engine Target to use Iris Worlds --- .../volmit/iris/engine/framework/EngineTarget.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java b/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java index bdd833b0b..417ad7b3f 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java @@ -20,10 +20,10 @@ package com.volmit.iris.engine.framework; import com.volmit.iris.core.IrisDataManager; import com.volmit.iris.engine.object.IrisDimension; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallax.ParallaxWorld; import com.volmit.iris.engine.parallel.MultiBurst; import lombok.Data; -import org.bukkit.World; import java.io.File; @@ -31,13 +31,13 @@ import java.io.File; public class EngineTarget { private final MultiBurst burster; private final IrisDimension dimension; - private World world; + private IrisWorld world; private final int height; private final IrisDataManager data; private final ParallaxWorld parallaxWorld; private final boolean inverted; - public EngineTarget(World world, IrisDimension dimension, IrisDataManager data, int height, boolean inverted, int threads) { + public EngineTarget(IrisWorld world, IrisDimension dimension, IrisDataManager data, int height, boolean inverted, int threads) { this.world = world; this.height = height; this.dimension = dimension; @@ -47,11 +47,7 @@ public class EngineTarget { this.burster = new MultiBurst(threads); } - public void updateWorld(World world) { - this.world = world; - } - - public EngineTarget(World world, IrisDimension dimension, IrisDataManager data, int height, int threads) { + public EngineTarget(IrisWorld world, IrisDimension dimension, IrisDataManager data, int height, int threads) { this(world, dimension, data, height, false, threads); } } From 1bb9090434f2d673f7fd90c53e7b2649de1e02ec Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:22:51 -0400 Subject: [PATCH 02/42] Update engine compounds for iris worlds --- .../com/volmit/iris/engine/IrisEngineCompound.java | 10 +++------- .../volmit/iris/engine/framework/EngineCompound.java | 5 ++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java b/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java index 2ba9b78ca..2f932b1fc 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java @@ -28,6 +28,7 @@ import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimensionIndex; import com.volmit.iris.engine.object.IrisPosition; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.atomics.AtomicRollingSequence; import com.volmit.iris.util.collection.KList; @@ -50,7 +51,7 @@ import java.util.List; public class IrisEngineCompound implements EngineCompound { @Getter - private World world; + private IrisWorld world; private final AtomicRollingSequence wallClock; @@ -77,7 +78,7 @@ public class IrisEngineCompound implements EngineCompound { @Setter private boolean studio; - public IrisEngineCompound(World world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads) { + public IrisEngineCompound(IrisWorld world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads) { wallClock = new AtomicRollingSequence(32); this.rootDimension = rootDimension; Iris.info("Initializing Engine Composite for " + world.getName()); @@ -274,11 +275,6 @@ public class IrisEngineCompound implements EngineCompound { return defaultEngine; } - @Override - public void updateWorld(World world) { - this.world = world; - } - @Override public void hotload() { for (int i = 0; i < getSize(); i++) { diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineCompound.java b/src/main/java/com/volmit/iris/engine/framework/EngineCompound.java index cff9a2dd9..ef0740b62 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineCompound.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineCompound.java @@ -26,6 +26,7 @@ import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisPosition; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; @@ -43,7 +44,7 @@ public interface EngineCompound extends Listener, Hotloadable, DataProvider { void generate(int x, int z, Hunk blocks, Hunk postblocks, Hunk biomes); - World getWorld(); + IrisWorld getWorld(); List getStrongholdPositions(); @@ -149,8 +150,6 @@ public interface EngineCompound extends Listener, Hotloadable, DataProvider { return v.v(); } - void updateWorld(World world); - default int getLowestBedrock() { int f = Integer.MAX_VALUE; From 08346a2326fc6e927c812b4bff491411d3b81f34 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:23:20 -0400 Subject: [PATCH 03/42] V+ --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7b6379a0c..29eb2e1df 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'com.volmit.iris' -version '1.5.3' +version '1.5.3-HEADLESS' def apiVersion = '1.17' def name = 'Iris' def main = 'com.volmit.iris.Iris' From 86367298cc1d36094aeb0a7a2cc000bcc6355a8b Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:25:46 -0400 Subject: [PATCH 04/42] Support get players --- .../iris/engine/object/common/IrisWorld.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index 859aa037d..b80cfe42e 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -18,20 +18,23 @@ package com.volmit.iris.engine.object.common; +import com.volmit.iris.util.collection.KList; import lombok.Builder; import lombok.Data; import org.bukkit.World; +import org.bukkit.entity.Player; import java.io.File; @Builder @Data public class IrisWorld { + private static final KList NO_PLAYERS = new KList<>(); private String name; private File worldFolder; private long seed; private World.Environment environment; - private boolean real; + private World realWorld; public static IrisWorld fromWorld(World world) { @@ -42,4 +45,19 @@ public class IrisWorld { .environment(world.getEnvironment()) .build(); } + + public boolean hasRealWorld() + { + return realWorld != null; + } + + public Iterable getPlayers() { + + if(hasRealWorld()) + { + return getRealWorld().getPlayers(); + } + + return NO_PLAYERS; + } } From bd954e7292041df0c51da2cd3d0ceeb51e36ab2b Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:36:59 -0400 Subject: [PATCH 05/42] Support additional world methods --- .../iris/engine/object/common/IrisWorld.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index b80cfe42e..53c785d0e 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -18,9 +18,11 @@ package com.volmit.iris.engine.object.common; +import com.volmit.iris.engine.IrisWorlds; import com.volmit.iris.util.collection.KList; import lombok.Builder; import lombok.Data; +import lombok.experimental.Accessors; import org.bukkit.World; import org.bukkit.entity.Player; @@ -28,6 +30,7 @@ import java.io.File; @Builder @Data +@Accessors(chain = true, fluent = true) public class IrisWorld { private static final KList NO_PLAYERS = new KList<>(); private String name; @@ -35,15 +38,23 @@ public class IrisWorld { private long seed; private World.Environment environment; private World realWorld; + private int minHeight; + private int maxHeight; public static IrisWorld fromWorld(World world) { - return IrisWorld.builder() - .name(world.getName()) - .worldFolder(world.getWorldFolder()) - .seed(world.getSeed()) - .environment(world.getEnvironment()) - .build(); + return bindWorld(IrisWorld.builder().build(), world); + } + + private static IrisWorld bindWorld(IrisWorld iw, World world) + { + return iw.name(world.getName()) + .worldFolder(world.getWorldFolder()) + .seed(world.getSeed()) + .minHeight(world.getMinHeight()) + .maxHeight(world.getMaxHeight()) + .realWorld(world) + .environment(world.getEnvironment()); } public boolean hasRealWorld() @@ -55,9 +66,20 @@ public class IrisWorld { if(hasRealWorld()) { - return getRealWorld().getPlayers(); + return realWorld().getPlayers(); } return NO_PLAYERS; } + + public void evacuate() { + if(hasRealWorld()) + { + IrisWorlds.evacuate(realWorld()); + } + } + + public void bind(World world) { + bindWorld(this, world); + } } From fe2de5d8ae2d83d24d94b22b24b237336f3a87bb Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:37:09 -0400 Subject: [PATCH 06/42] Use Iris worlds --- .../volmit/iris/engine/framework/IrisAccess.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java b/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java index ebc927194..8c68ce12a 100644 --- a/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java +++ b/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java @@ -25,6 +25,7 @@ import com.volmit.iris.engine.data.DataProvider; import com.volmit.iris.engine.data.mca.NBTWorld; import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisRegion; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.math.M; @@ -44,9 +45,9 @@ import java.util.function.Consumer; @SuppressWarnings("EmptyMethod") public interface IrisAccess extends Hotloadable, DataProvider { - void directWriteMCA(World w, int x, int z, NBTWorld writer, MultiBurst burst); + void directWriteMCA(IrisWorld w, int x, int z, NBTWorld writer, MultiBurst burst); - void directWriteChunk(World w, int x, int z, NBTWorld writer); + void directWriteChunk(IrisWorld w, int x, int z, NBTWorld writer); int getGenerated(); @@ -72,8 +73,6 @@ public interface IrisAccess extends Hotloadable, DataProvider { void changeThreadCount(int m); - void regenerate(int x, int z); - void close(); boolean isClosed(); @@ -238,14 +237,6 @@ public interface IrisAccess extends Hotloadable, DataProvider { return location.get(); } - void clearRegeneratedLists(int x, int z); - - void precache(World world, int x, int z); - - int getPrecacheSize(); - - Chunk generatePaper(World world, int cx, int cz); - default int getParallaxChunkCount() { int v = 0; From 6618cdc0adba96076cdac23dc797c365388e0931 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:37:17 -0400 Subject: [PATCH 07/42] Composite generator use only iris worlds --- .../framework/EngineCompositeGenerator.java | 236 +++--------------- 1 file changed, 28 insertions(+), 208 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java index 0039e714a..93a191302 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java @@ -33,6 +33,7 @@ import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisPosition; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallel.BurstExecutor; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.collection.KList; @@ -79,9 +80,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce private long mst = 0; private int generated = 0; private int lgenerated = 0; - private final KMap chunkCache; private final ChronoLatch hotloadcd; - private final AtomicBoolean fake; @Getter private double generatedPerSecond = 0; private final int art; @@ -93,8 +92,6 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce public EngineCompositeGenerator(String query, boolean production) { super(); - chunkCache = new KMap<>(); - fake = new AtomicBoolean(true); hotloadcd = new ChronoLatch(3500); mst = M.ms(); this.production = production; @@ -113,6 +110,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce }); } + @Override public void hotload() { if (isStudio()) { Iris.proj.updateWorkspace(); @@ -158,14 +156,14 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce } } - private synchronized IrisDimension getDimension(World world) { + private synchronized IrisDimension getDimension(IrisWorld world) { String query = dimensionQuery; - query = Iris.linkMultiverseCore.getWorldNameType(world.getName(), query); + query = Iris.linkMultiverseCore.getWorldNameType(world.name(), query); IrisDimension dim = null; if (query == null) { - File iris = new File(world.getWorldFolder(), "iris"); + File iris = new File(world.worldFolder(), "iris"); if (iris.exists() && iris.isDirectory()) { for (File i : iris.listFiles()) { @@ -191,7 +189,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce } if (query == null) { - Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!"); + Iris.error("Cannot find iris dimension data for world: " + world.name() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!"); query = IrisSettings.get().getGenerator().getDefaultWorldType(); } @@ -213,8 +211,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce dim = new IrisDataManager(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey()); if (dim == null) { - Iris.info("Installing Iris pack " + od.getName() + " into world " + world.getName() + "..."); - Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), od.getLoadKey(), world.getWorldFolder()); + 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 IrisDataManager(getDataFolder(world)).getDimensionLoader().load(od.getLoadKey()); if (dim == null) { @@ -294,20 +292,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce return dim; } - public synchronized void initialize(World world) { - if (!(world instanceof FakeWorld) && fake.get() && this.compound.get() != null) { - fake.set(false); - this.compound.get().updateWorld(world); - getTarget().updateWorld(world); - placeStrongholds(world); - - for (int i = 0; i < getComposite().getSize(); i++) { - getComposite().getEngine(i).getTarget().updateWorld(world); - } - - Iris.info("Attached Real World to Engine Target"); - } - + public synchronized void initialize(IrisWorld world) { if (initialized.get()) { return; } @@ -445,8 +430,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce ); } - private File getDataFolder(World world) { - return new File(world.getWorldFolder(), "iris/pack"); + private File getDataFolder(IrisWorld world) { + return new File(world.worldFolder(), "iris/pack"); } private File getDataFolder(String world) { @@ -458,7 +443,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) { PrecisionStopwatch ps = PrecisionStopwatch.start(); TerrainChunk tc = TerrainChunk.create(world, biome); - generateChunkRawData(world, x, z, tc).run(); + + if(!getComposite().getWorld().hasRealWorld()) + { + getComposite().getWorld().bind(world); + } + + generateChunkRawData(getComposite().getWorld(), x, z, tc).run(); generated++; ps.end(); @@ -469,7 +460,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce return tc.getRaw(); } - public void directWriteMCA(World w, int x, int z, NBTWorld writer, MultiBurst burst) { + @Override + public void directWriteMCA(IrisWorld w, int x, int z, NBTWorld writer, MultiBurst burst) { BurstExecutor e = burst.burst(1024); int mcaox = x << 5; int mcaoz = z << 5; @@ -485,7 +477,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce e.complete(); } - public void directWriteChunk(World w, int x, int z, NBTWorld writer) { + @Override + public void directWriteChunk(IrisWorld w, int x, int z, NBTWorld writer) { int ox = x << 4; int oz = z << 4; com.volmit.iris.engine.data.mca.Chunk cc = writer.getChunk(x, z); @@ -526,12 +519,12 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce @Override public int getMinHeight() { - return w.getMinHeight(); + return w.minHeight(); } @Override public int getMaxHeight() { - return w.getMaxHeight(); + return w.maxHeight(); } @Override @@ -614,50 +607,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce }).run(); } - public Chunk generatePaper(World world, int x, int z) { - precache(world, x, z); - Chunk c = PaperLib.getChunkAtAsync(world, x, z, true).join(); - chunkCache.remove(Cache.key(x, z)); - return c; - } - - public void precache(World world, int x, int z) { - synchronized (this) { - initialize(world); - } - - synchronized (chunkCache) { - if (chunkCache.containsKey(Cache.key(x, z))) { - return; - } - } - - PregeneratedData data = new PregeneratedData(getComposite().getHeight() - 1); - compound.get().generate(x * 16, z * 16, data.getBlocks(), data.getPost(), data.getBiomes()); - synchronized (chunkCache) { - chunkCache.put(Cache.key(x, z), data); - } - } - - @Override - public int getPrecacheSize() { - return chunkCache.size(); - } - - public int getCachedChunks() { - return chunkCache.size(); - } - - public Runnable generateChunkRawData(World world, int x, int z, TerrainChunk tc) { + public Runnable generateChunkRawData(IrisWorld world, int x, int z, TerrainChunk tc) { initialize(world); - - synchronized (chunkCache) { - long g = Cache.key(x, z); - if (chunkCache.containsKey(g)) { - return chunkCache.remove(g).inject(tc); - } - } - Hunk blocks = Hunk.view((ChunkData) tc); Hunk biomes = Hunk.view((BiomeGrid) tc); Hunk post = Hunk.newAtomicHunk(biomes.getWidth(), biomes.getHeight(), biomes.getDepth()); @@ -783,146 +734,15 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce // TODO: DO IT } - @Override - public void clearRegeneratedLists(int x, int z) { - for (int i = 0; i < getComposite().getSize(); i++) { - getComposite().getEngine(i).getParallax().delete(x, z); - } - } - - @Override - public void regenerate(int x, int z) { - - clearRegeneratedLists(x, z); - int xx = x * 16; - int zz = z * 16; - BiomeBaseInjector inj = (a, b, c, d) -> { - }; - //noinspection deprecation - generateChunkRawData(getComposite().getWorld(), x, z, new TerrainChunk() { - @Override - public BiomeBaseInjector getBiomeBaseInjector() { - return inj; - } - - @Override - public void setRaw(ChunkData data) { - - } - - @NotNull - @Override - public Biome getBiome(int x, int z) { - return Biome.THE_VOID; - } - - @NotNull - @Override - public Biome getBiome(int x, int y, int z) { - return Biome.THE_VOID; - } - - @Override - public void setBiome(int x, int z, Biome bio) { - - } - - @Override - public void setBiome(int x, int y, int z, Biome bio) { - - } - - @Override - public int getMinHeight() { - return getComposite().getWorld().getMinHeight(); - } - - @Override - public int getMaxHeight() { - return getComposite().getWorld().getMaxHeight(); - } - - @Override - public void setBlock(int x, int y, int z, BlockData blockData) { - if (!getBlockData(x, y, z).matches(blockData)) { - Iris.edit.set(compound.get().getWorld(), x + xx, y, z + zz, blockData); - } - } - - @NotNull - @Override - public BlockData getBlockData(int x, int y, int z) { - return Iris.edit.get(compound.get().getWorld(), x + xx, y, z + zz); - } - - @Override - public ChunkData getRaw() { - return null; - } - - @Override - public void inject(BiomeGrid biome) { - - } - - @Override - public void setBlock(int i, int i1, int i2, @NotNull Material material) { - setBlock(i, i1, i2, material.createBlockData()); - } - - @Override - public void setBlock(int i, int i1, int i2, @NotNull MaterialData materialData) { - setBlock(i, i1, i2, materialData.getItemType()); - } - - @Override - public void setRegion(int i, int i1, int i2, int i3, int i4, int i5, @NotNull Material material) { - - } - - @Override - public void setRegion(int i, int i1, int i2, int i3, int i4, int i5, @NotNull MaterialData materialData) { - - } - - @Override - public void setRegion(int i, int i1, int i2, int i3, int i4, int i5, @NotNull BlockData blockData) { - - } - - @NotNull - @Override - public Material getType(int i, int i1, int i2) { - return getBlockData(i, i1, i2).getMaterial(); - } - - @NotNull - @Override - public MaterialData getTypeAndData(int i, int i1, int i2) { - return null; - } - - @Override - public byte getData(int i, int i1, int i2) { - return 0; - } - }); - - Iris.edit.flushNow(); - - } - - @Override public void close() { J.car(art); if (getComposite() != null) { getComposite().close(); - - if (isStudio()) { - IrisWorlds.evacuate(getComposite().getWorld()); - Bukkit.unloadWorld(getComposite().getWorld(), !isStudio()); + if (isStudio() && getComposite().getWorld().hasRealWorld()) { + getComposite().getWorld().evacuate(); + Bukkit.unloadWorld(getComposite().getWorld().realWorld(), !isStudio()); } } } From f241679087ea60f6d20caccf5402d20e452358ec Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:37:55 -0400 Subject: [PATCH 08/42] Fix world method in studio close --- .../volmit/iris/core/command/studio/CommandIrisStudioClose.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioClose.java b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioClose.java index 6be720bbc..19080e304 100644 --- a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioClose.java +++ b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioClose.java @@ -56,7 +56,7 @@ public class CommandIrisStudioClose extends MortarCommand { World f = null; for (World i : Bukkit.getWorlds()) { - if (i.getWorldFolder().getAbsolutePath().equals(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getWorldFolder().getAbsolutePath())) { + if (i.getWorldFolder().getAbsolutePath().equals(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().worldFolder().getAbsolutePath())) { continue; } From 85b936ead27b072d13815d410991d978752443cf Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:38:12 -0400 Subject: [PATCH 09/42] Engine target fix for world folder --- .../java/com/volmit/iris/engine/framework/EngineTarget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java b/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java index 417ad7b3f..6c7f2856c 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineTarget.java @@ -42,7 +42,7 @@ public class EngineTarget { this.height = height; this.dimension = dimension; this.data = data; - this.parallaxWorld = new ParallaxWorld(256, new File(world.getWorldFolder(), "iris/" + dimension.getLoadKey() + "/parallax")); + this.parallaxWorld = new ParallaxWorld(256, new File(world.worldFolder(), "iris/" + dimension.getLoadKey() + "/parallax")); this.inverted = inverted; this.burster = new MultiBurst(threads); } From 986cf025a01823b31cca257544d7619d59f63d2a Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:38:47 -0400 Subject: [PATCH 10/42] Seed access for spawns --- .../volmit/iris/engine/object/IrisEntitySpawnOverride.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/object/IrisEntitySpawnOverride.java b/src/main/java/com/volmit/iris/engine/object/IrisEntitySpawnOverride.java index 488cb519a..1cc0150f9 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisEntitySpawnOverride.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisEntitySpawnOverride.java @@ -88,8 +88,8 @@ public class IrisEntitySpawnOverride { return null; } - if (rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1) { - return getRealEntity(g).spawn(g, at, rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4))); + if (rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4)).i(1, getRarity()) == 1) { + return getRealEntity(g).spawn(g, at, rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4))); } return null; From 21d8ceacf0dc3f3942650c14e3d260611d9788e4 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:39:36 -0400 Subject: [PATCH 11/42] Initial spawn fixes --- .../com/volmit/iris/engine/object/IrisEntityInitialSpawn.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/object/IrisEntityInitialSpawn.java b/src/main/java/com/volmit/iris/engine/object/IrisEntityInitialSpawn.java index 8feff8a42..1e72382a3 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisEntityInitialSpawn.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisEntityInitialSpawn.java @@ -82,7 +82,7 @@ public class IrisEntityInitialSpawn { return null; } - if (rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1) { + if (rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4)).i(1, getRarity()) == 1) { return spawn100(g, at); } @@ -90,6 +90,6 @@ public class IrisEntityInitialSpawn { } private Entity spawn100(Engine g, Location at) { - return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4))); + return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().seed() + 4))); } } From ea9fb5bcb0ac64ad04cb71ac24911d8a5d4cfe37 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:39:54 -0400 Subject: [PATCH 12/42] Update Engine for Iris Worlds --- src/main/java/com/volmit/iris/engine/framework/Engine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/Engine.java b/src/main/java/com/volmit/iris/engine/framework/Engine.java index d2ad0638a..38ffb462c 100644 --- a/src/main/java/com/volmit/iris/engine/framework/Engine.java +++ b/src/main/java/com/volmit/iris/engine/framework/Engine.java @@ -27,6 +27,7 @@ import com.volmit.iris.engine.data.B; import com.volmit.iris.engine.data.DataProvider; import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.object.*; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.parallax.ParallaxAccess; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.collection.KList; @@ -105,7 +106,7 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro return getTarget().getData(); } - default World getWorld() { + default IrisWorld getWorld() { return getTarget().getWorld(); } From 8a0b7fbc471a38ad2c4d05f50ae5049a92824fc1 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:41:39 -0400 Subject: [PATCH 13/42] Patch goto in headless mode --- .../volmit/iris/engine/framework/IrisAccess.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java b/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java index 8c68ce12a..8c6e692f7 100644 --- a/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java +++ b/src/main/java/com/volmit/iris/engine/framework/IrisAccess.java @@ -86,6 +86,12 @@ public interface IrisAccess extends Hotloadable, DataProvider { boolean isStudio(); default Location lookForBiome(IrisBiome biome, long timeout, Consumer triesc) { + if(!getCompound().getWorld().hasRealWorld()) + { + Iris.error("Cannot GOTO without a bound world (headless mode)"); + return null; + } + IrisComplex.cacheLock.set(true); ChronoLatch cl = new ChronoLatch(250, false); long s = M.ms(); @@ -129,7 +135,7 @@ public interface IrisAccess extends Hotloadable, DataProvider { if (b != null && b.getLoadKey().equals(biome.getLoadKey())) { found.lazySet(true); - location.lazySet(new Location(e.getWorld(), x, e.getHeight(x, z), z)); + location.lazySet(new Location(e.getWorld().realWorld(), x, e.getHeight(x, z), z)); } tries.getAndIncrement(); @@ -166,6 +172,12 @@ public interface IrisAccess extends Hotloadable, DataProvider { } default Location lookForRegion(IrisRegion reg, long timeout, Consumer triesc) { + if(!getCompound().getWorld().hasRealWorld()) + { + Iris.error("Cannot GOTO without a bound world (headless mode)"); + return null; + } + IrisComplex.cacheLock.set(true); ChronoLatch cl = new ChronoLatch(3000, false); long s = M.ms(); @@ -203,7 +215,7 @@ public interface IrisAccess extends Hotloadable, DataProvider { if (b != null && b.getLoadKey() != null && b.getLoadKey().equals(reg.getLoadKey())) { found.lazySet(true); - location.lazySet(new Location(e.getWorld(), x, e.getHeight(x, z) + e.getMinHeight(), z)); + location.lazySet(new Location(e.getWorld().realWorld(), x, e.getHeight(x, z) + e.getMinHeight(), z)); } tries.getAndIncrement(); From 63ba5cf39d4617f37dac332d98e3fcc9bca25657 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:42:05 -0400 Subject: [PATCH 14/42] Patch engine components --- .../java/com/volmit/iris/engine/framework/EngineComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineComponent.java b/src/main/java/com/volmit/iris/engine/framework/EngineComponent.java index f62641efc..440525632 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineComponent.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineComponent.java @@ -69,7 +69,7 @@ public interface EngineComponent { } default long getSeed() { - return getTarget().getWorld().getSeed(); + return getTarget().getWorld().seed(); } default EngineFramework getFramework() { From 75fe59ef79fecfd7975870eec78af673bbfc6fab Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:42:32 -0400 Subject: [PATCH 15/42] Patch complex --- src/main/java/com/volmit/iris/engine/IrisComplex.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisComplex.java b/src/main/java/com/volmit/iris/engine/IrisComplex.java index 1d2878269..0fe44827b 100644 --- a/src/main/java/com/volmit/iris/engine/IrisComplex.java +++ b/src/main/java/com/volmit/iris/engine/IrisComplex.java @@ -108,14 +108,14 @@ public class IrisComplex implements DataProvider { public IrisComplex(Engine engine, boolean simple) { int cacheSize = 1024 * 128; - this.rng = new RNG(engine.getWorld().getSeed()); + this.rng = new RNG(engine.getWorld().seed()); this.data = engine.getData(); double height = engine.getHeight(); fluidHeight = engine.getDimension().getFluidHeight(); generators = new KList<>(); focus = engine.getFocus(); IrisRegion focusRegion = focus != null ? findRegion(focus, engine) : null; - RNG rng = new RNG(engine.getWorld().getSeed()); + RNG rng = new RNG(engine.getWorld().seed()); //@builder engine.getDimension().getRegions().forEach((i) -> data.getRegionLoader().load(i) .getAllBiomes(this).forEach((b) -> b @@ -124,7 +124,7 @@ public class IrisComplex implements DataProvider { overlayStream = ProceduralStream.ofDouble((x, z) -> 0D); engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, x, z))); rngStream = ProceduralStream.of((x, z) -> new RNG(((x.longValue()) << 32) | (z.longValue() & 0xffffffffL)) - .nextParallelRNG(engine.getWorld().getSeed()), Interpolated.RNG); + .nextParallelRNG(engine.getWorld().seed()), Interpolated.RNG); chunkRngStream = rngStream.blockToChunkCoords(); rockStream = engine.getDimension().getRockPalette().getLayerGenerator(rng.nextParallelRNG(45), data).stream() .select(engine.getDimension().getRockPalette().getBlockData(data)); @@ -193,7 +193,7 @@ public class IrisComplex implements DataProvider { .convertAware2D(this::implode).cache2D(cacheSize); heightStream = ProceduralStream.of((x, z) -> { IrisBiome b = focus != null ? focus : baseBiomeStream.get(x, z); - return getHeight(engine, b, x, z, engine.getWorld().getSeed()); + return getHeight(engine, b, x, z, engine.getWorld().seed()); }, Interpolated.DOUBLE).cache2D(cacheSize); slopeStream = heightStream.slope(3).interpolate().bilinear(3, 3).cache2D(cacheSize); objectChanceStream = ProceduralStream.ofDouble((x, z) -> { From 957dbecb3d7d1356224a65e04b1bc16302d078ae Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:43:14 -0400 Subject: [PATCH 16/42] Plxmgr headless --- .../volmit/iris/engine/framework/EngineParallaxManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineParallaxManager.java b/src/main/java/com/volmit/iris/engine/framework/EngineParallaxManager.java index cea30dd0f..9c9d88709 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineParallaxManager.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineParallaxManager.java @@ -271,7 +271,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer { if (!getParallaxAccess().isFeatureGenerated(xx, zz)) { burst.queue(() -> { getParallaxAccess().setFeatureGenerated(xx, zz); - RNG rng = new RNG(Cache.key(xx, zz)).nextParallelRNG(getEngine().getTarget().getWorld().getSeed()); + RNG rng = new RNG(Cache.key(xx, zz)).nextParallelRNG(getEngine().getTarget().getWorld().seed()); IrisRegion region = getComplex().getRegionStream().get(xxx, zzz); IrisBiome biome = getComplex().getTrueBiomeStream().get(xxx, zzz); generateParallaxFeatures(rng, xx, zz, region, biome); @@ -332,7 +332,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer { if (getEngine().getDimension().isPlaceObjects()) { int xx = x << 4; int zz = z << 4; - RNG rng = new RNG(Cache.key(x, z)).nextParallelRNG(getEngine().getTarget().getWorld().getSeed()); + RNG rng = new RNG(Cache.key(x, z)).nextParallelRNG(getEngine().getTarget().getWorld().seed()); IrisRegion region = getComplex().getRegionStream().get(xx + 8, zz + 8); IrisBiome biome = getComplex().getTrueBiomeStream().get(xx + 8, zz + 8); after.addAll(generateParallaxJigsaw(rng, x, z, biome, region)); @@ -351,7 +351,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer { int xx = x << 4; int zz = z << 4; getParallaxAccess().setParallaxGenerated(x, z); - RNG rng = new RNG(Cache.key(x, z)).nextParallelRNG(getEngine().getTarget().getWorld().getSeed()); + RNG rng = new RNG(Cache.key(x, z)).nextParallelRNG(getEngine().getTarget().getWorld().seed()); IrisBiome biome = getComplex().getTrueBiomeStream().get(xx + 8, zz + 8); IrisRegion region = getComplex().getRegionStream().get(xx + 8, zz + 8); generateParallaxSurface(rng, x, z, biome, region, false); From aae47e103b81b63fe7be00c08366356a9ab495db Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:44:52 -0400 Subject: [PATCH 17/42] Spawn loc headless --- .../studio/CommandIrisStudioExplorerGenerator.java | 2 +- .../volmit/iris/engine/object/common/IrisWorld.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioExplorerGenerator.java b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioExplorerGenerator.java index 7fe029d98..4f496636d 100644 --- a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioExplorerGenerator.java +++ b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioExplorerGenerator.java @@ -63,7 +63,7 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand { if (Iris.proj.isProjectOpen()) { generator = Iris.proj.getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(args[0]); - seed = Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getSeed(); + seed = Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().seed(); } else { generator = IrisDataManager.loadAnyGenerator(args[0]); } diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index 53c785d0e..000c5c25b 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -18,11 +18,13 @@ package com.volmit.iris.engine.object.common; +import com.volmit.iris.Iris; import com.volmit.iris.engine.IrisWorlds; import com.volmit.iris.util.collection.KList; import lombok.Builder; import lombok.Data; import lombok.experimental.Accessors; +import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; @@ -82,4 +84,14 @@ public class IrisWorld { public void bind(World world) { bindWorld(this, world); } + + public Location getSpawnLocation() { + if(hasRealWorld()) + { + return realWorld().getSpawnLocation(); + } + + Iris.error("This world is not real yet, cannot get spawn location! HEADLESS!"); + return null; + } } From deb75df77a5940d6e65554e66fd274f589b379d2 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:45:41 -0400 Subject: [PATCH 18/42] Cleanup unused --- .../iris/core/command/studio/CommandIrisStudioTPStudio.java | 2 +- src/main/java/com/volmit/iris/core/gui/IrisRenderer.java | 4 ---- .../java/com/volmit/iris/engine/object/common/IrisWorld.java | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioTPStudio.java b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioTPStudio.java index 63d0af4bd..f34d11cdc 100644 --- a/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioTPStudio.java +++ b/src/main/java/com/volmit/iris/core/command/studio/CommandIrisStudioTPStudio.java @@ -57,7 +57,7 @@ public class CommandIrisStudioTPStudio extends MortarCommand { try { sender.sendMessage("Teleporting you to the active studio world."); - sender.player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getSpawnLocation()); + sender.player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation()); sender.player().setGameMode(GameMode.SPECTATOR); } catch (Throwable e) { Iris.reportError(e); diff --git a/src/main/java/com/volmit/iris/core/gui/IrisRenderer.java b/src/main/java/com/volmit/iris/core/gui/IrisRenderer.java index 436d57951..977438c9a 100644 --- a/src/main/java/com/volmit/iris/core/gui/IrisRenderer.java +++ b/src/main/java/com/volmit/iris/core/gui/IrisRenderer.java @@ -60,8 +60,4 @@ public class IrisRenderer { return image; } - - public void set(double worldX, double worldZ) { - renderer.getWorld().getBlockAt((int) worldX, 20, (int) worldZ).setType(Material.DIAMOND_BLOCK); - } } diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index 000c5c25b..c5cc9caa4 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -85,7 +85,7 @@ public class IrisWorld { bindWorld(this, world); } - public Location getSpawnLocation() { + public Location spawnLocation() { if(hasRealWorld()) { return realWorld().getSpawnLocation(); From fa818d50d170aaad6af5de08df93e4de0dbbf8dd Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:48:57 -0400 Subject: [PATCH 19/42] Vision headless support --- .../java/com/volmit/iris/core/gui/IrisVision.java | 5 +++-- .../volmit/iris/engine/object/common/IrisWorld.java | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/gui/IrisVision.java b/src/main/java/com/volmit/iris/core/gui/IrisVision.java index d8dacadc7..8d074cc9b 100644 --- a/src/main/java/com/volmit/iris/core/gui/IrisVision.java +++ b/src/main/java/com/volmit/iris/core/gui/IrisVision.java @@ -24,6 +24,7 @@ import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.IrisAccess; import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisRegion; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KSet; @@ -70,7 +71,7 @@ public class IrisVision extends JPanel implements MouseWheelListener, KeyListene private boolean alt = false; private int posX = 0; private IrisRenderer renderer; - private World world; + private IrisWorld world; private double velocity = 0; private int lowq = 12; private int posZ = 0; @@ -726,7 +727,7 @@ public class IrisVision extends JPanel implements MouseWheelListener, KeyListene } } - private static void createAndShowGUI(Engine r, int s, World world) { + private static void createAndShowGUI(Engine r, int s, IrisWorld world) { JFrame frame = new JFrame("Vision"); IrisVision nv = new IrisVision(frame); nv.world = world; diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index c5cc9caa4..d3d00b3d2 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -26,15 +26,19 @@ import lombok.Data; import lombok.experimental.Accessors; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import java.io.File; +import java.util.Collection; @Builder @Data @Accessors(chain = true, fluent = true) public class IrisWorld { private static final KList NO_PLAYERS = new KList<>(); + private static final KList NO_ENTITIES = new KList<>(); private String name; private File worldFolder; private long seed; @@ -94,4 +98,13 @@ public class IrisWorld { Iris.error("This world is not real yet, cannot get spawn location! HEADLESS!"); return null; } + + public Collection getEntitiesByClass(Class t) { + if(hasRealWorld()) + { + return realWorld().getEntitiesByClass(t); + } + + return (KList) NO_ENTITIES; + } } From 465ceab271d8811ac751a61d78b09603bbfc3e15 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:50:07 -0400 Subject: [PATCH 20/42] Pregen fix but it needs to be recreated --- src/main/java/com/volmit/iris/core/gui/Pregenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/gui/Pregenerator.java b/src/main/java/com/volmit/iris/core/gui/Pregenerator.java index 83a24546c..19bce324f 100644 --- a/src/main/java/com/volmit/iris/core/gui/Pregenerator.java +++ b/src/main/java/com/volmit/iris/core/gui/Pregenerator.java @@ -250,7 +250,7 @@ public class Pregenerator implements Listener { method.set("Direct (Fast)"); mcaIteration.accept(mcaox, mcaoz, (ii, jj) -> e.queue(() -> { draw(ii, jj, COLOR_MCA_GENERATE); - access.directWriteChunk(world, ii, jj, directWriter); + access.directWriteChunk(access.getCompound().getWorld(), ii, jj, directWriter); draw(ii, jj, COLOR_MCA_GENERATED_MCA); generated.getAndIncrement(); vcax.set(ii); @@ -286,7 +286,7 @@ public class Pregenerator implements Listener { int finalJ = j; requeue.add(() -> { draw(((x << 5) + finalI), ((z << 5) + finalJ), COLOR_MCA_GENERATE); - access.directWriteChunk(world, ((x << 5) + finalI), ((z << 5) + finalJ), directWriter); + access.directWriteChunk(access.getCompound().getWorld(), ((x << 5) + finalI), ((z << 5) + finalJ), directWriter); draw(((x << 5) + finalI), ((z << 5) + finalJ), COLOR_MCA_GENERATED_MCA); }); } From 44cf7f733043393f5bea76218d7a4a65737ba1f6 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:50:33 -0400 Subject: [PATCH 21/42] Iris Project headless --- src/main/java/com/volmit/iris/core/IrisProject.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/IrisProject.java b/src/main/java/com/volmit/iris/core/IrisProject.java index e300dd604..7f29c9f58 100644 --- a/src/main/java/com/volmit/iris/core/IrisProject.java +++ b/src/main/java/com/volmit/iris/core/IrisProject.java @@ -307,9 +307,9 @@ public class IrisProject { public void close() { activeProvider.close(); - File folder = activeProvider.getTarget().getWorld().getWorldFolder(); - Iris.linkMultiverseCore.removeFromConfig(activeProvider.getTarget().getWorld().getName()); - Bukkit.unloadWorld(activeProvider.getTarget().getWorld().getName(), false); + File folder = activeProvider.getTarget().getWorld().worldFolder(); + Iris.linkMultiverseCore.removeFromConfig(activeProvider.getTarget().getWorld().name()); + Bukkit.unloadWorld(activeProvider.getTarget().getWorld().name(), false); J.attemptAsync(() -> IO.delete(folder)); activeProvider = null; } From 7260e0d0f5d80ff1f71100535b16dcd96cc79dc4 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:50:53 -0400 Subject: [PATCH 22/42] Biome actuator headless --- .../java/com/volmit/iris/engine/actuator/IrisBiomeActuator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/actuator/IrisBiomeActuator.java b/src/main/java/com/volmit/iris/engine/actuator/IrisBiomeActuator.java index 5e9a9dd89..e69d2df0a 100644 --- a/src/main/java/com/volmit/iris/engine/actuator/IrisBiomeActuator.java +++ b/src/main/java/com/volmit/iris/engine/actuator/IrisBiomeActuator.java @@ -37,7 +37,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator { public IrisBiomeActuator(Engine engine) { super(engine, "Biome"); - rng = new RNG(engine.getWorld().getSeed() + 243995); + rng = new RNG(engine.getWorld().seed() + 243995); } private boolean injectBiome(Hunk h, int x, int y, int z, Object bb) { From 2223405e799daf0fc44d03e1fd0d0d19bfef4ac6 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:54:42 -0400 Subject: [PATCH 23/42] Decorant support headless --- .../com/volmit/iris/engine/actuator/IrisDecorantActuator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/actuator/IrisDecorantActuator.java b/src/main/java/com/volmit/iris/engine/actuator/IrisDecorantActuator.java index 7ddde6c93..9ecc0a538 100644 --- a/src/main/java/com/volmit/iris/engine/actuator/IrisDecorantActuator.java +++ b/src/main/java/com/volmit/iris/engine/actuator/IrisDecorantActuator.java @@ -50,7 +50,7 @@ public class IrisDecorantActuator extends EngineAssignedActuator { public IrisDecorantActuator(Engine engine) { super(engine, "Decorant"); shouldRay = shouldRayDecorate(); - this.rng = new RNG(engine.getTarget().getWorld().getSeed()); + this.rng = new RNG(engine.getTarget().getWorld().seed()); surfaceDecorator = new IrisSurfaceDecorator(getEngine()); ceilingDecorator = new IrisCeilingDecorator(getEngine()); seaSurfaceDecorator = new IrisSeaSurfaceDecorator(getEngine()); From b4ddc8e5fcc3b900e16002dca56d63e8a9523ec0 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:54:55 -0400 Subject: [PATCH 24/42] Island experiment support headless --- .../volmit/iris/engine/actuator/IrisTerrainIslandActuator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainIslandActuator.java b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainIslandActuator.java index ee92ad37c..3b1480b5b 100644 --- a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainIslandActuator.java +++ b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainIslandActuator.java @@ -45,7 +45,7 @@ public class IrisTerrainIslandActuator extends EngineAssignedActuator public IrisTerrainIslandActuator(Engine engine) { super(engine, "TerrainIsland"); - rng = new RNG(engine.getWorld().getSeed()); + rng = new RNG(engine.getWorld().seed()); carving = getDimension().isCarving() && getDimension().getCarveLayers().isNotEmpty(); hasUnder = getDimension().getUndercarriage() != null && !getDimension().getUndercarriage().getGenerator().isFlat(); } From a5ea58dbf7cec1be76fb7b79c7b1e2e6ffc9e1d0 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:55:25 -0400 Subject: [PATCH 25/42] Terrain actuator headless --- .../volmit/iris/engine/actuator/IrisTerrainNormalActuator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java index b06397c27..8638ffc3e 100644 --- a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java +++ b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java @@ -42,7 +42,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator public IrisTerrainNormalActuator(Engine engine) { super(engine, "Terrain"); - rng = new RNG(engine.getWorld().getSeed()); + rng = new RNG(engine.getWorld().seed()); carving = getDimension().isCarving() && getDimension().getCarveLayers().isNotEmpty(); hasUnder = getDimension().getUndercarriage() != null && !getDimension().getUndercarriage().getGenerator().isFlat(); } From 35106f5e67cd6893f05b18229e9d227c9554ab8a Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:55:40 -0400 Subject: [PATCH 26/42] Engine support headless --- src/main/java/com/volmit/iris/engine/IrisEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisEngine.java b/src/main/java/com/volmit/iris/engine/IrisEngine.java index cb66c1d98..bcfcf367c 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngine.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngine.java @@ -88,7 +88,7 @@ public class IrisEngine extends BlockPopulator implements Engine { private double maxBiomeDecoratorDensity; public IrisEngine(EngineTarget target, EngineCompound compound, int index) { - Iris.info("Initializing Engine: " + target.getWorld().getName() + "/" + target.getDimension().getLoadKey() + " (" + target.getHeight() + " height)"); + Iris.info("Initializing Engine: " + target.getWorld().name() + "/" + target.getDimension().getLoadKey() + " (" + target.getHeight() + " height)"); metrics = new EngineMetrics(32); this.target = target; this.framework = new IrisEngineFramework(this); From fb8b5ac6b634294e7069576acc5ec7d1118cd55f Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:56:05 -0400 Subject: [PATCH 27/42] Compound headless mode --- src/main/java/com/volmit/iris/engine/IrisEngineCompound.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java b/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java index 2f932b1fc..36dac5f21 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngineCompound.java @@ -81,7 +81,7 @@ public class IrisEngineCompound implements EngineCompound { public IrisEngineCompound(IrisWorld world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads) { wallClock = new AtomicRollingSequence(32); this.rootDimension = rootDimension; - Iris.info("Initializing Engine Composite for " + world.getName()); + Iris.info("Initializing Engine Composite for " + world.name()); this.world = world; engineMetadata = EngineData.load(getEngineMetadataFile()); engineMetadata.setDimension(rootDimension.getLoadKey()); @@ -209,7 +209,7 @@ public class IrisEngineCompound implements EngineCompound { } private File getEngineMetadataFile() { - return new File(world.getWorldFolder(), "iris/engine-metadata.json"); + return new File(world.worldFolder(), "iris/engine-metadata.json"); } @Override From 854b13782020e6c1c3ac12a457da2c02a19e7d2b Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:57:05 -0400 Subject: [PATCH 28/42] Fix wrong list for worlds --- .../java/com/volmit/iris/engine/object/common/IrisWorld.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java index d3d00b3d2..3d1f5b2c9 100644 --- a/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java +++ b/src/main/java/com/volmit/iris/engine/object/common/IrisWorld.java @@ -32,6 +32,7 @@ import org.bukkit.entity.Player; import java.io.File; import java.util.Collection; +import java.util.List; @Builder @Data @@ -68,7 +69,7 @@ public class IrisWorld { return realWorld != null; } - public Iterable getPlayers() { + public List getPlayers() { if(hasRealWorld()) { From f58f29389cb3c4ce72be2dcb716db1f0a7c08f56 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:58:16 -0400 Subject: [PATCH 29/42] Use IrisWorld instead of FakeWorld om World Creator --- .../java/com/volmit/iris/engine/IrisWorldCreator.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java b/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java index ce830b071..f9c23436a 100644 --- a/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java +++ b/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java @@ -21,6 +21,7 @@ package com.volmit.iris.engine; import com.volmit.iris.core.IrisDataManager; import com.volmit.iris.engine.framework.EngineCompositeGenerator; import com.volmit.iris.engine.object.IrisDimension; +import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.util.fakenews.FakeWorld; import org.bukkit.World; import org.bukkit.WorldCreator; @@ -78,8 +79,14 @@ public class IrisWorldCreator { public WorldCreator create() { EngineCompositeGenerator g = new EngineCompositeGenerator(dimensionName, !studio); - g.initialize(new FakeWorld(name, minHeight, maxHeight, seed, new File(name), findEnvironment())); - + g.initialize(IrisWorld.builder() + .name(name) + .minHeight(minHeight) + .maxHeight(maxHeight) + .seed(seed) + .worldFolder(new File(name)) + .environment(findEnvironment()) + .build()); return new WorldCreator(name) .environment(findEnvironment()) .generateStructures(true) From 8c272ea0328db802399548f46e383c26f60dff75 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:58:36 -0400 Subject: [PATCH 30/42] Cave mod headless support --- .../java/com/volmit/iris/engine/modifier/IrisCaveModifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier.java b/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier.java index 8e2cd9644..1596152f1 100644 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier.java +++ b/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier.java @@ -43,7 +43,7 @@ public class IrisCaveModifier extends EngineAssignedModifier { public IrisCaveModifier(Engine engine) { super(engine, "Cave"); - rng = new RNG(engine.getWorld().getSeed() + 28934555); + rng = new RNG(engine.getWorld().seed() + 28934555); gg = new FastNoiseDouble(324895L * rng.nextParallelRNG(49678).imax()); } From 05259eb0d2fb2fc65da2575ec6b13ab66399f279 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:58:49 -0400 Subject: [PATCH 31/42] Deposit mod support headless --- .../com/volmit/iris/engine/modifier/IrisDepositModifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisDepositModifier.java b/src/main/java/com/volmit/iris/engine/modifier/IrisDepositModifier.java index 623678fee..035e95383 100644 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisDepositModifier.java +++ b/src/main/java/com/volmit/iris/engine/modifier/IrisDepositModifier.java @@ -36,7 +36,7 @@ public class IrisDepositModifier extends EngineAssignedModifier { public IrisDepositModifier(Engine engine) { super(engine, "Deposit"); - rng = new RNG(getEngine().getWorld().getSeed() + 12938).nextParallelRNG(28348777); + rng = new RNG(getEngine().getWorld().seed() + 12938).nextParallelRNG(28348777); } @Override From 078ac1abe41d771beccebbc788939951ec83af67 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:59:01 -0400 Subject: [PATCH 32/42] Post mod support headless --- .../java/com/volmit/iris/engine/modifier/IrisPostModifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java b/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java index 89aeaf6e7..67309d589 100644 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java +++ b/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java @@ -40,7 +40,7 @@ public class IrisPostModifier extends EngineAssignedModifier { public IrisPostModifier(Engine engine) { super(engine, "Post"); - rng = new RNG(getEngine().getWorld().getSeed() + 12938).nextParallelRNG(28348777); + rng = new RNG(getEngine().getWorld().seed() + 12938).nextParallelRNG(28348777); } @Override From 2bc27bd6f58c0a5ac8e385ea93b7e78970f37c5d Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:59:14 -0400 Subject: [PATCH 33/42] Ravine mod support headless --- .../com/volmit/iris/engine/modifier/IrisRavineModifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisRavineModifier.java b/src/main/java/com/volmit/iris/engine/modifier/IrisRavineModifier.java index 25fcaa5ac..1fd82cdbb 100644 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisRavineModifier.java +++ b/src/main/java/com/volmit/iris/engine/modifier/IrisRavineModifier.java @@ -41,7 +41,7 @@ public class IrisRavineModifier extends EngineAssignedModifier { public IrisRavineModifier(Engine engine) { super(engine, "Ravine"); - rng = new RNG(getEngine().getWorld().getSeed()).nextParallelRNG(29596878); + rng = new RNG(getEngine().getWorld().seed()).nextParallelRNG(29596878); cng = NoiseStyle.IRIS_THICK.create(rng); } From ab06365a81c98a56075d1681b21f490b09b765c7 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 18:59:48 -0400 Subject: [PATCH 34/42] Fix FakeEngine --- .../java/com/volmit/iris/util/fakenews/FakeEngine.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java b/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java index b6fb97c02..03f7c7c33 100644 --- a/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java +++ b/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java @@ -23,6 +23,7 @@ import com.volmit.iris.engine.IrisEngineFramework; import com.volmit.iris.engine.framework.*; import com.volmit.iris.engine.hunk.Hunk; import com.volmit.iris.engine.object.*; +import com.volmit.iris.engine.object.common.IrisWorld; import lombok.Getter; import org.bukkit.World; import org.bukkit.block.Biome; @@ -30,8 +31,6 @@ import org.bukkit.block.data.BlockData; public class FakeEngine implements Engine { - - @Getter private double maxBiomeObjectDensity; @@ -47,9 +46,9 @@ public class FakeEngine implements Engine { private final EngineFramework framework; @Getter - private final World world; + private final IrisWorld world; - public FakeEngine(IrisDimension dimension, FakeWorld world) { + public FakeEngine(IrisDimension dimension, IrisWorld world) { this.dimension = dimension; this.world = world; computeBiomeMaxes(); From 2f9658fa221e63003da1156172fee8a8f097f3c4 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:00:45 -0400 Subject: [PATCH 35/42] No More Fake News --- .../volmit/iris/util/fakenews/FakeEngine.java | 196 --- .../volmit/iris/util/fakenews/FakeWorld.java | 1214 ----------------- .../iris/util/fakenews/HeightedFakeWorld.java | 1200 ---------------- 3 files changed, 2610 deletions(-) delete mode 100644 src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java delete mode 100644 src/main/java/com/volmit/iris/util/fakenews/FakeWorld.java delete mode 100644 src/main/java/com/volmit/iris/util/fakenews/HeightedFakeWorld.java diff --git a/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java b/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java deleted file mode 100644 index 03f7c7c33..000000000 --- a/src/main/java/com/volmit/iris/util/fakenews/FakeEngine.java +++ /dev/null @@ -1,196 +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.util.fakenews; - -import com.volmit.iris.core.IrisDataManager; -import com.volmit.iris.engine.IrisEngineFramework; -import com.volmit.iris.engine.framework.*; -import com.volmit.iris.engine.hunk.Hunk; -import com.volmit.iris.engine.object.*; -import com.volmit.iris.engine.object.common.IrisWorld; -import lombok.Getter; -import org.bukkit.World; -import org.bukkit.block.Biome; -import org.bukkit.block.data.BlockData; - - -public class FakeEngine implements Engine { - @Getter - private double maxBiomeObjectDensity; - - @Getter - private double maxBiomeLayerDensity; - - @Getter - private double maxBiomeDecoratorDensity; - - @Getter - private final IrisDimension dimension; - - private final EngineFramework framework; - - @Getter - private final IrisWorld world; - - public FakeEngine(IrisDimension dimension, IrisWorld world) { - this.dimension = dimension; - this.world = world; - computeBiomeMaxes(); - this.framework = new IrisEngineFramework(this); - } - - private void computeBiomeMaxes() { - for (IrisBiome i : getDimension().getAllBiomes(this)) { - double density = 0; - - for (IrisObjectPlacement j : i.getObjects()) { - density += j.getDensity() * j.getChance(); - } - - maxBiomeObjectDensity = Math.max(maxBiomeObjectDensity, density); - density = 0; - - for (IrisDecorator j : i.getDecorators()) { - density += Math.max(j.getStackMax(), 1) * j.getChance(); - } - - maxBiomeDecoratorDensity = Math.max(maxBiomeDecoratorDensity, density); - density = 0; - - for (IrisBiomePaletteLayer j : i.getLayers()) { - density++; - } - - maxBiomeLayerDensity = Math.max(maxBiomeLayerDensity, density); - } - } - - @Override - public void close() { - } - - @Override - public boolean isClosed() { - return false; - } - - @Override - public IrisDataManager getData() { - return dimension.getLoader().copy(); - } - - @Override - public EngineWorldManager getWorldManager() { - return null; - } - - @Override - public void setParallelism(int parallelism) { - } - - @Override - public int getParallelism() { - return 0; - } - - @Override - public EngineTarget getTarget() { - return null; - } - - @Override - public EngineFramework getFramework() { - return null; - } - - @Override - public void setMinHeight(int min) { - } - - @Override - public void recycle() { - } - - @Override - public int getIndex() { - return 0; - } - - @Override - public int getMinHeight() { - return 0; - } - - @Override - public int getHeight() { - return 64; - } - - @Override - public double modifyX(double x) { - return 0; - } - - @Override - public double modifyZ(double z) { - return 0; - } - - @Override - public void generate(int x, int z, Hunk blocks, Hunk biomes) { - } - - @Override - public EngineMetrics getMetrics() { - return null; - } - - @Override - public EngineEffects getEffects() { - return null; - } - - @Override - public EngineCompound getCompound() { - return null; - } - - @Override - public IrisBiome getFocus() { - return null; - } - - @Override - public void fail(String error, Throwable e) { - } - - @Override - public boolean hasFailed() { - return false; - } - - @Override - public int getCacheID() { - return 0; - } - - @Override - public void hotload() { - } -} diff --git a/src/main/java/com/volmit/iris/util/fakenews/FakeWorld.java b/src/main/java/com/volmit/iris/util/fakenews/FakeWorld.java deleted file mode 100644 index a86b67185..000000000 --- a/src/main/java/com/volmit/iris/util/fakenews/FakeWorld.java +++ /dev/null @@ -1,1214 +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.util.fakenews; - -import lombok.Setter; -import org.bukkit.*; -import org.bukkit.block.Biome; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.boss.DragonBattle; -import org.bukkit.entity.*; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.plugin.Plugin; -import org.bukkit.util.BoundingBox; -import org.bukkit.util.Consumer; -import org.bukkit.util.RayTraceResult; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.util.*; -import java.util.function.Predicate; - -@SuppressWarnings("deprecation") -public class FakeWorld implements World { - private final int height; - private final int minHeight; - private final long seed; - private final File worldFolder; - private final Environment environment; - @Setter - private String worldName; - - public FakeWorld(String name, int minHeight, int height, long seed, File worldFolder, Environment environment) { - this.worldName = name; - this.height = height; - this.seed = seed; - this.worldFolder = worldFolder; - this.minHeight = minHeight; - this.environment = environment; - worldFolder.mkdirs(); - } - - @Override - public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, @NotNull byte[] message) { - - } - - @NotNull - @Override - public Set getListeningPluginChannels() { - - return null; - } - - @Override - public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) { - - } - - @NotNull - @Override - public List getMetadata(@NotNull String metadataKey) { - - return null; - } - - @Override - public boolean hasMetadata(@NotNull String metadataKey) { - - return false; - } - - @Override - public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) { - - } - - @NotNull - @Override - public Block getBlockAt(int x, int y, int z) { - - return null; - } - - @NotNull - @Override - public Block getBlockAt(@NotNull Location location) { - - return null; - } - - @Override - public int getHighestBlockYAt(int x, int z) { - - return 0; - } - - @Override - public int getHighestBlockYAt(@NotNull Location location) { - - return 0; - } - - @NotNull - @Override - public Block getHighestBlockAt(int x, int z) { - - return null; - } - - @NotNull - @Override - public Block getHighestBlockAt(@NotNull Location location) { - - return null; - } - - @Override - public int getHighestBlockYAt(int x, int z, @NotNull HeightMap heightMap) { - - return 0; - } - - @Override - public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightMap heightMap) { - - return 0; - } - - @NotNull - @Override - public Block getHighestBlockAt(int x, int z, @NotNull HeightMap heightMap) { - - return null; - } - - @NotNull - @Override - public Block getHighestBlockAt(@NotNull Location location, @NotNull HeightMap heightMap) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(int x, int z) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(@NotNull Location location) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(@NotNull Block block) { - - return null; - } - - @Override - public boolean isChunkLoaded(@NotNull Chunk chunk) { - - return false; - } - - @NotNull - @Override - public Chunk[] getLoadedChunks() { - - return null; - } - - @Override - public void loadChunk(@NotNull Chunk chunk) { - - } - - @Override - public boolean isChunkLoaded(int x, int z) { - - return false; - } - - @Override - public boolean isChunkGenerated(int x, int z) { - - return false; - } - - @Override - public boolean isChunkInUse(int x, int z) { - - return false; - } - - @Override - public void loadChunk(int x, int z) { - - } - - @Override - public boolean loadChunk(int x, int z, boolean generate) { - - return false; - } - - @Override - public boolean unloadChunk(@NotNull Chunk chunk) { - - return false; - } - - @Override - public boolean unloadChunk(int x, int z) { - - return false; - } - - @Override - public boolean unloadChunk(int x, int z, boolean save) { - - return false; - } - - @Override - public boolean unloadChunkRequest(int x, int z) { - - return false; - } - - @Override - public boolean regenerateChunk(int x, int z) { - - return false; - } - - @Override - public boolean refreshChunk(int x, int z) { - - return false; - } - - @Override - public boolean isChunkForceLoaded(int x, int z) { - - return false; - } - - @Override - public void setChunkForceLoaded(int x, int z, boolean forced) { - - } - - @NotNull - @Override - public Collection getForceLoadedChunks() { - - return null; - } - - @Override - public boolean addPluginChunkTicket(int x, int z, @NotNull Plugin plugin) { - - return false; - } - - @Override - public boolean removePluginChunkTicket(int x, int z, @NotNull Plugin plugin) { - - return false; - } - - @Override - public void removePluginChunkTickets(@NotNull Plugin plugin) { - - } - - @NotNull - @Override - public Collection getPluginChunkTickets(int x, int z) { - - return null; - } - - @NotNull - @Override - public Map> getPluginChunkTickets() { - - return null; - } - - @NotNull - @Override - public Item dropItem(@NotNull Location location, @NotNull ItemStack item) { - - return null; - } - - @NotNull - @Override - public Item dropItem(@NotNull Location location, @NotNull ItemStack itemStack, @Nullable Consumer consumer) { - return null; - } - - @NotNull - @Override - public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item) { - - return null; - } - - @NotNull - @Override - public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack itemStack, @Nullable Consumer consumer) { - return null; - } - - @NotNull - @Override - public Arrow spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread) { - - return null; - } - - @NotNull - @Override - public T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class clazz) { - - return null; - } - - @Override - public boolean generateTree(@NotNull Location location, @NotNull TreeType type) { - - return false; - } - - @Override - public boolean generateTree(@NotNull Location loc, @NotNull TreeType type, @NotNull BlockChangeDelegate delegate) { - - return false; - } - - @NotNull - @Override - public Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type) { - - return null; - } - - @NotNull - @Override - public LightningStrike strikeLightning(@NotNull Location loc) { - - return null; - } - - @NotNull - @Override - public LightningStrike strikeLightningEffect(@NotNull Location loc) { - - return null; - } - - @NotNull - @Override - public List getEntities() { - - return null; - } - - @NotNull - @Override - public List getLivingEntities() { - - return null; - } - - @NotNull - @SuppressWarnings({"RedundantSuppression", "unchecked"}) - @Override - public Collection getEntitiesByClass(@NotNull @SuppressWarnings("unchecked") Class... classes) { - - return null; - } - - @NotNull - @Override - public Collection getEntitiesByClass(@NotNull Class cls) { - - return null; - } - - @NotNull - @Override - public Collection getEntitiesByClasses(@NotNull Class... classes) { - - return null; - } - - @NotNull - @Override - public List getPlayers() { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z, Predicate filter) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull BoundingBox boundingBox) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull BoundingBox boundingBox, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) { - - return null; - } - - @Override - public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate filter) { - - return null; - } - - @NotNull - @Override - public String getName() { - - return worldName; - } - - @NotNull - @Override - public UUID getUID() { - - return null; - } - - @NotNull - @Override - public Location getSpawnLocation() { - - return null; - } - - @Override - public boolean setSpawnLocation(@NotNull Location location) { - - return false; - } - - @Override - public boolean setSpawnLocation(int i, int i1, int i2, float v) { - return false; - } - - @Override - public boolean setSpawnLocation(int x, int y, int z) { - - return false; - } - - @Override - public long getTime() { - - return 0; - } - - @Override - public void setTime(long time) { - - } - - @Override - public long getFullTime() { - - return 0; - } - - @Override - public void setFullTime(long time) { - - } - - @Override - public long getGameTime() { - return 0; - } - - @Override - public boolean hasStorm() { - - return false; - } - - @Override - public void setStorm(boolean hasStorm) { - - } - - @Override - public int getWeatherDuration() { - - return 0; - } - - @Override - public void setWeatherDuration(int duration) { - - } - - @Override - public boolean isThundering() { - - return false; - } - - @Override - public void setThundering(boolean thundering) { - - } - - @Override - public int getThunderDuration() { - - return 0; - } - - @Override - public void setThunderDuration(int duration) { - - } - - @Override - public boolean isClearWeather() { - return false; - } - - @Override - public void setClearWeatherDuration(int i) { - - } - - @Override - public int getClearWeatherDuration() { - return 0; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, Entity source) { - - return false; - } - - @NotNull - @Override - public Environment getEnvironment() { - - return environment; - } - - @Override - public long getSeed() { - - return seed; - } - - @Override - public boolean getPVP() { - - return false; - } - - @Override - public void setPVP(boolean pvp) { - - } - - @Override - public ChunkGenerator getGenerator() { - - return null; - } - - @Override - public void save() { - - } - - @NotNull - @Override - public List getPopulators() { - - return null; - } - - @NotNull - @Override - public T spawn(@NotNull Location location, @NotNull Class clazz) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public T spawn(@NotNull Location location, @NotNull Class clazz, Consumer function) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data) throws IllegalArgumentException { - - return null; - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, int data) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, int data, int radius) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, T data) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, T data, int radius) { - - } - - @NotNull - @Override - public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp) { - - return null; - } - - @Override - public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) { - - } - - @Override - public boolean getAllowAnimals() { - - return false; - } - - @Override - public boolean getAllowMonsters() { - - return false; - } - - @NotNull - @Override - public Biome getBiome(int x, int z) { - - return null; - } - - @NotNull - @Override - public Biome getBiome(int x, int y, int z) { - - return null; - } - - @Override - public void setBiome(int x, int z, @NotNull Biome bio) { - - } - - @Override - public void setBiome(int x, int y, int z, @NotNull Biome bio) { - - } - - @Override - public double getTemperature(int x, int z) { - - return 0; - } - - @Override - public double getTemperature(int x, int y, int z) { - - return 0; - } - - @Override - public double getHumidity(int x, int z) { - - return 0; - } - - @Override - public double getHumidity(int x, int y, int z) { - - return 0; - } - - @Override - public int getMinHeight() { - return minHeight; - } - - @Override - public int getMaxHeight() { - - return height; - } - - @Override - public int getSeaLevel() { - - return 0; - } - - @Override - public boolean getKeepSpawnInMemory() { - - return false; - } - - @Override - public void setKeepSpawnInMemory(boolean keepLoaded) { - - } - - @Override - public boolean isAutoSave() { - - return false; - } - - @Override - public void setAutoSave(boolean value) { - - } - - @Override - public void setDifficulty(@NotNull Difficulty difficulty) { - - } - - @NotNull - @Override - public Difficulty getDifficulty() { - - return null; - } - - @NotNull - @Override - public File getWorldFolder() { - - return worldFolder; - } - - @Override - public WorldType getWorldType() { - - return null; - } - - @Override - public boolean canGenerateStructures() { - - return false; - } - - @Override - public boolean isHardcore() { - - return false; - } - - @Override - public void setHardcore(boolean hardcore) { - - } - - @Override - public long getTicksPerAnimalSpawns() { - - return 0; - } - - @Override - public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) { - - } - - @Override - public long getTicksPerMonsterSpawns() { - - return 0; - } - - @Override - public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) { - - } - - @Override - public long getTicksPerWaterSpawns() { - - return 0; - } - - @Override - public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) { - - } - - @Override - public long getTicksPerWaterAmbientSpawns() { - - return 0; - } - - @Override - public void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns) { - - } - - @Override - public long getTicksPerAmbientSpawns() { - - return 0; - } - - @Override - public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) { - - } - - @Override - public int getMonsterSpawnLimit() { - - return 0; - } - - @Override - public void setMonsterSpawnLimit(int limit) { - - } - - @Override - public int getAnimalSpawnLimit() { - - return 0; - } - - @Override - public void setAnimalSpawnLimit(int limit) { - - } - - @Override - public int getWaterAnimalSpawnLimit() { - - return 0; - } - - @Override - public void setWaterAnimalSpawnLimit(int limit) { - - } - - @Override - public int getWaterAmbientSpawnLimit() { - - return 0; - } - - @Override - public void setWaterAmbientSpawnLimit(int limit) { - - } - - @Override - public int getAmbientSpawnLimit() { - - return 0; - } - - @Override - public void setAmbientSpawnLimit(int limit) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull Sound sound, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull String sound, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) { - - } - - @NotNull - @Override - public String[] getGameRules() { - - return null; - } - - @Override - public String getGameRuleValue(String rule) { - - return null; - } - - @Override - public boolean setGameRuleValue(@NotNull String rule, @NotNull String value) { - - return false; - } - - @Override - public boolean isGameRule(@NotNull String rule) { - - return false; - } - - @Override - public T getGameRuleValue(@NotNull GameRule rule) { - - return null; - } - - @Override - public T getGameRuleDefault(@NotNull GameRule rule) { - - return null; - } - - @Override - public boolean setGameRule(@NotNull GameRule rule, @NotNull T newValue) { - - return false; - } - - @NotNull - @Override - public WorldBorder getWorldBorder() { - - return null; - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { - - } - - @Override - public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { - return null; - } - - @Override - public int getViewDistance() { - return 0; - } - - @NotNull - @Override - public Spigot spigot() { - return null; - } - - @Override - public Raid locateNearestRaid(@NotNull Location location, int radius) { - return null; - } - - @NotNull - @Override - public List getRaids() { - return null; - } - - @Override - public DragonBattle getEnderDragonBattle() { - return null; - } -} diff --git a/src/main/java/com/volmit/iris/util/fakenews/HeightedFakeWorld.java b/src/main/java/com/volmit/iris/util/fakenews/HeightedFakeWorld.java deleted file mode 100644 index 8176f0cb9..000000000 --- a/src/main/java/com/volmit/iris/util/fakenews/HeightedFakeWorld.java +++ /dev/null @@ -1,1200 +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.util.fakenews; - -import org.bukkit.*; -import org.bukkit.block.Biome; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.boss.DragonBattle; -import org.bukkit.entity.*; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.plugin.Plugin; -import org.bukkit.util.BoundingBox; -import org.bukkit.util.Consumer; -import org.bukkit.util.RayTraceResult; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.util.*; -import java.util.function.Predicate; - -@SuppressWarnings({"deprecation", "ClassCanBeRecord", "unchecked"}) -public class HeightedFakeWorld implements World { - private final int height; - - public HeightedFakeWorld(int height) { - this.height = height; - } - - @Override - public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, @NotNull byte[] message) { - - } - - @NotNull - @Override - public Set getListeningPluginChannels() { - - return null; - } - - @Override - public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) { - - } - - @NotNull - @Override - public List getMetadata(@NotNull String metadataKey) { - - return null; - } - - @Override - public boolean hasMetadata(@NotNull String metadataKey) { - - return false; - } - - @Override - public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) { - - } - - @NotNull - @Override - public Block getBlockAt(int x, int y, int z) { - - return null; - } - - @NotNull - @Override - public Block getBlockAt(@NotNull Location location) { - - return null; - } - - @Override - public int getHighestBlockYAt(int x, int z) { - - return 0; - } - - @Override - public int getHighestBlockYAt(@NotNull Location location) { - - return 0; - } - - @NotNull - @Override - public Block getHighestBlockAt(int x, int z) { - - return null; - } - - @NotNull - @Override - public Block getHighestBlockAt(@NotNull Location location) { - - return null; - } - - @Override - public int getHighestBlockYAt(int x, int z, @NotNull HeightMap heightMap) { - - return 0; - } - - @Override - public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightMap heightMap) { - - return 0; - } - - @NotNull - @Override - public Block getHighestBlockAt(int x, int z, @NotNull HeightMap heightMap) { - - return null; - } - - @NotNull - @Override - public Block getHighestBlockAt(@NotNull Location location, @NotNull HeightMap heightMap) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(int x, int z) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(@NotNull Location location) { - - return null; - } - - @NotNull - @Override - public Chunk getChunkAt(@NotNull Block block) { - - return null; - } - - @Override - public boolean isChunkLoaded(@NotNull Chunk chunk) { - - return false; - } - - @NotNull - @Override - public Chunk[] getLoadedChunks() { - - return null; - } - - @Override - public void loadChunk(@NotNull Chunk chunk) { - - } - - @Override - public boolean isChunkLoaded(int x, int z) { - - return false; - } - - @Override - public boolean isChunkGenerated(int x, int z) { - - return false; - } - - @Override - public boolean isChunkInUse(int x, int z) { - - return false; - } - - @Override - public void loadChunk(int x, int z) { - - } - - @Override - public boolean loadChunk(int x, int z, boolean generate) { - - return false; - } - - @Override - public boolean unloadChunk(@NotNull Chunk chunk) { - - return false; - } - - @Override - public boolean unloadChunk(int x, int z) { - - return false; - } - - @Override - public boolean unloadChunk(int x, int z, boolean save) { - - return false; - } - - @Override - public boolean unloadChunkRequest(int x, int z) { - - return false; - } - - @Override - public boolean regenerateChunk(int x, int z) { - - return false; - } - - @Override - public boolean refreshChunk(int x, int z) { - - return false; - } - - @Override - public boolean isChunkForceLoaded(int x, int z) { - - return false; - } - - @Override - public void setChunkForceLoaded(int x, int z, boolean forced) { - - } - - @NotNull - @Override - public Collection getForceLoadedChunks() { - - return null; - } - - @Override - public boolean addPluginChunkTicket(int x, int z, @NotNull Plugin plugin) { - - return false; - } - - @Override - public boolean removePluginChunkTicket(int x, int z, @NotNull Plugin plugin) { - - return false; - } - - @Override - public void removePluginChunkTickets(@NotNull Plugin plugin) { - - } - - @NotNull - @Override - public Collection getPluginChunkTickets(int x, int z) { - - return null; - } - - @NotNull - @Override - public Map> getPluginChunkTickets() { - - return null; - } - - @NotNull - @Override - public Item dropItem(@NotNull Location location, @NotNull ItemStack item) { - - return null; - } - - @NotNull - @Override - public Item dropItem(@NotNull Location location, @NotNull ItemStack itemStack, @Nullable Consumer consumer) { - return null; - } - - @NotNull - @Override - public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item) { - - return null; - } - - @NotNull - @Override - public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack itemStack, @Nullable Consumer consumer) { - return null; - } - - @NotNull - @Override - public Arrow spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread) { - - return null; - } - - @NotNull - @Override - public T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class clazz) { - - return null; - } - - @Override - public boolean generateTree(@NotNull Location location, @NotNull TreeType type) { - - return false; - } - - @Override - public boolean generateTree(@NotNull Location loc, @NotNull TreeType type, @NotNull BlockChangeDelegate delegate) { - - return false; - } - - @NotNull - @Override - public Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type) { - - return null; - } - - @NotNull - @Override - public LightningStrike strikeLightning(@NotNull Location loc) { - - return null; - } - - @NotNull - @Override - public LightningStrike strikeLightningEffect(@NotNull Location loc) { - - return null; - } - - @NotNull - @Override - public List getEntities() { - - return null; - } - - @NotNull - @Override - public List getLivingEntities() { - - return null; - } - - @NotNull - @Override - public Collection getEntitiesByClass(@NotNull Class... classes) { - - return null; - } - - @NotNull - @Override - public Collection getEntitiesByClass(@NotNull Class cls) { - - return null; - } - - @NotNull - @Override - public Collection getEntitiesByClasses(@NotNull Class... classes) { - - return null; - } - - @NotNull - @Override - public List getPlayers() { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z, Predicate filter) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull BoundingBox boundingBox) { - - return null; - } - - @NotNull - @Override - public Collection getNearbyEntities(@NotNull BoundingBox boundingBox, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, Predicate filter) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) { - - return null; - } - - @Override - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) { - - return null; - } - - @Override - public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, Predicate filter) { - - return null; - } - - @NotNull - @Override - public String getName() { - - return null; - } - - @NotNull - @Override - public UUID getUID() { - - return null; - } - - @NotNull - @Override - public Location getSpawnLocation() { - - return null; - } - - @Override - public boolean setSpawnLocation(@NotNull Location location) { - - return false; - } - - @Override - public boolean setSpawnLocation(int i, int i1, int i2, float v) { - return false; - } - - @Override - public boolean setSpawnLocation(int x, int y, int z) { - - return false; - } - - @Override - public long getTime() { - - return 0; - } - - @Override - public void setTime(long time) { - - } - - @Override - public long getFullTime() { - - return 0; - } - - @Override - public void setFullTime(long time) { - - } - - @Override - public long getGameTime() { - return 0; - } - - @Override - public boolean hasStorm() { - - return false; - } - - @Override - public void setStorm(boolean hasStorm) { - - } - - @Override - public int getWeatherDuration() { - - return 0; - } - - @Override - public void setWeatherDuration(int duration) { - - } - - @Override - public boolean isThundering() { - - return false; - } - - @Override - public void setThundering(boolean thundering) { - - } - - @Override - public int getThunderDuration() { - - return 0; - } - - @Override - public void setThunderDuration(int duration) { - - } - - @Override - public boolean isClearWeather() { - return false; - } - - @Override - public void setClearWeatherDuration(int i) { - - } - - @Override - public int getClearWeatherDuration() { - return 0; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) { - - return false; - } - - @Override - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks) { - - return false; - } - - @Override - public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, Entity source) { - - return false; - } - - @NotNull - @Override - public Environment getEnvironment() { - - return null; - } - - @Override - public long getSeed() { - - return 0; - } - - @Override - public boolean getPVP() { - - return false; - } - - @Override - public void setPVP(boolean pvp) { - - } - - @Override - public ChunkGenerator getGenerator() { - - return null; - } - - @Override - public void save() { - - } - - @NotNull - @Override - public List getPopulators() { - - return null; - } - - @NotNull - @Override - public T spawn(@NotNull Location location, @NotNull Class clazz) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public T spawn(@NotNull Location location, @NotNull Class clazz, Consumer function) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException { - - return null; - } - - @NotNull - @Override - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data) throws IllegalArgumentException { - - return null; - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, int data) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, int data, int radius) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, T data) { - - } - - @Override - public void playEffect(@NotNull Location location, @NotNull Effect effect, T data, int radius) { - - } - - @NotNull - @Override - public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp) { - - return null; - } - - @Override - public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) { - - } - - @Override - public boolean getAllowAnimals() { - - return false; - } - - @Override - public boolean getAllowMonsters() { - - return false; - } - - @NotNull - @Override - public Biome getBiome(int x, int z) { - - return null; - } - - @NotNull - @Override - public Biome getBiome(int x, int y, int z) { - - return null; - } - - @Override - public void setBiome(int x, int z, @NotNull Biome bio) { - - } - - @Override - public void setBiome(int x, int y, int z, @NotNull Biome bio) { - - } - - @Override - public double getTemperature(int x, int z) { - - return 0; - } - - @Override - public double getTemperature(int x, int y, int z) { - - return 0; - } - - @Override - public double getHumidity(int x, int z) { - - return 0; - } - - @Override - public double getHumidity(int x, int y, int z) { - - return 0; - } - - @Override - public int getMinHeight() { - return 0; - } - - @Override - public int getMaxHeight() { - - return height; - } - - @Override - public int getSeaLevel() { - - return 0; - } - - @Override - public boolean getKeepSpawnInMemory() { - - return false; - } - - @Override - public void setKeepSpawnInMemory(boolean keepLoaded) { - - } - - @Override - public boolean isAutoSave() { - - return false; - } - - @Override - public void setAutoSave(boolean value) { - - } - - @Override - public void setDifficulty(@NotNull Difficulty difficulty) { - - } - - @NotNull - @Override - public Difficulty getDifficulty() { - - return null; - } - - @NotNull - @Override - public File getWorldFolder() { - - return null; - } - - @Override - public WorldType getWorldType() { - - return null; - } - - @Override - public boolean canGenerateStructures() { - - return false; - } - - @Override - public boolean isHardcore() { - - return false; - } - - @Override - public void setHardcore(boolean hardcore) { - - } - - @Override - public long getTicksPerAnimalSpawns() { - - return 0; - } - - @Override - public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) { - - } - - @Override - public long getTicksPerMonsterSpawns() { - - return 0; - } - - @Override - public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) { - - } - - @Override - public long getTicksPerWaterSpawns() { - - return 0; - } - - @Override - public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) { - - } - - @Override - public long getTicksPerWaterAmbientSpawns() { - - return 0; - } - - @Override - public void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns) { - - } - - @Override - public long getTicksPerAmbientSpawns() { - - return 0; - } - - @Override - public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) { - - } - - @Override - public int getMonsterSpawnLimit() { - - return 0; - } - - @Override - public void setMonsterSpawnLimit(int limit) { - - } - - @Override - public int getAnimalSpawnLimit() { - - return 0; - } - - @Override - public void setAnimalSpawnLimit(int limit) { - - } - - @Override - public int getWaterAnimalSpawnLimit() { - - return 0; - } - - @Override - public void setWaterAnimalSpawnLimit(int limit) { - - } - - @Override - public int getWaterAmbientSpawnLimit() { - - return 0; - } - - @Override - public void setWaterAmbientSpawnLimit(int limit) { - - } - - @Override - public int getAmbientSpawnLimit() { - - return 0; - } - - @Override - public void setAmbientSpawnLimit(int limit) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull Sound sound, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull String sound, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) { - - } - - @Override - public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) { - - } - - @NotNull - @Override - public String[] getGameRules() { - - return null; - } - - @Override - public String getGameRuleValue(String rule) { - - return null; - } - - @Override - public boolean setGameRuleValue(@NotNull String rule, @NotNull String value) { - - return false; - } - - @Override - public boolean isGameRule(@NotNull String rule) { - - return false; - } - - @Override - public T getGameRuleValue(@NotNull GameRule rule) { - - return null; - } - - @Override - public T getGameRuleDefault(@NotNull GameRule rule) { - - return null; - } - - @Override - public boolean setGameRule(@NotNull GameRule rule, @NotNull T newValue) { - - return false; - } - - @NotNull - @Override - public WorldBorder getWorldBorder() { - - return null; - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { - - } - - @Override - public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { - - } - - @Override - public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { - return null; - } - - @Override - public int getViewDistance() { - return 0; - } - - @NotNull - @Override - public Spigot spigot() { - return null; - } - - @Override - public Raid locateNearestRaid(@NotNull Location location, int radius) { - return null; - } - - @NotNull - @Override - public List getRaids() { - return null; - } - - @Override - public DragonBattle getEnderDragonBattle() { - return null; - } -} From db65a80a7f6e0d8b13f4b2416c4d1e615b4c1f34 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:01:53 -0400 Subject: [PATCH 36/42] Drop support for non-world terrain chunks --- .../engine/data/chunk/LinkedTerrainChunk.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java index 92ca2792e..f1af07874 100644 --- a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java +++ b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java @@ -22,7 +22,6 @@ import com.volmit.iris.Iris; import com.volmit.iris.core.nms.BiomeBaseInjector; import com.volmit.iris.core.nms.INMS; import com.volmit.iris.util.data.IrisBiomeStorage; -import com.volmit.iris.util.fakenews.HeightedFakeWorld; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Biome; @@ -38,33 +37,12 @@ public class LinkedTerrainChunk implements TerrainChunk { private ChunkData rawChunkData; private final BiomeGrid storage; - public LinkedTerrainChunk(int maxHeight) { - this(null, maxHeight); - } - public LinkedTerrainChunk(BiomeGrid storage, ChunkData data) { this.storage = storage; rawChunkData = data; biome3D = storage != null ? null : new IrisBiomeStorage(); } - public LinkedTerrainChunk(BiomeGrid storage, int maxHeight) { - this.storage = storage; - rawChunkData = createChunkData(maxHeight); - biome3D = storage != null ? null : new IrisBiomeStorage(); - } - - private ChunkData createChunkData(int maxHeight) { - try { - return Bukkit.createChunkData(new HeightedFakeWorld(maxHeight)); - } catch (Throwable e) { - Iris.reportError(e); - e.printStackTrace(); - } - - return null; - } - @Override public BiomeBaseInjector getBiomeBaseInjector() { return (x, y, z, bb) -> INMS.get().forceBiomeInto(x, y, z, bb, storage); From f933aae5624e369828006d203e2386590498c7ab Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:02:26 -0400 Subject: [PATCH 37/42] Cleanup imports --- .../volmit/iris/engine/framework/EngineCompositeGenerator.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java index 93a191302..49ebe3ae8 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java @@ -38,7 +38,6 @@ import com.volmit.iris.engine.parallel.BurstExecutor; import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; -import com.volmit.iris.util.fakenews.FakeWorld; import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.Form; import com.volmit.iris.util.io.ReactiveFolder; @@ -49,7 +48,6 @@ import com.volmit.iris.util.scheduling.ChronoLatch; import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.PrecisionStopwatch; import io.netty.util.internal.ConcurrentSet; -import io.papermc.lib.PaperLib; import lombok.Getter; import org.bukkit.*; import org.bukkit.block.Biome; From d5066adb4b425848cf66dbdfe22deb17b50cbda0 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:05:22 -0400 Subject: [PATCH 38/42] Fix terrain chunk creation --- .../com/volmit/iris/engine/IrisWorldCreator.java | 1 - .../iris/engine/data/chunk/LinkedTerrainChunk.java | 12 ++++++++++++ .../volmit/iris/engine/data/chunk/TerrainChunk.java | 12 ++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java b/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java index f9c23436a..3eeb54c59 100644 --- a/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java +++ b/src/main/java/com/volmit/iris/engine/IrisWorldCreator.java @@ -22,7 +22,6 @@ import com.volmit.iris.core.IrisDataManager; import com.volmit.iris.engine.framework.EngineCompositeGenerator; import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.common.IrisWorld; -import com.volmit.iris.util.fakenews.FakeWorld; import org.bukkit.World; import org.bukkit.WorldCreator; diff --git a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java index f1af07874..aa28d7e93 100644 --- a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java +++ b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java @@ -22,8 +22,10 @@ import com.volmit.iris.Iris; import com.volmit.iris.core.nms.BiomeBaseInjector; import com.volmit.iris.core.nms.INMS; import com.volmit.iris.util.data.IrisBiomeStorage; +import net.minecraft.world.level.chunk.BiomeStorage; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.data.BlockData; import org.bukkit.generator.ChunkGenerator.BiomeGrid; @@ -37,6 +39,16 @@ public class LinkedTerrainChunk implements TerrainChunk { private ChunkData rawChunkData; private final BiomeGrid storage; + public LinkedTerrainChunk(World world) + { + this(null, Bukkit.createChunkData(world)); + } + + public LinkedTerrainChunk(World world, BiomeGrid storage) + { + this(storage, Bukkit.createChunkData(world)); + } + public LinkedTerrainChunk(BiomeGrid storage, ChunkData data) { this.storage = storage; rawChunkData = data; diff --git a/src/main/java/com/volmit/iris/engine/data/chunk/TerrainChunk.java b/src/main/java/com/volmit/iris/engine/data/chunk/TerrainChunk.java index 785962413..078a39bef 100644 --- a/src/main/java/com/volmit/iris/engine/data/chunk/TerrainChunk.java +++ b/src/main/java/com/volmit/iris/engine/data/chunk/TerrainChunk.java @@ -28,25 +28,17 @@ import org.jetbrains.annotations.NotNull; public interface TerrainChunk extends BiomeGrid, ChunkData { static TerrainChunk create(World world) { - return create(world.getMaxHeight()); - } - - static TerrainChunk create(int maxHeight) { - return new LinkedTerrainChunk(maxHeight); + return new LinkedTerrainChunk(world); } static TerrainChunk create(World world, BiomeGrid grid) { - return create(world.getMaxHeight(), grid); + return new LinkedTerrainChunk(world, grid); } static TerrainChunk create(ChunkData raw, BiomeGrid grid) { return new LinkedTerrainChunk(grid, raw); } - static TerrainChunk create(int maxHeight, BiomeGrid grid) { - return new LinkedTerrainChunk(grid, maxHeight); - } - BiomeBaseInjector getBiomeBaseInjector(); void setRaw(ChunkData data); From dd54a714cbeb5d2d25cc8a65ca45ee30e2421fc4 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:35:56 -0400 Subject: [PATCH 39/42] Fix init errors --- .../volmit/iris/engine/framework/EngineCompositeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java index 49ebe3ae8..f16276dcb 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineCompositeGenerator.java @@ -441,13 +441,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) { PrecisionStopwatch ps = PrecisionStopwatch.start(); TerrainChunk tc = TerrainChunk.create(world, biome); + generateChunkRawData(getComposite().getWorld(), x, z, tc).run(); if(!getComposite().getWorld().hasRealWorld()) { getComposite().getWorld().bind(world); } - generateChunkRawData(getComposite().getWorld(), x, z, tc).run(); generated++; ps.end(); From d5f64a79b2bed5aa63d23bbf55ab11ec0576170b Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:36:02 -0400 Subject: [PATCH 40/42] Headless worlds --- .../iris/engine/headless/HeadlessWorld.java | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/main/java/com/volmit/iris/engine/headless/HeadlessWorld.java diff --git a/src/main/java/com/volmit/iris/engine/headless/HeadlessWorld.java b/src/main/java/com/volmit/iris/engine/headless/HeadlessWorld.java new file mode 100644 index 000000000..b84ddf929 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/headless/HeadlessWorld.java @@ -0,0 +1,80 @@ +/* + * 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.headless; + +import com.volmit.iris.Iris; +import com.volmit.iris.core.IrisDataManager; +import com.volmit.iris.engine.framework.EngineCompositeGenerator; +import com.volmit.iris.engine.object.IrisDimension; +import com.volmit.iris.engine.object.common.IrisWorld; +import com.volmit.iris.util.plugin.VolmitSender; +import lombok.Data; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; + +import java.io.File; + +@Data +@SuppressWarnings("ResultOfMethodCallIgnored") +public class HeadlessWorld { + private final IrisDimension dimension; + private final String worldName; + private final IrisWorld world; + + public HeadlessWorld(String worldName, IrisDimension dimension, long seed) + { + this.worldName = worldName; + this.dimension = dimension; + world = IrisWorld.builder() + .environment(dimension.getEnvironment()) + .worldFolder(new File(worldName)) + .seed(seed) + .maxHeight(256) + .minHeight(0) + .name(worldName) + .build(); + world.worldFolder().mkdirs(); + new File(world.worldFolder(), "region").mkdirs(); + + if(!new File(world.worldFolder(), "iris").exists()) + { + Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag("Headless")), dimension.getLoadKey(), world.worldFolder()); + } + } + + public HeadlessGenerator headlessMode() + { + return new HeadlessGenerator(this); + } + + public World load() + { + return new WorldCreator(worldName) + .environment(dimension.getEnvironment()) + .seed(world.seed()) + .generator(new EngineCompositeGenerator(dimension.getLoadKey(), true)) + .createWorld(); + } + + public static HeadlessWorld from(String name, String dimension, long seed) + { + return new HeadlessWorld(name, IrisDataManager.loadAnyDimension(dimension), seed); + } +} From 254b5c963b08936f15fcb879883abedffda02e8a Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:36:18 -0400 Subject: [PATCH 41/42] Headless Generator --- .../engine/headless/HeadlessGenerator.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java diff --git a/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java b/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java new file mode 100644 index 000000000..b9802da7d --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java @@ -0,0 +1,38 @@ +/* + * 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.headless; + +import com.volmit.iris.engine.data.mca.NBTWorld; +import com.volmit.iris.engine.framework.EngineCompositeGenerator; +import lombok.Data; + +@Data +public class HeadlessGenerator { + private final HeadlessWorld world; + private final EngineCompositeGenerator generator; + private final NBTWorld writer; + + public HeadlessGenerator(HeadlessWorld world) + { + this.world = world; + generator = new EngineCompositeGenerator(world.getDimension().getLoadKey(), true); + generator.initialize(world.getWorld()); + writer = new NBTWorld(world.getWorld().worldFolder()); + } +} From 51f333471192b5915ed2a4f09c108e5abcab0dd7 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 18 Jul 2021 19:49:54 -0400 Subject: [PATCH 42/42] Headless generation --- .../engine/headless/HeadlessGenerator.java | 25 +++++++++++++++++++ .../iris/engine/parallel/MultiBurst.java | 18 +++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java b/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java index b9802da7d..b2f2967a7 100644 --- a/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java +++ b/src/main/java/com/volmit/iris/engine/headless/HeadlessGenerator.java @@ -20,6 +20,7 @@ package com.volmit.iris.engine.headless; import com.volmit.iris.engine.data.mca.NBTWorld; import com.volmit.iris.engine.framework.EngineCompositeGenerator; +import com.volmit.iris.engine.parallel.MultiBurst; import lombok.Data; @Data @@ -27,12 +28,36 @@ public class HeadlessGenerator { private final HeadlessWorld world; private final EngineCompositeGenerator generator; private final NBTWorld writer; + private final MultiBurst burst; public HeadlessGenerator(HeadlessWorld world) { this.world = world; + burst = new MultiBurst("Iris Headless Generator", 9, Runtime.getRuntime().availableProcessors()); generator = new EngineCompositeGenerator(world.getDimension().getLoadKey(), true); generator.initialize(world.getWorld()); writer = new NBTWorld(world.getWorld().worldFolder()); } + + public void generateChunk(int x, int z) + { + generator.directWriteChunk(world.getWorld(), x, z, writer); + } + + public void generateRegion(int x, int z) + { + generator.directWriteMCA(world.getWorld(), x, z, writer, burst); + } + + public void save() + { + writer.save(); + } + + public void close() + { + burst.shutdownAndAwait(); + generator.close(); + writer.close(); + } } diff --git a/src/main/java/com/volmit/iris/engine/parallel/MultiBurst.java b/src/main/java/com/volmit/iris/engine/parallel/MultiBurst.java index da965047b..e79883bd7 100644 --- a/src/main/java/com/volmit/iris/engine/parallel/MultiBurst.java +++ b/src/main/java/com/volmit/iris/engine/parallel/MultiBurst.java @@ -95,4 +95,22 @@ public class MultiBurst { public void shutdown() { service.shutdown(); } + + public void shutdownAndAwait() { + service.shutdown(); + + try + { + while(!service.awaitTermination(10, TimeUnit.SECONDS)) + { + Iris.info("Still waiting to shutdown burster..."); + } + } + + catch(Throwable e) + { + e.printStackTrace(); + Iris.reportError(e); + } + } }