mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-05 15:26:28 +00:00
f
This commit is contained in:
@@ -67,7 +67,6 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
private CNG swirl;
|
||||
private MB ICE = new MB(Material.ICE);
|
||||
private MB PACKED_ICE = new MB(Material.PACKED_ICE);
|
||||
private MB WATER = new MB(Material.STATIONARY_WATER);
|
||||
private MB BEDROCK = new MB(Material.BEDROCK);
|
||||
private GenObjectDecorator god;
|
||||
private GenLayerLayeredNoise glLNoise;
|
||||
@@ -143,24 +142,6 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
return new ChunkPlan();
|
||||
}
|
||||
|
||||
public IrisBiome getBiome(int wxx, int wzx)
|
||||
{
|
||||
PrecisionStopwatch c = getMetrics().start();
|
||||
IrisBiome biome = glBiome.getBiome(wxx, wzx);
|
||||
IrisBiome real = glBiome.getBiome(wxx, wzx, true);
|
||||
boolean frozen = getRegion(biome) != null ? getRegion(biome).isFrozen() : false;
|
||||
int height = computeHeight(wxx, wzx, new ChunkPlan(), biome);
|
||||
IrisBiome nbiome = height < 63 ? getOcean(real, height) : biome;
|
||||
biome = nbiome;
|
||||
int beach = (int) Math.round(65 + this.beach.noise(wxx, wzx));
|
||||
biome = height > 61 && height < 65 ? frozen ? biome : getBeach(real) : biome;
|
||||
biome = height > 63 && biome.getType().equals(BiomeType.FLUID) ? getBeach(real) : biome;
|
||||
biome = height >= beach && !biome.getType().equals(BiomeType.LAND) ? real : biome;
|
||||
getMetrics().stop("biome:ms:x256:/terrain:..", c);
|
||||
|
||||
return biome;
|
||||
}
|
||||
|
||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||
{
|
||||
random = new Random(world.getSeed());
|
||||
@@ -193,32 +174,10 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
return metrics;
|
||||
}
|
||||
|
||||
public IrisBiome getOcean(IrisBiome biome, int height)
|
||||
{
|
||||
IrisRegion region = glBiome.getRegion(biome.getRegion());
|
||||
if(region != null)
|
||||
{
|
||||
if(region.isFrozen())
|
||||
{
|
||||
return biome("Frozen Ocean");
|
||||
}
|
||||
}
|
||||
|
||||
if(height < 36)
|
||||
{
|
||||
return biome("Deep Ocean");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return biome("Ocean");
|
||||
}
|
||||
}
|
||||
|
||||
public IrisBiome getBeach(IrisBiome biome)
|
||||
{
|
||||
IrisBiome beach = null;
|
||||
IrisRegion region = glBiome.getRegion(biome.getRegion());
|
||||
IrisRegion region = glBiome.getRegion(biome.getRegionID());
|
||||
|
||||
if(region != null)
|
||||
{
|
||||
@@ -283,7 +242,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
|
||||
public IrisRegion getRegion(IrisBiome biome)
|
||||
{
|
||||
return glBiome.getRegion(biome.getRegion());
|
||||
return glBiome.getRegion(biome.getRegionID());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -341,27 +300,32 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
int wzx = (int) wz;
|
||||
int highest = 0;
|
||||
int seaLevel = Iris.settings.gen.seaLevel;
|
||||
IrisBiome biome = getBiome(wxx, wzx);
|
||||
IrisRegion r = getRegion(biome);
|
||||
boolean frozen = r != null && r.isFrozen();
|
||||
IrisBiome biome = glBiome.getBiome(wxx, wzx);
|
||||
IrisBiome realBiome = glBiome.getBiome(wxx, wzx, true);
|
||||
IrisRegion region = getRegion(realBiome);
|
||||
MB FLUID = biome.getFluid();
|
||||
int height = computeHeight(wxx, wzx, plan, biome);
|
||||
int max = Math.max(height, seaLevel);
|
||||
boolean land = height >= seaLevel;
|
||||
int beachHeight = land ? (int) Math.round(seaLevel + beach.noise(wx, wz)) : seaLevel;
|
||||
boolean beach = height <= beachHeight + 2 && land;
|
||||
biome = land && biome.getType().equals(BiomeType.FLUID) ? region.getBeach() : biome;
|
||||
biome = !land && biome.getType().equals(BiomeType.LAND) ? region.getLake() : biome;
|
||||
biome = beach && !land && biome.getType().equals(BiomeType.FLUID) ? region.getShore() : biome;
|
||||
// biome = !beach && land && biome.getType().equals(BiomeType.FRONT) ? realBiome
|
||||
// : biome;
|
||||
|
||||
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 underwater = i >= height && i < seaLevel;
|
||||
boolean someunderwater = i >= height && i < seaLevel - (1 + scatterInt(x, i, z, 1));
|
||||
boolean wayunderwater = i >= height && i < seaLevel - (3 + scatterInt(x, i, z, 2));
|
||||
boolean underground = i < height;
|
||||
int dheight = biome.getDirtDepth();
|
||||
int rheight = biome.getRockDepth();
|
||||
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 ? frozen ? PACKED_ICE : WATER : mb;
|
||||
mb = someunderwater ? frozen ? ICE : WATER : mb;
|
||||
mb = wayunderwater ? WATER : mb;
|
||||
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;
|
||||
@@ -438,7 +402,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
||||
{
|
||||
IrisBiome biome = glBiome.getBiome(x, z);
|
||||
double h = Iris.settings.gen.baseHeight + biome.getHeight();
|
||||
h += biome.getGenerator().getHeight(x, z);
|
||||
h += biome.getGenerator().getHeight(x, z) / 2D;
|
||||
plan.setHeight(x, z, h);
|
||||
return h;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class BiomeNoiseGenerator
|
||||
}
|
||||
|
||||
double r = block * 52;
|
||||
double m = biome.getGenAmplifier() < 1D ? (r - (biome.getGenAmplifier() * r)) : 0;
|
||||
return (gen.noise(x, z) * biome.getGenAmplifier() * r) + m;
|
||||
return (gen.noise(x, z) * biome.getGenAmplifier() * r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,18 @@ import java.util.function.Function;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import mortar.util.text.C;
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.pack.IrisBiome;
|
||||
import ninja.bytecode.iris.pack.IrisRegion;
|
||||
import ninja.bytecode.iris.util.BiomeLayer;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.PolygonGenerator;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
import ninja.bytecode.shuriken.collections.GMap;
|
||||
import ninja.bytecode.shuriken.logging.L;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.M;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerBiome extends GenLayer
|
||||
@@ -23,17 +25,18 @@ public class GenLayerBiome extends GenLayer
|
||||
private Function<CNG, CNG> factory;
|
||||
private CNG fracture;
|
||||
private CNG fuzz;
|
||||
private CNG island;
|
||||
private PolygonGenerator channel;
|
||||
private PolygonGenerator ocean;
|
||||
private BiomeLayer master;
|
||||
|
||||
public GenLayerBiome(IrisGenerator iris, World world, Random random, RNG rng, GList<IrisBiome> biomes)
|
||||
{
|
||||
super(iris, world, random, rng);
|
||||
//@builder
|
||||
island = new CNG(rng.nextParallelRNG(10334), 1D, 1)
|
||||
.scale(0.003 * Iris.settings.gen.landScale)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(1211), 1D, 1)
|
||||
.scale(0.001 * Iris.settings.gen.landScale), 3600);
|
||||
channel = new PolygonGenerator(rng.nextParallelRNG(-12), 2, 0.0005, 1, (g)->g.fractureWith(new CNG(rng.nextParallelRNG(34), 1D, 2)
|
||||
.scale(0.01), 30));
|
||||
ocean = new PolygonGenerator(rng.nextParallelRNG(-11), 6, 0.005, 1, (g)->g.fractureWith(new CNG(rng.nextParallelRNG(34), 1D, 2)
|
||||
.scale(0.01), 150));
|
||||
fuzz = new CNG(rng.nextParallelRNG(9112), 1D * 8 * Iris.settings.gen.biomeEdgeFuzzScale, 1).scale(6.5);
|
||||
fracture = new CNG(rng.nextParallelRNG(28), 1D, 4).scale(0.0021 * Iris.settings.gen.biomeEdgeScrambleScale)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(34), 1D, 2)
|
||||
@@ -48,17 +51,17 @@ public class GenLayerBiome extends GenLayer
|
||||
|
||||
for(IrisBiome i : biomes)
|
||||
{
|
||||
if(i.getRegion().equals("default"))
|
||||
if(i.getRegionID().equals("default"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!regions.containsKey(i.getRegion()))
|
||||
if(!regions.containsKey(i.getRegionID()))
|
||||
{
|
||||
regions.put(i.getRegion(), new IrisRegion(i.getRegion()));
|
||||
regions.put(i.getRegionID(), new IrisRegion(i.getRegionID()));
|
||||
}
|
||||
|
||||
regions.get(i.getRegion()).getBiomes().add(i);
|
||||
regions.get(i.getRegionID()).getBiomes().add(i);
|
||||
}
|
||||
|
||||
for(IrisRegion i : regions.values())
|
||||
@@ -81,53 +84,6 @@ public class GenLayerBiome extends GenLayer
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasBorder(int checks, double distance, double... dims)
|
||||
{
|
||||
IrisBiome current = getBiome(dims[0], dims[1]);
|
||||
double ajump = 360D / (double) checks;
|
||||
|
||||
if(dims.length == 2)
|
||||
{
|
||||
for(int i = 0; i < checks; i++)
|
||||
{
|
||||
double dx = M.sin((float) Math.toRadians(ajump * i));
|
||||
double dz = M.cos((float) Math.toRadians(ajump * i));
|
||||
if(!current.equals(getBiome((dx * distance) + dims[0], (dz * distance) + dims[1])))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasHeightBorder(int checks, double distance, double... dims)
|
||||
{
|
||||
IrisBiome current = getBiome(dims[0], dims[1]);
|
||||
double ajump = 360D / (double) checks;
|
||||
|
||||
if(dims.length == 2)
|
||||
{
|
||||
for(int i = 0; i < checks; i++)
|
||||
{
|
||||
double dx = M.sin((float) Math.toRadians(ajump * i));
|
||||
double dz = M.cos((float) Math.toRadians(ajump * i));
|
||||
if(current.getHeight() != getBiome((dx * distance) + dims[0], (dz * distance) + dims[1]).getHeight())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBorder(int wx, int wz, double range)
|
||||
{
|
||||
return hasHeightBorder(6, range, wx, wz);
|
||||
}
|
||||
|
||||
public IrisBiome getBiome(double wxx, double wzx)
|
||||
{
|
||||
return getBiome(wxx, wzx, false);
|
||||
@@ -137,36 +93,56 @@ public class GenLayerBiome extends GenLayer
|
||||
{
|
||||
double wx = Math.round((double) wxx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
|
||||
double wz = Math.round((double) wzx * (Iris.settings.gen.horizontalZoom / 1.90476190476)) * Iris.settings.gen.biomeScale;
|
||||
double x = wx + ((fracture.noise(wx, wz) / 2D) * 200D * Iris.settings.gen.biomeEdgeScrambleRange);
|
||||
double z = wz - ((fracture.noise(wz, wx) / 2D) * 200D * Iris.settings.gen.biomeEdgeScrambleRange);
|
||||
x -= fuzz.noise(wx, wz);
|
||||
z += fuzz.noise(wz, wx);
|
||||
double xf = wx + ((fracture.noise(wx, wz) / 2D) * 200D * Iris.settings.gen.biomeEdgeScrambleRange);
|
||||
double zf = wz - ((fracture.noise(wz, wx) / 2D) * 200D * Iris.settings.gen.biomeEdgeScrambleRange);
|
||||
double x = xf - fuzz.noise(wx, wz);
|
||||
double z = zf + fuzz.noise(wz, wx);
|
||||
IrisBiome biome = master.computeBiome(x, z);
|
||||
|
||||
if(real)
|
||||
{
|
||||
return master.computeBiome(x, z);
|
||||
return biome;
|
||||
}
|
||||
|
||||
IrisBiome cbi = iris.biome("Ocean");
|
||||
double land = island.noise(x, z);
|
||||
double landChance = 1D - M.clip(Iris.settings.gen.landChance, 0D, 1D);
|
||||
|
||||
if(land > landChance)
|
||||
if(ocean.getIndex(x, z) == 0)
|
||||
{
|
||||
cbi = master.computeBiome(x, z);
|
||||
IrisRegion region = getRegion(biome.getRegionID());
|
||||
|
||||
if(region == null)
|
||||
{
|
||||
L.f(C.YELLOW + "Cannot find Region " + C.RED + biome.getRegionID());
|
||||
return biome;
|
||||
}
|
||||
|
||||
if(region.getOcean() == null)
|
||||
{
|
||||
L.f(C.YELLOW + "Cannot find Ocean in Region" + C.RED + biome.getRegionID());
|
||||
return biome;
|
||||
}
|
||||
|
||||
return getRegion(biome.getRegionID()).getOcean();
|
||||
}
|
||||
|
||||
else if(land < 0.1)
|
||||
if(channel.hasBorder(3, 44, xf, zf))
|
||||
{
|
||||
cbi = iris.biome("Deep Ocean");
|
||||
IrisRegion region = getRegion(biome.getRegionID());
|
||||
|
||||
if(region == null)
|
||||
{
|
||||
L.f(C.YELLOW + "Cannot find Region " + C.RED + biome.getRegionID());
|
||||
return biome;
|
||||
}
|
||||
|
||||
if(region.getChannel() == null)
|
||||
{
|
||||
L.f(C.YELLOW + "Cannot find Channel in Region" + C.RED + biome.getRegionID());
|
||||
return biome;
|
||||
}
|
||||
|
||||
return getRegion(biome.getRegionID()).getChannel();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
cbi = iris.biome("Ocean");
|
||||
}
|
||||
|
||||
return cbi;
|
||||
return biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user