mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Fixes
This commit is contained in:
parent
f68c206a17
commit
9f8caff571
@ -1,6 +1,5 @@
|
||||
package ninja.bytecode.iris;
|
||||
|
||||
import ninja.bytecode.iris.util.InterpolationType;
|
||||
import ninja.bytecode.iris.util.PerformanceMode;
|
||||
|
||||
public class Settings
|
||||
@ -30,7 +29,7 @@ public class Settings
|
||||
public double landScale = 0.325;
|
||||
public double landChance = 0.62;
|
||||
public double biomeEdgeScramble = 1550D; // 1550D
|
||||
public double roughness = 1.25;
|
||||
public double roughness = 1.55;
|
||||
public double heightMultiplier = 0.806;
|
||||
public double heightExponentBase = 1;
|
||||
public double heightExponentMultiplier = 1.41;
|
||||
@ -42,10 +41,10 @@ public class Settings
|
||||
public double caveScale = 1.45;
|
||||
public double biomeScale = 2;
|
||||
public boolean flatBedrock = false;
|
||||
public boolean genObjects = false;
|
||||
public boolean genCarving = false;
|
||||
public boolean genCaverns = false;
|
||||
public boolean genCaves = false;
|
||||
public boolean genObjects = true;
|
||||
public boolean genCarving = true;
|
||||
public boolean genCaverns = true;
|
||||
public boolean genCaves = true;
|
||||
public double carvingChance = 0.352;
|
||||
public double cavernChance = 0.321;
|
||||
public int minCarvingHeight = 75;
|
||||
|
@ -267,4 +267,22 @@ public class PackController implements IrisController
|
||||
J.attempt(() -> new File(Iris.instance.getDataFolder(), "dimensions").delete());
|
||||
compiledDimensions.clear();
|
||||
}
|
||||
|
||||
public IrisBiome getBiomeById(String id)
|
||||
{
|
||||
if(!biomes.containsKey(id))
|
||||
{
|
||||
try
|
||||
{
|
||||
biomes.put(id, Iris.getController(PackController.class).loadBiome(id));
|
||||
}
|
||||
|
||||
catch(JSONException | IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return biomes.get(id);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.controller.PackController;
|
||||
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
||||
import ninja.bytecode.iris.generator.genobject.GenObjectGroup;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerBase;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerBiome;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCarving;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerCaverns;
|
||||
@ -21,6 +22,7 @@ import ninja.bytecode.iris.generator.layer.GenLayerLayeredNoise;
|
||||
import ninja.bytecode.iris.generator.layer.GenLayerSnow;
|
||||
import ninja.bytecode.iris.pack.CompiledDimension;
|
||||
import ninja.bytecode.iris.pack.IrisBiome;
|
||||
import ninja.bytecode.iris.pack.IrisRegion;
|
||||
import ninja.bytecode.iris.util.AtomicChunkData;
|
||||
import ninja.bytecode.iris.util.ChunkPlan;
|
||||
import ninja.bytecode.iris.util.IrisInterpolation;
|
||||
@ -66,8 +68,8 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
private GenLayerCarving glCarving;
|
||||
private GenLayerCaverns glCaverns;
|
||||
private GenLayerSnow glSnow;
|
||||
private GenLayerBase glBase;
|
||||
private RNG rTerrain;
|
||||
private CNG lerpf;
|
||||
private CompiledDimension dim;
|
||||
private World world;
|
||||
private GMap<String, GenObjectGroup> schematicCache = new GMap<>();
|
||||
@ -128,6 +130,7 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
{
|
||||
this.world = world;
|
||||
rTerrain = new RNG(world.getSeed() + 1024);
|
||||
glBase = new GenLayerBase(this, world, random, rTerrain.nextParallelRNG(1));
|
||||
glLNoise = new GenLayerLayeredNoise(this, world, random, rTerrain.nextParallelRNG(2));
|
||||
glBiome = new GenLayerBiome(this, world, random, rTerrain.nextParallelRNG(4), dim.getBiomes());
|
||||
glCaves = new GenLayerCaves(this, world, random, rTerrain.nextParallelRNG(-1));
|
||||
@ -183,8 +186,7 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
double hv = IrisInterpolation.getNoise(wxx, wzx,
|
||||
Iris.settings.gen.hermiteSampleRadius,
|
||||
(xf, zf) -> getBiomedHeight((int) Math.round(xf), (int) Math.round(zf), plan));
|
||||
hv += glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, wxx * Iris.settings.gen.roughness * 0.82, wzx * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35)) * 0.725;
|
||||
|
||||
hv += glLNoise.generateLayer(hv * Iris.settings.gen.roughness * 215, wxx * Iris.settings.gen.roughness * 0.82, wzx * Iris.settings.gen.roughness * 0.82) * (1.6918 * (hv * 2.35));
|
||||
int height = (int) Math.round(M.clip(hv, 0D, 1D) * 253);
|
||||
int max = Math.max(height, seaLevel);
|
||||
IrisBiome override = null;
|
||||
@ -192,7 +194,20 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
|
||||
if(height > 61 && height < 65 + (glLNoise.getHeight(wz, wx) * Iris.settings.gen.beachScale))
|
||||
{
|
||||
override = biome("Beach");
|
||||
IrisBiome beach = null;
|
||||
IrisRegion region = glBiome.getRegion(biome.getRegion());
|
||||
|
||||
if(region != null)
|
||||
{
|
||||
beach = region.getBeach();
|
||||
}
|
||||
|
||||
if(beach == null)
|
||||
{
|
||||
beach = biome("Beach");
|
||||
}
|
||||
|
||||
override = beach;
|
||||
}
|
||||
|
||||
else if(height < 63)
|
||||
@ -323,6 +338,7 @@ public class IrisGenerator extends ParallelChunkGenerator
|
||||
int wz = (int) Math.round((double) z * (Iris.settings.gen.horizontalZoom / 1.90476190476));
|
||||
IrisBiome biome = glBiome.getBiome(wx * Iris.settings.gen.biomeScale, wz * Iris.settings.gen.biomeScale);
|
||||
double h = Iris.settings.gen.baseHeight + biome.getHeight();
|
||||
h += (glBase.getHeight(wx, wz) * 0.5) - (0.33 * 0.5);
|
||||
plan.setHeight(x, z, h);
|
||||
return h;
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package ninja.bytecode.iris.generator;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public double horizontalZoom = 0.525; // 0.525
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package ninja.bytecode.iris.generator.layer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.shuriken.math.CNG;
|
||||
import ninja.bytecode.shuriken.math.M;
|
||||
import ninja.bytecode.shuriken.math.RNG;
|
||||
|
||||
public class GenLayerBase extends GenLayer
|
||||
{
|
||||
private CNG gen;
|
||||
private CNG fracture;
|
||||
private CNG hfracture;
|
||||
private CNG height;
|
||||
private CNG superheight;
|
||||
|
||||
public GenLayerBase(IrisGenerator iris, World world, Random random, RNG rng)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
hfracture = new CNG(rng.nextParallelRNG(6), 1, 2)
|
||||
.scale(0.0124);
|
||||
gen = new CNG(rng.nextParallelRNG(7), 0.19D, 7)
|
||||
.scale(0.012)
|
||||
.amp(0.5)
|
||||
.freq(1.1)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(8), 1, 6)
|
||||
.scale(0.018)
|
||||
.injectWith(CNG.MULTIPLY)
|
||||
.child(new CNG(rng.nextParallelRNG(9), 0.745, 2)
|
||||
.scale(0.1)), 44);
|
||||
height = new CNG(rng.nextParallelRNG(10), 1, 8)
|
||||
.scale(0.0017601 * Iris.settings.gen.heightScale)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(11), 1, 6)
|
||||
.scale(0.0174)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(12), 1, 1)
|
||||
.scale(0.0034), 31)
|
||||
.scale(0.066), 58);
|
||||
superheight = new CNG(rng.nextParallelRNG(13), 1, 6)
|
||||
.scale(0.025 * Iris.settings.gen.superHeightScale)
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(14), 1, 1)
|
||||
.scale(0.13), 250);
|
||||
fracture = new CNG(rng.nextParallelRNG(15), 0.6D, 4)
|
||||
.scale(0.118);
|
||||
//@done
|
||||
}
|
||||
|
||||
public double getHeight(double x, double z)
|
||||
{
|
||||
return M.clip(Math.pow(height.noise(x + (hfracture.noise(x, z) * Iris.settings.gen.heightFracture), z + (hfracture.noise(z, x) * Iris.settings.gen.heightFracture)), Iris.settings.gen.heightExponentBase + (superheight.noise(x, z) * Iris.settings.gen.heightExponentMultiplier)) * Iris.settings.gen.heightMultiplier, 0D, 1D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double generateLayer(double gnoise, double dx, double dz)
|
||||
{
|
||||
double noise = gnoise + getHeight(dx, dz);
|
||||
double fnoise = fracture.noise(dx, dz);
|
||||
dx += (fnoise * 44);
|
||||
dz -= (fnoise * 44);
|
||||
return ((noise * 0.185) + (gen.noise(dx, dz) * (0.15 + (noise * 0.65))));
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ package ninja.bytecode.iris.generator.layer;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ninja.bytecode.iris.Iris;
|
||||
@ -11,7 +10,6 @@ import ninja.bytecode.iris.generator.IrisGenerator;
|
||||
import ninja.bytecode.iris.pack.IrisBiome;
|
||||
import ninja.bytecode.iris.pack.IrisRegion;
|
||||
import ninja.bytecode.iris.util.GenLayer;
|
||||
import ninja.bytecode.iris.util.MaxingGenerator;
|
||||
import ninja.bytecode.iris.util.MaxingGenerator.EnumMaxingGenerator;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
import ninja.bytecode.shuriken.collections.GMap;
|
||||
@ -22,27 +20,26 @@ import ninja.bytecode.shuriken.math.RNG;
|
||||
public class GenLayerBiome extends GenLayer
|
||||
{
|
||||
private EnumMaxingGenerator<IrisRegion> regionGenerator;
|
||||
private MaxingGenerator roads;
|
||||
private GMap<String, IrisRegion> regions;
|
||||
private Function<CNG, CNG> factory;
|
||||
private CNG pathCheck;
|
||||
private CNG fracture;
|
||||
private CNG island;
|
||||
|
||||
public GenLayerBiome(IrisGenerator iris, World world, Random random, RNG rng, GList<IrisBiome> biomes)
|
||||
{
|
||||
//@builder
|
||||
super(iris, world, random, rng);
|
||||
island = new CNG(rng.nextParallelRNG(10334), 1D, 3).scale(0.003 * Iris.settings.gen.landScale).fractureWith(new CNG(rng.nextParallelRNG(34), 1D, 12).scale(0.6), 180);
|
||||
fracture = new CNG(rng.nextParallelRNG(28), 1D, 24).scale(0.0021).fractureWith(new CNG(rng.nextParallelRNG(34), 1D, 12).scale(0.01), 12250);
|
||||
factory = (g) -> g.fractureWith(new CNG(rng.nextParallelRNG(29), 1D, 4).scale(0.02), 56);
|
||||
pathCheck = new CNG(rng.nextParallelRNG(31), 1D, 1).scale(0.00096);
|
||||
roads = new MaxingGenerator(rng.nextParallelRNG(32), 5, 0.00055, 8, factory);
|
||||
//@done
|
||||
|
||||
GMap<String, IrisRegion> regions = new GMap<>();
|
||||
regions = new GMap<>();
|
||||
|
||||
for(IrisBiome i : biomes)
|
||||
{
|
||||
if(i.getName().equals("Beach"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!regions.containsKey(i.getRegion()))
|
||||
{
|
||||
regions.put(i.getRegion(), new IrisRegion(i.getRegion()));
|
||||
@ -51,6 +48,11 @@ public class GenLayerBiome extends GenLayer
|
||||
regions.get(i.getRegion()).getBiomes().add(i);
|
||||
}
|
||||
|
||||
for(IrisRegion i : regions.values())
|
||||
{
|
||||
i.load();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -74,29 +76,9 @@ public class GenLayerBiome extends GenLayer
|
||||
double land = island.noise(x, z);
|
||||
double landChance = 1D - M.clip(Iris.settings.gen.landChance, 0D, 1D);
|
||||
|
||||
if(land > landChance && land < landChance + 0.0175)
|
||||
{
|
||||
cbi = iris.biome("Beach");
|
||||
}
|
||||
|
||||
else if(land > landChance + 0.0175)
|
||||
if(land > landChance + 0.0175)
|
||||
{
|
||||
cbi = getRegionGenerator(x, z).getChoice(x, z);
|
||||
|
||||
if(pathCheck.noise(x, z) > 0.33)
|
||||
{
|
||||
IrisBiome road = iris.biome("Beach");
|
||||
|
||||
if(cbi.getSurface().get(0).material.equals(Material.GRASS))
|
||||
{
|
||||
road = IrisBiome.ROAD_GRASSY;
|
||||
}
|
||||
|
||||
if(Math.abs(road.getHeight() - cbi.getHeight()) < 0.0001 && roads.hasBorder(4, 3, xx, zz))
|
||||
{
|
||||
return road;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if(land < 0.3)
|
||||
@ -112,4 +94,9 @@ public class GenLayerBiome extends GenLayer
|
||||
{
|
||||
return noise;
|
||||
}
|
||||
|
||||
public IrisRegion getRegion(String name)
|
||||
{
|
||||
return regions.get(name);
|
||||
}
|
||||
}
|
||||
|
@ -21,25 +21,10 @@ import ninja.bytecode.shuriken.math.RNG;
|
||||
public class IrisBiome
|
||||
{
|
||||
public static final double MAX_HEIGHT = 0.77768;
|
||||
public static final double IDEAL_HEIGHT = 0.1127;
|
||||
public static final double IDEAL_HEIGHT = 0.0527;
|
||||
public static final double MIN_HEIGHT = -0.0218;
|
||||
|
||||
//@builder
|
||||
private static final IrisBiome RIVER = new IrisBiome("River", Biome.RIVER)
|
||||
.surface(MB.of(Material.SAND))
|
||||
.coreBiome();
|
||||
private static final IrisBiome BEACH = new IrisBiome("Beach", Biome.BEACHES)
|
||||
.height(-0.078)
|
||||
.coreBiome()
|
||||
.surface(MB.of(Material.SAND));
|
||||
public static final IrisBiome ROAD_GRAVEL = new IrisBiome("Gravel Road", Biome.PLAINS)
|
||||
.surface(MB.of(Material.GRAVEL), MB.of(Material.COBBLESTONE))
|
||||
.coreBiome()
|
||||
.scatter(MB.of(Material.TORCH), 0.05);
|
||||
public static final IrisBiome ROAD_GRASSY = new IrisBiome("Grass Path", Biome.PLAINS)
|
||||
.surface(MB.of(Material.GRASS_PATH))
|
||||
.coreBiome()
|
||||
.scatter(MB.of(Material.TORCH), 0.05);
|
||||
private static final IrisBiome OCEAN = new IrisBiome("Ocean", Biome.OCEAN)
|
||||
.height(-0.5)
|
||||
.coreBiome()
|
||||
@ -83,26 +68,6 @@ public class IrisBiome
|
||||
return MIN_HEIGHT;
|
||||
}
|
||||
|
||||
public static IrisBiome getRiver()
|
||||
{
|
||||
return RIVER;
|
||||
}
|
||||
|
||||
public static IrisBiome getBeach()
|
||||
{
|
||||
return BEACH;
|
||||
}
|
||||
|
||||
public static IrisBiome getRoadGravel()
|
||||
{
|
||||
return ROAD_GRAVEL;
|
||||
}
|
||||
|
||||
public static IrisBiome getRoadGrassy()
|
||||
{
|
||||
return ROAD_GRASSY;
|
||||
}
|
||||
|
||||
public static IrisBiome getOcean()
|
||||
{
|
||||
return OCEAN;
|
||||
@ -146,7 +111,7 @@ public class IrisBiome
|
||||
|
||||
public IrisBiome(String name, Biome realBiome)
|
||||
{
|
||||
this.region = "Default";
|
||||
this.region = "default";
|
||||
this.core = false;
|
||||
this.name = name;
|
||||
this.realBiome = realBiome;
|
||||
@ -454,7 +419,7 @@ public class IrisBiome
|
||||
|
||||
public static GList<IrisBiome> getBiomes()
|
||||
{
|
||||
return map.v().remove(IrisBiome.BEACH, IrisBiome.OCEAN, IrisBiome.DEEP_OCEAN, IrisBiome.ROAD_GRASSY, IrisBiome.ROAD_GRAVEL, IrisBiome.BEACH, IrisBiome.RIVER);
|
||||
return map.v().remove(IrisBiome.OCEAN, IrisBiome.DEEP_OCEAN);
|
||||
}
|
||||
|
||||
public static GList<IrisBiome> getAllBiomes()
|
||||
|
@ -1,18 +1,37 @@
|
||||
package ninja.bytecode.iris.pack;
|
||||
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.controller.PackController;
|
||||
import ninja.bytecode.iris.util.MaxingGenerator.EnumMaxingGenerator;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
import ninja.bytecode.shuriken.execution.J;
|
||||
import ninja.bytecode.shuriken.json.JSONObject;
|
||||
|
||||
public class IrisRegion
|
||||
{
|
||||
private String name;
|
||||
private GList<IrisBiome> biomes;
|
||||
private EnumMaxingGenerator<IrisBiome> gen;
|
||||
private double rarity;
|
||||
private IrisBiome beach;
|
||||
|
||||
public IrisRegion(String name)
|
||||
{
|
||||
this.name = name;
|
||||
this.biomes = new GList<>();
|
||||
rarity = 1;
|
||||
beach = null;
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
J.attempt(() ->
|
||||
{
|
||||
JSONObject o = Iris.getController(PackController.class).loadJSON("pack/regions/" + name + ".json");
|
||||
J.attempt(() -> name = o.getString("name"));
|
||||
J.attempt(() -> rarity = o.getDouble("rarity"));
|
||||
J.attempt(() -> beach = Iris.getController(PackController.class).getBiomeById(o.getString("beach")));
|
||||
});
|
||||
}
|
||||
|
||||
public EnumMaxingGenerator<IrisBiome> getGen()
|
||||
@ -45,13 +64,38 @@ public class IrisRegion
|
||||
this.biomes = biomes;
|
||||
}
|
||||
|
||||
public double getRarity()
|
||||
{
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public void setRarity(double rarity)
|
||||
{
|
||||
this.rarity = rarity;
|
||||
}
|
||||
|
||||
public IrisBiome getBeach()
|
||||
{
|
||||
return beach;
|
||||
}
|
||||
|
||||
public void setBeach(IrisBiome beach)
|
||||
{
|
||||
this.beach = beach;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((beach == null) ? 0 : beach.hashCode());
|
||||
result = prime * result + ((biomes == null) ? 0 : biomes.hashCode());
|
||||
result = prime * result + ((gen == null) ? 0 : gen.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(rarity);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -65,6 +109,13 @@ public class IrisRegion
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
IrisRegion other = (IrisRegion) obj;
|
||||
if(beach == null)
|
||||
{
|
||||
if(other.beach != null)
|
||||
return false;
|
||||
}
|
||||
else if(!beach.equals(other.beach))
|
||||
return false;
|
||||
if(biomes == null)
|
||||
{
|
||||
if(other.biomes != null)
|
||||
@ -72,6 +123,13 @@ public class IrisRegion
|
||||
}
|
||||
else if(!biomes.equals(other.biomes))
|
||||
return false;
|
||||
if(gen == null)
|
||||
{
|
||||
if(other.gen != null)
|
||||
return false;
|
||||
}
|
||||
else if(!gen.equals(other.gen))
|
||||
return false;
|
||||
if(name == null)
|
||||
{
|
||||
if(other.name != null)
|
||||
@ -79,6 +137,8 @@ public class IrisRegion
|
||||
}
|
||||
else if(!name.equals(other.name))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(rarity) != Double.doubleToLongBits(other.rarity))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user