From 9ec0e7f0cb660b6e27dde18420ce6d583c032ee1 Mon Sep 17 00:00:00 2001 From: Treer Date: Sun, 17 Jun 2018 03:26:46 +1000 Subject: [PATCH] Fix #17, v6 biomes Vonoroi at altitude=1 has biome overlap --- src/main/java/amidst/gui/voronoi/VoronoiPanel.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/amidst/gui/voronoi/VoronoiPanel.java b/src/main/java/amidst/gui/voronoi/VoronoiPanel.java index d273e8c6..af03ec7a 100644 --- a/src/main/java/amidst/gui/voronoi/VoronoiPanel.java +++ b/src/main/java/amidst/gui/voronoi/VoronoiPanel.java @@ -337,7 +337,17 @@ public class VoronoiPanel extends JPanel { if (biomeProfile != null) for (IBiome biome : biomeProfile.allBiomes()) { MinetestBiome mtBiome = (MinetestBiome)biome; if (altitude <= (mtBiome.y_max + mtBiome.vertical_blend) && altitude >= mtBiome.y_min) { - newBiomes.add(mtBiome); + // We have a new biome to add, check whether the heat/humidity point is already occupied + // (When Minetest looks for the closest biome to a heat/humidity point, it iterates through + // the biomes in order, and ignores any matches that are not better than previous matches) + boolean alreadyOccupied = false; + for (MinetestBiome existingBiome : newBiomes) { + if (existingBiome.heat_point == mtBiome.heat_point && existingBiome.humidity_point == mtBiome.humidity_point) { + alreadyOccupied = true; + break; + } + } + if (!alreadyOccupied) newBiomes.add(mtBiome); } }