SPIGOT-6064: world.getBiome() null Error

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-08-12 10:50:20 +10:00
parent 86bf456dfd
commit 6c307816d0
7 changed files with 26 additions and 15 deletions

View File

@@ -29,6 +29,7 @@ import org.bukkit.Chunk;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Registry;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
@@ -42,6 +43,7 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.CraftRayTraceResult;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
@@ -488,20 +490,20 @@ public class CraftBlock implements Block {
getWorld().setBiome(getX(), getY(), getZ(), bio);
}
public static Biome biomeBaseToBiome(BiomeBase base) {
public static Biome biomeBaseToBiome(IRegistry<BiomeBase> registry, BiomeBase base) {
if (base == null) {
return null;
}
return Biome.valueOf(RegistryGeneration.WORLDGEN_BIOME.getKey(base).getKey().toUpperCase(java.util.Locale.ENGLISH));
return Registry.BIOME.get(CraftNamespacedKey.fromMinecraft(registry.getKey(base)));
}
public static BiomeBase biomeToBiomeBase(Biome bio) {
public static BiomeBase biomeToBiomeBase(IRegistry<BiomeBase> registry, Biome bio) {
if (bio == null) {
return null;
}
return RegistryGeneration.WORLDGEN_BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
return registry.get(CraftNamespacedKey.toMinecraft(bio.getKey()));
}
@Override