Fixes CompatibleBiome#isCompatible and #getBiome

`#isCompatible` always returned true and `#getBiome` could result in an Exception because of biomes not having any version information configured (silencing it should not be the way to go but Minecraft 1.18 updates \o/)
This commit is contained in:
Christian Koop 2021-12-10 19:35:30 +01:00
parent 7f055c4391
commit 070f1adee7
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -170,10 +170,7 @@ public enum CompatibleBiome {
}
public boolean isCompatible() {
Version version = versions.getLast();
ServerVersion.isServerVersionAtLeast(version.version);
return true;
return getBiome() != null;
}
public List<Version> getVersions() {
@ -181,10 +178,13 @@ public enum CompatibleBiome {
}
public Biome getBiome() {
for (Version version : versions) {
if (ServerVersion.isServerVersionAtLeast(version.version)) {
return Biome.valueOf(version.biome);
try {
for (Version version : versions) {
if (ServerVersion.isServerVersionAtLeast(version.version)) {
return Biome.valueOf(version.biome);
}
}
} catch (IllegalArgumentException ignore) { // This means the supporter biome server version is wrongly configured
}
return null;