mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-07 00:06:10 +00:00
Caverns
This commit is contained in:
@@ -18,6 +18,7 @@ import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
||||
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
||||
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCarving;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCaves;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCliffs;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerLayeredNoise;
|
||||
@@ -75,6 +76,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
private GenLayerSnow glSnow;
|
||||
private GenLayerCliffs glCliffs;
|
||||
private GenLayerCaves glCaves;
|
||||
private GenLayerCarving glCarving;
|
||||
private GenLayerOres glOres;
|
||||
private RNG rTerrain;
|
||||
private CompiledDimension dim;
|
||||
@@ -133,7 +135,8 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
glSnow = new GenLayerSnow(this, world, random, rTerrain.nextParallelRNG(5));
|
||||
glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9));
|
||||
glCaves = new GenLayerCaves(this, world, random, rTerrain.nextParallelRNG(10));
|
||||
glOres = new GenLayerOres(this, world, random, rTerrain.nextParallelRNG(11));
|
||||
glCarving = new GenLayerCarving(this, world, random, rTerrain.nextParallelRNG(11));
|
||||
glOres = new GenLayerOres(this, world, random, rTerrain.nextParallelRNG(12));
|
||||
scatter = new CNG(rTerrain.nextParallelRNG(52), 1, 1).scale(10);
|
||||
|
||||
if(Iris.settings.performance.objectMode.equals(ObjectMode.PARALLAX))
|
||||
@@ -358,6 +361,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
for(int i = surfaceOnly ? max > seaLevel ? max - 2 : height - 2 : 0; i < max; i++)
|
||||
{
|
||||
MB mb = ROCK.get(scatterInt(wzx, i, wxx, ROCK.size()));
|
||||
boolean carved = surfaceOnly ? false : glCarving.isCarved(wzx, wxx, x, z, i, data, plan);
|
||||
boolean underwater = i >= height && i < seaLevel;
|
||||
boolean underground = i < height;
|
||||
int dheight = biome.getDirtDepth();
|
||||
@@ -365,17 +369,26 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
boolean dirt = (height - 1) - i < (dheight > 0 ? scatterInt(x, i, z, 4) : 0) + dheight;
|
||||
boolean rocky = i > height - rheight && !dirt;
|
||||
boolean bedrock = i == 0 || !Iris.settings.gen.flatBedrock ? i <= 2 : i < scatterInt(x, i, z, 3);
|
||||
mb = underwater ? FLUID : mb;
|
||||
mb = underground && dirt ? biome.getSubSurface(wxx, i, wzx, rTerrain) : mb;
|
||||
mb = underground && rocky ? biome.getRock(wxx, i, wzx, rTerrain) : mb;
|
||||
mb = bedrock ? BEDROCK : mb;
|
||||
|
||||
if(i == height - 1)
|
||||
if(!carved)
|
||||
{
|
||||
mb = biome.getSurface(wx, wz, rTerrain);
|
||||
mb = underwater ? FLUID : mb;
|
||||
mb = underground && dirt ? biome.getSubSurface(wxx, i, wzx, rTerrain) : mb;
|
||||
mb = underground && rocky ? biome.getRock(wxx, i, wzx, rTerrain) : mb;
|
||||
mb = bedrock ? BEDROCK : mb;
|
||||
|
||||
if(i == height - 1)
|
||||
{
|
||||
mb = biome.getSurface(wx, wz, rTerrain);
|
||||
}
|
||||
|
||||
highest = i > highest ? i : highest;
|
||||
}
|
||||
|
||||
highest = i > highest ? i : highest;
|
||||
else
|
||||
{
|
||||
mb = MB.of(Material.AIR);
|
||||
}
|
||||
data.setBlock(x, i, z, mb.material, mb.data);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
||||
import ninja.bytecode.iris.util.ChunkPlan;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.IrisInterpolation;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.M;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerCarving extends GenLayer
|
||||
{
|
||||
private CNG scram;
|
||||
private CNG cng;
|
||||
private CNG cngh;
|
||||
private CNG cngo;
|
||||
|
||||
public GenLayerCarving(IrisGenerator iris, World world, Random random, RNG rng)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
cng = new CNG(rng.nextParallelRNG(2339234), 1D, 1).scale(0.02);
|
||||
cngh = new CNG(rng.nextParallelRNG(1939234), 1D, 1).scale(0.027);
|
||||
cngo = new CNG(rng.nextParallelRNG(8939234), 1D, 1).scale(0.002);
|
||||
scram = new CNG(rng.nextParallelRNG(2639634), 1D, 1).scale(0.15);
|
||||
|
||||
//@done
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double gnoise, double dx, double dz)
|
||||
{
|
||||
return gnoise;
|
||||
}
|
||||
|
||||
public boolean isCarved(double vwxxf, double vwzxf, int x, int z, double hl, AtomicChunkData data, ChunkPlan plan)
|
||||
{
|
||||
double a = cngh.noise(vwxxf, vwzxf);
|
||||
double hmax = 99 + (a * 30);
|
||||
double hmin = 68 + (a * 30);
|
||||
|
||||
if(hl > hmax || hl < hmin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
double wxxf = (scram.noise(vwxxf, vwzxf) * 12) - vwzxf;
|
||||
double wzxf = (scram.noise(vwzxf, vwxxf) * 12) + vwxxf;
|
||||
|
||||
double downrange = M.lerpInverse(hmin, hmax, hl);
|
||||
double opacity = IrisInterpolation.sinCenter(downrange);
|
||||
|
||||
if(cng.noise(wxxf, wzxf, hl / 3) < (opacity / 1.4D) * cngo.noise(wxxf, wzxf))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,11 @@ public class GenLayerCaves extends GenLayer
|
||||
|
||||
public void genCaves(double wxxf, double wzxf, int x, int z, AtomicChunkData data, ChunkPlan plan)
|
||||
{
|
||||
if(true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PrecisionStopwatch s = PrecisionStopwatch.start();
|
||||
double itr = 2;
|
||||
double level = 8;
|
||||
|
||||
Reference in New Issue
Block a user