feat: improve error when loading biomes (#2241)

This commit is contained in:
Jordan
2023-06-04 17:50:08 +01:00
committed by GitHub
parent 0e215e98d5
commit e9fed5a066
5 changed files with 56 additions and 26 deletions

View File

@ -645,10 +645,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements
.registryAccess()
.ownedRegistryOrThrow(
Registry.BIOME_REGISTRY);
return biomeRegistry.stream()
.map(biomeRegistry::getKey).filter(Objects::nonNull)
.map(CraftNamespacedKey::fromMinecraft)
.collect(Collectors.toList());
List<ResourceLocation> keys = biomeRegistry.stream()
.map(biomeRegistry::getKey).filter(Objects::nonNull).toList();
List<NamespacedKey> namespacedKeys = new ArrayList<>();
for (ResourceLocation key : keys) {
try {
namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key));
} catch (IllegalArgumentException e) {
LOGGER.error("Error converting biome key {}", key.toString(), e);
}
}
return namespacedKeys;
}
@Override