diff --git a/src/main/java/ninja/bytecode/iris/IrisGenerator.java b/src/main/java/ninja/bytecode/iris/IrisGenerator.java index 98a4f03d8..336498e7d 100644 --- a/src/main/java/ninja/bytecode/iris/IrisGenerator.java +++ b/src/main/java/ninja/bytecode/iris/IrisGenerator.java @@ -15,7 +15,6 @@ import ninja.bytecode.iris.gen.GenLayerBase; import ninja.bytecode.iris.gen.GenLayerBiome; import ninja.bytecode.iris.gen.GenLayerLayeredNoise; import ninja.bytecode.iris.gen.GenLayerRidge; -import ninja.bytecode.iris.pop.PopulatorLakes; import ninja.bytecode.iris.pop.PopulatorTrees; import ninja.bytecode.shuriken.collections.GList; import ninja.bytecode.shuriken.collections.GMap; @@ -106,7 +105,7 @@ public class IrisGenerator extends ParallelChunkGenerator private double getBilinearNoise(int x, int z) { - int h = 3; + int h = 5; int fx = x >> h; int fz = z >> h; int xa = (fx << h) - 2; @@ -125,7 +124,7 @@ public class IrisGenerator extends ParallelChunkGenerator private double getBicubicNoise(int x, int z) { - int h = 3; + int h = 5; int fx = x >> h; int fz = z >> h; int xa = (fx << h); @@ -193,6 +192,15 @@ public class IrisGenerator extends ParallelChunkGenerator mb = BEDROCK; } + if(i == height - 1 && i < 66 + (glBase.scatter(wx, i, wz) * 2) && i > 59) + { + mb = MB.of(Material.SAND); + setBlock(x, i+1, z, Material.AIR); + setBlock(x, i-1, z, mb.material, mb.data); + setBlock(x, i-2, z, mb.material, mb.data); + setBlock(x, i-3, z, mb.material, mb.data); + } + setBlock(x, i, z, mb.material, mb.data); } @@ -204,7 +212,6 @@ public class IrisGenerator extends ParallelChunkGenerator { GList p = new GList(); p.add(new PopulatorTrees()); - p.add(new PopulatorLakes()); return p; } diff --git a/src/main/java/ninja/bytecode/iris/ParallelChunkGenerator.java b/src/main/java/ninja/bytecode/iris/ParallelChunkGenerator.java index 8f4bacddb..5cfb43dee 100644 --- a/src/main/java/ninja/bytecode/iris/ParallelChunkGenerator.java +++ b/src/main/java/ninja/bytecode/iris/ParallelChunkGenerator.java @@ -9,7 +9,6 @@ import org.bukkit.block.Biome; import org.bukkit.generator.ChunkGenerator; import ninja.bytecode.iris.atomics.AtomicChunkData; -import ninja.bytecode.iris.pop.PopulatorLakes; import ninja.bytecode.iris.pop.PopulatorTrees; import ninja.bytecode.shuriken.Shuriken; import ninja.bytecode.shuriken.collections.GList; @@ -55,15 +54,15 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator cg = 0; } - double total = rs.getAverage() + PopulatorTrees.timings.getAverage() + PopulatorLakes.timings.getAverage(); + double total = rs.getAverage() + PopulatorTrees.timings.getAverage(); double rcs = (1000D / total); double work = cps.getAverage() / (rcs + 1); L.i("Terrain Gen for " + world.getName()); L.i("- Terrain (MLTC): " + F.duration(rs.getAverage(), 2)); L.i("- Trees (SGLC): " + F.duration(PopulatorTrees.timings.getAverage(), 2)); - L.i("- Lakes (SGLC): " + F.duration(PopulatorLakes.timings.getAverage(), 2)); L.i("Total: " + F.duration(total, 3) + " Work: " + F.f(cps.getAverage(), 0) + "/s of " + F.f(rcs, 0) + "/s (" + F.pc(work, 0) + " utilization)"); L.flush(); + System.out.println(""); }); diff --git a/src/main/java/ninja/bytecode/iris/Settings.java b/src/main/java/ninja/bytecode/iris/Settings.java index 92ca5ff6c..48bbba85f 100644 --- a/src/main/java/ninja/bytecode/iris/Settings.java +++ b/src/main/java/ninja/bytecode/iris/Settings.java @@ -14,16 +14,16 @@ public class Settings public static class GeneratorSettings { - public double horizontalZoom = 2.225; // 1.856 2.556 + public double horizontalZoom = 0.525; // 2.225 - 1.625 (big) public double heightFracture = 155; - public double heightMultiplier = 1.154; + public double heightMultiplier = 0.806; public double heightExponentBase = 1; public double heightExponentMultiplier = 1.41; public double heightScale = 1; public double superHeightScale = 0.65; public double baseHeight = 0.165; public int seaLevel = 63; - public double biomeScale = 2.41; + public double biomeScale = 2.46; public boolean flatBedrock = false; } } diff --git a/src/main/java/ninja/bytecode/iris/biome/CBI.java b/src/main/java/ninja/bytecode/iris/biome/CBI.java index d088a5db2..c5648327f 100644 --- a/src/main/java/ninja/bytecode/iris/biome/CBI.java +++ b/src/main/java/ninja/bytecode/iris/biome/CBI.java @@ -20,6 +20,8 @@ public class CBI //@builder public static final CBI RIVER = new CBI("River", Biome.RIVER) .surface(MB.of(Material.SAND)); + public static final CBI BEACH = new CBI("Beach", Biome.BEACHES) + .surface(MB.of(Material.SAND)); public static final CBI ROAD_GRAVEL = new CBI("Gravel Road", Biome.PLAINS) .surface(MB.of(Material.GRAVEL), MB.of(Material.COBBLESTONE)) .scatter(MB.of(Material.TORCH), 0.05); @@ -27,22 +29,24 @@ public class CBI .surface(MB.of(Material.GRASS_PATH)) .scatter(MB.of(Material.TORCH), 0.05); public static final CBI OCEAN = new CBI("Ocean", Biome.OCEAN) - .surface(MB.of(Material.SAND)) - .height(-0.07); + .surface(MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL)) + .simplexSurface() + .height(-0.03); public static final CBI DEEP_OCEAN = new CBI("Deep Ocean", Biome.DEEP_OCEAN) - .surface(MB.of(Material.SAND)) + .surface(MB.of(Material.SAND), MB.of(Material.CLAY), MB.of(Material.GRAVEL)) + .simplexSurface() .height(-0.07); public static final CBI DESERT = new CBI("Desert", Biome.DESERT) .surface(MB.of(Material.SAND)) - .scatter(MB.of(Material.DEAD_BUSH, 0), 0.08) + .scatter(MB.of(Material.DEAD_BUSH, 0), 0.008) .dirt(MB.of(Material.SANDSTONE)); public static final CBI DESERT_RED = new CBI("Red Desert", Biome.DESERT) .surface(MB.of(Material.SAND, 1)) - .scatter(MB.of(Material.DEAD_BUSH, 0), 0.08) + .scatter(MB.of(Material.DEAD_BUSH, 0), 0.008) .dirt(MB.of(Material.RED_SANDSTONE)); public static final CBI DESERT_COMBINED = new CBI("Combined Desert", Biome.DESERT) .surface(MB.of(Material.SAND), MB.of(Material.SAND, 1)) - .scatter(MB.of(Material.DEAD_BUSH, 0), 0.08) + .scatter(MB.of(Material.DEAD_BUSH, 0), 0.008) .dirt(MB.of(Material.SANDSTONE), MB.of(Material.RED_SANDSTONE)) .simplexSurface(); public static final CBI DESERT_HILLS = new CBI("Desert Hills", Biome.DESERT_HILLS) @@ -63,16 +67,17 @@ public class CBI .amp(0.75); public static final CBI JUNGLE = new CBI("Jungle", Biome.JUNGLE) .scatter(MB.of(Material.LONG_GRASS, 1), 0.058) - .tree(TreeType.JUNGLE, 0.8) + .tree(TreeType.JUNGLE, 0.9) .tree(TreeType.JUNGLE_BUSH, 0.3) .tree(TreeType.SMALL_JUNGLE, 0.1) .scatter(MB.of(Material.LONG_GRASS, 2), 0.013); public static final CBI JUNGLE_HILLS = new CBI("Jungle Hills", Biome.JUNGLE_HILLS) .scatter(MB.of(Material.LONG_GRASS, 1), 0.081) - .tree(TreeType.JUNGLE, 0.8) + .tree(TreeType.JUNGLE, 0.9) .tree(TreeType.JUNGLE_BUSH, 0.3) .tree(TreeType.SMALL_JUNGLE, 0.1) - .amp(0.75) + .amp(1.75) + .height(0.166) .scatter(MB.of(Material.LONG_GRASS, 2), 0.02); public static final CBI SWAMP = new CBI("Swamp", Biome.SWAMPLAND) .scatter(MB.of(Material.LONG_GRASS, 1), 0.04) @@ -95,6 +100,24 @@ public class CBI .amp(0.75) .tree(TreeType.TREE, 0.7) .scatter(MB.of(Material.LONG_GRASS, 2), 0.13); + public static final CBI FOREST_MOUNTAINS = new CBI("Forest Mountains", Biome.MUTATED_EXTREME_HILLS_WITH_TREES) + .scatter(MB.of(Material.LONG_GRASS, 1), 0.13) + .amp(2.25) + .height(0.265) + .tree(TreeType.MEGA_REDWOOD, 0.5) + .tree(TreeType.TALL_REDWOOD, 0.7) + .scatter(MB.of(Material.LONG_GRASS, 2), 0.13); + public static final CBI HAUNTED_FOREST = new CBI("Haunted Forest", Biome.MUTATED_SWAMPLAND) + .scatter(MB.of(Material.LONG_GRASS, 1), 0.13) + .tree(TreeType.JUNGLE_BUSH, 0.5) + .tree(TreeType.BIG_TREE, 0.4) + .tree(TreeType.SWAMP, 0.4) + .tree(TreeType.JUNGLE, 0.4) + .tree(TreeType.SMALL_JUNGLE, 0.4) + .tree(TreeType.JUNGLE_BUSH, 0.5) + .scatter(MB.of(Material.LONG_GRASS, 2), 0.13) + .surface(MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.GRASS), MB.of(Material.DIRT), MB.of(Material.DIRT, 1), MB.of(Material.DIRT, 2)) + .scatterSurface(); public static final CBI BIRCH_FOREST = new CBI("Birch Forest", Biome.BIRCH_FOREST) .scatter(MB.of(Material.LONG_GRASS, 1), 0.23) .tree(TreeType.BIRCH, 0.7) @@ -109,21 +132,21 @@ public class CBI .tree(TreeType.DARK_OAK, 0.9) .scatter(MB.of(Material.LONG_GRASS, 2), 0.13); public static final CBI TAIGA = new CBI("Taiga", Biome.TAIGA) - .tree(TreeType.REDWOOD, 0.4) .scatter(MB.of(Material.LONG_GRASS, 2), 0.07); public static final CBI EXTREME_HILLS = new CBI("Extreme Hills", Biome.EXTREME_HILLS) - .scatter(MB.of(Material.LONG_GRASS, 2), 0.04); + .scatter(MB.of(Material.LONG_GRASS, 2), 0.04) + .amp(1.565) + .height(0.22); public static final CBI EXTREME_HILLS_TREES = new CBI("Extreme Hills +", Biome.EXTREME_HILLS_WITH_TREES) .scatter(MB.of(Material.LONG_GRASS, 2), 0.09) - .tree(TreeType.REDWOOD, 0.1) - .amp(1.25); + .amp(1.525) + .height(0.22); public static final CBI TAIGA_COLD = new CBI("Taiga Cold", Biome.TAIGA_COLD) .tree(TreeType.REDWOOD, 0.3) .scatter(MB.of(Material.LONG_GRASS, 2), 0.04); public static final CBI TAIGA_COLD_HILLS = new CBI("Taiga Cold Hills", Biome.TAIGA_COLD_HILLS) - .tree(TreeType.REDWOOD, 0.15).amp(0.75); public static final CBI ICE_FLATS = new CBI("Ice Flats", Biome.ICE_FLATS); public static final CBI ICE_MOUNTAINS = new CBI("Ice Mountains", Biome.ICE_MOUNTAINS) @@ -138,7 +161,7 @@ public class CBI .surface(MB.of(Material.DIRT, 2), MB.of(Material.DIRT, 1)) .amp(0.75) .simplexSurface(); - + //@done private static final GMap map = build(); private String name; @@ -149,6 +172,7 @@ public class CBI private GList surface; private GList dirt; private GMap scatterChance; + private boolean scatterSurface; private boolean simplexScatter; private GMap schematicGroups; private PolygonGenerator.EnumPolygonGenerator poly; @@ -213,6 +237,12 @@ public class CBI simplexScatter = true; return this; } + + public CBI scatterSurface() + { + scatterSurface = true; + return this; + } public CBI surface(MB... mbs) { @@ -268,19 +298,34 @@ public class CBI return dirt; } - public MB getSurface(int wx, int wz, RNG rng) + public MB getSurface(int x, int z, RNG rng) { + double wx = x + 1000D; + double wz = z + 1000D; if(simplexScatter) { if(poly == null) { - poly = new PolygonGenerator.EnumPolygonGenerator(rng, 0.05, 12, getSurface().toArray(new MB[getSurface().size()]), (g) -> + poly = new PolygonGenerator.EnumPolygonGenerator(rng, 0.25, 2, getSurface().toArray(new MB[getSurface().size()]), (g) -> { - return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.155), 24); + return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.0155), 242); }); } - return poly.getChoice(wx, wz); + return poly.getChoice(wx * 0.2D, wz * 0.2D); + } + + if(scatterSurface) + { + if(poly == null) + { + poly = new PolygonGenerator.EnumPolygonGenerator(rng, 15.05, 2, getSurface().toArray(new MB[getSurface().size()]), (g) -> + { + return g.fractureWith(new CNG(rng.nextRNG(), 1D, 2).scale(0.0155), 224); + }); + } + + return poly.getChoice(wx * 0.2D, wz * 0.2D); } return getSurface().getRandom(); diff --git a/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java b/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java index a50fa1c99..743b4e3ac 100644 --- a/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java +++ b/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java @@ -27,13 +27,15 @@ public class GenLayerBiome extends GenLayer { //@builder super(iris, world, random, rng); - fracture = new CNG(rng.nextRNG(), 1D, 7).scale(0.004).fractureWith(new CNG(rng.nextRNG(), 1D, 3).scale(0.19), 277D); + fracture = new CNG(rng.nextRNG(), 1D, 24).scale(0.0021).fractureWith(new CNG(rng.nextRNG(), 1D, 12).scale(0.01), 12250); factory = (g) -> g.fractureWith(new CNG(rng.nextRNG(), 1D, 4).scale(0.02), 56); riverCheck = new CNG(rng.nextRNG(), 1D, 2).scale(0.00096); pathCheck = new CNG(rng.nextRNG(), 1D, 1).scale(0.00096); roads = new MaxingGenerator(rng.nextRNG(), 5, 0.00055, 8, factory); biomeGenerator = new EnumMaxingGenerator(rng.nextRNG(), 0.00755 * Iris.settings.gen.biomeScale, 1, new CBI[] { + CBI.HAUNTED_FOREST, + CBI.FOREST_MOUNTAINS, CBI.DESERT, CBI.DESERT_HILLS, CBI.MESA, @@ -67,8 +69,8 @@ public class GenLayerBiome extends GenLayer public CBI getBiome(double xx, double zz) { - double x = xx + (fracture.noise(zz, xx) * 866); - double z = zz - (fracture.noise(xx, zz) * 866); + double x = xx + (fracture.noise(zz, xx) * 1550D); + double z = zz - (fracture.noise(xx, zz) * 1550D); if(riverCheck.noise(x, z) > 0.75) { @@ -80,7 +82,7 @@ public class GenLayerBiome extends GenLayer CBI cbi = biomeGenerator.getChoice(x, z); - if(pathCheck.noise(x, z) > 0.5) + if(pathCheck.noise(x, z) > 0.33) { CBI road = CBI.ROAD_GRAVEL; @@ -89,11 +91,10 @@ public class GenLayerBiome extends GenLayer road = CBI.ROAD_GRASSY; } - if(Math.abs(road.getHeight() - cbi.getHeight()) < 0.0001 && roads.hasBorder(4, 8, xx, zz)) + if(Math.abs(road.getHeight() - cbi.getHeight()) < 0.0001 && roads.hasBorder(4, 3, xx, zz)) { return road; } - } return cbi; diff --git a/src/main/java/ninja/bytecode/iris/gen/GenLayerFracture.java b/src/main/java/ninja/bytecode/iris/gen/GenLayerFracture.java index 1b620e782..ff96e26c8 100644 --- a/src/main/java/ninja/bytecode/iris/gen/GenLayerFracture.java +++ b/src/main/java/ninja/bytecode/iris/gen/GenLayerFracture.java @@ -19,14 +19,14 @@ public class GenLayerFracture extends GenLayer { //@builder super(iris, world, random, rng); - gen = new CNG(rng.nextRNG(), 1D, 4) - .scale(0.013) + gen = new CNG(rng.nextRNG(), 1D, 12) + .scale(0.023) .fractureWith(new CNG(rng.nextRNG(), 1D, 1) - .scale(0.05), 25); - cond = new CNG(rng.nextRNG(), 1D, 4) - .scale(0.018) + .scale(0.05), 333); + cond = new CNG(rng.nextRNG(), 1D, 12) + .scale(0.038) .fractureWith(new CNG(rng.nextRNG(), 1D, 1) - .scale(0.025), 9); + .scale(0.025), 299); //@done } diff --git a/src/main/java/ninja/bytecode/iris/pop/PopulatorLakes.java b/src/main/java/ninja/bytecode/iris/pop/PopulatorLakes.java deleted file mode 100644 index f68d804bb..000000000 --- a/src/main/java/ninja/bytecode/iris/pop/PopulatorLakes.java +++ /dev/null @@ -1,112 +0,0 @@ -package ninja.bytecode.iris.pop; - -import java.util.Random; - -import org.bukkit.Chunk; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.generator.BlockPopulator; - -import ninja.bytecode.shuriken.bench.PrecisionStopwatch; -import ninja.bytecode.shuriken.math.RollingSequence; - -public class PopulatorLakes extends BlockPopulator -{ - public static RollingSequence timings = new RollingSequence(512); - - @Override - public void populate(World world, Random random, Chunk chunk) - { - PrecisionStopwatch f = PrecisionStopwatch.start(); - - if(random.nextInt(100) < 10) - { - Block block; - int chunkX = chunk.getX(); - int chunkZ = chunk.getZ(); - int X = chunkX * 16 + random.nextInt(15) - 8; - int Z = chunkZ * 16 + random.nextInt(15) - 8; - int Y; - for(Y = world.getMaxHeight() - 1; chunk.getBlock(X, Y, Z).getType() == Material.AIR; Y--) - ; - Y -= 7; - block = world.getBlockAt(Z + 8, Y, Z + 8); - if(random.nextInt(100) < 90) - block.setType(Material.WATER); - else - block.setType(Material.LAVA); - boolean[] aboolean = new boolean[2048]; - int i = random.nextInt(4) + 4; - - int j, j1, k1; - - for(j = 0; j < i; ++j) - { - double d0 = random.nextDouble() * 6.0D + 3.0D; - double d1 = random.nextDouble() * 4.0D + 2.0D; - double d2 = random.nextDouble() * 6.0D + 3.0D; - double d3 = random.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D; - double d4 = random.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D; - double d5 = random.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D; - - for(int k = 1; k < 15; ++k) - { - for(int l = 1; l < 15; ++l) - { - for(int i1 = 1; i1 < 7; ++i1) - { - double d6 = ((double) k - d3) / (d0 / 2.0D); - double d7 = ((double) i1 - d4) / (d1 / 2.0D); - double d8 = ((double) l - d5) / (d2 / 2.0D); - double d9 = d6 * d6 + d7 * d7 + d8 * d8; - - if(d9 < 1.0D) - { - aboolean[(k * 16 + l) * 8 + i1] = true; - } - } - } - } - } - - for(j = 0; j < 16; ++j) - { - for(k1 = 0; k1 < 16; ++k1) - { - for(j1 = 0; j1 < 8; ++j1) - { - if(aboolean[(j * 16 + k1) * 8 + j1]) - { - world.getBlockAt(X + j, Y + j1, Z + k1).setType(j1 > 4 ? Material.AIR : block.getType()); - } - } - } - } - - for(j = 0; j < 16; ++j) - { - for(k1 = 0; k1 < 16; ++k1) - { - for(j1 = 4; j1 < 8; ++j1) - { - if(aboolean[(j * 16 + k1) * 8 + j1]) - { - int X1 = X + j; - int Y1 = Y + j1 - 1; - int Z1 = Z + k1; - if(world.getBlockAt(X1, Y1, Z1).getType() == Material.DIRT) - { - world.getBlockAt(X1, Y1, Z1).setType(Material.GRASS, false); - } - } - } - } - } - } - - f.end(); - timings.put(f.getMilliseconds()); - } - -} diff --git a/src/main/java/ninja/bytecode/iris/pop/PopulatorTrees.java b/src/main/java/ninja/bytecode/iris/pop/PopulatorTrees.java index 9cb280efe..c626ffb9c 100644 --- a/src/main/java/ninja/bytecode/iris/pop/PopulatorTrees.java +++ b/src/main/java/ninja/bytecode/iris/pop/PopulatorTrees.java @@ -16,7 +16,7 @@ import ninja.bytecode.shuriken.math.RollingSequence; public class PopulatorTrees extends BlockPopulator { public static RollingSequence timings = new RollingSequence(512); - + @Override public void populate(World world, Random random, Chunk source) {