This commit is contained in:
cyberpwn 2021-08-20 01:34:14 -04:00
parent 4a1e511262
commit 154adafbcb
16 changed files with 213 additions and 585 deletions

View File

@ -498,7 +498,7 @@ public class Iris extends VolmitPlugin implements Listener {
} catch (Throwable e) {
try {
System.out.println(instance.getTag() + string.replaceAll("(<([^>]+)>)", ""));
} catch (Throwable ignored1) {
} catch (Throwable ee) {
}
}

View File

@ -192,8 +192,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> engine.getComplex().getTrueBiomeStreamNoFeatures().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_LAND -> colorFunction = (x, z) -> engine.getComplex().getLandBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_SEA -> colorFunction = (x, z) -> engine.getComplex().getSeaBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case REGION -> colorFunction = (x, z) -> engine.getComplex().getRegionStream().get(x, z).getColor(engine.getComplex(), currentType).getRGB();
case CAVE_LAND -> colorFunction = (x, z) -> engine.getComplex().getCaveBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
// TODO: CAVE
case REGION, CAVE_LAND -> colorFunction = (x, z) -> engine.getComplex().getRegionStream().get(x, z).getColor(engine.getComplex(), currentType).getRGB();
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(engine.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
}
@ -696,8 +696,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT -> r = complex.getTrueBiomeStreamNoFeatures().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case BIOME_LAND -> r = complex.getLandBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case BIOME_SEA -> r = complex.getSeaBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case REGION -> r = complex.getRegionStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case CAVE_LAND -> r = complex.getCaveBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
// TODO: CAVE
case REGION, CAVE_LAND -> r = complex.getRegionStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
}
notify("Opening " + r.getPath() + " in VSCode");

View File

@ -41,8 +41,8 @@ public class IrisRenderer {
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> renderer.getComplex().getTrueBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_LAND -> colorFunction = (x, z) -> renderer.getComplex().getLandBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_SEA -> colorFunction = (x, z) -> renderer.getComplex().getSeaBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case REGION -> colorFunction = (x, z) -> renderer.getComplex().getRegionStream().get(x, z).getColor(renderer.getComplex(), currentType).getRGB();
case CAVE_LAND -> colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
// TODO: CAVE
case REGION,CAVE_LAND -> colorFunction = (x, z) -> renderer.getComplex().getRegionStream().get(x, z).getColor(renderer.getComplex(), currentType).getRGB();
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
}

View File

