diff --git a/patches/server/Add-RegistryAccess-for-managing-Registries.patch b/patches/server/Add-RegistryAccess-for-managing-Registries.patch index bde3b899be..b1b83d7c1a 100644 --- a/patches/server/Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/Add-RegistryAccess-for-managing-Registries.patch @@ -213,10 +213,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated(forRemoval = true) + @Override + public @Nullable Registry getRegistry(final Class type) { -+ final RegistryKey registryKey; -+ final @Nullable RegistryEntry entry; -+ registryKey = requireNonNull(byType(type), () -> type + " is not a valid registry type"); -+ entry = PaperRegistries.getEntry(registryKey); ++ final @Nullable RegistryKey registryKey = byType(type); ++ // If our mapping from Class -> RegistryKey did not contain the passed type it was either a completely invalid type or a registry ++ // that merely exists as a SimpleRegistry in the org.bukkit.Registry type. We cannot return a registry for these, return null ++ // as per method contract in Bukkit#getRegistry. ++ if (registryKey == null) return null; ++ ++ final @Nullable RegistryEntry entry = PaperRegistries.getEntry(registryKey); + final @Nullable RegistryHolder registry = (RegistryHolder) this.registries.get(registryKey); + if (registry != null) { + // if the registry exists, return right away. Since this is the "legacy" method, we return DelayedRegistry