Don't use delayed registries in impl anywhere (#11918)
This commit is contained in:
@@ -2,13 +2,14 @@ package org.bukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.FeatureFlag;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.packs.DataPack;
|
||||
import org.bukkit.util.OldEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -17,8 +18,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <p>
|
||||
* The Biomes listed in this interface are present in the default server
|
||||
* or can be enabled via a {@link FeatureFlag}.
|
||||
* There may be additional biomes present in the server, for example from a {@link DataPack}
|
||||
* which can be accessed via {@link Registry#BIOME}.
|
||||
* There may be additional biomes present in the server, for example from a {@link io.papermc.paper.datapack.Datapack}
|
||||
* which can be accessed via {@link io.papermc.paper.registry.RegistryAccess#getRegistry(RegistryKey)} and {@link RegistryKey#BIOME}.
|
||||
*/
|
||||
public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
|
||||
@@ -98,7 +99,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
|
||||
|
||||
@NotNull
|
||||
private static Biome getBiome(@NotNull String key) {
|
||||
return Registry.BIOME.getOrThrow(NamespacedKey.minecraft(key));
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.BIOME).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +114,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
|
||||
return Biome.CUSTOM;
|
||||
}
|
||||
|
||||
Biome biome = Bukkit.getUnsafe().get(Registry.BIOME, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Biome biome = Bukkit.getUnsafe().get(RegistryKey.BIOME, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Preconditions.checkArgument(biome != null, "No biome found with the name %s", name);
|
||||
return biome;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.block.banner;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -45,7 +46,7 @@ public class Pattern implements ConfigurationSerializable {
|
||||
PatternType patternType = PatternType.getByIdentifier(value);
|
||||
|
||||
if (patternType == null) {
|
||||
patternType = Bukkit.getUnsafe().get(Registry.BANNER_PATTERN, NamespacedKey.fromString(value));
|
||||
patternType = Bukkit.getUnsafe().get(RegistryKey.BANNER_PATTERN, NamespacedKey.fromString(value));
|
||||
}
|
||||
|
||||
Preconditions.checkNotNull(patternType, "Pattern type for key %s cannot be null", value);
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.bukkit.block.banner;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@@ -95,8 +97,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @return the matched pattern type or null
|
||||
* @see Registry#BANNER_PATTERN
|
||||
* @deprecated magic value, use {@link Registry#get(NamespacedKey)} instead
|
||||
* @deprecated magic value, use {@link Registry#get(NamespacedKey)} instead with {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}
|
||||
*/
|
||||
@Contract("null -> null")
|
||||
@Nullable
|
||||
@@ -117,7 +118,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
|
||||
|
||||
@NotNull
|
||||
private static PatternType getType(@NotNull String key) {
|
||||
return Registry.BANNER_PATTERN.getOrThrow(NamespacedKey.minecraft(key));
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.BANNER_PATTERN).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user