From db361cc42014f64000f931a482176c831d00e84e Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Fri, 9 Jun 2023 13:22:23 +0200
Subject: [PATCH] Wrong biome list for 1.19.4 if datapacks are not enabled
(#4016)
* Remove cherry grove for 1.20 below
* Handle PR feedback. Replace version check with registry check
* Simplify the biomes list
* Update Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
Co-authored-by: Hannes Greule
* Handle pr feedback
---------
Co-authored-by: Hannes Greule
---
.../bukkit/generator/BukkitPlotGenerator.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
index 767bcd375..da97ac621 100644
--- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
@@ -37,6 +37,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.HeightMap;
+import org.bukkit.Registry;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BiomeProvider;
@@ -48,9 +49,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Set;
+import java.util.stream.Collectors;
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper {
@@ -434,9 +437,9 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
private static final List BIOMES;
static {
- ArrayList biomes = new ArrayList<>(List.of(Biome.values()));
- biomes.remove(Biome.CUSTOM);
- BIOMES = List.copyOf(biomes);
+ BIOMES = Arrays.stream(Biome.values())
+ .filter(b -> Registry.BIOME.get(b.getKey()) != null)
+ .collect(Collectors.toList());
}
@Override