mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
f
This commit is contained in:
parent
c1971bffa8
commit
199a26afbc
@ -22,7 +22,6 @@ import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||
import ninja.bytecode.iris.pack.CompiledDimension;
|
||||
import ninja.bytecode.iris.pack.IrisBiome;
|
||||
import ninja.bytecode.iris.util.BiomeLayer;
|
||||
import ninja.bytecode.iris.util.ObjectMode;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
import ninja.bytecode.shuriken.collections.GMap;
|
||||
import ninja.bytecode.shuriken.execution.ChronoLatch;
|
||||
@ -228,30 +227,6 @@ public class CommandIris implements CommandExecutor
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("regen"))
|
||||
{
|
||||
if(sender instanceof Player)
|
||||
{
|
||||
ChronoLatch cl = new ChronoLatch(3000);
|
||||
Player p = (Player) sender;
|
||||
World ww = ((Player) sender).getWorld();
|
||||
|
||||
msg(p, "Regenerating View Distance");
|
||||
|
||||
WorldReactor r = new WorldReactor(ww);
|
||||
r.generateRegionNormal(p, true, 200, (pct) ->
|
||||
{
|
||||
if(cl.flip())
|
||||
{
|
||||
msg(p, "Regenerating " + F.pc(pct));
|
||||
}
|
||||
}, () ->
|
||||
{
|
||||
msg(p, "Done! Use F3 + A");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("hotload"))
|
||||
{
|
||||
msg(sender, "=== Hotloading Pack ===");
|
||||
@ -300,6 +275,30 @@ public class CommandIris implements CommandExecutor
|
||||
c.compile();
|
||||
L.logConsumers.remove(m);
|
||||
|
||||
J.s(() ->
|
||||
{
|
||||
if(sender instanceof Player)
|
||||
{
|
||||
ChronoLatch cl = new ChronoLatch(3000);
|
||||
Player p = (Player) sender;
|
||||
World ww = ((Player) sender).getWorld();
|
||||
|
||||
msg(p, "Regenerating View Distance");
|
||||
|
||||
WorldReactor r = new WorldReactor(ww);
|
||||
r.generateRegionNormal(p, true, 200, (pct) ->
|
||||
{
|
||||
if(cl.flip())
|
||||
{
|
||||
msg(p, "Regenerating " + F.pc(pct));
|
||||
}
|
||||
}, () ->
|
||||
{
|
||||
msg(p, "Done! Use F3 + A");
|
||||
});
|
||||
}
|
||||
}, 5);
|
||||
|
||||
for(String fi : f.k())
|
||||
{
|
||||
J.s(() ->
|
||||
|
@ -25,8 +25,8 @@ public class Settings
|
||||
|
||||
public static class GeneratorSettings
|
||||
{
|
||||
public InterpolationMode interpolationMode = InterpolationMode.BILINEAR;
|
||||
public int interpolationRadius = 3;
|
||||
public InterpolationMode interpolationMode = InterpolationMode.BICUBIC;
|
||||
public int interpolationRadius = 4;
|
||||
public double objectDensity = 1D;
|
||||
public double horizontalZoom = 2;
|
||||
public double heightFracture = 155;
|
||||
@ -42,7 +42,7 @@ public class Settings
|
||||
public double heightScale = 0.56;
|
||||
public double baseHeight = 0.065;
|
||||
public int seaLevel = 63;
|
||||
public double biomeScale = 0.525;
|
||||
public double biomeScale = 1;
|
||||
public boolean flatBedrock = false;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ninja.bytecode.iris.pack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -25,7 +26,7 @@ import ninja.bytecode.shuriken.math.RNG;
|
||||
public class IrisBiome
|
||||
{
|
||||
public static final double MAX_HEIGHT = 0.77768;
|
||||
public static final double IDEAL_HEIGHT = 0.0527;
|
||||
public static final double IDEAL_HEIGHT = 0.138;
|
||||
public static final double MIN_HEIGHT = -0.0218;
|
||||
private static final GMap<Biome, IrisBiome> map = build();
|
||||
private String name;
|
||||
@ -33,6 +34,7 @@ public class IrisBiome
|
||||
private Biome realBiome;
|
||||
private double height;
|
||||
private GList<MB> rock;
|
||||
private MB fluid;
|
||||
private int rockDepth;
|
||||
private GList<MB> surface;
|
||||
private GList<MB> dirt;
|
||||
@ -118,6 +120,7 @@ public class IrisBiome
|
||||
this.name = name;
|
||||
type = BiomeType.LAND;
|
||||
cliffs = false;
|
||||
fluid = MB.of(Material.STATIONARY_WATER);
|
||||
genScale = 1;
|
||||
rarity = 1;
|
||||
genAmplifier = 0.35;
|
||||
@ -236,14 +239,15 @@ public class IrisBiome
|
||||
type = BiomeType.valueOf(o.getString("type").toUpperCase().replaceAll(" ", "_"));
|
||||
J.attempt(() -> region = o.getString("region"));
|
||||
J.attempt(() -> parent = o.getString("parent"));
|
||||
J.attempt(() -> height = o.getDouble("height"));
|
||||
J.attempt(() -> height = o.getDouble("genHeight"));
|
||||
J.attempt(() -> height(o.getDouble("height")));
|
||||
J.attempt(() -> height(o.getDouble("genHeight")));
|
||||
J.attempt(() -> genAmplifier = o.getDouble("genAmplifier"));
|
||||
J.attempt(() -> genSwirl = o.getDouble("genSwirl"));
|
||||
J.attempt(() -> genSwirlScale = o.getDouble("genSwirlScale"));
|
||||
J.attempt(() -> genScale = o.getDouble("genScale"));
|
||||
J.attempt(() -> snow = o.getDouble("snow"));
|
||||
J.attempt(() -> rarity = o.getDouble("rarity"));
|
||||
J.attempt(() -> fluid = MB.of(o.getString("fluid")));
|
||||
J.attempt(() -> dirtDepth = o.getInt("subSurfaceDepth"));
|
||||
J.attempt(() -> dirtDepth = o.getInt("dirtDepth"));
|
||||
J.attempt(() -> rockDepth = o.getInt("rockDepth"));
|
||||
@ -298,6 +302,7 @@ public class IrisBiome
|
||||
J.attempt(() -> j.put("derivative", realBiome.name().toLowerCase().replaceAll("_", " ")));
|
||||
J.attempt(() -> j.put("type", type.name().toLowerCase().replaceAll("_", " ")));
|
||||
J.attempt(() -> j.put("rarity", rarity));
|
||||
J.attempt(() -> j.put("fluid", fluid.toString()));
|
||||
J.attempt(() -> j.put("genHeight", height));
|
||||
J.attempt(() -> j.put("genScale", genScale));
|
||||
J.attempt(() -> j.put("genSwirl", genSwirl));
|
||||
@ -479,7 +484,7 @@ public class IrisBiome
|
||||
|
||||
else
|
||||
{
|
||||
this.height = M.lerp(MIN_HEIGHT, IDEAL_HEIGHT, M.clip(height, -1D, 0D));
|
||||
this.height = M.lerp(MIN_HEIGHT, IDEAL_HEIGHT, 1d - Math.abs(M.clip(height, -1D, 0D)));
|
||||
}
|
||||
|
||||
return this;
|
||||
@ -635,7 +640,7 @@ public class IrisBiome
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getRegion()
|
||||
public String getRegionID()
|
||||
{
|
||||
return region;
|
||||
}
|
||||
@ -1038,173 +1043,39 @@ public class IrisBiome
|
||||
}
|
||||
}
|
||||
|
||||
public MB getFluid()
|
||||
{
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public void setFluid(MB fluid)
|
||||
{
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
public void setRarity(double rarity)
|
||||
{
|
||||
this.rarity = rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(cliffChance);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(cliffScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + (cliffs ? 1231 : 1237);
|
||||
result = prime * result + (core ? 1231 : 1237);
|
||||
result = prime * result + ((dirt == null) ? 0 : dirt.hashCode());
|
||||
result = prime * result + dirtDepth;
|
||||
temp = Double.doubleToLongBits(genAmplifier);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(genScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(genSwirl);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(genSwirlScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((parent == null) ? 0 : parent.hashCode());
|
||||
temp = Double.doubleToLongBits(rarity);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((realBiome == null) ? 0 : realBiome.hashCode());
|
||||
result = prime * result + ((region == null) ? 0 : region.hashCode());
|
||||
result = prime * result + ((rock == null) ? 0 : rock.hashCode());
|
||||
result = prime * result + rockDepth;
|
||||
temp = Double.doubleToLongBits(rockScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((scatterChance == null) ? 0 : scatterChance.hashCode());
|
||||
result = prime * result + (scatterSurface ? 1231 : 1237);
|
||||
result = prime * result + (scatterSurfaceRock ? 1231 : 1237);
|
||||
result = prime * result + (scatterSurfaceSub ? 1231 : 1237);
|
||||
result = prime * result + ((schematicGroups == null) ? 0 : schematicGroups.hashCode());
|
||||
result = prime * result + (simplexScatter ? 1231 : 1237);
|
||||
result = prime * result + (simplexScatterRock ? 1231 : 1237);
|
||||
result = prime * result + (simplexScatterSub ? 1231 : 1237);
|
||||
temp = Double.doubleToLongBits(snow);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(subSurfaceScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((surface == null) ? 0 : surface.hashCode());
|
||||
temp = Double.doubleToLongBits(surfaceScale);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
return result;
|
||||
return Objects.hash(cliffChance, cliffScale, cliffs, core, dirt, dirtDepth, fluid, genAmplifier, genScale, genSwirl, genSwirlScale, height, name, parent, rarity, realBiome, region, rock, rockDepth, rockScale, scatterChance, scatterSurface, scatterSurfaceRock, scatterSurfaceSub, schematicGroups, simplexScatter, simplexScatterRock, simplexScatterSub, snow, subSurfaceScale, surface, surfaceScale, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
{
|
||||
return true;
|
||||
if(obj == null)
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
}
|
||||
if(!(obj instanceof IrisBiome))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
IrisBiome other = (IrisBiome) obj;
|
||||
if(Double.doubleToLongBits(cliffChance) != Double.doubleToLongBits(other.cliffChance))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(cliffScale) != Double.doubleToLongBits(other.cliffScale))
|
||||
return false;
|
||||
if(cliffs != other.cliffs)
|
||||
return false;
|
||||
if(core != other.core)
|
||||
return false;
|
||||
if(dirt == null)
|
||||
{
|
||||
if(other.dirt != null)
|
||||
return false;
|
||||
}
|
||||
else if(!dirt.equals(other.dirt))
|
||||
return false;
|
||||
if(dirtDepth != other.dirtDepth)
|
||||
return false;
|
||||
if(Double.doubleToLongBits(genAmplifier) != Double.doubleToLongBits(other.genAmplifier))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(genScale) != Double.doubleToLongBits(other.genScale))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(genSwirl) != Double.doubleToLongBits(other.genSwirl))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(genSwirlScale) != Double.doubleToLongBits(other.genSwirlScale))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(height) != Double.doubleToLongBits(other.height))
|
||||
return false;
|
||||
if(name == null)
|
||||
{
|
||||
if(other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if(!name.equals(other.name))
|
||||
return false;
|
||||
if(parent == null)
|
||||
{
|
||||
if(other.parent != null)
|
||||
return false;
|
||||
}
|
||||
else if(!parent.equals(other.parent))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(rarity) != Double.doubleToLongBits(other.rarity))
|
||||
return false;
|
||||
if(realBiome != other.realBiome)
|
||||
return false;
|
||||
if(region == null)
|
||||
{
|
||||
if(other.region != null)
|
||||
return false;
|
||||
}
|
||||
else if(!region.equals(other.region))
|
||||
return false;
|
||||
if(rock == null)
|
||||
{
|
||||
if(other.rock != null)
|
||||
return false;
|
||||
}
|
||||
else if(!rock.equals(other.rock))
|
||||
return false;
|
||||
if(rockDepth != other.rockDepth)
|
||||
return false;
|
||||
if(Double.doubleToLongBits(rockScale) != Double.doubleToLongBits(other.rockScale))
|
||||
return false;
|
||||
if(scatterChance == null)
|
||||
{
|
||||
if(other.scatterChance != null)
|
||||
return false;
|
||||
}
|
||||
else if(!scatterChance.equals(other.scatterChance))
|
||||
return false;
|
||||
if(scatterSurface != other.scatterSurface)
|
||||
return false;
|
||||
if(scatterSurfaceRock != other.scatterSurfaceRock)
|
||||
return false;
|
||||
if(scatterSurfaceSub != other.scatterSurfaceSub)
|
||||
return false;
|
||||
if(schematicGroups == null)
|
||||
{
|
||||
if(other.schematicGroups != null)
|
||||
return false;
|
||||
}
|
||||
else if(!schematicGroups.equals(other.schematicGroups))
|
||||
return false;
|
||||
if(simplexScatter != other.simplexScatter)
|
||||
return false;
|
||||
if(simplexScatterRock != other.simplexScatterRock)
|
||||
return false;
|
||||
if(simplexScatterSub != other.simplexScatterSub)
|
||||
return false;
|
||||
if(Double.doubleToLongBits(snow) != Double.doubleToLongBits(other.snow))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(subSurfaceScale) != Double.doubleToLongBits(other.subSurfaceScale))
|
||||
return false;
|
||||
if(surface == null)
|
||||
{
|
||||
if(other.surface != null)
|
||||
return false;
|
||||
}
|
||||
else if(!surface.equals(other.surface))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(surfaceScale) != Double.doubleToLongBits(other.surfaceScale))
|
||||
return false;
|
||||
if(type != other.type)
|
||||
return false;
|
||||
return true;
|
||||
return Double.doubleToLongBits(cliffChance) == Double.doubleToLongBits(other.cliffChance) && Double.doubleToLongBits(cliffScale) == Double.doubleToLongBits(other.cliffScale) && cliffs == other.cliffs && core == other.core && Objects.equals(dirt, other.dirt) && dirtDepth == other.dirtDepth && Objects.equals(fluid, other.fluid) && Double.doubleToLongBits(genAmplifier) == Double.doubleToLongBits(other.genAmplifier) && Double.doubleToLongBits(genScale) == Double.doubleToLongBits(other.genScale) && Double.doubleToLongBits(genSwirl) == Double.doubleToLongBits(other.genSwirl) && Double.doubleToLongBits(genSwirlScale) == Double.doubleToLongBits(other.genSwirlScale) && Double.doubleToLongBits(height) == Double.doubleToLongBits(other.height) && Objects.equals(name, other.name) && Objects.equals(parent, other.parent) && Double.doubleToLongBits(rarity) == Double.doubleToLongBits(other.rarity) && realBiome == other.realBiome && Objects.equals(region, other.region) && Objects.equals(rock, other.rock) && rockDepth == other.rockDepth && Double.doubleToLongBits(rockScale) == Double.doubleToLongBits(other.rockScale) && Objects.equals(scatterChance, other.scatterChance) && scatterSurface == other.scatterSurface && scatterSurfaceRock == other.scatterSurfaceRock && scatterSurfaceSub == other.scatterSurfaceSub && Objects.equals(schematicGroups, other.schematicGroups) && simplexScatter == other.simplexScatter && simplexScatterRock == other.simplexScatterRock && simplexScatterSub == other.simplexScatterSub && Double.doubleToLongBits(snow) == Double.doubleToLongBits(other.snow) && Double.doubleToLongBits(subSurfaceScale) == Double.doubleToLongBits(other.subSurfaceScale) && Objects.equals(surface, other.surface) && Double.doubleToLongBits(surfaceScale) == Double.doubleToLongBits(other.surfaceScale) && type == other.type;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ninja.bytecode.iris.pack;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import ninja.bytecode.iris.Iris;
|
||||
import ninja.bytecode.iris.controller.PackController;
|
||||
import ninja.bytecode.shuriken.collections.GList;
|
||||
@ -10,17 +12,21 @@ public class IrisRegion
|
||||
{
|
||||
private String name;
|
||||
private GList<IrisBiome> biomes;
|
||||
private double rarity;
|
||||
private boolean frozen;
|
||||
private IrisBiome ocean;
|
||||
private IrisBiome lake;
|
||||
private IrisBiome lakeBeach;
|
||||
private IrisBiome channel;
|
||||
private IrisBiome beach;
|
||||
|
||||
public IrisRegion(String name)
|
||||
{
|
||||
frozen = false;
|
||||
this.name = name;
|
||||
this.biomes = new GList<>();
|
||||
rarity = 1;
|
||||
beach = null;
|
||||
ocean = null;
|
||||
lake = null;
|
||||
lakeBeach = null;
|
||||
channel = null;
|
||||
}
|
||||
|
||||
public void load()
|
||||
@ -28,10 +34,12 @@ public class IrisRegion
|
||||
J.attempt(() ->
|
||||
{
|
||||
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(() -> rarity = o.getDouble("rarity"));
|
||||
J.attempt(() -> ocean = Iris.getController(PackController.class).getBiomeById(o.getString("ocean")));
|
||||
J.attempt(() -> beach = Iris.getController(PackController.class).getBiomeById(o.getString("beach")));
|
||||
J.attempt(() -> lake = Iris.getController(PackController.class).getBiomeById(o.getString("lake")));
|
||||
J.attempt(() -> lakeBeach = Iris.getController(PackController.class).getBiomeById(o.getString("lakeBeach")));
|
||||
J.attempt(() -> channel = Iris.getController(PackController.class).getBiomeById(o.getString("channel")));
|
||||
});
|
||||
}
|
||||
|
||||
@ -55,16 +63,6 @@ public class IrisRegion
|
||||
this.biomes = biomes;
|
||||
}
|
||||
|
||||
public double getRarity()
|
||||
{
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public void setRarity(double rarity)
|
||||
{
|
||||
this.rarity = rarity;
|
||||
}
|
||||
|
||||
public IrisBiome getBeach()
|
||||
{
|
||||
return beach;
|
||||
@ -75,59 +73,44 @@ public class IrisRegion
|
||||
this.beach = beach;
|
||||
}
|
||||
|
||||
public IrisBiome getOcean()
|
||||
{
|
||||
return ocean;
|
||||
}
|
||||
|
||||
public IrisBiome getLake()
|
||||
{
|
||||
return lake;
|
||||
}
|
||||
|
||||
public IrisBiome getShore()
|
||||
{
|
||||
return lakeBeach;
|
||||
}
|
||||
|
||||
public IrisBiome getChannel()
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
||||
@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 + ((name == null) ? 0 : name.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(rarity);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
return Objects.hash(beach, biomes, channel, lake, lakeBeach, name, ocean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
{
|
||||
return true;
|
||||
if(obj == null)
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
}
|
||||
if(!(obj instanceof IrisRegion))
|
||||
{
|
||||
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)
|
||||
return false;
|
||||
}
|
||||
else if(!biomes.equals(other.biomes))
|
||||
return false;
|
||||
|
||||
if(name == null)
|
||||
{
|
||||
if(other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if(!name.equals(other.name))
|
||||
return false;
|
||||
if(Double.doubleToLongBits(rarity) != Double.doubleToLongBits(other.rarity))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isFrozen()
|
||||
{
|
||||
return frozen;
|
||||
return Objects.equals(beach, other.beach) && Objects.equals(biomes, other.biomes) && Objects.equals(channel, other.channel) && Objects.equals(lake, other.lake) && Objects.equals(lakeBeach, other.lakeBeach) && Objects.equals(name, other.name) && Objects.equals(ocean, other.ocean);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ public class PolygonGenerator
|
||||
int current = getIndex(dims);
|
||||
double ajump = 360D / (double) checks;
|
||||
int hit = -1;
|
||||
int hit2 = -1;
|
||||
|
||||
if(dims.length == 3)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user