From 05f501a66a775a52bd81d32a33f6e5513072817d Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Thu, 17 Oct 2019 09:44:03 -0400 Subject: [PATCH] f --- .../ninja/bytecode/iris/IrisGenerator.java | 58 ++++++++----------- .../bytecode/iris/gen/GenLayerBiome.java | 20 ++++++- .../ninja/bytecode/iris/util/RealBiome.java | 8 ++- 3 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/main/java/ninja/bytecode/iris/IrisGenerator.java b/src/main/java/ninja/bytecode/iris/IrisGenerator.java index 25ab48f03..0936c8238 100644 --- a/src/main/java/ninja/bytecode/iris/IrisGenerator.java +++ b/src/main/java/ninja/bytecode/iris/IrisGenerator.java @@ -2,12 +2,14 @@ package ninja.bytecode.iris; import java.util.Random; +import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.data.Bisected; import org.bukkit.block.data.Bisected.Half; import org.bukkit.block.data.BlockData; +import org.bukkit.util.Vector; import ninja.bytecode.iris.gen.GenLayerBase; import ninja.bytecode.iris.gen.GenLayerBiome; @@ -15,7 +17,6 @@ import ninja.bytecode.iris.gen.GenLayerDeepOcean; import ninja.bytecode.iris.gen.IGenLayer; import ninja.bytecode.iris.util.RealBiome; import ninja.bytecode.shuriken.collections.GList; -import ninja.bytecode.shuriken.math.M; import ninja.bytecode.shuriken.math.RNG; public class IrisGenerator extends ParallelChunkGenerator @@ -28,10 +29,22 @@ public class IrisGenerator extends ParallelChunkGenerator private GenLayerBiome glBiome; private GenLayerBase glBase; private int waterLevel = 127; + private GList updates = new GList<>(); + + public void doUpdates(Chunk c) + { + for(Vector i : updates) + { + c.getBlock(i.getBlockX(), i.getBlockY(), i.getBlockZ()).getState().update(true); + } + + updates.clear(); + } @Override public void onInit(World world, Random random) { + updates = new GList<>(); genLayers = new GList<>(); RNG rng = new RNG(world.getSeed()); genLayers.add(glBiome = new GenLayerBiome(world, random, rng.nextRNG())); @@ -59,11 +72,10 @@ public class IrisGenerator extends ParallelChunkGenerator public Biome genColumn(int wx, int wz, int x, int z) { int height = getHeight(wx, wz); - double temp = glBiome.getTemperature(wx, wz); - double humidity = glBiome.getHumidity(wx, wz); - RealBiome b = glBiome.getBiome(wx, wz); + double temp = glBiome.getTemperature(wx, wz, height); + RealBiome b = glBiome.getBiome(wx, wz, temp, height); boolean underwater = height < waterLevel; - + // Change biome to ocean / deep ocean if underwater height if(underwater) { @@ -142,36 +154,7 @@ public class IrisGenerator extends ParallelChunkGenerator // Surface blocks else if(i == height - 1) { - if(temp > 0.6 && b.getBiome().equals(Biome.BEACH)) - { - if(humidity > 0.6) - { - mb = Material.YELLOW_CONCRETE_POWDER.createBlockData(); - } - - else - { - mb = Material.BLACK_CONCRETE_POWDER.createBlockData(); - } - } - - else if(temp < 0.4 && b.getBiome().equals(Biome.BEACH)) - { - if(humidity > 0.6) - { - mb = Material.WHITE_CONCRETE_POWDER.createBlockData(); - } - - else - { - mb = Material.LIGHT_GRAY_CONCRETE_POWDER.createBlockData(); - } - } - - else - { - mb = b.surface(wx, i, wz, glBase); - } + mb = b.surface(wx, i, wz, glBase); } // Dirt Blocks @@ -223,6 +206,11 @@ public class IrisGenerator extends ParallelChunkGenerator return b.getBiome(); } + private void scheduleUpdate(int x, int y, int z) + { + updates.add(new Vector(x, y, z)); + } + public int pick(int max, double noise) { return (int) (noise * max); diff --git a/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java b/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java index 1f21b2552..7a47a88f7 100644 --- a/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java +++ b/src/main/java/ninja/bytecode/iris/gen/GenLayerBiome.java @@ -15,6 +15,7 @@ public class GenLayerBiome extends GenLayer private CNG humidity; private CNG hfracture; private CNG alt; + private CNG bfracture; private CNG height; private CNG superheight; @@ -30,6 +31,8 @@ public class GenLayerBiome extends GenLayer humidity = new CNG(rng.nextRNG(), 1, 2) .scale(0.0024) .fractureWith(new CNG(rng.nextRNG(), 1, 1).scale(0.06), 32); + bfracture = new CNG(rng.nextRNG(), 1, 1) + .scale(0.524); superheight = new CNG(rng.nextRNG(), 1, 8) .scale(0.0004) .fractureWith(new CNG(rng.nextRNG(), 1, 1).scale(0.021), 250); @@ -50,6 +53,11 @@ public class GenLayerBiome extends GenLayer { return RealBiome.match(getTemperature(x, z) * 2, getHumidity(x, z), getHeight(x, z), getAlt(x, z)); } + + public RealBiome getBiome(double x, double z, double temp, double height) + { + return RealBiome.match(temp * 2, getHumidity(x, z), height, getAlt(x, z)); + } private double getAlt(double x, double z) { @@ -58,7 +66,17 @@ public class GenLayerBiome extends GenLayer public double getTemperature(double x, double z) { - return M.clip(temperature.noise(x, z) - (getHeight(x, z) * 0.19), 0D, 1D); + return getTemperature(x, z, getHeight(x, z)); + } + + public double getTemperature(double x, double z, double height) + { + return M.clip(temperature.noise(x, z) - (height * 0.19), 0D, 1D); + } + + public double getBFracture(double x, double z) + { + return bfracture.noise(x, z); } public double getHumidity(double x, double z) diff --git a/src/main/java/ninja/bytecode/iris/util/RealBiome.java b/src/main/java/ninja/bytecode/iris/util/RealBiome.java index 1aead01ee..be8995a26 100644 --- a/src/main/java/ninja/bytecode/iris/util/RealBiome.java +++ b/src/main/java/ninja/bytecode/iris/util/RealBiome.java @@ -103,10 +103,13 @@ public class RealBiome .surface(Material.SAND.createBlockData(), Material.CLAY.createBlockData(), Material.GRAVEL.createBlockData()), new RealBiome(Biome.DEEP_WARM_OCEAN.ordinal(), 0.6, h, -1) .water() - .surface(Material.BRAIN_CORAL_BLOCK.createBlockData(), Material.FIRE_CORAL_BLOCK.createBlockData(), Material.HORN_CORAL_BLOCK.createBlockData(), Material.MAGMA_BLOCK.createBlockData(), Material.TUBE_CORAL_BLOCK.createBlockData(), Material.BRAIN_CORAL_BLOCK.createBlockData(), Material.BLUE_CONCRETE_POWDER.createBlockData(), Material.CYAN_CONCRETE_POWDER.createBlockData(), Material.LIGHT_BLUE_CONCRETE_POWDER.createBlockData(), Material.SAND.createBlockData()) - .surface(Material.SAND.createBlockData()) + .surface(Material.BRAIN_CORAL_BLOCK.createBlockData(), Material.FIRE_CORAL_BLOCK.createBlockData(), Material.HORN_CORAL_BLOCK.createBlockData(), Material.TUBE_CORAL_BLOCK.createBlockData(), Material.BRAIN_CORAL_BLOCK.createBlockData(), Material.BLUE_CONCRETE_POWDER.createBlockData(), Material.CYAN_CONCRETE_POWDER.createBlockData(), Material.LIGHT_BLUE_CONCRETE_POWDER.createBlockData(), Material.SAND.createBlockData()) .surface(Material.SEAGRASS.createBlockData(), 0.39) .surface(Material.TALL_SEAGRASS.createBlockData(), 0.52) + .surface(Material.MAGMA_BLOCK.createBlockData(), 0.003) + .surface(Material.SEA_LANTERN.createBlockData(), 0.003) + .surface(Material.SOUL_SAND.createBlockData(), 0.003) + .surface(Material.BRAIN_CORAL.createBlockData(), 0.09) .surface(Material.BRAIN_CORAL.createBlockData(), 0.09) .surface(Material.BUBBLE_CORAL.createBlockData(), 0.09) .surface(Material.FIRE_CORAL.createBlockData(), 0.09) @@ -116,7 +119,6 @@ public class RealBiome .surface(Material.BUBBLE_CORAL_FAN.createBlockData(), 0.05) .surface(Material.FIRE_CORAL_FAN.createBlockData(), 0.05) .surface(Material.HORN_CORAL_FAN.createBlockData(), 0.05) - .surface(Material.SEA_LANTERN.createBlockData(), 0.006) .surface(Material.TUBE_CORAL_FAN.createBlockData(), 0.05), new RealBiome(Biome.DEEP_LUKEWARM_OCEAN.ordinal(), 0.7, h, -1) .water()