mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Fixes?
This commit is contained in:
parent
3b90a58418
commit
75d9bf458a
@ -9,11 +9,11 @@ public class Settings
|
|||||||
|
|
||||||
public static class PerformanceSettings
|
public static class PerformanceSettings
|
||||||
{
|
{
|
||||||
public PerformanceMode performanceMode = PerformanceMode.MATCH_CPU;
|
public PerformanceMode performanceMode = PerformanceMode.UNLIMITED;
|
||||||
public boolean fastDecoration = true;
|
public boolean fastDecoration = true;
|
||||||
public int threadPriority = Thread.MIN_PRIORITY;
|
public int threadPriority = Thread.MAX_PRIORITY;
|
||||||
public int compilerPriority = Thread.MIN_PRIORITY;
|
public int compilerPriority = Thread.MAX_PRIORITY;
|
||||||
public int threadCount = 1;
|
public int threadCount = 4;
|
||||||
public boolean debugMode = true;
|
public boolean debugMode = true;
|
||||||
public int compilerThreads = 12;
|
public int compilerThreads = 12;
|
||||||
public int decorationAccuracy = 1;
|
public int decorationAccuracy = 1;
|
||||||
@ -39,7 +39,7 @@ public class Settings
|
|||||||
public int seaLevel = 63;
|
public int seaLevel = 63;
|
||||||
public double caveDensity = 4;
|
public double caveDensity = 4;
|
||||||
public double caveScale = 1.45;
|
public double caveScale = 1.45;
|
||||||
public double biomeScale = 2;
|
public double biomeScale = 2.5;
|
||||||
public boolean flatBedrock = true;
|
public boolean flatBedrock = true;
|
||||||
public boolean genObjects = true;
|
public boolean genObjects = true;
|
||||||
public boolean genCarving = true;
|
public boolean genCarving = true;
|
||||||
|
@ -2,7 +2,6 @@ package ninja.bytecode.iris.generator;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -62,6 +61,8 @@ public class IrisGenerator extends ParallelChunkGenerator
|
|||||||
private CNG scatter;
|
private CNG scatter;
|
||||||
public GMap<String, IrisBiome> biomeCache = new GMap<>();
|
public GMap<String, IrisBiome> biomeCache = new GMap<>();
|
||||||
private MB WATER = new MB(Material.STATIONARY_WATER);
|
private MB WATER = new MB(Material.STATIONARY_WATER);
|
||||||
|
private MB ICE = new MB(Material.ICE);
|
||||||
|
private MB PACKED_ICE = new MB(Material.PACKED_ICE);
|
||||||
private MB BEDROCK = new MB(Material.BEDROCK);
|
private MB BEDROCK = new MB(Material.BEDROCK);
|
||||||
private GList<IrisBiome> internal;
|
private GList<IrisBiome> internal;
|
||||||
private GenLayerLayeredNoise glLNoise;
|
private GenLayerLayeredNoise glLNoise;
|
||||||
@ -190,6 +191,15 @@ public class IrisGenerator extends ParallelChunkGenerator
|
|||||||
|
|
||||||
public IrisBiome getOcean(IrisBiome biome, int height)
|
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)
|
if(height < 36)
|
||||||
{
|
{
|
||||||
return biome("Deep Ocean");
|
return biome("Deep Ocean");
|
||||||
@ -237,6 +247,11 @@ public class IrisGenerator extends ParallelChunkGenerator
|
|||||||
return hv;
|
return hv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IrisRegion getRegion(IrisBiome biome)
|
||||||
|
{
|
||||||
|
return glBiome.getRegion(biome.getRegion());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome genColumn(int wxx, int wzx, int x, int z, ChunkPlan plan)
|
public Biome genColumn(int wxx, int wzx, int x, int z, ChunkPlan plan)
|
||||||
{
|
{
|
||||||
@ -245,22 +260,28 @@ public class IrisGenerator extends ParallelChunkGenerator
|
|||||||
double wx = getOffsetX(wxx);
|
double wx = getOffsetX(wxx);
|
||||||
double wz = getOffsetZ(wzx);
|
double wz = getOffsetZ(wzx);
|
||||||
IrisBiome biome = getBiome(wxx, wzx);
|
IrisBiome biome = getBiome(wxx, wzx);
|
||||||
|
boolean frozen = getRegion(biome) != null ? getRegion(biome).isFrozen() : false;
|
||||||
int height = computeHeight(wxx, wzx, plan, biome);
|
int height = computeHeight(wxx, wzx, plan, biome);
|
||||||
int max = Math.max(height, seaLevel);
|
int max = Math.max(height, seaLevel);
|
||||||
biome = height > 61 && height < 65 ? getBeach(biome) : biome;
|
IrisBiome nbiome = height < 63 ? getOcean(biome, height) : biome;
|
||||||
biome = height < 63 ? getOcean(biome, height) : biome;
|
biome = nbiome;
|
||||||
|
biome = height > 61 && height < 65 ? frozen ? biome : getBeach(biome) : biome;
|
||||||
|
|
||||||
for(int i = 0; i < max; i++)
|
for(int i = 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 underwater = i >= height && i < seaLevel;
|
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;
|
boolean underground = i < height;
|
||||||
int dheight = biome.getDirtDepth();
|
int dheight = biome.getDirtDepth();
|
||||||
int rheight = biome.getRockDepth();
|
int rheight = biome.getRockDepth();
|
||||||
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 ? WATER : mb;
|
mb = underwater ? frozen ? PACKED_ICE : WATER : mb;
|
||||||
|
mb = someunderwater ? frozen ? ICE : WATER : mb;
|
||||||
|
mb = wayunderwater ? WATER : mb;
|
||||||
mb = underground && dirt ? biome.getSubSurface(wxx, i, wzx, rTerrain) : mb;
|
mb = underground && dirt ? biome.getSubSurface(wxx, i, wzx, rTerrain) : mb;
|
||||||
mb = underground && rocky ? biome.getRock(wxx, i, wzx, rTerrain) : mb;
|
mb = underground && rocky ? biome.getRock(wxx, i, wzx, rTerrain) : mb;
|
||||||
mb = bedrock ? BEDROCK : mb;
|
mb = bedrock ? BEDROCK : mb;
|
||||||
|
@ -10,7 +10,7 @@ import ninja.bytecode.iris.generator.IrisGenerator;
|
|||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
import ninja.bytecode.iris.pack.IrisRegion;
|
import ninja.bytecode.iris.pack.IrisRegion;
|
||||||
import ninja.bytecode.iris.util.GenLayer;
|
import ninja.bytecode.iris.util.GenLayer;
|
||||||
import ninja.bytecode.iris.util.MaxingGenerator.EnumMaxingGenerator;
|
import ninja.bytecode.iris.util.PolygonGenerator.EnumPolygonGenerator;
|
||||||
import ninja.bytecode.shuriken.collections.GList;
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
import ninja.bytecode.shuriken.collections.GMap;
|
import ninja.bytecode.shuriken.collections.GMap;
|
||||||
import ninja.bytecode.shuriken.math.CNG;
|
import ninja.bytecode.shuriken.math.CNG;
|
||||||
@ -19,7 +19,7 @@ import ninja.bytecode.shuriken.math.RNG;
|
|||||||
|
|
||||||
public class GenLayerBiome extends GenLayer
|
public class GenLayerBiome extends GenLayer
|
||||||
{
|
{
|
||||||
private EnumMaxingGenerator<IrisRegion> regionGenerator;
|
private EnumPolygonGenerator<IrisRegion> regionGenerator;
|
||||||
private GMap<String, IrisRegion> regions;
|
private GMap<String, IrisRegion> regions;
|
||||||
private Function<CNG, CNG> factory;
|
private Function<CNG, CNG> factory;
|
||||||
private CNG fracture;
|
private CNG fracture;
|
||||||
@ -54,16 +54,16 @@ public class GenLayerBiome extends GenLayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
int v = 85034;
|
int v = 85034;
|
||||||
regionGenerator = new EnumMaxingGenerator<IrisRegion>(rng.nextParallelRNG(v), 0.00522 * Iris.settings.gen.biomeScale * 0.189, 1, regions.v().toArray(new IrisRegion[regions.v().size()]), factory);
|
regionGenerator = new EnumPolygonGenerator<IrisRegion>(rng.nextParallelRNG(v), 0.00522 * Iris.settings.gen.biomeScale * 0.189, 1, regions.v().toArray(new IrisRegion[regions.v().size()]), factory);
|
||||||
|
|
||||||
for(IrisRegion i : regions.v())
|
for(IrisRegion i : regions.v())
|
||||||
{
|
{
|
||||||
v += 13 - i.getName().length();
|
v += 13 - i.getName().length();
|
||||||
i.setGen(new EnumMaxingGenerator<IrisBiome>(rng.nextParallelRNG(33 + v), 0.000255 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory));
|
i.setGen(new EnumPolygonGenerator<IrisBiome>(rng.nextParallelRNG(33 + v), 0.000255 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumMaxingGenerator<IrisBiome> getRegionGenerator(double xx, double zz)
|
public EnumPolygonGenerator<IrisBiome> getRegionGenerator(double xx, double zz)
|
||||||
{
|
{
|
||||||
return regionGenerator.getChoice(xx, zz).getGen();
|
return regionGenerator.getChoice(xx, zz).getGen();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.World;
|
|||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
import ninja.bytecode.iris.util.GenLayer;
|
import ninja.bytecode.iris.util.GenLayer;
|
||||||
import ninja.bytecode.iris.util.MaxingGenerator;
|
import ninja.bytecode.iris.util.PolygonGenerator;
|
||||||
import ninja.bytecode.shuriken.math.CNG;
|
import ninja.bytecode.shuriken.math.CNG;
|
||||||
import ninja.bytecode.shuriken.math.RNG;
|
import ninja.bytecode.shuriken.math.RNG;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class GenLayerCaves extends GenLayer
|
|||||||
private CNG caveHeight;
|
private CNG caveHeight;
|
||||||
private CNG caveGirth;
|
private CNG caveGirth;
|
||||||
private CNG caveClamp;
|
private CNG caveClamp;
|
||||||
private MaxingGenerator caveVeins;
|
private PolygonGenerator caveVeins;
|
||||||
|
|
||||||
public GenLayerCaves(IrisGenerator iris, World world, Random random, RNG rng)
|
public GenLayerCaves(IrisGenerator iris, World world, Random random, RNG rng)
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ public class GenLayerCaves extends GenLayer
|
|||||||
caveHeight = new CNG(rng.nextParallelRNG(-100001), 1D, 3).scale(0.00222);
|
caveHeight = new CNG(rng.nextParallelRNG(-100001), 1D, 3).scale(0.00222);
|
||||||
caveGirth = new CNG(rng.nextParallelRNG(-100002), 1D, 3).scale(0.03);
|
caveGirth = new CNG(rng.nextParallelRNG(-100002), 1D, 3).scale(0.03);
|
||||||
caveClamp = new CNG(rng.nextParallelRNG(-10000), 1D, 3).scale(0.1422);
|
caveClamp = new CNG(rng.nextParallelRNG(-10000), 1D, 3).scale(0.1422);
|
||||||
caveVeins = new MaxingGenerator(rng.nextParallelRNG(-99999), 4, 0.002 * Iris.settings.gen.caveScale, 1, (g) -> g.fractureWith(new CNG(rng.nextParallelRNG(-5555), 1D, 4).scale(0.02), 70));
|
caveVeins = new PolygonGenerator(rng.nextParallelRNG(-99999), 4, 0.002 * Iris.settings.gen.caveScale, 1, (g) -> g.fractureWith(new CNG(rng.nextParallelRNG(-5555), 1D, 4).scale(0.02), 70));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g)
|
public void genCaves(double wxx, double wzx, int x, int z, int s, IrisGenerator g)
|
||||||
|
@ -26,12 +26,17 @@ public class IrisBiome
|
|||||||
|
|
||||||
//@builder
|
//@builder
|
||||||
private static final IrisBiome OCEAN = new IrisBiome("Ocean", Biome.OCEAN)
|
private static final IrisBiome OCEAN = new IrisBiome("Ocean", Biome.OCEAN)
|
||||||
.height(-0.5)
|
.height(-0.2)
|
||||||
|
.coreBiome()
|
||||||
|
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
|
||||||
|
.simplexSurface();
|
||||||
|
private static final IrisBiome FROZEN_OCEAN = new IrisBiome("Frozen Ocean", Biome.FROZEN_OCEAN)
|
||||||
|
.height(-0.16)
|
||||||
.coreBiome()
|
.coreBiome()
|
||||||
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
|
.surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
|
||||||
.simplexSurface();
|
.simplexSurface();
|
||||||
private static final IrisBiome DEEP_OCEAN = new IrisBiome("Deep Ocean", Biome.DEEP_OCEAN)
|
private static final IrisBiome DEEP_OCEAN = new IrisBiome("Deep Ocean", Biome.DEEP_OCEAN)
|
||||||
.height(-0.88)
|
.height(-0.4)
|
||||||
.coreBiome()
|
.coreBiome()
|
||||||
.surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
|
.surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL))
|
||||||
.simplexSurface();
|
.simplexSurface();
|
||||||
|
@ -2,7 +2,7 @@ package ninja.bytecode.iris.pack;
|
|||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
import ninja.bytecode.iris.controller.PackController;
|
||||||
import ninja.bytecode.iris.util.MaxingGenerator.EnumMaxingGenerator;
|
import ninja.bytecode.iris.util.PolygonGenerator.EnumPolygonGenerator;
|
||||||
import ninja.bytecode.shuriken.collections.GList;
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
import ninja.bytecode.shuriken.json.JSONObject;
|
import ninja.bytecode.shuriken.json.JSONObject;
|
||||||
@ -11,12 +11,14 @@ public class IrisRegion
|
|||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private GList<IrisBiome> biomes;
|
private GList<IrisBiome> biomes;
|
||||||
private EnumMaxingGenerator<IrisBiome> gen;
|
private EnumPolygonGenerator<IrisBiome> gen;
|
||||||
private double rarity;
|
private double rarity;
|
||||||
|
private boolean frozen;
|
||||||
private IrisBiome beach;
|
private IrisBiome beach;
|
||||||
|
|
||||||
public IrisRegion(String name)
|
public IrisRegion(String name)
|
||||||
{
|
{
|
||||||
|
frozen = false;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.biomes = new GList<>();
|
this.biomes = new GList<>();
|
||||||
rarity = 1;
|
rarity = 1;
|
||||||
@ -28,18 +30,19 @@ public class IrisRegion
|
|||||||
J.attempt(() ->
|
J.attempt(() ->
|
||||||
{
|
{
|
||||||
JSONObject o = Iris.getController(PackController.class).loadJSON("pack/regions/" + name + ".json");
|
JSONObject o = Iris.getController(PackController.class).loadJSON("pack/regions/" + name + ".json");
|
||||||
|
J.attempt(() -> frozen = o.getBoolean("frozen"));
|
||||||
J.attempt(() -> name = o.getString("name"));
|
J.attempt(() -> name = o.getString("name"));
|
||||||
J.attempt(() -> rarity = o.getDouble("rarity"));
|
J.attempt(() -> rarity = o.getDouble("rarity"));
|
||||||
J.attempt(() -> beach = Iris.getController(PackController.class).getBiomeById(o.getString("beach")));
|
J.attempt(() -> beach = Iris.getController(PackController.class).getBiomeById(o.getString("beach")));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumMaxingGenerator<IrisBiome> getGen()
|
public EnumPolygonGenerator<IrisBiome> getGen()
|
||||||
{
|
{
|
||||||
return gen;
|
return gen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGen(EnumMaxingGenerator<IrisBiome> gen)
|
public void setGen(EnumPolygonGenerator<IrisBiome> gen)
|
||||||
{
|
{
|
||||||
this.gen = gen;
|
this.gen = gen;
|
||||||
}
|
}
|
||||||
@ -141,4 +144,9 @@ public class IrisRegion
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFrozen()
|
||||||
|
{
|
||||||
|
return frozen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
package ninja.bytecode.iris.util;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import ninja.bytecode.shuriken.math.CNG;
|
|
||||||
import ninja.bytecode.shuriken.math.RNG;
|
|
||||||
|
|
||||||
public class MaxingGenerator
|
|
||||||
{
|
|
||||||
private CNG[] gen;
|
|
||||||
private int possibilities;
|
|
||||||
|
|
||||||
public MaxingGenerator(RNG rng, int possibilities, double scale, int octaves, Function<CNG, CNG> factory)
|
|
||||||
{
|
|
||||||
this.possibilities = possibilities;
|
|
||||||
gen = new CNG[possibilities];
|
|
||||||
|
|
||||||
for(int i = 0; i < possibilities; i++)
|
|
||||||
{
|
|
||||||
gen[i] = new CNG(rng.nextParallelRNG((i * 15000) + 11285), 1D, 1).scale(scale);
|
|
||||||
gen[i] = factory.apply(gen[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getEdge(double... dim)
|
|
||||||
{
|
|
||||||
double b = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < gen.length; i++)
|
|
||||||
{
|
|
||||||
double g = Math.pow(gen[i].noise(dim), gen.length);
|
|
||||||
|
|
||||||
if(g > b)
|
|
||||||
{
|
|
||||||
b = g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndex(double... dim)
|
|
||||||
{
|
|
||||||
double b = 0;
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < gen.length; i++)
|
|
||||||
{
|
|
||||||
double g = Math.pow(gen[i].noise(dim), gen.length);
|
|
||||||
|
|
||||||
if(g > b)
|
|
||||||
{
|
|
||||||
b = g;
|
|
||||||
index = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return index % possibilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasBorder(int checks, double distance, double... dims)
|
|
||||||
{
|
|
||||||
int current = getIndex(dims);
|
|
||||||
double ajump = 360D / (double) checks;
|
|
||||||
|
|
||||||
if(dims.length == 2)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < checks; i++)
|
|
||||||
{
|
|
||||||
double dx = Math.sin(Math.toRadians(ajump * i));
|
|
||||||
double dz = Math.cos(Math.toRadians(ajump * i));
|
|
||||||
if(current != getIndex((dx * distance) + dims[0], (dz * distance) + dims[1]))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dims.length == 3)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < checks; i++)
|
|
||||||
{
|
|
||||||
double dx = Math.sin(Math.toRadians(ajump * i));
|
|
||||||
double dz = Math.cos(Math.toRadians(ajump * i));
|
|
||||||
double dy = Math.tan(Math.toRadians(ajump * i));
|
|
||||||
if(current != getIndex((dx * distance) + dims[0], (dz * distance) + dims[1], (dy * distance) + dims[2]))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class EnumMaxingGenerator<T> extends MaxingGenerator
|
|
||||||
{
|
|
||||||
private T[] choices;
|
|
||||||
|
|
||||||
public EnumMaxingGenerator(RNG rng, double scale, int octaves, T[] choices, Function<CNG, CNG> factory)
|
|
||||||
{
|
|
||||||
super(rng, choices.length, scale / (double) choices.length, octaves, factory);
|
|
||||||
|
|
||||||
if(choices.length == 0)
|
|
||||||
{
|
|
||||||
throw new RuntimeException("Must contain more than 0 choices!");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.choices = choices;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getChoice(double... dim)
|
|
||||||
{
|
|
||||||
if(choices.length == 1)
|
|
||||||
{
|
|
||||||
return choices[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return choices[super.getIndex(dim)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package ninja.bytecode.iris.util;
|
||||||
|
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
|
|
||||||
|
public class MulticoreChunkGenerator extends ChunkGenerator
|
||||||
|
{
|
||||||
|
private GList<ParallelChunkGenerator> generators;
|
||||||
|
|
||||||
|
public MulticoreChunkGenerator(int tc)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ import ninja.bytecode.shuriken.execution.ChronoLatch;
|
|||||||
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult;
|
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult;
|
||||||
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
import ninja.bytecode.shuriken.math.RollingSequence;
|
import ninja.bytecode.shuriken.math.RollingSequence;
|
||||||
import ninja.bytecode.shuriken.reaction.O;
|
import ninja.bytecode.shuriken.reaction.O;
|
||||||
|
|
||||||
@ -37,9 +38,9 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateFullColumn(int a, int b, int c, int d, BiomeGrid g, ChunkPlan p)
|
public Biome generateFullColumn(int a, int b, int c, int d, ChunkPlan p)
|
||||||
{
|
{
|
||||||
g.setBiome(c, d, genColumn(a, b, c, d, p));
|
return genColumn(a, b, c, d, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||||
@ -51,6 +52,20 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
{
|
{
|
||||||
genPool = Iris.getController(ExecutionController.class).getExecutor(world);
|
genPool = Iris.getController(ExecutionController.class).getExecutor(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.world != null && world.getSeed() != this.world.getSeed())
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < 16; j++)
|
||||||
|
{
|
||||||
|
data.setBlock(i, 0, j, Material.YELLOW_GLAZED_TERRACOTTA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.toChunkData();
|
||||||
|
}
|
||||||
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
data = new AtomicChunkData(world);
|
data = new AtomicChunkData(world);
|
||||||
if(!ready)
|
if(!ready)
|
||||||
@ -61,6 +76,7 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
|
|
||||||
tg = genPool.startWork();
|
tg = genPool.startWork();
|
||||||
O<ChunkPlan> plan = new O<ChunkPlan>();
|
O<ChunkPlan> plan = new O<ChunkPlan>();
|
||||||
|
|
||||||
for(i = 0; i < 16; i++)
|
for(i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
wx = (x * 16) + i;
|
wx = (x * 16) + i;
|
||||||
@ -72,7 +88,7 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
int b = wz;
|
int b = wz;
|
||||||
int c = i;
|
int c = i;
|
||||||
int d = j;
|
int d = j;
|
||||||
tg.queue(() -> generateFullColumn(a, b, c, d, biome, plan.get()));
|
tg.queue(() -> biome.setBiome(c, d, generateFullColumn(a, b, c, d, plan.get())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,11 +101,8 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
{
|
|
||||||
if(cl.flip())
|
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 16; i++)
|
for(int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ package ninja.bytecode.iris.util;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import ninja.bytecode.shuriken.math.CNG;
|
import ninja.bytecode.shuriken.math.CNG;
|
||||||
|
import ninja.bytecode.shuriken.math.M;
|
||||||
import ninja.bytecode.shuriken.math.RNG;
|
import ninja.bytecode.shuriken.math.RNG;
|
||||||
|
|
||||||
public class PolygonGenerator
|
public class PolygonGenerator
|
||||||
@ -32,6 +33,41 @@ public class PolygonGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasBorder(int checks, double distance, double... dims)
|
||||||
|
{
|
||||||
|
int current = getIndex(dims);
|
||||||
|
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 != getIndex((dx * distance) + dims[0], (dz * distance) + dims[1]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dims.length == 3)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
double dy = Math.tan(Math.toRadians(ajump * i));
|
||||||
|
if(current != getIndex((dx * distance) + dims[0], (dz * distance) + dims[1], (dy * distance) + dims[2]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns 0.0 to 1.0 where 0.0 is directly on the border of another region and 1.0 is perfectly in the center of a region
|
* Returns 0.0 to 1.0 where 0.0 is directly on the border of another region and 1.0 is perfectly in the center of a region
|
||||||
* @param x the x
|
* @param x the x
|
||||||
|
35
src/main/java/ninja/bytecode/iris/util/PrepackagedChunk.java
Normal file
35
src/main/java/ninja/bytecode/iris/util/PrepackagedChunk.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package ninja.bytecode.iris.util;
|
||||||
|
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
public class PrepackagedChunk
|
||||||
|
{
|
||||||
|
private AtomicChunkData data;
|
||||||
|
private Biome[] biome;
|
||||||
|
|
||||||
|
public PrepackagedChunk(AtomicChunkData data, Biome[] biome)
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
this.biome = biome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AtomicChunkData getData()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(AtomicChunkData data)
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Biome[] getBiome()
|
||||||
|
{
|
||||||
|
return biome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBiome(Biome[] biome)
|
||||||
|
{
|
||||||
|
this.biome = biome;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user