From 03e8ccee7d1e46059b46741f19835e21f620b522 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Thu, 19 Aug 2021 06:21:03 -0400 Subject: [PATCH 1/3] Worms --- .../engine/object/cave/IrisWormGenerator.java | 59 +++++++++++++++++++ .../java/com/volmit/iris/util/noise/Worm.java | 43 ++++++++++++++ .../com/volmit/iris/util/noise/Worm2.java | 52 ++++++++++++++++ .../com/volmit/iris/util/noise/Worm3.java | 55 +++++++++++++++++ .../volmit/iris/util/noise/WormIterator2.java | 49 +++++++++++++++ 5 files changed, 258 insertions(+) create mode 100644 src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java create mode 100644 src/main/java/com/volmit/iris/util/noise/Worm.java create mode 100644 src/main/java/com/volmit/iris/util/noise/Worm2.java create mode 100644 src/main/java/com/volmit/iris/util/noise/Worm3.java create mode 100644 src/main/java/com/volmit/iris/util/noise/WormIterator2.java diff --git a/src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java b/src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.java new file mode 100644 index 000000000..1717af527 --- /dev/null +++ b/src/main/java/com/volmit/iris/engine/object/cave/IrisWormGenerator.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.object.cave; + +import com.volmit.iris.engine.object.annotations.Desc; +import com.volmit.iris.engine.object.annotations.MinNumber; +import com.volmit.iris.engine.object.annotations.Required; +import com.volmit.iris.engine.object.basic.IrisRange; +import com.volmit.iris.engine.object.common.IRare; +import com.volmit.iris.engine.object.noise.IrisGeneratorStyle; +import com.volmit.iris.engine.object.noise.IrisNoiseGenerator; +import com.volmit.iris.engine.object.noise.IrisStyledRange; +import com.volmit.iris.engine.object.noise.NoiseStyle; +import com.volmit.iris.util.noise.Worm; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@Desc("Generate worms") +@Data +public class IrisWormGenerator 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(); + + @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; + + @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)); +} diff --git a/src/main/java/com/volmit/iris/util/noise/Worm.java b/src/main/java/com/volmit/iris/util/noise/Worm.java new file mode 100644 index 000000000..d21802e1d --- /dev/null +++ b/src/main/java/com/volmit/iris/util/noise/Worm.java @@ -0,0 +1,43 @@ +/* + * 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.noise; + +import lombok.Data; + +@Data +public class Worm { + private double position; + private double velocity; + + public Worm(double startPosition, double startVelocity) + { + this.position = startPosition; + this.velocity = startVelocity; + } + + public void unstep() + { + position -= velocity; + } + + public void step() + { + position += velocity; + } +} diff --git a/src/main/java/com/volmit/iris/util/noise/Worm2.java b/src/main/java/com/volmit/iris/util/noise/Worm2.java new file mode 100644 index 000000000..a062ea98b --- /dev/null +++ b/src/main/java/com/volmit/iris/util/noise/Worm2.java @@ -0,0 +1,52 @@ +/* + * 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.noise; + +import com.volmit.iris.util.math.Position2; +import lombok.Data; + +@Data +public class Worm2 +{ + private final Worm x; + private final Worm z; + + public Worm2(Worm x, Worm z) + { + this.x = x; + this.z = z; + } + + public Worm2(int x, int z, int vx, int vz) + { + this(new Worm(x, vx), new Worm(z, vz)); + } + + public void step() + { + x.step(); + z.step(); + } + + public void unstep() + { + x.unstep(); + z.unstep(); + } +} diff --git a/src/main/java/com/volmit/iris/util/noise/Worm3.java b/src/main/java/com/volmit/iris/util/noise/Worm3.java new file mode 100644 index 000000000..30c105ff4 --- /dev/null +++ b/src/main/java/com/volmit/iris/util/noise/Worm3.java @@ -0,0 +1,55 @@ +/* + * 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.noise; + +import lombok.Data; + +@Data +public class Worm3 +{ + private final Worm x; + private final Worm y; + private final Worm z; + + public Worm3(Worm x,Worm y, Worm z) + { + this.x = x; + this.y = y; + this.z = z; + } + + public Worm3(int x, int y, int z, int vx, int vy, int vz) + { + this(new Worm(x, vx), new Worm(y, vy), new Worm(z, vz)); + } + + public void step() + { + x.step(); + y.step(); + z.step(); + } + + public void unstep() + { + x.unstep(); + y.unstep(); + z.unstep(); + } +} diff --git a/src/main/java/com/volmit/iris/util/noise/WormIterator2.java b/src/main/java/com/volmit/iris/util/noise/WormIterator2.java new file mode 100644 index 000000000..c2421cf59 --- /dev/null +++ b/src/main/java/com/volmit/iris/util/noise/WormIterator2.java @@ -0,0 +1,49 @@ +/* + * 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.noise; + +import com.volmit.iris.util.function.NoiseProvider; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class WormIterator2 { + private transient Worm2 worm; + private int x; + private int z; + private int maxDistance; + private int maxIterations; + + public boolean hasNext() + { + double dist = maxDistance - (Math.max(Math.abs(worm.getX().getVelocity()), Math.abs(worm.getZ().getVelocity())) + 1); + return maxIterations > 0 && + ((x * x) - (worm.getX().getPosition() * worm.getX().getPosition())) + + ((z * z) - (worm.getZ().getPosition() * worm.getZ().getPosition())) < dist * dist; + } + + public Worm2 next(NoiseProvider p) + { + if(worm == null) + { + worm = new Worm2(x, z, 0, 0); + } + } +} From 931f1fb27d5912a6972a6249b7c7a4ec7e8ae1a5 Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Thu, 19 Aug 2021 06:21:18 -0400 Subject: [PATCH 2/3] Why itj why. --- src/main/java/com/volmit/iris/engine/IrisEngine.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/volmit/iris/engine/IrisEngine.java b/src/main/java/com/volmit/iris/engine/IrisEngine.java index 0e6fdff5e..cb973fc0c 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngine.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngine.java @@ -31,10 +31,7 @@ import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; import com.volmit.iris.engine.data.cache.AtomicCache; import com.volmit.iris.engine.framework.*; import com.volmit.iris.engine.mantle.EngineMantle; -import com.volmit.iris.engine.modifier.IrisCaveModifier; -import com.volmit.iris.engine.modifier.IrisDepositModifier; -import com.volmit.iris.engine.modifier.IrisPostModifier; -import com.volmit.iris.engine.modifier.IrisRavineModifier; +import com.volmit.iris.engine.modifier.*; import com.volmit.iris.engine.object.biome.IrisBiome; import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer; import com.volmit.iris.engine.object.decoration.IrisDecorator; From 6795ff7db93c1cb7f746d3a9fe8c6fabbaeed62e Mon Sep 17 00:00:00 2001 From: cyberpwn Date: Thu, 19 Aug 2021 06:21:37 -0400 Subject: [PATCH 3/3] Compile at least --- src/main/java/com/volmit/iris/util/noise/WormIterator2.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/volmit/iris/util/noise/WormIterator2.java b/src/main/java/com/volmit/iris/util/noise/WormIterator2.java index c2421cf59..9c229472c 100644 --- a/src/main/java/com/volmit/iris/util/noise/WormIterator2.java +++ b/src/main/java/com/volmit/iris/util/noise/WormIterator2.java @@ -45,5 +45,7 @@ public class WormIterator2 { { worm = new Worm2(x, z, 0, 0); } + + return worm; } }