mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Revert "Rarity System"
This reverts commit a9ce316d282790c4a9b12526a291952486d27ea7.
This commit is contained in:
parent
a9ce316d28
commit
ae5d0b282c
@ -11,16 +11,15 @@ import ninja.bytecode.iris.util.BiomeResult;
|
|||||||
import ninja.bytecode.iris.util.CellGenerator;
|
import ninja.bytecode.iris.util.CellGenerator;
|
||||||
import ninja.bytecode.iris.util.GenLayer;
|
import ninja.bytecode.iris.util.GenLayer;
|
||||||
import ninja.bytecode.iris.util.RNG;
|
import ninja.bytecode.iris.util.RNG;
|
||||||
import ninja.bytecode.iris.util.RarityCellGenerator;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
|
|
||||||
public class GenLayerBiome extends GenLayer
|
public class GenLayerBiome extends GenLayer
|
||||||
{
|
{
|
||||||
private CellGenerator region;
|
private CellGenerator region;
|
||||||
private CellGenerator bridge;
|
private CellGenerator bridge;
|
||||||
private RarityCellGenerator<IrisBiome> land;
|
private CellGenerator land;
|
||||||
private RarityCellGenerator<IrisBiome> shore;
|
private CellGenerator shore;
|
||||||
private RarityCellGenerator<IrisBiome> sea;
|
private CellGenerator sea;
|
||||||
private DimensionChunkGenerator iris;
|
private DimensionChunkGenerator iris;
|
||||||
|
|
||||||
public GenLayerBiome(DimensionChunkGenerator iris, RNG rng)
|
public GenLayerBiome(DimensionChunkGenerator iris, RNG rng)
|
||||||
@ -29,9 +28,9 @@ public class GenLayerBiome extends GenLayer
|
|||||||
this.iris = iris;
|
this.iris = iris;
|
||||||
region = new CellGenerator(rng.nextParallelRNG(1188519));
|
region = new CellGenerator(rng.nextParallelRNG(1188519));
|
||||||
bridge = new CellGenerator(rng.nextParallelRNG(1541462));
|
bridge = new CellGenerator(rng.nextParallelRNG(1541462));
|
||||||
land = new RarityCellGenerator<>(rng.nextParallelRNG(9045162));
|
land = new CellGenerator(rng.nextParallelRNG(9045162));
|
||||||
shore = new RarityCellGenerator<>(rng.nextParallelRNG(2342812));
|
shore = new CellGenerator(rng.nextParallelRNG(2342812));
|
||||||
sea = new RarityCellGenerator<>(rng.nextParallelRNG(6135621));
|
sea = new CellGenerator(rng.nextParallelRNG(6135621));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisRegion getRegion(double bx, double bz)
|
public IrisRegion getRegion(double bx, double bz)
|
||||||
|
@ -10,7 +10,6 @@ import lombok.EqualsAndHashCode;
|
|||||||
import ninja.bytecode.iris.util.CNG;
|
import ninja.bytecode.iris.util.CNG;
|
||||||
import ninja.bytecode.iris.util.CellGenerator;
|
import ninja.bytecode.iris.util.CellGenerator;
|
||||||
import ninja.bytecode.iris.util.Desc;
|
import ninja.bytecode.iris.util.Desc;
|
||||||
import ninja.bytecode.iris.util.IRare;
|
|
||||||
import ninja.bytecode.iris.util.RNG;
|
import ninja.bytecode.iris.util.RNG;
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
@ -18,14 +17,11 @@ import ninja.bytecode.shuriken.logging.L;
|
|||||||
@Desc("Represents a biome in iris.")
|
@Desc("Represents a biome in iris.")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisBiome extends IrisRegistrant implements IRare
|
public class IrisBiome extends IrisRegistrant
|
||||||
{
|
{
|
||||||
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
||||||
private String name = "A Biome";
|
private String name = "A Biome";
|
||||||
|
|
||||||
@Desc("The weight of this biome. Higher than 1 is more common, less than 1 (above 0) is rarer")
|
|
||||||
private double weight = 1D;
|
|
||||||
|
|
||||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen")
|
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen")
|
||||||
private Dispersion biomeDispersion = Dispersion.SCATTER;
|
private Dispersion biomeDispersion = Dispersion.SCATTER;
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package ninja.bytecode.iris.util;
|
|
||||||
|
|
||||||
public interface IRare
|
|
||||||
{
|
|
||||||
public double getWeight();
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package ninja.bytecode.iris.util;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.math.DoubleRange;
|
|
||||||
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
|
||||||
|
|
||||||
public class RarityCellGenerator<T extends IRare> extends CellGenerator
|
|
||||||
{
|
|
||||||
public RarityCellGenerator(RNG rng)
|
|
||||||
{
|
|
||||||
super(rng);
|
|
||||||
}
|
|
||||||
|
|
||||||
public T get(double x, double z, KList<T> t)
|
|
||||||
{
|
|
||||||
int totalWeight = 0;
|
|
||||||
KMap<DoubleRange, T> ranges = new KMap<>();
|
|
||||||
|
|
||||||
for(T i : t)
|
|
||||||
{
|
|
||||||
int weight = (int) Math.round(1000 * i.getWeight());
|
|
||||||
|
|
||||||
if(weight < 1)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ranges.put(new DoubleRange(totalWeight, totalWeight + weight), i);
|
|
||||||
totalWeight += weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
int r = getIndex(x, z, totalWeight);
|
|
||||||
|
|
||||||
for(DoubleRange i : ranges.keySet())
|
|
||||||
{
|
|
||||||
if(i.containsDouble(r))
|
|
||||||
{
|
|
||||||
return ranges.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!t.isEmpty())
|
|
||||||
{
|
|
||||||
return t.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user