11package world .bentobox .boxed .generators .biomes ;
22
33import java .io .File ;
4- import java .util .Arrays ;
54import java .util .Collections ;
65import java .util .EnumMap ;
76import java .util .List ;
1110import java .util .SortedMap ;
1211import java .util .TreeMap ;
1312
13+ import org .bukkit .Registry ;
1414import org .bukkit .World .Environment ;
1515import org .bukkit .block .Biome ;
1616import org .bukkit .block .BlockFace ;
2121import org .bukkit .util .Vector ;
2222import org .eclipse .jdt .annotation .NonNull ;
2323
24- import com .google .common .base .Enums ;
25-
2624import world .bentobox .boxed .Boxed ;
2725
2826/**
@@ -1129,7 +1127,7 @@ Biome getBeachBiome(int t) {
11291127 }
11301128
11311129 public static double convertToY (double x ) {
1132- x = Math .max (- 1 , Math . min ( 1 , x )); // Clamp value
1130+ x = Math .clamp ( x , - 1 , 1 );
11331131 if (x >= -1 && x < -0.5 ) {
11341132 return 2 * x + 1 ;
11351133 } else if (x >= -0.5 && x < 0 ) {
@@ -1196,7 +1194,7 @@ private Biome getMappedBiome(WorldInfo worldInfo, int x, int y, int z, BiomePara
11961194 @ Override
11971195 public List <Biome > getBiomes (WorldInfo worldInfo ) {
11981196 // Return all of them for now!
1199- return Arrays . stream (Biome . values () ).filter (b -> !b .equals (Biome .CUSTOM )).toList ();
1197+ return Registry . BIOME . stream ().filter (b -> !b .equals (Biome .CUSTOM )).toList ();
12001198 }
12011199
12021200 /**
@@ -1215,7 +1213,7 @@ private SortedMap<Double, Biome> loadQuad(YamlConfiguration config, String secto
12151213 if (split .length == 2 ) {
12161214 try {
12171215 double d = Double .parseDouble (split [0 ]);
1218- Biome biome = Enums . getIfPresent ( Biome .class , split [1 ].toUpperCase (Locale .ENGLISH )). orNull ( );
1216+ Biome biome = Biome .valueOf ( split [1 ].toUpperCase (Locale .ENGLISH ));
12191217 if (biome == null ) {
12201218 addon .logError (split [1 ].toUpperCase (Locale .ENGLISH ) + " is an unknown biome on this server." );
12211219 result .put (d , Biome .CUSTOM );
0 commit comments