From bbf441c3b4d9c8d661c0c6b8c8f1f4d5bb1c11b8 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Thu, 19 Aug 2021 22:26:40 -0400 Subject: [PATCH] Worms --- build.gradle | 2 +- .../engine/modifier/IrisCaveModifier2.java | 75 ------------------- .../IrisWorm.java} | 23 +++--- 3 files changed, 12 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier2.java rename src/main/java/com/volmit/iris/engine/object/{cave/IrisWormGenerator.java => noise/IrisWorm.java} (84%) diff --git a/build.gradle b/build.gradle index fc5a8fed1..b32a90615 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ plugins { } group 'com.volmit.iris' -version '1.7.4' +version '1.7.5' def apiVersion = '1.17' def name = getRootProject().getName() // See settings.gradle def main = 'com.volmit.iris.Iris' diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier2.java b/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier2.java deleted file mode 100644 index bb496eaae..000000000 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisCaveModifier2.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Bukkit Servers - * Copyright (c) 2021 Arcane Arts (Volmit Software) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.volmit.iris.engine.modifier; - -import com.volmit.iris.engine.framework.Engine; -import com.volmit.iris.engine.framework.EngineAssignedModifier; -import com.volmit.iris.engine.object.common.CaveResult; -import com.volmit.iris.util.collection.KList; -import com.volmit.iris.util.data.B; -import com.volmit.iris.util.hunk.Hunk; -import com.volmit.iris.util.math.RNG; -import com.volmit.iris.util.noise.FastNoiseDouble; -import com.volmit.iris.util.parallel.BurstExecutor; -import com.volmit.iris.util.scheduling.PrecisionStopwatch; -import org.bukkit.block.data.BlockData; - -public class IrisCaveModifier2 extends EngineAssignedModifier { - public static final BlockData CAVE_AIR = B.get("CAVE_AIR"); - public static final BlockData AIR = B.get("AIR"); - private static final KList EMPTY = new KList<>(); - private final FastNoiseDouble gg; - private final RNG rng; - - public IrisCaveModifier2(Engine engine) { - super(engine, "Cave"); - rng = new RNG(engine.getWorld().seed() + 28934555); - gg = new FastNoiseDouble(324895L * rng.nextParallelRNG(49678).imax()); - } - - @Override - public void onModify(int x, int z, Hunk a, boolean multicore) { - if (!getDimension().isCaves()) { - return; - } - - PrecisionStopwatch p = PrecisionStopwatch.start(); - if (multicore) { - BurstExecutor e = getEngine().burst().burst(a.getWidth()); - for (int i = 0; i < a.getWidth(); i++) { - int finalI = i; - e.queue(() -> modifySliver(x, z, finalI, a)); - } - - e.complete(); - } else { - for (int i = 0; i < a.getWidth(); i++) { - modifySliver(x, z, i, a); - } - } - - getEngine().getMetrics().getCave().put(p.getMilliseconds()); - } - - public void modifySliver(int x, int z, int finalI, Hunk a) { - for (int j = 0; j < a.getDepth(); j++) { - - } - } -} diff --git a/src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java b/src/main/java/com/volmit/iris/engine/object/noise/IrisWorm.java similarity index 84% rename from src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java rename to src/main/java/com/volmit/iris/engine/object/noise/IrisWorm.java index c8f036dc4..5e0a4f61a 100644 --- a/src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java +++ b/src/main/java/com/volmit/iris/engine/object/noise/IrisWorm.java @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -package com.volmit.iris.engine.object.cave; +package com.volmit.iris.engine.object.noise; import com.volmit.iris.core.project.loader.IrisData; import com.volmit.iris.engine.data.cache.AtomicCache; @@ -44,14 +44,14 @@ import lombok.experimental.Accessors; @AllArgsConstructor @Desc("Generate worms") @Data -public class IrisWormGenerator implements IRare { +public class IrisWorm implements IRare { @Required @Desc("Typically a 1 in RARITY on a per chunk basis") @MinNumber(1) private int rarity = 15; @Desc("The style used to determine the curvature of this worm") - private IrisGeneratorStyle angleStyle = new IrisGeneratorStyle(); + private IrisGeneratorStyle angleStyle = new IrisGeneratorStyle(NoiseStyle.PERLIN); @Desc("The max block distance this worm can travel from its start. This can have performance implications at ranges over 1,000 blocks but it's not too serious, test.") private int maxDistance = 128; @@ -59,20 +59,19 @@ public class IrisWormGenerator implements IRare { @Desc("The max segments, or iterations this worm can execute on. Setting this to -1 will allow it to run up to the maxDistance's value of iterations (default)") private int maxSegments = -1; - @Desc("The thickness of the worm over distance") - private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(7) - .setStyle(new IrisGeneratorStyle(NoiseStyle.SIMPLEX)); + @Desc("The distance between segments") + private IrisStyledRange segmentDistance = new IrisStyledRange().setMin(4).setMax(7) + .setStyle(new IrisGeneratorStyle(NoiseStyle.PERLIN)); + + @Desc("The thickness of the worms. Each individual worm has the same thickness while traveling however, each spawned worm will vary in thickness.") + private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(5) + .setStyle(new IrisGeneratorStyle(NoiseStyle.PERLIN)); private transient final AtomicCache angleProviderCache = new AtomicCache<>(); - public void test() - { - - } - public NoiseProvider getAngleProvider(RNG rng, IrisData data) { - return angleProviderCache.aquire(() -> (xx, zz) -> angleStyle.create(rng, data).noise(xx, zz)); + return angleProviderCache.aquire(() -> (xx, zz) -> angleStyle.create(rng, data).noise(xx, zz) * segmentDistance.get(rng, xx, zz, data)); } public WormIterator2 iterate2D(RNG rng, IrisData data, int x, int z)