mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 22:32:04 +00:00
Worms
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.volmit.iris'
|
group 'com.volmit.iris'
|
||||||
version '1.7.4'
|
version '1.7.5'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = getRootProject().getName() // See settings.gradle
|
def name = getRootProject().getName() // See settings.gradle
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
|
|||||||
@@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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<BlockData> {
|
|
||||||
public static final BlockData CAVE_AIR = B.get("CAVE_AIR");
|
|
||||||
public static final BlockData AIR = B.get("AIR");
|
|
||||||
private static final KList<CaveResult> 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<BlockData> 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<BlockData> a) {
|
|
||||||
for (int j = 0; j < a.getDepth(); j++) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+11
-12
@@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
@@ -44,14 +44,14 @@ import lombok.experimental.Accessors;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Desc("Generate worms")
|
@Desc("Generate worms")
|
||||||
@Data
|
@Data
|
||||||
public class IrisWormGenerator implements IRare {
|
public class IrisWorm implements IRare {
|
||||||
@Required
|
@Required
|
||||||
@Desc("Typically a 1 in RARITY on a per chunk basis")
|
@Desc("Typically a 1 in RARITY on a per chunk basis")
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
private int rarity = 15;
|
private int rarity = 15;
|
||||||
|
|
||||||
@Desc("The style used to determine the curvature of this worm")
|
@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.")
|
@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;
|
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)")
|
@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;
|
private int maxSegments = -1;
|
||||||
|
|
||||||
@Desc("The thickness of the worm over distance")
|
@Desc("The distance between segments")
|
||||||
private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(7)
|
private IrisStyledRange segmentDistance = new IrisStyledRange().setMin(4).setMax(7)
|
||||||
.setStyle(new IrisGeneratorStyle(NoiseStyle.SIMPLEX));
|
.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<NoiseProvider> angleProviderCache = new AtomicCache<>();
|
private transient final AtomicCache<NoiseProvider> angleProviderCache = new AtomicCache<>();
|
||||||
|
|
||||||
public void test()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public NoiseProvider getAngleProvider(RNG rng, IrisData data)
|
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)
|
public WormIterator2 iterate2D(RNG rng, IrisData data, int x, int z)
|
||||||
Reference in New Issue
Block a user