Explicitly allow a null registry access
This commit is contained in:
parent
e8d8461e1d
commit
768416a51a
1 changed files with 6 additions and 5 deletions
|
@ -18,6 +18,7 @@ import net.minecraft.world.level.biome.Biomes;
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class BCLBiomeRegistry {
|
public class BCLBiomeRegistry {
|
||||||
public static final ResourceKey<Registry<BCLBiome>> BCL_BIOMES_REGISTRY =
|
public static final ResourceKey<Registry<BCLBiome>> BCL_BIOMES_REGISTRY =
|
||||||
|
@ -122,18 +123,18 @@ public class BCLBiomeRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BCLBiome get(ResourceLocation loc) {
|
public static BCLBiome get(ResourceLocation loc) {
|
||||||
return get(WorldBootstrap.getLastRegistryAccessOrElseBuiltin(), loc);
|
return get(WorldBootstrap.getLastRegistryAccess(), loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BCLBiome get(RegistryAccess access, ResourceLocation loc) {
|
public static BCLBiome get(@Nullable RegistryAccess access, ResourceLocation loc) {
|
||||||
return getBclBiomesRegistry(access).get(loc);
|
return getBclBiomesRegistry(access).get(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BCLBiome getOrElseEmpty(ResourceLocation loc) {
|
public static BCLBiome getOrElseEmpty(ResourceLocation loc) {
|
||||||
return getOrElseEmpty(WorldBootstrap.getLastRegistryAccessOrElseBuiltin(), loc);
|
return getOrElseEmpty(WorldBootstrap.getLastRegistryAccess(), loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BCLBiome getOrElseEmpty(RegistryAccess access, ResourceLocation loc) {
|
public static BCLBiome getOrElseEmpty(@Nullable RegistryAccess access, ResourceLocation loc) {
|
||||||
BCLBiome res = get(access, loc);
|
BCLBiome res = get(access, loc);
|
||||||
if (res == null) return EMPTY_BIOME;
|
if (res == null) return EMPTY_BIOME;
|
||||||
return res;
|
return res;
|
||||||
|
@ -151,7 +152,7 @@ public class BCLBiomeRegistry {
|
||||||
.map(e -> e.getKey());
|
.map(e -> e.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Registry<BCLBiome> getBclBiomesRegistry(RegistryAccess access) {
|
private static Registry<BCLBiome> getBclBiomesRegistry(@Nullable RegistryAccess access) {
|
||||||
if (access != null) {
|
if (access != null) {
|
||||||
return access
|
return access
|
||||||
.registry(BCLBiomeRegistry.BCL_BIOMES_REGISTRY)
|
.registry(BCLBiomeRegistry.BCL_BIOMES_REGISTRY)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue