From 3b90a58418902b4afe7d11fb196cf7483e7609f4 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Thu, 16 Jan 2020 01:49:19 -0500 Subject: [PATCH] Fixes for biome derivatives --- .../genobject/GenObjectDecorator.java | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java index 3e685a897..6af2e5db1 100644 --- a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java +++ b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java @@ -5,7 +5,6 @@ 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.Block; import org.bukkit.block.BlockFace; import org.bukkit.generator.BlockPopulator; @@ -26,20 +25,18 @@ import ninja.bytecode.shuriken.math.M; public class GenObjectDecorator extends BlockPopulator { - private GMap biomeMap; - private GMap> populationCache; + private GMap> populationCache; private IPlacer placer; + private IrisGenerator g; private ChronoLatch cl = new ChronoLatch(250); public GenObjectDecorator(IrisGenerator generator) { - biomeMap = new GMap<>(); + this.g = generator; populationCache = new GMap<>(); for(IrisBiome i : generator.getLoadedBiomes()) { - biomeMap.put(i.getRealBiome(), i); - GMap gc = new GMap<>(); for(String j : i.getSchematicGroups().k()) @@ -62,7 +59,7 @@ public class GenObjectDecorator extends BlockPopulator if(!gc.isEmpty()) { - populationCache.put(i.getRealBiome(), gc); + populationCache.put(i, gc); } } } @@ -74,26 +71,19 @@ public class GenObjectDecorator extends BlockPopulator { Random random = new Random(((source.getX() - 32) * (source.getZ() + 54)) + world.getSeed()); Iris.getController(TimingsController.class).started("decor"); - GSet hits = new GSet<>(); + GSet hits = new GSet<>(); for(int i = 0; i < Iris.settings.performance.decorationAccuracy; i++) { int x = (source.getX() << 4) + random.nextInt(16); int z = (source.getZ() << 4) + random.nextInt(16); - Biome biome = world.getBiome(x, z); + IrisBiome biome = g.getBiome(x, z); if(hits.contains(biome)) { continue; } - IrisBiome ibiome = biomeMap.get(biome); - - if(ibiome == null) - { - continue; - } - GMap objects = populationCache.get(biome); if(objects == null) @@ -102,7 +92,7 @@ public class GenObjectDecorator extends BlockPopulator } hits.add(biome); - populate(world, random, source, biome, ibiome, objects); + populate(world, random, source, biome, objects); } Iris.getController(TimingsController.class).stopped("decor"); @@ -114,7 +104,7 @@ public class GenObjectDecorator extends BlockPopulator } } - private void populate(World world, Random random, Chunk source, Biome biome, IrisBiome ibiome, GMap objects) + private void populate(World world, Random random, Chunk source, IrisBiome biome, GMap objects) { for(GenObjectGroup i : objects.k()) { @@ -125,7 +115,7 @@ public class GenObjectDecorator extends BlockPopulator Block b = world.getHighestBlockAt(x, z).getRelative(BlockFace.DOWN); Material t = b.getType(); - if(!t.isSolid() || !ibiome.isSurface(t)) + if(!t.isSolid() || !biome.isSurface(t)) { continue; }