mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Ores
This commit is contained in:
parent
30ffc8cd11
commit
7cc6dd03ff
@ -94,12 +94,12 @@ public class Iris extends MortarPlugin
|
|||||||
r.setPhysicsThrottle(5);
|
r.setPhysicsThrottle(5);
|
||||||
r.setMonsterActivationRange(5);
|
r.setMonsterActivationRange(5);
|
||||||
r.setArrowDespawnRate(1);
|
r.setArrowDespawnRate(1);
|
||||||
r.setForcedGameMode(GameMode.CREATIVE);
|
|
||||||
r.load();
|
r.load();
|
||||||
|
|
||||||
for(Player i : Bukkit.getOnlinePlayers())
|
for(Player i : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
i.teleport(r.getSpawn());
|
i.teleport(r.getSpawn());
|
||||||
|
i.setGameMode(GameMode.CREATIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ public class Settings
|
|||||||
{
|
{
|
||||||
public PerformanceSettings performance = new PerformanceSettings();
|
public PerformanceSettings performance = new PerformanceSettings();
|
||||||
public GeneratorSettings gen = new GeneratorSettings();
|
public GeneratorSettings gen = new GeneratorSettings();
|
||||||
|
public OreSettings ore = new OreSettings();
|
||||||
|
|
||||||
public static class PerformanceSettings
|
public static class PerformanceSettings
|
||||||
{
|
{
|
||||||
@ -45,4 +46,42 @@ public class Settings
|
|||||||
public double biomeScale = 0.75;
|
public double biomeScale = 0.75;
|
||||||
public boolean flatBedrock = false;
|
public boolean flatBedrock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class OreSettings
|
||||||
|
{
|
||||||
|
public int ironMinHeight = 5;
|
||||||
|
public int ironMaxHeight = 65;
|
||||||
|
public double ironMaxDispersion = 0.02;
|
||||||
|
public double ironMinDispersion = 0.26;
|
||||||
|
|
||||||
|
public int coalMinHeight = 5;
|
||||||
|
public int coalMaxHeight = 100;
|
||||||
|
public double coalMaxDispersion = 0.02;
|
||||||
|
public double coalMinDispersion = 0.29;
|
||||||
|
|
||||||
|
public int goldMinHeight = 5;
|
||||||
|
public int goldMaxHeight = 34;
|
||||||
|
public double goldMaxDispersion = 0.01;
|
||||||
|
public double goldMinDispersion = 0.13;
|
||||||
|
|
||||||
|
public int redstoneMinHeight = 5;
|
||||||
|
public int redstoneMaxHeight = 15;
|
||||||
|
public double redstoneMaxDispersion = 0.05;
|
||||||
|
public double redstoneMinDispersion = 0.17;
|
||||||
|
|
||||||
|
public int lapisMinHeight = 13;
|
||||||
|
public int lapisMaxHeight = 33;
|
||||||
|
public double lapisMaxDispersion = 0.05;
|
||||||
|
public double lapisMinDispersion = 0.12;
|
||||||
|
|
||||||
|
public int diamondMinHeight = 5;
|
||||||
|
public int diamondMaxHeight = 16;
|
||||||
|
public double diamondMaxDispersion = 0.05;
|
||||||
|
public double diamondMinDispersion = 0.1;
|
||||||
|
|
||||||
|
public int emeraldMinHeight = 5;
|
||||||
|
public int emeraldMaxHeight = 16;
|
||||||
|
public double emeraldMaxDispersion = 0.005;
|
||||||
|
public double emeraldMinDispersion = 0.07;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
|||||||
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;
|
||||||
|
import ninja.bytecode.iris.generator.layer.GenLayerOres;
|
||||||
import ninja.bytecode.iris.generator.layer.GenLayerSnow;
|
import ninja.bytecode.iris.generator.layer.GenLayerSnow;
|
||||||
import ninja.bytecode.iris.generator.parallax.ParallaxWorldGenerator;
|
import ninja.bytecode.iris.generator.parallax.ParallaxWorldGenerator;
|
||||||
import ninja.bytecode.iris.pack.BiomeType;
|
import ninja.bytecode.iris.pack.BiomeType;
|
||||||
@ -74,6 +75,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 GenLayerOres glOres;
|
||||||
private RNG rTerrain;
|
private RNG rTerrain;
|
||||||
private CompiledDimension dim;
|
private CompiledDimension dim;
|
||||||
private IrisMetrics metrics = new IrisMetrics(0, 512);
|
private IrisMetrics metrics = new IrisMetrics(0, 512);
|
||||||
@ -130,6 +132,7 @@ 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));
|
||||||
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))
|
||||||
@ -390,6 +393,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
|||||||
if(!surfaceOnly)
|
if(!surfaceOnly)
|
||||||
{
|
{
|
||||||
glCaves.genCaves(wxxf, wzxf, x, z, data, plan);
|
glCaves.genCaves(wxxf, wzxf, x, z, data, plan);
|
||||||
|
glOres.genOres(wxxf, wzxf, x, z, hl, data, plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
plan.setRealHeight(x, z, hl);
|
plan.setRealHeight(x, z, hl);
|
||||||
|
@ -25,9 +25,9 @@ public class GenLayerCaves extends GenLayer
|
|||||||
{
|
{
|
||||||
//@builder
|
//@builder
|
||||||
super(iris, world, random, rng);
|
super(iris, world, random, rng);
|
||||||
g = new PolygonGenerator(RNG.r, 3, 0.014, 1, (c) -> c);
|
g = new PolygonGenerator(rng.nextParallelRNG(1111), 3, 0.014, 1, (c) -> c);
|
||||||
gincline = new CNG(RNG.r, 1D, 3).scale(0.00652);
|
gincline = new CNG(rng.nextParallelRNG(1112), 1D, 3).scale(0.00652);
|
||||||
gfract = new CNG(RNG.r, 24D, 1).scale(0.0152);
|
gfract = new CNG(rng.nextParallelRNG(1113), 24D, 1).scale(0.0152);
|
||||||
//@done
|
//@done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ public class GenLayerCaves extends GenLayer
|
|||||||
|
|
||||||
public boolean cann(Material m)
|
public boolean cann(Material m)
|
||||||
{
|
{
|
||||||
return m.isSolid() || m.equals(Material.AIR);
|
return m.isSolid() || m.equals(Material.AIR) && !m.equals(Material.BEDROCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean can(Material m)
|
public boolean can(Material m)
|
||||||
{
|
{
|
||||||
return m.isSolid();
|
return m.isSolid() && !m.equals(Material.BEDROCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,145 @@
|
|||||||
|
package ninja.bytecode.iris.generator.layer;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
import ninja.bytecode.iris.Settings.OreSettings;
|
||||||
|
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.bench.PrecisionStopwatch;
|
||||||
|
import ninja.bytecode.shuriken.math.CNG;
|
||||||
|
import ninja.bytecode.shuriken.math.M;
|
||||||
|
import ninja.bytecode.shuriken.math.RNG;
|
||||||
|
|
||||||
|
public class GenLayerOres extends GenLayer
|
||||||
|
{
|
||||||
|
private CNG ore;
|
||||||
|
|
||||||
|
public GenLayerOres(IrisGenerator iris, World world, Random random, RNG rng)
|
||||||
|
{
|
||||||
|
//@builder
|
||||||
|
super(iris, world, random, rng);
|
||||||
|
ore = new CNG(rng.nextParallelRNG(12944), 1D, 1).scale(0.1);
|
||||||
|
//@done
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double generateLayer(double gnoise, double dx, double dz)
|
||||||
|
{
|
||||||
|
return gnoise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void genOres(double xxf, double zzf, int x, int z, int h, AtomicChunkData data, ChunkPlan plan)
|
||||||
|
{
|
||||||
|
PrecisionStopwatch s = PrecisionStopwatch.start();
|
||||||
|
OreSettings o = Iris.settings.ore;
|
||||||
|
|
||||||
|
for(int i = 0; i < h; i++)
|
||||||
|
{
|
||||||
|
if(i >= o.ironMinHeight && i <= o.ironMaxHeight &&
|
||||||
|
ore.noise(xxf + 64, i, zzf - 64) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.ironMinDispersion,
|
||||||
|
Iris.settings.ore.ironMaxDispersion,
|
||||||
|
M.lerpInverse(o.ironMinHeight, o.ironMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.setBlock(x, i, z, Material.IRON_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.coalMinHeight && i <= o.coalMaxHeight &&
|
||||||
|
ore.noise(xxf + 128, i, zzf - 128) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.coalMinDispersion,
|
||||||
|
Iris.settings.ore.coalMaxDispersion,
|
||||||
|
M.lerpInverse(o.coalMinHeight, o.coalMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.COAL_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.goldMinHeight && i <= o.goldMaxHeight &&
|
||||||
|
ore.noise(xxf + 64, i, zzf - 128) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.goldMinDispersion,
|
||||||
|
Iris.settings.ore.goldMaxDispersion,
|
||||||
|
M.lerpInverse(o.goldMinHeight, o.goldMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.GOLD_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.redstoneMinHeight && i <= o.redstoneMaxHeight &&
|
||||||
|
ore.noise(xxf + 128, i, zzf - 64) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.redstoneMinDispersion,
|
||||||
|
Iris.settings.ore.redstoneMaxDispersion,
|
||||||
|
M.lerpInverse(o.redstoneMinHeight, o.redstoneMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.REDSTONE_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.lapisMinHeight && i <= o.lapisMaxHeight &&
|
||||||
|
ore.noise(xxf + 256, i, zzf - 64) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.lapisMinDispersion,
|
||||||
|
Iris.settings.ore.lapisMaxDispersion,
|
||||||
|
M.lerpInverse(o.lapisMinHeight, o.lapisMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.LAPIS_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.diamondMinHeight && i <= o.diamondMaxHeight &&
|
||||||
|
ore.noise(xxf + 64, i, zzf - 256) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.diamondMinDispersion,
|
||||||
|
Iris.settings.ore.diamondMaxDispersion,
|
||||||
|
M.lerpInverse(o.diamondMinHeight, o.diamondMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.DIAMOND_ORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i >= o.emeraldMinHeight && i <= o.emeraldMaxHeight &&
|
||||||
|
ore.noise(xxf + 128, i, zzf - 256) < IrisInterpolation.lerpCenterSinBezier(
|
||||||
|
o.emeraldMinDispersion,
|
||||||
|
Iris.settings.ore.emeraldMaxDispersion,
|
||||||
|
M.lerpInverse(o.emeraldMinHeight, o.emeraldMaxHeight, i)))
|
||||||
|
{
|
||||||
|
if(!can(data.getType(x, i, z)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.setBlock(x, i, z, Material.EMERALD_ORE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iris.getMetrics().stop("ores:ms:x256:/chunk:..", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean can(Material m)
|
||||||
|
{
|
||||||
|
return m.equals(Material.STONE) || m.name().endsWith("_ORE");
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,16 @@ public class IrisInterpolation
|
|||||||
return a + (bezier(f) * (b - a));
|
return a + (bezier(f) * (b - a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double sinCenter(double f)
|
||||||
|
{
|
||||||
|
return (M.sin((float) ((f * Math.PI * 2D) + 4.745555D)) + 1D) / 2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double lerpCenterSinBezier(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));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user