From d891791929786d250fcc03a5f73151b0642167d8 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Sun, 19 Sep 2021 00:48:16 -0400 Subject: [PATCH 1/7] Engine modes --- .../iris/engine/framework/EngineMode.java | 33 +++++++++++++++++++ .../iris/engine/framework/SeedManager.java | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 src/main/java/com/volmit/iris/engine/framework/EngineMode.java diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineMode.java b/src/main/java/com/volmit/iris/engine/framework/EngineMode.java new file mode 100644 index 000000000..5f59b1090 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/framework/EngineMode.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2021 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.volmit.iris.engine.framework; + +import com.volmit.iris.util.documentation.BlockCoordinates; +import com.volmit.iris.util.hunk.Hunk; +import org.bukkit.block.Biome; +import org.bukkit.block.data.BlockData; + +public interface EngineMode { + void close(); + + Engine getEngine(); + + @BlockCoordinates + void generate(int x, int z, Hunk blocks, Hunk biomes, boolean multicore); +} diff --git a/src/main/java/com/volmit/iris/engine/framework/SeedManager.java b/src/main/java/com/volmit/iris/engine/framework/SeedManager.java index d4051b5fe..66a146895 100644 --- a/src/main/java/com/volmit/iris/engine/framework/SeedManager.java +++ b/src/main/java/com/volmit/iris/engine/framework/SeedManager.java @@ -51,6 +51,7 @@ public class SeedManager { private final long deposit; private final long post; private final long bodies; + private final long mode; @Setter(AccessLevel.NONE) private long fullMixedSeed; @@ -75,6 +76,7 @@ public class SeedManager { deposit = of("deposit"); post = of("post"); bodies = of("bodies"); + mode = of("mode"); } private long of(String name) { From b95cea35a2b071f3e788b728b74c3f0b40608eda Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Sun, 19 Sep 2021 03:15:49 -0400 Subject: [PATCH 2/7] Modes --- .../com/volmit/iris/engine/IrisEngine.java | 36 ++++------- .../volmit/iris/engine/framework/Engine.java | 6 +- .../iris/engine/framework/EngineMode.java | 47 +++++++++++++- .../iris/engine/framework/IrisEngineMode.java | 61 +++++++++++++++++++ .../volmit/iris/engine/framework/Staged.java | 33 ++++++++++ .../iris/engine/mode/ModeEnclosure.java | 39 ++++++++++++ .../volmit/iris/engine/mode/ModeIslands.java | 39 ++++++++++++ .../iris/engine/mode/ModeOverworld.java | 59 ++++++++++++++++++ .../iris/engine/mode/ModeSuperFlat.java | 39 ++++++++++++ .../iris/engine/object/IrisDimension.java | 3 + .../iris/engine/object/IrisDimensionMode.java | 38 ++++++++++++ .../engine/object/IrisDimensionModeType.java | 56 +++++++++++++++++ 12 files changed, 426 insertions(+), 30 deletions(-) create mode 100644 src/main/java/com/volmit/iris/engine/framework/IrisEngineMode.java create mode 100644 src/main/java/com/volmit/iris/engine/framework/Staged.java create mode 100644 src/main/java/com/volmit/iris/engine/mode/ModeEnclosure.java create mode 100644 src/main/java/com/volmit/iris/engine/mode/ModeIslands.java create mode 100644 src/main/java/com/volmit/iris/engine/mode/ModeOverworld.java create mode 100644 src/main/java/com/volmit/iris/engine/mode/ModeSuperFlat.java create mode 100644 src/main/java/com/volmit/iris/engine/object/IrisDimensionMode.java create mode 100644 src/main/java/com/volmit/iris/engine/object/IrisDimensionModeType.java diff --git a/src/main/java/com/volmit/iris/engine/IrisEngine.java b/src/main/java/com/volmit/iris/engine/IrisEngine.java index 4ef3a0910..a8ff713e7 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngine.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngine.java @@ -31,12 +31,14 @@ import com.volmit.iris.engine.data.cache.AtomicCache; import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.EngineEffects; import com.volmit.iris.engine.framework.EngineMetrics; +import com.volmit.iris.engine.framework.EngineMode; import com.volmit.iris.engine.framework.EngineStage; import com.volmit.iris.engine.framework.EngineTarget; import com.volmit.iris.engine.framework.EngineWorldManager; import com.volmit.iris.engine.framework.SeedManager; import com.volmit.iris.engine.framework.WrongEngineBroException; import com.volmit.iris.engine.mantle.EngineMantle; +import com.volmit.iris.engine.mode.ModeOverworld; import com.volmit.iris.engine.modifier.IrisCarveModifier; import com.volmit.iris.engine.modifier.IrisDepositModifier; import com.volmit.iris.engine.modifier.IrisPerfectionModifier; @@ -94,6 +96,7 @@ public class IrisEngine implements Engine { private final KList stages; private final AtomicRollingSequence wallClock; private final int art; + private EngineMode mode; private final AtomicCache engineData = new AtomicCache<>(); private final AtomicBoolean cleaning; private final ChronoLatch cleanLatch; @@ -167,6 +170,8 @@ public class IrisEngine implements Engine { stages.forEach(EngineStage::close); stages.clear(); effects.close(); + mode.close(); + J.a(() -> new IrisProject(getData().getDataFolder()).updateWorkspace()); } @@ -178,7 +183,7 @@ public class IrisEngine implements Engine { complex = new IrisComplex(this); execution = new IrisExecutionEnvironment(this); effects = new IrisEngineEffects(this); - setupStages(); + setupMode(); J.a(this::computeBiomeMaxes); } catch (Throwable e) { Iris.error("FAILED TO SETUP ENGINE!"); @@ -188,25 +193,13 @@ public class IrisEngine implements Engine { Iris.debug("Engine Setup Complete " + getCacheID()); } - private void setupStages() { - var terrain = new IrisTerrainNormalActuator(this); - var biome = new IrisBiomeActuator(this); - var decorant = new IrisDecorantActuator(this); - var cave = new IrisCarveModifier(this); - var post = new IrisPostModifier(this); - var deposit = new IrisDepositModifier(this); - var perfection = new IrisPerfectionModifier(this); + private void setupMode() { + if(mode != null) + { + mode.close(); + } - registerStage((x, z, k, p, m) -> warmupChunk(x >> 4, z >> 4)); - registerStage((x, z, k, p, m) -> generateMatter(x >> 4, z >> 4, m)); - registerStage((x, z, k, p, m) -> terrain.actuate(x, z, k, m)); - registerStage((x, z, k, p, m) -> biome.actuate(x, z, p, m)); - registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m)); - registerStage((x, z, k, p, m) -> decorant.actuate(x, z, k, m)); - registerStage((x, z, k, p, m) -> post.modify(x, z, k, m)); - registerStage((x, z, k, p, m) -> deposit.modify(x, z, k, m)); - registerStage((x, z, K, p, m) -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, K, m)); - registerStage((x, z, k, p, m) -> perfection.modify(x, z, k, m)); + mode = getDimension().getMode().getType().create(this); } @Override @@ -335,11 +328,6 @@ public class IrisEngine implements Engine { } } - @Override - public void registerStage(EngineStage stage) { - stages.add(stage); - } - @Override public int getBlockUpdatesPerSecond() { return buds.get(); 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 f4731da6c..81e8e1619 100644 --- a/src/main/java/com/volmit/iris/engine/framework/Engine.java +++ b/src/main/java/com/volmit/iris/engine/framework/Engine.java @@ -93,12 +93,10 @@ import java.util.function.Consumer; import java.util.stream.Collectors; public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdater, Renderer, Hotloadable { - KList getStages(); - - void registerStage(EngineStage stage); - IrisComplex getComplex(); + EngineMode getMode(); + int getBlockUpdatesPerSecond(); void printMetrics(CommandSender sender); diff --git a/src/main/java/com/volmit/iris/engine/framework/EngineMode.java b/src/main/java/com/volmit/iris/engine/framework/EngineMode.java index 5f59b1090..22018a963 100644 --- a/src/main/java/com/volmit/iris/engine/framework/EngineMode.java +++ b/src/main/java/com/volmit/iris/engine/framework/EngineMode.java @@ -18,16 +18,59 @@ package com.volmit.iris.engine.framework; +import com.volmit.iris.engine.IrisComplex; +import com.volmit.iris.engine.mantle.EngineMantle; import com.volmit.iris.util.documentation.BlockCoordinates; import com.volmit.iris.util.hunk.Hunk; +import com.volmit.iris.util.parallel.BurstExecutor; +import com.volmit.iris.util.parallel.MultiBurst; import org.bukkit.block.Biome; import org.bukkit.block.data.BlockData; -public interface EngineMode { +public interface EngineMode extends Staged { void close(); Engine getEngine(); + default MultiBurst burst() + { + return getEngine().burst(); + } + + default EngineStage burst(EngineStage... stages) + { + return (x, z, blocks, biomes, multicore) -> { + BurstExecutor e = burst().burst(stages.length); + e.setMulticore(multicore); + + for(EngineStage i : stages) + { + e.queue(() -> i.generate(x, z, blocks, biomes, multicore)); + } + + e.complete(); + }; + } + + default IrisComplex getComplex() + { + return getEngine().getComplex(); + } + + default EngineMantle getMantle() + { + return getEngine().getMantle(); + } + + default void generateMatter(int x, int z, boolean multicore) { + getMantle().generateMatter(x, z, multicore); + } + @BlockCoordinates - void generate(int x, int z, Hunk blocks, Hunk biomes, boolean multicore); + default void generate(int x, int z, Hunk blocks, Hunk biomes, boolean multicore) + { + for (EngineStage i : getStages()) { + i.generate(x, z, blocks, biomes, multicore); + } + } } diff --git a/src/main/java/com/volmit/iris/engine/framework/IrisEngineMode.java b/src/main/java/com/volmit/iris/engine/framework/IrisEngineMode.java new file mode 100644 index 000000000..f0b9d17fa --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/framework/IrisEngineMode.java @@ -0,0 +1,61 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2021 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.volmit.iris.engine.framework; + +import com.volmit.iris.util.collection.KList; + +public abstract class IrisEngineMode implements EngineMode { + private final Engine engine; + private final KList stages; + private boolean closed; + + public IrisEngineMode(Engine engine) + { + this.engine = engine; + this.stages = new KList<>(); + this.closed = false; + } + + @Override + public synchronized void close() + { + if(closed) + { + return; + } + + closed = true; + dump(); + } + + @Override + public Engine getEngine() { + return engine; + } + + @Override + public KList getStages() { + return stages; + } + + @Override + public void registerStage(EngineStage stage) { + stages.add(stage); + } +} diff --git a/src/main/java/com/volmit/iris/engine/framework/Staged.java b/src/main/java/com/volmit/iris/engine/framework/Staged.java new file mode 100644 index 000000000..069d8af77 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/framework/Staged.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2021 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.volmit.iris.engine.framework; + +import com.volmit.iris.util.collection.KList; + +public interface Staged { + KList getStages(); + + void registerStage(EngineStage stage); + + default void dump() + { + getStages().forEach(EngineStage::close); + getStages().clear(); + } +} diff --git a/src/main/java/com/volmit/iris/engine/mode/ModeEnclosure.java b/src/main/java/com/volmit/iris/engine/mode/ModeEnclosure.java new file mode 100644 index 000000000..24def0438 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/mode/ModeEnclosure.java @@ -0,0 +1,39 @@ +/* + * 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.mode; + +import com.volmit.iris.engine.actuator.IrisBiomeActuator; +import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; +import com.volmit.iris.engine.framework.Engine; +import com.volmit.iris.engine.framework.EngineMode; +import com.volmit.iris.engine.framework.IrisEngineMode; + +public class ModeEnclosure extends IrisEngineMode implements EngineMode { + public ModeEnclosure(Engine engine) + { + super(engine); + var terrain = new IrisTerrainNormalActuator(getEngine()); + var biome = new IrisBiomeActuator(getEngine()); + + registerStage(burst( + (x, z, k, p, m) -> terrain.actuate(x, z, k, m), + (x, z, k, p, m) -> biome.actuate(x, z, p, m) + )); + } +} diff --git a/src/main/java/com/volmit/iris/engine/mode/ModeIslands.java b/src/main/java/com/volmit/iris/engine/mode/ModeIslands.java new file mode 100644 index 000000000..5dd557b52 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/mode/ModeIslands.java @@ -0,0 +1,39 @@ +/* + * 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.mode; + +import com.volmit.iris.engine.actuator.IrisBiomeActuator; +import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; +import com.volmit.iris.engine.framework.Engine; +import com.volmit.iris.engine.framework.EngineMode; +import com.volmit.iris.engine.framework.IrisEngineMode; + +public class ModeIslands extends IrisEngineMode implements EngineMode { + public ModeIslands(Engine engine) + { + super(engine); + var terrain = new IrisTerrainNormalActuator(getEngine()); + var biome = new IrisBiomeActuator(getEngine()); + + registerStage(burst( + (x, z, k, p, m) -> terrain.actuate(x, z, k, m), + (x, z, k, p, m) -> biome.actuate(x, z, p, m) + )); + } +} diff --git a/src/main/java/com/volmit/iris/engine/mode/ModeOverworld.java b/src/main/java/com/volmit/iris/engine/mode/ModeOverworld.java new file mode 100644 index 000000000..e7c5ba046 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/mode/ModeOverworld.java @@ -0,0 +1,59 @@ +/* + * 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.mode; + +import com.volmit.iris.engine.actuator.IrisBiomeActuator; +import com.volmit.iris.engine.actuator.IrisDecorantActuator; +import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; +import com.volmit.iris.engine.framework.Engine; +import com.volmit.iris.engine.framework.EngineMode; +import com.volmit.iris.engine.framework.IrisEngineMode; +import com.volmit.iris.engine.modifier.IrisCarveModifier; +import com.volmit.iris.engine.modifier.IrisDepositModifier; +import com.volmit.iris.engine.modifier.IrisPerfectionModifier; +import com.volmit.iris.engine.modifier.IrisPostModifier; +import org.bukkit.block.data.BlockData; + +public class ModeOverworld extends IrisEngineMode implements EngineMode { + public ModeOverworld(Engine engine) + { + super(engine); + var terrain = new IrisTerrainNormalActuator(getEngine()); + var biome = new IrisBiomeActuator(getEngine()); + var decorant = new IrisDecorantActuator(getEngine()); + var cave = new IrisCarveModifier(getEngine()); + var post = new IrisPostModifier(getEngine()); + var deposit = new IrisDepositModifier(getEngine()); + var perfection = new IrisPerfectionModifier(getEngine()); + + registerStage(burst( + (x, z, k, p, m) -> generateMatter(x >> 4, z >> 4, m), + (x, z, k, p, m) -> terrain.actuate(x, z, k, m), + (x, z, k, p, m) -> biome.actuate(x, z, p, m) + )); + registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m)); + registerStage(burst( + (x, z, k, p, m) -> decorant.actuate(x, z, k, m), + (x, z, k, p, m) -> post.modify(x, z, k, m), + (x, z, k, p, m) -> deposit.modify(x, z, k, m), + (x, z, K, p, m) -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, K, m) + )); + registerStage((x, z, k, p, m) -> perfection.modify(x, z, k, m)); + } +} diff --git a/src/main/java/com/volmit/iris/engine/mode/ModeSuperFlat.java b/src/main/java/com/volmit/iris/engine/mode/ModeSuperFlat.java new file mode 100644 index 000000000..89e3b4d64 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/mode/ModeSuperFlat.java @@ -0,0 +1,39 @@ +/* + * 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.mode; + +import com.volmit.iris.engine.actuator.IrisBiomeActuator; +import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; +import com.volmit.iris.engine.framework.Engine; +import com.volmit.iris.engine.framework.EngineMode; +import com.volmit.iris.engine.framework.IrisEngineMode; + +public class ModeSuperFlat extends IrisEngineMode implements EngineMode { + public ModeSuperFlat(Engine engine) + { + super(engine); + var terrain = new IrisTerrainNormalActuator(getEngine()); + var biome = new IrisBiomeActuator(getEngine()); + + registerStage(burst( + (x, z, k, p, m) -> terrain.actuate(x, z, k, m), + (x, z, k, p, m) -> biome.actuate(x, z, p, m) + )); + } +} diff --git a/src/main/java/com/volmit/iris/engine/object/IrisDimension.java b/src/main/java/com/volmit/iris/engine/object/IrisDimension.java index a92911455..5b303fb17 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisDimension.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisDimension.java @@ -171,6 +171,9 @@ public class IrisDimension extends IrisRegistrant { @MaxNumber(360) @Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.") private double dimensionAngleDeg = 0; + @Required + @Desc("Define the mode of this dimension (required!)") + private IrisDimensionMode mode = new IrisDimensionMode(); @MinNumber(0) @MaxNumber(8192) @Desc("Coordinate fracturing applies noise to the input coordinates. This creates the 'iris swirls' and wavy features. The distance pushes these waves further into places they shouldnt be. This is a block value multiplier.") diff --git a/src/main/java/com/volmit/iris/engine/object/IrisDimensionMode.java b/src/main/java/com/volmit/iris/engine/object/IrisDimensionMode.java new file mode 100644 index 000000000..805b0d142 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/object/IrisDimensionMode.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.object; + +import com.volmit.iris.engine.object.annotations.Desc; +import com.volmit.iris.engine.object.annotations.Snippet; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Snippet("dimension-mode") +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@Desc("Represents a dimensional mode") +@Data +public class IrisDimensionMode { + @Desc("The dimension type") + private IrisDimensionModeType type = IrisDimensionModeType.OVERWORLD; + +} diff --git a/src/main/java/com/volmit/iris/engine/object/IrisDimensionModeType.java b/src/main/java/com/volmit/iris/engine/object/IrisDimensionModeType.java new file mode 100644 index 000000000..789ae615a --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/object/IrisDimensionModeType.java @@ -0,0 +1,56 @@ +/* + * 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.object; + +import com.volmit.iris.engine.framework.Engine; +import com.volmit.iris.engine.framework.EngineMode; +import com.volmit.iris.engine.mode.ModeEnclosure; +import com.volmit.iris.engine.mode.ModeIslands; +import com.volmit.iris.engine.mode.ModeOverworld; +import com.volmit.iris.engine.mode.ModeSuperFlat; +import com.volmit.iris.engine.object.annotations.Desc; + +import java.util.function.Function; + +@Desc("The type of dimension this is") +public enum IrisDimensionModeType { + @Desc("Typical dimensions. Has a fluid height, and all features of a biome based world") + OVERWORLD(ModeOverworld::new), + + @Desc("Ultra fast, but very limited in features. Only supports terrain & biomes. No decorations, mobs, objects, or anything of the sort!") + SUPERFLAT(ModeSuperFlat::new), + + @Desc("Like the nether, a ceiling & floor carved out") + ENCLOSURE(ModeEnclosure::new), + + @Desc("Floating islands of terrain") + ISLANDS(ModeIslands::new), + ; + private final Function factory; + + IrisDimensionModeType(Function factory) + { + this.factory = factory; + } + + public EngineMode create(Engine e) + { + return factory.apply(e); + } +} From 7224ca43f3535fd8511a821a8ac1bf73fc353286 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Mon, 20 Sep 2021 07:14:31 -0400 Subject: [PATCH 3/7] Auto configuration modes --- .../volmit/iris/core/ServerConfigurator.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main/java/com/volmit/iris/core/ServerConfigurator.java diff --git a/src/main/java/com/volmit/iris/core/ServerConfigurator.java b/src/main/java/com/volmit/iris/core/ServerConfigurator.java new file mode 100644 index 000000000..113b433b8 --- /dev/null +++ b/src/main/java/com/volmit/iris/core/ServerConfigurator.java @@ -0,0 +1,54 @@ +/* + * 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.plugin; + +import com.volmit.iris.Iris; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +public class ServerConfigurator { + public void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException { + File spigotConfig = new File("spigot.yml"); + FileConfiguration f = new YamlConfiguration(); + f.load(spigotConfig); + long tt = f.getLong("settings.timeout-time"); + + if(tt < TimeUnit.MINUTES.toMillis(7)) + { + Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toMillis(5) + " (5 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value."); + } + } + + public void increasePaperWatchdog() throws IOException, InvalidConfigurationException { + File spigotConfig = new File("spigot.yml"); + FileConfiguration f = new YamlConfiguration(); + f.load(spigotConfig); + long tt = f.getLong("settings.watchdog.early-warning-delay"); + + if(tt < TimeUnit.MINUTES.toMillis(3)) + { + Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value."); + } + } +} From c744f761a1f77f55b5184d53abc16a79bbdd9f60 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Mon, 20 Sep 2021 07:14:38 -0400 Subject: [PATCH 4/7] Wire modes to engine --- src/main/java/com/volmit/iris/engine/IrisEngine.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisEngine.java b/src/main/java/com/volmit/iris/engine/IrisEngine.java index a8ff713e7..278320078 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngine.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngine.java @@ -93,7 +93,6 @@ public class IrisEngine implements Engine { private final ChronoLatch perSecondBudLatch; private final EngineMetrics metrics; private final boolean studio; - private final KList stages; private final AtomicRollingSequence wallClock; private final int art; private EngineMode mode; @@ -117,7 +116,6 @@ public class IrisEngine implements Engine { public IrisEngine(EngineTarget target, boolean studio) { this.studio = studio; this.target = target; - stages = new KList<>(); getEngineData(); verifySeed(); this.seedManager = new SeedManager(target.getWorld().getRawWorldSeed()); @@ -167,8 +165,6 @@ public class IrisEngine implements Engine { worldManager.close(); complex.close(); execution.close(); - stages.forEach(EngineStage::close); - stages.clear(); effects.close(); mode.close(); @@ -395,10 +391,9 @@ public class IrisEngine implements Engine { getWorldManager().close(); getTarget().close(); saveEngineData(); - stages.forEach(EngineStage::close); - stages.clear(); getMantle().close(); getComplex().close(); + mode.close(); getData().dump(); getData().clearLists(); Iris.service(PreservationSVC.class).dereference(); @@ -457,9 +452,7 @@ public class IrisEngine implements Engine { } } } else { - for (EngineStage i : stages) { - i.generate(x, z, blocks, vbiomes, multicore); - } + mode.generate(x, z, blocks, vbiomes, multicore); } getMetrics().getTotal().put(p.getMilliseconds()); From d4f26577a55eceb8c758c11b567c72c9804b0062 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Mon, 20 Sep 2021 07:14:56 -0400 Subject: [PATCH 5/7] Autoconfigure iris first time startup --- src/main/java/com/volmit/iris/Iris.java | 170 +------------ .../com/volmit/iris/core/IrisSettings.java | 8 + .../volmit/iris/core/ServerConfigurator.java | 234 +++++++++++++++++- .../volmit/iris/core/service/StudioSVC.java | 4 +- 4 files changed, 242 insertions(+), 174 deletions(-) diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index afd3a88cb..57737fcf3 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -19,6 +19,7 @@ package com.volmit.iris; import com.volmit.iris.core.IrisSettings; +import com.volmit.iris.core.ServerConfigurator; import com.volmit.iris.core.link.IrisPapiExpansion; import com.volmit.iris.core.link.MultiverseCoreLink; import com.volmit.iris.core.link.MythicMobsLink; @@ -237,6 +238,8 @@ public class Iris extends VolmitPlugin implements Listener { while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) { fileOutputStream.write(dataBuffer, 0, bytesRead); } + + fileOutputStream.flush(); } catch (IOException e) { e.printStackTrace(); Iris.reportError(e); @@ -405,7 +408,6 @@ public class Iris extends VolmitPlugin implements Listener { initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class) i.getClass(), (IrisService) i)); INMS.get(); IO.delete(new File("iris")); - installDataPacks(); fixShading(); } @@ -445,7 +447,7 @@ public class Iris extends VolmitPlugin implements Listener { J.ar(this::checkConfigHotload, 60); J.sr(this::tickQueue, 0); J.s(this::setupPapi); - J.a(this::verifyDataPacksPost, 20); + J.a(ServerConfigurator::configure, 20); splash(); if (IrisSettings.get().getStudio().isAutoStartDefaultStudio()) { @@ -494,72 +496,6 @@ public class Iris extends VolmitPlugin implements Listener { } } - public File getDatapacksFolder() { - if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) { - return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"); - } - - File props = new File("server.properties"); - - if (props.exists()) { - try { - KList m = new KList<>(IO.readAll(props).split("\\Q\n\\E")); - - for (String i : m) { - if (i.trim().startsWith("level-name=")) { - return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks"); - } - } - } catch (IOException e) { - Iris.reportError(e); - e.printStackTrace(); - } - } - - return null; - } - - public void installDataPacks() { - Iris.info("Checking Data Packs..."); - boolean reboot = false; - File packs = new File("plugins/Iris/packs"); - File dpacks = getDatapacksFolder(); - - if (dpacks == null) { - Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?"); - return; - } - - if (packs.exists()) { - for (File i : packs.listFiles()) { - if (i.isDirectory()) { - Iris.verbose("Checking Pack: " + i.getPath()); - IrisData data = IrisData.get(i); - File dims = new File(i, "dimensions"); - - if (dims.exists()) { - for (File j : dims.listFiles()) { - if (j.getName().endsWith(".json")) { - IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); - - if (dim == null) { - continue; - } - - Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath()); - if (dim.installDataPack(() -> data, dpacks)) { - reboot = true; - } - } - } - } - } - } - } - - Iris.info("Data Packs Setup!"); - } - @Override public void start() { @@ -609,104 +545,6 @@ public class Iris extends VolmitPlugin implements Listener { } } - public void verifyDataPacksPost() { - File packs = new File("plugins/Iris/packs"); - File dpacks = getDatapacksFolder(); - - if (dpacks == null) { - Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?"); - return; - } - - boolean bad = false; - if (packs.exists()) { - for (File i : packs.listFiles()) { - if (i.isDirectory()) { - Iris.verbose("Checking Pack: " + i.getPath()); - IrisData data = IrisData.get(i); - File dims = new File(i, "dimensions"); - - if (dims.exists()) { - for (File j : dims.listFiles()) { - if (j.getName().endsWith(".json")) { - IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); - - if (dim == null) { - Iris.error("Failed to load " + j.getPath() + " "); - continue; - } - - if (!verifyDataPackInstalled(dim)) { - bad = true; - } - } - } - } - } - } - } - - if (bad && INMS.get().supportsDataPacks()) { - Iris.error("============================================================================"); - Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes."); - Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes."); - Iris.error("----------------------------------------------------------------------------"); - Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!"); - Iris.error("============================================================================"); - - for (Player i : Bukkit.getOnlinePlayers()) { - if (i.isOp() || i.hasPermission("iris.all")) { - VolmitSender sender = new VolmitSender(i, getTag("WARNING")); - sender.sendMessage("There are some Iris Packs that have custom biomes in them"); - sender.sendMessage("You need to restart your server to use these packs."); - } - } - - J.sleep(3000); - } - } - - public boolean verifyDataPackInstalled(IrisDimension dimension) { - IrisData idm = IrisData.get(getDataFolder("packs", dimension.getLoadKey())); - KSet keys = new KSet<>(); - boolean warn = false; - - for (IrisBiome i : dimension.getAllBiomes(() -> idm)) { - if (i.isCustom()) { - for (IrisBiomeCustom j : i.getCustomDerivitives()) { - keys.add(dimension.getLoadKey() + ":" + j.getId()); - } - } - } - - if (!INMS.get().supportsDataPacks()) { - if (!keys.isEmpty()) { - Iris.warn("==================================================================================="); - Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). "); - Iris.warn("Your server version does not yet support datapacks for iris."); - Iris.warn("The world will generate these biomes as backup biomes."); - Iris.warn("===================================================================================="); - } - - return true; - } - - for (String i : keys) { - Object o = INMS.get().getCustomBiomeBaseFor(i); - - if (o == null) { - Iris.warn("The Biome " + i + " is not registered on the server."); - warn = true; - } - } - - if (warn) { - Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!"); - } - - return !warn; - } - @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { return super.onCommand(sender, command, label, args); diff --git a/src/main/java/com/volmit/iris/core/IrisSettings.java b/src/main/java/com/volmit/iris/core/IrisSettings.java index e3b4ef028..fd599a73c 100644 --- a/src/main/java/com/volmit/iris/core/IrisSettings.java +++ b/src/main/java/com/volmit/iris/core/IrisSettings.java @@ -35,6 +35,7 @@ public class IrisSettings { public static transient IrisSettings settings; private IrisSettingsGeneral general = new IrisSettingsGeneral(); private IrisSettingsGUI gui = new IrisSettingsGUI(); + private IrisSettingsAutoconfiguration autoConfiguration = new IrisSettingsAutoconfiguration(); private IrisSettingsGenerator generator = new IrisSettingsGenerator(); private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency(); private IrisSettingsStudio studio = new IrisSettingsStudio(); @@ -48,6 +49,13 @@ public class IrisSettings { }; } + @Data + public static class IrisSettingsAutoconfiguration { + public boolean configureSpigotTimeoutTime = true; + public boolean configurePaperWatchdogDelay = true; + public boolean autoRestartOnCustomBiomeInstall = true; + } + @Data public static class IrisSettingsConcurrency { public int parallelism = -1; diff --git a/src/main/java/com/volmit/iris/core/ServerConfigurator.java b/src/main/java/com/volmit/iris/core/ServerConfigurator.java index 113b433b8..403a717e8 100644 --- a/src/main/java/com/volmit/iris/core/ServerConfigurator.java +++ b/src/main/java/com/volmit/iris/core/ServerConfigurator.java @@ -16,32 +16,63 @@ * along with this program. If not, see . */ -package com.volmit.iris.util.plugin; +package com.volmit.iris.core; import com.volmit.iris.Iris; +import com.volmit.iris.core.loader.IrisData; +import com.volmit.iris.core.nms.INMS; +import com.volmit.iris.engine.object.IrisBiome; +import com.volmit.iris.engine.object.IrisBiomeCustom; +import com.volmit.iris.engine.object.IrisDimension; +import com.volmit.iris.util.collection.KList; +import com.volmit.iris.util.collection.KSet; +import com.volmit.iris.util.format.C; +import com.volmit.iris.util.io.IO; +import com.volmit.iris.util.plugin.VolmitSender; +import com.volmit.iris.util.scheduling.J; +import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; public class ServerConfigurator { - public void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException { + public static void configure() + { + IrisSettings.IrisSettingsAutoconfiguration s = IrisSettings.get().getAutoConfiguration(); + if(s.isConfigureSpigotTimeoutTime()) + { + J.attempt(ServerConfigurator::increaseKeepAliveSpigot); + } + + if(s.isConfigurePaperWatchdogDelay()) + { + J.attempt(ServerConfigurator::increasePaperWatchdog); + } + + installDataPacks(true); + } + + private static void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException { File spigotConfig = new File("spigot.yml"); FileConfiguration f = new YamlConfiguration(); f.load(spigotConfig); long tt = f.getLong("settings.timeout-time"); - if(tt < TimeUnit.MINUTES.toMillis(7)) + if(tt < TimeUnit.MINUTES.toSeconds(5)) { - Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toMillis(5) + " (5 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value."); + Iris.warn("Updating spigot.yml timeout-time: " + tt + " -> " + TimeUnit.MINUTES.toSeconds(5) + " (5 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value."); + f.set("settings.timeout-time", TimeUnit.MINUTES.toSeconds(5)); + f.save(spigotConfig); } } - public void increasePaperWatchdog() throws IOException, InvalidConfigurationException { - File spigotConfig = new File("spigot.yml"); + private static void increasePaperWatchdog() throws IOException, InvalidConfigurationException { + File spigotConfig = new File("paper.yml"); FileConfiguration f = new YamlConfiguration(); f.load(spigotConfig); long tt = f.getLong("settings.watchdog.early-warning-delay"); @@ -49,6 +80,197 @@ public class ServerConfigurator { if(tt < TimeUnit.MINUTES.toMillis(3)) { Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes). You can disable this change (autoconfigureServer) in Iris settings, then change back the value."); + f.set("settings.watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3)); + f.save(spigotConfig); } } + + private static File getDatapacksFolder() { + if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) { + return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"); + } + + File props = new File("server.properties"); + + if (props.exists()) { + try { + KList m = new KList<>(IO.readAll(props).split("\\Q\n\\E")); + + for (String i : m) { + if (i.trim().startsWith("level-name=")) { + return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks"); + } + } + } catch (IOException e) { + Iris.reportError(e); + e.printStackTrace(); + } + } + + return null; + } + + public static void installDataPacks(boolean fullInstall) + { + Iris.info("Checking Data Packs..."); + boolean reboot = false; + File packs = new File("plugins/Iris/packs"); + File dpacks = getDatapacksFolder(); + + if (dpacks == null) { + Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?"); + return; + } + + if (packs.exists()) { + for (File i : packs.listFiles()) { + if (i.isDirectory()) { + Iris.verbose("Checking Pack: " + i.getPath()); + IrisData data = IrisData.get(i); + File dims = new File(i, "dimensions"); + + if (dims.exists()) { + for (File j : dims.listFiles()) { + if (j.getName().endsWith(".json")) { + IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); + + if (dim == null) { + continue; + } + + Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath()); + if (dim.installDataPack(() -> data, dpacks)) { + reboot = true; + } + } + } + } + } + } + } + + Iris.info("Data Packs Setup!"); + + if(fullInstall) + { + verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall()); + } + } + + private static void verifyDataPacksPost(boolean allowRestarting) { + File packs = new File("plugins/Iris/packs"); + File dpacks = getDatapacksFolder(); + + if (dpacks == null) { + Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?"); + return; + } + + boolean bad = false; + if (packs.exists()) { + for (File i : packs.listFiles()) { + if (i.isDirectory()) { + Iris.verbose("Checking Pack: " + i.getPath()); + IrisData data = IrisData.get(i); + File dims = new File(i, "dimensions"); + + if (dims.exists()) { + for (File j : dims.listFiles()) { + if (j.getName().endsWith(".json")) { + IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); + + if (dim == null) { + Iris.error("Failed to load " + j.getPath() + " "); + continue; + } + + if (!verifyDataPackInstalled(dim)) { + bad = true; + } + } + } + } + } + } + } + + if(bad) + { + if(allowRestarting) + { + restart(); + } + + else if (INMS.get().supportsDataPacks()) { + Iris.error("============================================================================"); + Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes."); + Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes."); + Iris.error("----------------------------------------------------------------------------"); + Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!"); + Iris.error("============================================================================"); + + for (Player i : Bukkit.getOnlinePlayers()) { + if (i.isOp() || i.hasPermission("iris.all")) { + VolmitSender sender = new VolmitSender(i, Iris.instance.getTag("WARNING")); + sender.sendMessage("There are some Iris Packs that have custom biomes in them"); + sender.sendMessage("You need to restart your server to use these packs."); + } + } + + J.sleep(3000); + } + } + } + + public static void restart() { + J.s(() -> { + Iris.warn("New data pack entries have been installed in Iris! Restarting server! (You can disable this auto restart in iris settings). This will only happen when your pack changes (updates/first time setup)"); + J.s(() -> { + Iris.warn("Looks like the restart command diddn't work. Stopping the server instead!"); + Bukkit.shutdown(); + }, 100); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "restart"); + }); + } + + public static boolean verifyDataPackInstalled(IrisDimension dimension) { + IrisData idm = IrisData.get(Iris.instance.getDataFolder("packs", dimension.getLoadKey())); + KSet keys = new KSet<>(); + boolean warn = false; + + for (IrisBiome i : dimension.getAllBiomes(() -> idm)) { + if (i.isCustom()) { + for (IrisBiomeCustom j : i.getCustomDerivitives()) { + keys.add(dimension.getLoadKey() + ":" + j.getId()); + } + } + } + + if (!INMS.get().supportsDataPacks()) { + if (!keys.isEmpty()) { + Iris.warn("==================================================================================="); + Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). "); + Iris.warn("Your server version does not yet support datapacks for iris."); + Iris.warn("The world will generate these biomes as backup biomes."); + Iris.warn("===================================================================================="); + } + + return true; + } + + for (String i : keys) { + Object o = INMS.get().getCustomBiomeBaseFor(i); + + if (o == null) { + Iris.warn("The Biome " + i + " is not registered on the server."); + warn = true; + } + } + + if (warn) { + Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!"); + } + + return !warn; + } } diff --git a/src/main/java/com/volmit/iris/core/service/StudioSVC.java b/src/main/java/com/volmit/iris/core/service/StudioSVC.java index 1227d1475..4614bb5f1 100644 --- a/src/main/java/com/volmit/iris/core/service/StudioSVC.java +++ b/src/main/java/com/volmit/iris/core/service/StudioSVC.java @@ -22,6 +22,7 @@ import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import com.volmit.iris.Iris; import com.volmit.iris.core.IrisSettings; +import com.volmit.iris.core.ServerConfigurator; import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.pack.IrisPack; import com.volmit.iris.core.project.IrisProject; @@ -285,8 +286,7 @@ public class StudioSVC implements IrisService { } sender.sendMessage("Successfully Aquired " + d.getName()); - Iris.instance.installDataPacks(); - Iris.instance.verifyDataPacksPost(); + ServerConfigurator.installDataPacks(true); } public KMap getListing(boolean cached) { From 3d411fc6f3f680f22467430e344c9f40751b880f Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Mon, 20 Sep 2021 07:33:18 -0400 Subject: [PATCH 6/7] Find strongholds closes #639 --- .../volmit/iris/engine/framework/Engine.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) 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 81e8e1619..320944f2a 100644 --- a/src/main/java/com/volmit/iris/engine/framework/Engine.java +++ b/src/main/java/com/volmit/iris/engine/framework/Engine.java @@ -24,6 +24,7 @@ import com.volmit.iris.core.gui.components.Renderer; import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.loader.IrisRegistrant; import com.volmit.iris.engine.IrisComplex; +import com.volmit.iris.engine.IrisWorldManager; import com.volmit.iris.engine.data.cache.Cache; import com.volmit.iris.engine.data.chunk.TerrainChunk; import com.volmit.iris.engine.mantle.EngineMantle; @@ -56,6 +57,7 @@ import com.volmit.iris.util.hunk.Hunk; import com.volmit.iris.util.mantle.MantleFlag; import com.volmit.iris.util.math.BlockPosition; import com.volmit.iris.util.math.M; +import com.volmit.iris.util.math.Position2; import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.matter.MatterCavern; import com.volmit.iris.util.matter.MatterUpdate; @@ -70,11 +72,13 @@ import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.data.BlockData; import org.bukkit.command.CommandSender; +import org.bukkit.entity.EnderSignal; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.Inventory; @@ -788,6 +792,41 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat } default void gotoJigsaw(IrisJigsawStructure s, Player player) { + if(s.getLoadKey().equals(getDimension().getStronghold())) + { + KList p = getDimension().getStrongholds(getSeedManager().getSpawn()); + + if(p.isEmpty()) + { + player.sendMessage(C.GOLD + "No strongholds in world."); + } + + Position2 px = new Position2(player.getLocation().getBlockX(), player.getLocation().getBlockZ()); + Position2 pr = null; + double d = Double.MAX_VALUE; + + Iris.debug("Ps: " + p.size()); + + for (Position2 i : p) { + Iris.debug("- " + i.getX() + " " + i.getZ()); + } + + for (Position2 i : p) { + double dx = i.distance(px); + if (dx < d) { + d = dx; + pr = i; + } + } + + if (pr != null) { + Location ll = new Location(player.getWorld(), pr.getX(), 40, pr.getZ()); + J.s(() -> player.teleport(ll)); + } + + return; + } + if (getDimension().getJigsawStructures().stream() .map(IrisJigsawStructurePlacement::getStructure) .collect(Collectors.toSet()).contains(s.getLoadKey())) { From 4489197d01ffe2a8b972cfca00053e4e31f7ef24 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Mon, 20 Sep 2021 07:38:37 -0400 Subject: [PATCH 7/7] V+ --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b927ab134..e920fdc78 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ plugins { } group 'com.volmit.iris' -version '1.8.11' +version '1.8.12' def apiVersion = '1.17' def name = getRootProject().getName() // Defined in settings.gradle def main = 'com.volmit.iris.Iris'