mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Caverns
This commit is contained in:
parent
e385e3cec8
commit
67a2ad708f
2
pom.xml
2
pom.xml
@ -147,7 +147,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ninja.bytecode</groupId>
|
<groupId>ninja.bytecode</groupId>
|
||||||
<artifactId>Shuriken</artifactId>
|
<artifactId>Shuriken</artifactId>
|
||||||
<version>1.1.1</version>
|
<version>1.1.14</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.volmit</groupId>
|
<groupId>com.volmit</groupId>
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package ninja.bytecode.iris;
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Difficulty;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -13,8 +15,9 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import mortar.api.rift.PhantomRift;
|
||||||
import mortar.api.rift.Rift;
|
import mortar.api.rift.Rift;
|
||||||
import mortar.api.sched.S;
|
import mortar.api.rift.RiftException;
|
||||||
import mortar.bukkit.command.Command;
|
import mortar.bukkit.command.Command;
|
||||||
import mortar.bukkit.plugin.Control;
|
import mortar.bukkit.plugin.Control;
|
||||||
import mortar.bukkit.plugin.MortarPlugin;
|
import mortar.bukkit.plugin.MortarPlugin;
|
||||||
@ -27,7 +30,6 @@ import ninja.bytecode.iris.generator.IrisGenerator;
|
|||||||
import ninja.bytecode.iris.util.Direction;
|
import ninja.bytecode.iris.util.Direction;
|
||||||
import ninja.bytecode.iris.util.HotswapGenerator;
|
import ninja.bytecode.iris.util.HotswapGenerator;
|
||||||
import ninja.bytecode.iris.util.IrisMetrics;
|
import ninja.bytecode.iris.util.IrisMetrics;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
|
|
||||||
public class Iris extends MortarPlugin
|
public class Iris extends MortarPlugin
|
||||||
@ -95,6 +97,36 @@ public class Iris extends MortarPlugin
|
|||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
packController.compile();
|
packController.compile();
|
||||||
|
|
||||||
|
if(Iris.settings.performance.debugMode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//@builder
|
||||||
|
r = new PhantomRift("Iris-Debug/" + UUID.randomUUID().toString())
|
||||||
|
.setTileTickLimit(0.1)
|
||||||
|
.setEntityTickLimit(0.1)
|
||||||
|
.setAllowBosses(false)
|
||||||
|
.setEnvironment(Environment.NORMAL)
|
||||||
|
.setDifficulty(Difficulty.PEACEFUL)
|
||||||
|
.setRandomLightUpdates(false)
|
||||||
|
.setViewDistance(32)
|
||||||
|
.setHangingTickRate(2000)
|
||||||
|
.setGenerator(IrisGenerator.class)
|
||||||
|
.load();
|
||||||
|
|
||||||
|
for(Player i : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
r.send(i);
|
||||||
|
}
|
||||||
|
//@done
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(RiftException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@ public class Settings
|
|||||||
public ObjectMode objectMode = ObjectMode.PARALLAX;
|
public ObjectMode objectMode = ObjectMode.PARALLAX;
|
||||||
public int threadPriority = Thread.MAX_PRIORITY;
|
public int threadPriority = Thread.MAX_PRIORITY;
|
||||||
public int threadCount = 16;
|
public int threadCount = 16;
|
||||||
public boolean debugMode = false;
|
public boolean debugMode = true;
|
||||||
public int decorationAccuracy = 1;
|
public int decorationAccuracy = 1;
|
||||||
public boolean noObjectFail = false;
|
public boolean noObjectFail = false;
|
||||||
public boolean verbose = false;
|
public boolean verbose = false;
|
||||||
@ -26,7 +26,7 @@ public class Settings
|
|||||||
public static class GeneratorSettings
|
public static class GeneratorSettings
|
||||||
{
|
{
|
||||||
public InterpolationMode interpolationMode = InterpolationMode.BILINEAR;
|
public InterpolationMode interpolationMode = InterpolationMode.BILINEAR;
|
||||||
public int interpolationRadius = 64;
|
public int interpolationRadius = 32;
|
||||||
public int blockSmoothing = 1;
|
public int blockSmoothing = 1;
|
||||||
public double objectDensity = 1D;
|
public double objectDensity = 1D;
|
||||||
public double horizontalZoom = 2;
|
public double horizontalZoom = 2;
|
||||||
@ -43,7 +43,7 @@ public class Settings
|
|||||||
public double heightScale = 0.56;
|
public double heightScale = 0.56;
|
||||||
public double baseHeight = 0.065;
|
public double baseHeight = 0.065;
|
||||||
public int seaLevel = 63;
|
public int seaLevel = 63;
|
||||||
public double biomeScale = 0.75;
|
public double biomeScale = 1;
|
||||||
public boolean flatBedrock = false;
|
public boolean flatBedrock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
|||||||
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
||||||
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||||
import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
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.GenLayerCaves;
|
||||||
import ninja.bytecode.iris.generator.layer.GenLayerCliffs;
|
import ninja.bytecode.iris.generator.layer.GenLayerCliffs;
|
||||||
import ninja.bytecode.iris.generator.layer.GenLayerLayeredNoise;
|
import ninja.bytecode.iris.generator.layer.GenLayerLayeredNoise;
|
||||||
@ -75,6 +76,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
|||||||
private GenLayerSnow glSnow;
|
private GenLayerSnow glSnow;
|
||||||
private GenLayerCliffs glCliffs;
|
private GenLayerCliffs glCliffs;
|
||||||
private GenLayerCaves glCaves;
|
private GenLayerCaves glCaves;
|
||||||
|
private GenLayerCarving glCarving;
|
||||||
private GenLayerOres glOres;
|
private GenLayerOres glOres;
|
||||||
private RNG rTerrain;
|
private RNG rTerrain;
|
||||||
private CompiledDimension dim;
|
private CompiledDimension dim;
|
||||||
@ -133,7 +135,8 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
|||||||
glSnow = new GenLayerSnow(this, world, random, rTerrain.nextParallelRNG(5));
|
glSnow = new GenLayerSnow(this, world, random, rTerrain.nextParallelRNG(5));
|
||||||
glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9));
|
glCliffs = new GenLayerCliffs(this, world, random, rTerrain.nextParallelRNG(9));
|
||||||
glCaves = new GenLayerCaves(this, world, random, rTerrain.nextParallelRNG(10));
|
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);
|
scatter = new CNG(rTerrain.nextParallelRNG(52), 1, 1).scale(10);
|
||||||
|
|
||||||
if(Iris.settings.performance.objectMode.equals(ObjectMode.PARALLAX))
|
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++)
|
for(int i = surfaceOnly ? max > seaLevel ? max - 2 : height - 2 : 0; i < max; i++)
|
||||||
{
|
{
|
||||||
MB mb = ROCK.get(scatterInt(wzx, i, wxx, ROCK.size()));
|
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 underwater = i >= height && i < seaLevel;
|
||||||
boolean underground = i < height;
|
boolean underground = i < height;
|
||||||
int dheight = biome.getDirtDepth();
|
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 dirt = (height - 1) - i < (dheight > 0 ? scatterInt(x, i, z, 4) : 0) + dheight;
|
||||||
boolean rocky = i > height - rheight && !dirt;
|
boolean rocky = i > height - rheight && !dirt;
|
||||||
boolean bedrock = i == 0 || !Iris.settings.gen.flatBedrock ? i <= 2 : i < scatterInt(x, i, z, 3);
|
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);
|
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)
|
public void genCaves(double wxxf, double wzxf, int x, int z, AtomicChunkData data, ChunkPlan plan)
|
||||||
{
|
{
|
||||||
|
if(true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PrecisionStopwatch s = PrecisionStopwatch.start();
|
PrecisionStopwatch s = PrecisionStopwatch.start();
|
||||||
double itr = 2;
|
double itr = 2;
|
||||||
double level = 8;
|
double level = 8;
|
||||||
|
@ -27,7 +27,7 @@ public class IrisInterpolation
|
|||||||
|
|
||||||
public static double sinCenter(double f)
|
public static double sinCenter(double f)
|
||||||
{
|
{
|
||||||
return (M.sin((float) ((f * Math.PI * 2D) + 4.745555D)) + 1D) / 2D;
|
return Math.sin(f * Math.PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double lerpCenterSinBezier(double a, double b, double f)
|
public static double lerpCenterSinBezier(double a, double b, double f)
|
||||||
@ -35,6 +35,11 @@ public class IrisInterpolation
|
|||||||
return lerpBezier(a, b, sinCenter(f));
|
return lerpBezier(a, b, sinCenter(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double lerpCenterSin(double a, double b, double f)
|
||||||
|
{
|
||||||
|
return lerpBezier(a, b, sinCenter(f));
|
||||||
|
}
|
||||||
|
|
||||||
public static double lerpParametric(double a, double b, double f, double v)
|
public static double lerpParametric(double a, double b, double f, double v)
|
||||||
{
|
{
|
||||||
return a + (parametric(f, v) * (b - a));
|
return a + (parametric(f, v) * (b - a));
|
||||||
|
@ -48,14 +48,12 @@ public class IrisWorldData
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
L.i("Load: " + F.f(getLoadedChunks().size()) + " Chunks in " + F.f(getLoadedRegions().size()) + " Regions");
|
|
||||||
|
|
||||||
for(SMCAVector i : getLoadedChunks())
|
for(SMCAVector i : getLoadedChunks())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AtomicChunkData d = getChunk(i.getX(), i.getZ());
|
AtomicChunkData d = getChunk(i.getX(), i.getZ());
|
||||||
if(d.getTimeSinceLastUse() > 10000)
|
if(d.getTimeSinceLastUse() > 15000)
|
||||||
{
|
{
|
||||||
unloadChunk(i.getX(), i.getZ(), true);
|
unloadChunk(i.getX(), i.getZ(), true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user