From ae5d0b282c5994803e0930cc73b98634f89cbe75 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Wed, 22 Jul 2020 15:04:28 -0400 Subject: [PATCH] Revert "Rarity System" This reverts commit a9ce316d282790c4a9b12526a291952486d27ea7. --- .../bytecode/iris/layer/GenLayerBiome.java | 13 +++-- .../ninja/bytecode/iris/object/IrisBiome.java | 6 +-- .../java/ninja/bytecode/iris/util/IRare.java | 6 --- .../iris/util/RarityCellGenerator.java | 50 ------------------- 4 files changed, 7 insertions(+), 68 deletions(-) delete mode 100644 src/main/java/ninja/bytecode/iris/util/IRare.java delete mode 100644 src/main/java/ninja/bytecode/iris/util/RarityCellGenerator.java diff --git a/src/main/java/ninja/bytecode/iris/layer/GenLayerBiome.java b/src/main/java/ninja/bytecode/iris/layer/GenLayerBiome.java index d3ce4a0a1..49ffc187b 100644 --- a/src/main/java/ninja/bytecode/iris/layer/GenLayerBiome.java +++ b/src/main/java/ninja/bytecode/iris/layer/GenLayerBiome.java @@ -11,16 +11,15 @@ import ninja.bytecode.iris.util.BiomeResult; import ninja.bytecode.iris.util.CellGenerator; import ninja.bytecode.iris.util.GenLayer; import ninja.bytecode.iris.util.RNG; -import ninja.bytecode.iris.util.RarityCellGenerator; import ninja.bytecode.shuriken.collections.KList; public class GenLayerBiome extends GenLayer { private CellGenerator region; private CellGenerator bridge; - private RarityCellGenerator land; - private RarityCellGenerator shore; - private RarityCellGenerator sea; + private CellGenerator land; + private CellGenerator shore; + private CellGenerator sea; private DimensionChunkGenerator iris; public GenLayerBiome(DimensionChunkGenerator iris, RNG rng) @@ -29,9 +28,9 @@ public class GenLayerBiome extends GenLayer this.iris = iris; region = new CellGenerator(rng.nextParallelRNG(1188519)); bridge = new CellGenerator(rng.nextParallelRNG(1541462)); - land = new RarityCellGenerator<>(rng.nextParallelRNG(9045162)); - shore = new RarityCellGenerator<>(rng.nextParallelRNG(2342812)); - sea = new RarityCellGenerator<>(rng.nextParallelRNG(6135621)); + land = new CellGenerator(rng.nextParallelRNG(9045162)); + shore = new CellGenerator(rng.nextParallelRNG(2342812)); + sea = new CellGenerator(rng.nextParallelRNG(6135621)); } public IrisRegion getRegion(double bx, double bz) diff --git a/src/main/java/ninja/bytecode/iris/object/IrisBiome.java b/src/main/java/ninja/bytecode/iris/object/IrisBiome.java index debcc3b2c..fc708fda7 100644 --- a/src/main/java/ninja/bytecode/iris/object/IrisBiome.java +++ b/src/main/java/ninja/bytecode/iris/object/IrisBiome.java @@ -10,7 +10,6 @@ import lombok.EqualsAndHashCode; import ninja.bytecode.iris.util.CNG; import ninja.bytecode.iris.util.CellGenerator; import ninja.bytecode.iris.util.Desc; -import ninja.bytecode.iris.util.IRare; import ninja.bytecode.iris.util.RNG; import ninja.bytecode.shuriken.collections.KList; import ninja.bytecode.shuriken.logging.L; @@ -18,14 +17,11 @@ import ninja.bytecode.shuriken.logging.L; @Desc("Represents a biome in iris.") @Data @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.") 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") private Dispersion biomeDispersion = Dispersion.SCATTER; diff --git a/src/main/java/ninja/bytecode/iris/util/IRare.java b/src/main/java/ninja/bytecode/iris/util/IRare.java deleted file mode 100644 index ba314589e..000000000 --- a/src/main/java/ninja/bytecode/iris/util/IRare.java +++ /dev/null @@ -1,6 +0,0 @@ -package ninja.bytecode.iris.util; - -public interface IRare -{ - public double getWeight(); -} diff --git a/src/main/java/ninja/bytecode/iris/util/RarityCellGenerator.java b/src/main/java/ninja/bytecode/iris/util/RarityCellGenerator.java deleted file mode 100644 index cb952df1d..000000000 --- a/src/main/java/ninja/bytecode/iris/util/RarityCellGenerator.java +++ /dev/null @@ -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 extends CellGenerator -{ - public RarityCellGenerator(RNG rng) - { - super(rng); - } - - public T get(double x, double z, KList t) - { - int totalWeight = 0; - KMap 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; - } -}