@ -24,7 +24,6 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.modifier.IrisCaveModifier;
import com.volmit.iris.engine.object.biome.InferredType;
import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.engine.object.common.CaveResult;
@ -70,7 +69,6 @@ public class IrisComplex implements DataProvider {
private ProceduralStream<Double> islandDepthStream;
private ProceduralStream<InferredType> bridgeStream;
private ProceduralStream<IrisBiome> landBiomeStream;
private ProceduralStream<IrisBiome> caveBiomeStream;
private ProceduralStream<IrisBiome> seaBiomeStream;
private ProceduralStream<IrisBiome> shoreBiomeStream;
private ProceduralStream<IrisBiome> baseBiomeStream;
@ -105,9 +103,8 @@ public class IrisComplex implements DataProvider {
public ProceduralStream<IrisBiome> getBiomeStream(InferredType type) {
switch (type) {
case CAVE:
return caveBiomeStream;
case LAND:
return landBiomeStream;
return landBiomeStream; // TODO???
case SEA:
return seaBiomeStream;
case SHORE:
@ -123,10 +120,6 @@ public class IrisComplex implements DataProvider {
}
public IrisComplex(Engine engine) {
this(engine, false);
}
public IrisComplex(Engine engine, boolean simple) {
int cacheSize = 131072;
IrisBiome emptyBiome = new IrisBiome();
UUID focusUUID = UUID.nameUUIDFromBytes("focus".getBytes());
@ -173,21 +166,6 @@ public class IrisComplex implements DataProvider {
islandHeightStream = regionIdentityStream.style(rng.nextParallelRNG(330466), engine.getDimension().getIslandMode().getHeight(), data);
islandDepthStream = engine.getDimension().getIslandMode().getIslandDepth().stream(rng.nextParallelRNG(-39578888), data);
regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i), String.valueOf(i * 38445).hashCode() * 3245556666L));
caveBiomeStream = regionStream.convert((r)
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream()
.zoom(r.getCaveBiomeZoom())
.selectRarity(r.getCaveBiomes(), (i) -> data.getBiomeLoader().load(i))
.onNull("")
.convertCached((s) -> {
if (s.isEmpty()) {
return emptyBiome;
}
return data.getBiomeLoader().load(s)
.setInferredType(InferredType.CAVE);
})
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
inferredStreams.put(InferredType.CAVE, caveBiomeStream);
landBiomeStream = regionStream.convert((r)
-> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(InferredType.LAND.ordinal()), getData()).stream()
.zoom(r.getLandBiomeZoom())
@ -196,6 +174,7 @@ public class IrisComplex implements DataProvider {
.setInferredType(InferredType.LAND))
).convertAware2D(ProceduralStream::get)
.cache2D(cacheSize);
inferredStreams.put(InferredType.CAVE, landBiomeStream); // TODO: CAVE
inferredStreams.put(InferredType.LAND, landBiomeStream);
seaBiomeStream = regionStream.convert((r)
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(InferredType.SEA.ordinal()), getData()).stream()
@ -318,10 +297,6 @@ public class IrisComplex implements DataProvider {
.convertAware2D((b, xx, zz) -> decorateFor(b, xx, zz, IrisDecorationPart.NONE)).cache2D(cacheSize);
terrainCeilingDecoration = trueBiomeStream
.convertAware2D((b, xx, zz) -> decorateFor(b, xx, zz, IrisDecorationPart.CEILING)).cache2D(cacheSize);
terrainCaveSurfaceDecoration = caveBiomeStream
.convertAware2D((b, xx, zz) -> decorateFor(b, xx, zz, IrisDecorationPart.NONE)).cache2D(cacheSize);
terrainCaveCeilingDecoration = caveBiomeStream
.convertAware2D((b, xx, zz) -> decorateFor(b, xx, zz, IrisDecorationPart.CEILING)).cache2D(cacheSize);
shoreSurfaceDecoration = trueBiomeStream
.convertAware2D((b, xx, zz) -> decorateFor(b, xx, zz, IrisDecorationPart.SHORE_LINE)).cache2D(cacheSize);
seaSurfaceDecoration = trueBiomeStream
@ -344,21 +319,6 @@ public class IrisComplex implements DataProvider {
}
}
if (engine.getDimension().isCaves()) {
KList<CaveResult> caves = ((IrisCaveModifier) engine.getCaveModifier()).genCaves(rx, rz, 0, 0, null);
boolean again = true;
while (again) {
again = false;
for (CaveResult i : caves) {
if (i.getCeiling() > m && i.getFloor() < m) {
m = i.getFloor();
again = true;
}
}
}
}
return m;
}, Interpolated.INT).cache2D(cacheSize);
baseBiomeIDStream = trueBiomeStream.convertAware2D((b, x, z) -> {

View File

@ -64,6 +64,7 @@ import org.bukkit.generator.BlockPopulator;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@ -101,7 +102,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
private EngineActuator<BlockData> decorantActuator;
private EngineActuator<Biome> biomeActuator;
private EngineModifier<BlockData> depositModifier;
private EngineModifier<BlockData> caveModifier;
private EngineModifier<BlockData> ravineModifier;
private EngineModifier<BlockData> postModifier;
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
@ -151,27 +151,35 @@ public class IrisEngine extends BlockPopulator implements Engine {
biomeActuator.close();
depositModifier.close();
ravineModifier.close();
caveModifier.close();
postModifier.close();
effects.close();
}
private void setupEngine()
{
cacheId = RNG.r.nextInt();
worldManager = new IrisWorldManager(this);
complex = new IrisComplex(this);
execution = new IrisExecutionEnvironment(this);
terrainNormalActuator = new IrisTerrainNormalActuator(this);
terrainIslandActuator = new IrisTerrainIslandActuator(this);
decorantActuator = new IrisDecorantActuator(this);
biomeActuator = new IrisBiomeActuator(this);
depositModifier = new IrisDepositModifier(this);
ravineModifier = new IrisRavineModifier(this);
caveModifier = new IrisCaveModifier(this);
postModifier = new IrisPostModifier(this);
effects = new IrisEngineEffects(this);
J.a(this::computeBiomeMaxes);
private void setupEngine() {
try {
cacheId = RNG.r.nextInt();
worldManager = new IrisWorldManager(this);
complex = new IrisComplex(this);
execution = new IrisExecutionEnvironment(this);
terrainNormalActuator = new IrisTerrainNormalActuator(this);
terrainIslandActuator = new IrisTerrainIslandActuator(this);
decorantActuator = new IrisDecorantActuator(this);
biomeActuator = new IrisBiomeActuator(this);
depositModifier = new IrisDepositModifier(this);
ravineModifier = new IrisRavineModifier(this);
postModifier = new IrisPostModifier(this);
effects = new IrisEngineEffects(this);
J.a(this::computeBiomeMaxes);
} catch (Throwable e)
{
Iris.error("FATAL: Engine load failure!");
e.printStackTrace();
if(isStudio())
{
System.exit(0);
}
}
}
@Override
@ -332,7 +340,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
getBiomeActuator().close();
getDepositModifier().close();
getRavineModifier().close();
getCaveModifier().close();
getPostModifier().close();
getMantle().close();
getComplex().close();
@ -412,7 +419,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
getMantle().generateMatter(x >> 4, z >> 4, multicore);
getTerrainActuator().actuate(x, z, vblocks, multicore);
getBiomeActuator().actuate(x, z, vbiomes, multicore);
getCaveModifier().modify(x, z, vblocks, multicore);
getRavineModifier().modify(x, z, vblocks, multicore);
getPostModifier().modify(x, z, vblocks, multicore);
getDecorantActuator().actuate(x, z, blocks, multicore);

View File

@ -22,10 +22,13 @@ import com.volmit.iris.Iris;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.MantleComponent;
import com.volmit.iris.engine.mantle.components.MantleCaveComponent;
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.engine.object.cave.IrisCave;
import com.volmit.iris.engine.object.cave.IrisCavePlacer;
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructurePlacement;
@ -63,6 +66,7 @@ public class IrisEngineMantle implements EngineMantle {
registerComponent(new MantleFeatureComponent(this));
registerComponent(new MantleJigsawComponent(this));
registerComponent(new MantleObjectComponent(this));
registerComponent(new MantleCaveComponent(this));
}
@Override
@ -131,6 +135,7 @@ public class IrisEngineMantle implements EngineMantle {
KMap<IrisObjectScale, KList<String>> scalars = new KMap<>();
int x = xg.get();
int z = zg.get();
int s = 0;
if (getEngine().getDimension().isUseMantle()) {
KList<IrisRegion> r = getAllRegions();
@ -148,6 +153,11 @@ public class IrisEngineMantle implements EngineMantle {
for (IrisJigsawStructurePlacement j : i.getJigsawStructures()) {
jig = Math.max(jig, getData().getJigsawStructureLoader().load(j.getStructure()).getMaxDimension());
}
for(IrisCavePlacer j : i.getCaves())
{
s = Math.max(s, j.getRealCave(getData()).getWorm().getMaxDistance());
}
}
for (IrisRegion i : r) {
@ -162,6 +172,16 @@ public class IrisEngineMantle implements EngineMantle {
for (IrisJigsawStructurePlacement j : i.getJigsawStructures()) {
jig = Math.max(jig, getData().getJigsawStructureLoader().load(j.getStructure()).getMaxDimension());
}
for(IrisCavePlacer j : i.getCaves())
{
s = Math.max(s, j.getRealCave(getData()).getWorm().getMaxDistance());
}
}
for(IrisCavePlacer j : getDimension().getCaves())
{
s = Math.max(s, j.getRealCave(getData()).getWorm().getMaxDistance());
}
for (IrisJigsawStructurePlacement j : getEngine().getDimension().getJigsawStructures()) {
@ -265,6 +285,9 @@ public class IrisEngineMantle implements EngineMantle {
x = xg.get();
z = zg.get();
x = Math.max(s, x);
z = Math.max(s, z);
for (IrisDepositGenerator i : getEngine().getDimension().getDeposits()) {
int max = i.getMaxDimension();
x = Math.max(max, x);
@ -290,7 +313,7 @@ public class IrisEngineMantle implements EngineMantle {
return 0;
}
x = Math.max(z, x);
x = Math.max(x, z);
int u = x;
int v = computeFeatureRange();
x = Math.max(jig, x);

View File

@ -41,7 +41,6 @@ import java.util.function.Predicate;
public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
private static final Predicate<BlockData> PREDICATE_SOLID = (b) -> b != null && !b.getMaterial().isAir() && !b.getMaterial().equals(Material.WATER) && !b.getMaterial().equals(Material.LAVA);
private final BiPredicate<BlockData, Integer> PREDICATE_CAVELIQUID;
private final RNG rng;
@Getter
private final EngineDecorator surfaceDecorator;
@ -64,22 +63,6 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
seaSurfaceDecorator = new IrisSeaSurfaceDecorator(getEngine());
shoreLineDecorator = new IrisShoreLineDecorator(getEngine());
seaFloorDecorator = new IrisSeaFloorDecorator(getEngine());
PREDICATE_CAVELIQUID = (b, y) -> {
for (IrisCaveLayer layer : getEngine().getDimension().getCaveLayers()) {
if (!layer.getFluid().hasFluid(getData())) {
continue;
}
if (layer.getFluid().isInverseHeight() && y >= layer.getFluid().getFluidHeight()) {
if (b.matches(layer.getFluid().getFluid(getData()))) return true;
} else if (!layer.getFluid().isInverseHeight() && y <= layer.getFluid().getFluidHeight()) {
if (b.matches(layer.getFluid().getFluid(getData()))) return true;
}
}
return false;
};
}
@BlockCoordinates
@ -99,7 +82,7 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
int height;
int realX = (int) Math.round(modX(x + finalI));
int realZ;
IrisBiome biome, cave;
IrisBiome biome;
for (int j=0; j < output.getDepth(); j++) {
boolean solid, liquid;
int emptyFor = 0;
@ -108,9 +91,8 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
realZ = (int) Math.round(modZ(z + j));
height = (int) Math.round(getComplex().getHeightStream().get(realX, realZ));
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
cave = shouldRay ? getComplex().getCaveBiomeStream().get(realX, realZ) : null;
if (biome.getDecorators().isEmpty() && (cave == null || cave.getDecorators().isEmpty())) {
if (biome.getDecorators().isEmpty()) {
continue;
}
@ -133,32 +115,6 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
}
getSurfaceDecorator().decorate(finalI, j, realX, realZ, output, biome, height, getEngine().getHeight() - height);
if (cave != null && cave.getDecorators().isNotEmpty()) {
for (int k = height; k > 0; k--) {
solid = PREDICATE_SOLID.test(output.get(finalI, k, j));
liquid = PREDICATE_CAVELIQUID.test(output.get(finalI, k + 1, j), k + 1);
if (solid) {
if (emptyFor > 0) {
if (liquid) {
getSeaFloorDecorator().decorate(finalI, j, realX, realZ, output, cave, k + 1, liquidFor + lastSolid - emptyFor + 1);
getSeaSurfaceDecorator().decorate(finalI, j, realX, realZ, output, cave, k + liquidFor + 1, emptyFor - liquidFor + lastSolid);
} else {
getSurfaceDecorator().decorate(finalI, j, realX, realZ, output, cave, k, lastSolid);
getCeilingDecorator().decorate(finalI, j, realX, realZ, output, cave, lastSolid - 1, emptyFor);
}
emptyFor = 0;
liquidFor = 0;
}
lastSolid = k;
} else {
emptyFor++;
if (liquid) liquidFor++;
}
}
}
}
});
}
@ -169,6 +125,6 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
}
private boolean shouldRayDecorate() {
return getEngine().getDimension().isCarving() || getEngine().getDimension().isCaves() || getEngine().getDimension().isRavines();
return getEngine().getDimension().isCarving() || getEngine().getDimension().isRavines();
}
}

View File

@ -92,8 +92,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
EngineActuator<Biome> getBiomeActuator();
EngineModifier<BlockData> getCaveModifier();
EngineModifier<BlockData> getRavineModifier();
EngineModifier<BlockData> getDepositModifier();
@ -194,7 +192,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
@BlockCoordinates
default IrisBiome getCaveBiome(int x, int z) {
return getComplex().getCaveBiomeStream().get(x, z);
return getComplex().getLandBiomeStream().get(x, z); // TODO!!!!!!!!!!
}
@BlockCoordinates
@ -356,13 +354,11 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
}
IrisRegion region = getComplex().getRegionStream().get(rx, rz);
IrisBiome biomeSurface = getComplex().getTrueBiomeStream().get(rx, rz);
IrisBiome biomeUnder = b.getY() < he ? getComplex().getCaveBiomeStream().get(rx, rz) : biomeSurface;
KList<IrisLootTable> tables = new KList<>();
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier() * biomeUnder.getLoot().getMultiplier();
double multiplier = 1D * getDimension().getLoot().getMultiplier() * region.getLoot().getMultiplier() * biomeSurface.getLoot().getMultiplier();
injectTables(tables, getDimension().getLoot());
injectTables(tables, region.getLoot());
injectTables(tables, biomeSurface.getLoot());
injectTables(tables, biomeUnder.getLoot());
if (tables.isNotEmpty()) {
int target = (int) Math.round(tables.size() * multiplier);

View File

@ -0,0 +1,96 @@
/*
* 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.mantle.components;
import com.volmit.iris.Iris;
import com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.jigsaw.PlannedStructure;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.IrisMantleComponent;
import com.volmit.iris.engine.object.basic.IrisPosition;
import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.engine.object.cave.IrisCave;
import com.volmit.iris.engine.object.cave.IrisCavePlacer;
import com.volmit.iris.engine.object.dimensional.IrisDimension;
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructure;
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructurePlacement;
import com.volmit.iris.engine.object.regional.IrisRegion;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
import org.bukkit.util.Vector;
import java.util.List;
import java.util.function.Consumer;
public class MantleCaveComponent extends IrisMantleComponent {
private final RNG crng;
public MantleCaveComponent(EngineMantle engineMantle) {
super(engineMantle, MantleFlag.CAVE);
crng = new RNG(getEngineMantle().getEngine().getWorld().seed() - 229333333);
}
@Override
public void generateLayer(int x, int z, Consumer<Runnable> post) {
RNG rng = new RNG(Cache.key(x, z) + seed());
int xxx = (x << 4) + rng.i(16);
int zzz = (z << 4) + rng.i(16);
IrisBiome biome = getComplex().getTrueBiomeStreamNoFeatures().get(xxx, zzz);
for(IrisCavePlacer i : biome.getCaves())
{
if(rng.nextInt(i.getRarity()) == 0)
{
place(i, xxx, getEngineMantle().trueHeight(xxx, zzz), zzz);
return;
}
}
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
for(IrisCavePlacer i : region.getCaves())
{
if(rng.nextInt(i.getRarity()) == 0)
{
place(i, xxx, getEngineMantle().trueHeight(xxx, zzz), zzz);
return;
}
}
for(IrisCavePlacer i : getDimension().getCaves())
{
if(rng.nextInt(i.getRarity()) == 0)
{
place(i, xxx, getEngineMantle().trueHeight(xxx, zzz), zzz);
return;
}
}
}
private void place(IrisCavePlacer cave, int x, int y, int z) {
cave.generateCave(getMantle(), crng, getData(), x, y, z);
}
}

View File

@ -1,261 +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.biome.IrisBiome;
import com.volmit.iris.engine.object.carve.IrisCaveLayer;
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.Material;
import org.bukkit.block.data.BlockData;
import java.util.function.Function;
public class IrisCaveModifier 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 IrisCaveModifier(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++) {
KList<CaveResult> caves = genCaves(x + finalI, z + j, finalI, j, a);
int he = (int) Math.round(getComplex().getHeightStream().get(x + finalI, z + j));
if (caves != null && caves.isNotEmpty()) {
IrisBiome cave = getComplex().getCaveBiomeStream().get(x + finalI, z + j);
if (cave == null) {
continue;
}
for (CaveResult cl : caves) {
if (cl.getFloor() < 0 || cl.getFloor() > getEngine().getHeight() || cl.getCeiling() > getEngine().getHeight() || cl.getCeiling() < 0) {
continue;
}
KList<BlockData> floor = cave.generateLayers(x + finalI, z + j, rng, cl.getFloor(), cl.getFloor(), getData(), getComplex());
KList<BlockData> ceiling = cave.generateLayers(x + finalI + 656, z + j - 656, rng,
he - cl.getCeiling(),
he - cl.getCeiling(), getData(), getComplex());
for (int g = 0; g < floor.size(); g++) {
a.set(finalI, cl.getFloor() - g, j, floor.get(g));
}
for (int g = ceiling.size() - 1; g > 0; g--) {
a.set(finalI, cl.getCeiling() + g, j, ceiling.get(g));
}
}
}
}
}
public KList<CaveResult> genCaves(double wxx, double wzz) {
return genCaves(wxx, wzz, 0, 0, null);
}
public KList<CaveResult> genCaves(double wxx, double wzz, int x, int z, Hunk<BlockData> data) {
if (!getDimension().isCaves()) {
return EMPTY;
}
KList<CaveResult> result = new KList<>();
gg.setNoiseType(FastNoiseDouble.NoiseType.Cellular);
gg.setCellularReturnType(FastNoiseDouble.CellularReturnType.Distance2Sub);
gg.setCellularDistanceFunction(FastNoiseDouble.CellularDistanceFunction.Natural);
for (int i = 0; i < getDimension().getCaveLayers().size(); i++) {
IrisCaveLayer layer = getDimension().getCaveLayers().get(i);
generateCave(result, wxx, wzz, x, z, data, layer, i);
}
return result;
}
public void generateCave(KList<CaveResult> result, double wxx, double wzz, int x, int z, Hunk<BlockData> data, IrisCaveLayer layer, int seed) {
double scale = layer.getCaveZoom();
Function<Integer, BlockData> fluid = (height) ->
{
if (!layer.getFluid().hasFluid(getData())) {
return CAVE_AIR;
}
if (layer.getFluid().isInverseHeight() && height >= layer.getFluid().getFluidHeight()) {
return layer.getFluid().getFluid(getData());
} else if (!layer.getFluid().isInverseHeight() && height <= layer.getFluid().getFluidHeight()) {
return layer.getFluid().getFluid(getData());
}
return CAVE_AIR;
};
int surface = (int) Math.round(getComplex().getHeightStream().get(wxx, wzz));
double wx = wxx + layer.getHorizontalSlope().get(rng, getData(), wxx, wzz);
double wz = wzz + layer.getHorizontalSlope().get(rng, getData(), -wzz, -wxx);
double baseWidth = (14 * scale);
double distanceCheck = 0.0132 * baseWidth;
double distanceTake = 0.0022 * baseWidth;
double caveHeightNoise = layer.getVerticalSlope().get(rng, getData(), wxx, wzz);
if (caveHeightNoise > 259 || caveHeightNoise < -1) {
return;
}
// TODO: WARNING HEIGHT
int ceiling = -256;
int floor = 512;
for (double tunnelHeight = 1; tunnelHeight <= baseWidth; tunnelHeight++) {
double distance = (gg.GetCellular(((wx + (10000 * seed)) / layer.getCaveZoom()), ((wz - (10000 * seed)) / layer.getCaveZoom())) + 1D) / 2D;
if (distance < distanceCheck - (tunnelHeight * distanceTake)) {
int caveHeight = (int) Math.round(caveHeightNoise);
int pu = (int) (caveHeight + tunnelHeight);
int pd = (int) (caveHeight - tunnelHeight);
if (pd > surface + 1) {
continue;
}
if (!layer.isCanBreakSurface() && pu > surface - 3) {
continue;
}
if ((pu > 255 && pd > 255) || (pu < 0 && pd < 0)) {
continue;
}
if (data == null) {
ceiling = Math.max(pu, ceiling);
floor = Math.min(pu, floor);
ceiling = Math.max(pd, ceiling);
floor = Math.min(pd, floor);
if (tunnelHeight == 1) {
ceiling = Math.max(caveHeight, ceiling);
floor = Math.min(caveHeight, floor);
}
} else {
if (dig(x, pu, z, data, fluid)) {
ceiling = Math.max(pu, ceiling);
floor = Math.min(pu, floor);
}
if (dig(x, pd, z, data, fluid)) {
ceiling = Math.max(pd, ceiling);
floor = Math.min(pd, floor);
}
if (tunnelHeight == 1) {
if (dig(x, caveHeight, z, data, fluid)) {
ceiling = Math.max(caveHeight, ceiling);
floor = Math.min(caveHeight, floor);
}
}
}
}
}
if (floor >= 0 && ceiling <= 255) {
result.add(new CaveResult(floor, ceiling));
}
}
private Material mat(int x, int y, int z, Hunk<BlockData> data) {
BlockData d = data.get(Math.max(x, 0), Math.max(y, 0), Math.max(z, 0));
if (d != null) {
return d.getMaterial();
}
return Material.CAVE_AIR;
}
public boolean dig(int x, int y, int z, Hunk<BlockData> data, Function<Integer, BlockData> caveFluid) {
Material a = mat(x, y, z, data);
Material c = mat(x, y + 1, z, data);
Material d = mat(x, y + 2, z, data);
Material e = mat(x, y + 3, z, data);
Material f = mat(x, y - 1, z, data);
BlockData b = caveFluid.apply(y);
BlockData b2 = caveFluid.apply(y + 1);
if (can(a) && canAir(c, b) && canAir(f, b) && canWater(d) && canWater(e)) {
data.set(x, y, z, b);
data.set(x, y + 1, z, b2);
return true;
}
return false;
}
public boolean canAir(Material m, BlockData caveFluid) {
return (B.isSolid(m) ||
(B.isDecorant(m.createBlockData())) || m.equals(Material.AIR)
|| m.equals(caveFluid.getMaterial()) ||
m.equals(B.getMaterial("CAVE_AIR")))
&& !m.equals(Material.BEDROCK);
}
public boolean canWater(Material m) {
return !m.equals(Material.WATER);
}
public boolean can(Material m) {
return B.isSolid(m) && !m.equals(Material.BEDROCK);
}
}

View File

@ -159,58 +159,54 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
// Wall Patcher
IrisBiome biome = getComplex().getTrueBiomeStream().get(x, z);
if (getDimension().isPostProcessingWalls()) {
if (!biome.getWall().getPalette().isEmpty()) {
if (ha < h - 2 || hb < h - 2 || hc < h - 2 || hd < h - 2) {
boolean brokeGround = false;
int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd))));
if (!biome.getWall().getPalette().isEmpty()) {
if (ha < h - 2 || hb < h - 2 || hc < h - 2 || hd < h - 2) {
boolean brokeGround = false;
int max = Math.abs(Math.max(h - ha, Math.max(h - hb, Math.max(h - hc, h - hd))));
for (int i = h; i > h - max; i--) {
BlockData d = biome.getWall().get(rng, x + i, i + h, z + i, getData());
for (int i = h; i > h - max; i--) {
BlockData d = biome.getWall().get(rng, x + i, i + h, z + i, getData());
if (d != null) {
if (isAirOrWater(x, i, z, currentPostX, currentPostZ, currentData)) {
if (brokeGround) {
break;
}
continue;
if (d != null) {
if (isAirOrWater(x, i, z, currentPostX, currentPostZ, currentData)) {
if (brokeGround) {
break;
}
setPostBlock(x, i, z, d, currentPostX, currentPostZ, currentData);
brokeGround = true;
continue;
}
setPostBlock(x, i, z, d, currentPostX, currentPostZ, currentData);
brokeGround = true;
}
}
}
}
// Slab
if (getDimension().isPostProcessingSlabs()) {
//@builder
if ((ha == h + 1 && isSolidNonSlab(x + 1, ha, z, currentPostX, currentPostZ, currentData))
|| (hb == h + 1 && isSolidNonSlab(x, hb, z + 1, currentPostX, currentPostZ, currentData))
|| (hc == h + 1 && isSolidNonSlab(x - 1, hc, z, currentPostX, currentPostZ, currentData))
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
//@done
{
BlockData d = biome.getSlab().get(rng, x, h, z, getData());
//@builder
if ((ha == h + 1 && isSolidNonSlab(x + 1, ha, z, currentPostX, currentPostZ, currentData))
|| (hb == h + 1 && isSolidNonSlab(x, hb, z + 1, currentPostX, currentPostZ, currentData))
|| (hc == h + 1 && isSolidNonSlab(x - 1, hc, z, currentPostX, currentPostZ, currentData))
|| (hd == h + 1 && isSolidNonSlab(x, hd, z - 1, currentPostX, currentPostZ, currentData)))
//@done
{
BlockData d = biome.getSlab().get(rng, x, h, z, getData());
if (d != null) {
boolean cancel = B.isAir(d);
if (d != null) {
boolean cancel = B.isAir(d);
if (d.getMaterial().equals(Material.SNOW) && h + 1 <= getDimension().getFluidHeight()) {
cancel = true;
}
if (d.getMaterial().equals(Material.SNOW) && h + 1 <= getDimension().getFluidHeight()) {
cancel = true;
}
if (isSnowLayer(x, h, z, currentPostX, currentPostZ, currentData)) {
cancel = true;
}
if (isSnowLayer(x, h, z, currentPostX, currentPostZ, currentData)) {
cancel = true;
}
if (!cancel && isAirOrWater(x, h + 1, z, currentPostX, currentPostZ, currentData)) {
setPostBlock(x, h + 1, z, d, currentPostX, currentPostZ, currentData);
h++;
}
if (!cancel && isAirOrWater(x, h + 1, z, currentPostX, currentPostZ, currentData)) {
setPostBlock(x, h + 1, z, d, currentPostX, currentPostZ, currentData);
h++;
}
}
}
@ -250,141 +246,6 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
setPostBlock(x, h + 1, z, AIR, currentPostX, currentPostZ, currentData);
}
}
if (getDimension().isPostProcessCaves()) {
IrisBiome cave = getComplex().getCaveBiomeStream().get(x, z);
if (cave != null) {
for (CaveResult i : ((IrisCaveModifier) getEngine().getCaveModifier()).genCaves(x, z, 0, 0, null)) {
if (i.getCeiling() >= currentData.getMax2DParallelism() || i.getFloor() < 0) {
continue;
}
int f = i.getFloor();
int fa = nearestCaveFloor(f, x + 1, z, currentPostX, currentPostZ, currentData);
int fb = nearestCaveFloor(f, x, z + 1, currentPostX, currentPostZ, currentData);
int fc = nearestCaveFloor(f, x - 1, z, currentPostX, currentPostZ, currentData);
int fd = nearestCaveFloor(f, x, z - 1, currentPostX, currentPostZ, currentData);
int c = i.getCeiling();
int ca = nearestCaveCeiling(c, x + 1, z, currentPostX, currentPostZ, currentData);
int cb = nearestCaveCeiling(c, x, z + 1, currentPostX, currentPostZ, currentData);
int cc = nearestCaveCeiling(c, x - 1, z, currentPostX, currentPostZ, currentData);
int cd = nearestCaveCeiling(c, x, z - 1, currentPostX, currentPostZ, currentData);
// Cave Nibs
g = 0;
g += fa == f - 1 ? 1 : 0;
g += fb == f - 1 ? 1 : 0;
g += fc == f - 1 ? 1 : 0;
g += fd == f - 1 ? 1 : 0;
if (g >= 4) {
BlockData bc = getPostBlock(x, f, z, currentPostX, currentPostZ, currentData);
b = getPostBlock(x, f + 1, z, currentPostX, currentPostZ, currentData);
Material m = bc.getMaterial();
if (m.isSolid()) {
setPostBlock(x, f, z, b, currentPostX, currentPostZ, currentData);
h--;
}
} else {
// Cave Potholes
g = 0;
g += fa == f + 1 ? 1 : 0;
g += fb == f + 1 ? 1 : 0;
g += fc == f + 1 ? 1 : 0;
g += fd == f + 1 ? 1 : 0;
if (g >= 4) {
BlockData ba = getPostBlock(x, fa, z, currentPostX, currentPostZ, currentData);
BlockData bb = getPostBlock(x, fb, z, currentPostX, currentPostZ, currentData);
BlockData bc = getPostBlock(x, fc, z, currentPostX, currentPostZ, currentData);
BlockData bd = getPostBlock(x, fd, z, currentPostX, currentPostZ, currentData);
g = 0;
g = B.isSolid(ba) ? g + 1 : g;
g = B.isSolid(bb) ? g + 1 : g;
g = B.isSolid(bc) ? g + 1 : g;
g = B.isSolid(bd) ? g + 1 : g;
if (g >= 4) {
setPostBlock(x, f + 1, z, getPostBlock(x, f, z, currentPostX, currentPostZ, currentData), currentPostX, currentPostZ, currentData);
h++;
}
}
}
if (getDimension().isPostProcessingSlabs()) {
//@builder
if ((fa == f + 1 && isSolidNonSlab(x + 1, fa, z, currentPostX, currentPostZ, currentData))
|| (fb == f + 1 && isSolidNonSlab(x, fb, z + 1, currentPostX, currentPostZ, currentData))
|| (fc == f + 1 && isSolidNonSlab(x - 1, fc, z, currentPostX, currentPostZ, currentData))
|| (fd == f + 1 && isSolidNonSlab(x, fd, z - 1, currentPostX, currentPostZ, currentData)))
//@done
{
BlockData d = cave.getSlab().get(rng, x, f, z, getData());
if (d != null) {
boolean cancel = B.isAir(d);
if (d.getMaterial().equals(Material.SNOW) && f + 1 <= getDimension().getFluidHeight()) {
cancel = true;
}
if (isSnowLayer(x, f, z, currentPostX, currentPostZ, currentData)) {
cancel = true;
}
if (!cancel && isAirOrWater(x, f + 1, z, currentPostX, currentPostZ, currentData)) {
setPostBlock(x, f + 1, z, d, currentPostX, currentPostZ, currentData);
}
}
}
//@builder
if ((ca == c - 1 && isSolidNonSlab(x + 1, ca, z, currentPostX, currentPostZ, currentData))
|| (cb == c - 1 && isSolidNonSlab(x, cb, z + 1, currentPostX, currentPostZ, currentData))
|| (cc == c - 1 && isSolidNonSlab(x - 1, cc, z, currentPostX, currentPostZ, currentData))
|| (cd == c - 1 && isSolidNonSlab(x, cd, z - 1, currentPostX, currentPostZ, currentData)))
//@done
{
BlockData d = cave.getSlab().get(rng, x, c, z, getData());
if (d != null) {
boolean cancel = B.isAir(d);
if (!(d instanceof Slab)) {
cancel = true;
}
if (isSnowLayer(x, c, z, currentPostX, currentPostZ, currentData)) {
cancel = true;
}
if (!cancel && isAirOrWater(x, c, z, currentPostX, currentPostZ, currentData)) {
try {
Slab slab = (Slab) d.clone();
slab.setType(Slab.Type.TOP);
setPostBlock(x, c, z, slab, currentPostX, currentPostZ, currentData);
} catch (Throwable e) {
Iris.reportError(e);
try {
Slab slab = (Slab) d.clone();
synchronized (slab) {
slab.setType(Slab.Type.TOP);
setPostBlock(x, c, z, slab, currentPostX, currentPostZ, currentData);
}
} catch (Throwable ee) {
Iris.reportError(ee);
}
}
}
}
}
}
}
}
}
}
private int nearestCaveFloor(int floor, int x, int z, int currentPostX, int currentPostZ, Hunk<BlockData> currentData) {

View File

@ -27,6 +27,7 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.block.IrisBlockDrops;
import com.volmit.iris.engine.object.cave.IrisCavePlacer;
import com.volmit.iris.engine.object.common.IRare;
import com.volmit.iris.engine.object.decoration.IrisDecorator;
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
@ -74,6 +75,10 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
private String name = "A Biome";
@Desc("Register caves to generate")
@ArrayType(min = 1, type = IrisCavePlacer.class)
private KList<IrisCavePlacer> caves = new KList<>();
@ArrayType(min = 1, type = IrisBiomeCustom.class)
@Desc("If the biome type custom is defined, specify this")
private KList<IrisBiomeCustom> customDerivitives;

View File

@ -32,6 +32,8 @@ import com.volmit.iris.engine.object.carve.IrisCarveLayer;
import com.volmit.iris.engine.object.carve.IrisCaveFluid;
import com.volmit.iris.engine.object.carve.IrisCaveLayer;
import com.volmit.iris.engine.object.carve.IrisCaverns;
import com.volmit.iris.engine.object.cave.IrisCave;
import com.volmit.iris.engine.object.cave.IrisCavePlacer;
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
@ -175,9 +177,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("The placement style of biomes")
private IrisGeneratorStyle skylandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@Desc("Generate caves or not.")
private boolean caves = true;
@Desc("Instead of filling objects with air, fills them with cobweb so you can see them")
private boolean debugSmartBore = false;
@ -210,9 +209,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Add painted walls in post processing")
private boolean postProcessingWalls = true;
@Desc("Use post processing for caves or not")
private boolean postProcessCaves = true;
@Desc("The world environment")
private Environment environment = Environment.NORMAL;
@ -305,10 +301,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Overlay additional noise on top of the interoplated terrain.")
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
@ArrayType(min = 1, type = IrisCaveLayer.class)
@Desc("Define cave layers")
private KList<IrisCaveLayer> caveLayers = new KList<>();
@ArrayType(min = 1, type = IrisCarveLayer.class)
@Desc("Define carve layers")
private KList<IrisCarveLayer> carveLayers = new KList<>();
@ -330,6 +322,10 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Cartographer map trade overrides")
private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
@Desc("Register caves to generate")
@ArrayType(min = 1, type = IrisCavePlacer.class)
private KList<IrisCavePlacer> caves = new KList<>();
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();

View File

@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.modifier.IrisCaveModifier;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
@ -83,23 +82,8 @@ public class IrisEntitySpawn implements IRare {
int h = gen.getHeight(x, z, true);
int hf = gen.getHeight(x, z, false);
Location l = switch (getReferenceSpawner().getGroup()) {
case NORMAL -> new Location(c.getWorld(), x, hf + 1, z);
case CAVE -> {
IrisComplex comp = gen.getComplex();
IrisBiome cave = comp.getCaveBiomeStream().get(x, z);
KList<Location> r = new KList<>();
if (cave != null) {
for (CaveResult i : ((IrisCaveModifier) gen.getCaveModifier()).genCaves(x, z)) {
if (i.getCeiling() >= gen.getHeight() || i.getFloor() < 0 || i.getCeiling() - 2 <= i.getFloor()) {
continue;
}
r.add(new Location(c.getWorld(), x, i.getFloor(), z));
}
}
yield r.getRandom(rng);
}
case NORMAL, CAVE -> new Location(c.getWorld(), x, hf + 1, z);
// TODO HANDLE CAVES
case UNDERWATER, BEACH -> new Location(c.getWorld(), x, rng.i(h + 1, hf), z);
};

View File

@ -27,6 +27,7 @@ import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.biome.InferredType;
import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.engine.object.block.IrisBlockDrops;
import com.volmit.iris.engine.object.cave.IrisCavePlacer;
import com.volmit.iris.engine.object.common.IRare;
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
import com.volmit.iris.engine.object.feature.IrisFeaturePotential;
@ -69,6 +70,10 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@Desc("The name of the region")
private String name = "A Region";
@Desc("Register caves to generate")
@ArrayType(min = 1, type = IrisCavePlacer.class)
private KList<IrisCavePlacer> caves = new KList<>();
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
@Desc("Jigsaw structures")
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();

View File

@ -24,7 +24,8 @@ public enum MantleFlag {
OBJECT,
UPDATE,
JIGSAW,
FEATURE;
FEATURE,
CAVE;
static StateList getStateList() {
return new StateList(MantleFlag.values());