Allow only using getRegistryName

This commit is contained in:
shedaniel
2020-11-07 18:24:16 +08:00
parent 0eec3e7108
commit 87b5dcf7d9
2 changed files with 24 additions and 10 deletions

View File

@@ -53,7 +53,7 @@ public final class Registries {
* Fabric: Use registry
*/
@Nullable
public static <T> ResourceLocation getId(T object, ResourceKey<net.minecraft.core.Registry<T>> fallback) {
public static <T> ResourceLocation getId(T object, @Nullable ResourceKey<net.minecraft.core.Registry<T>> fallback) {
return IMPL.getId(object, fallback);
}
@@ -63,10 +63,20 @@ public final class Registries {
*/
@Nullable
@Deprecated
public static <T> ResourceLocation getId(T object, net.minecraft.core.Registry<T> fallback) {
public static <T> ResourceLocation getId(T object, @Nullable net.minecraft.core.Registry<T> fallback) {
return IMPL.getId(object, fallback);
}
/**
* Forge: If the object is {@code IForgeRegistryEntry}, use `getRegistryName`, else null
* Fabric: null
*/
@Deprecated
@Nullable
public static <T> ResourceLocation getRegistryName(T object) {
return IMPL.getId(object, (ResourceKey<net.minecraft.core.Registry<T>>) null);
}
public interface Impl {
RegistryProvider get(String modId);