From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ishland <ishlandmc@yeah.net>
Date: Sun, 23 Aug 2020 10:57:44 +0200
Subject: [PATCH] Fix MC-197271
Update 1.17: Fixed in openj9-0.23.0-m2 release
This patch only fixes an issue for servers running OpenJ9.

resolved https://bugs.mojang.com/browse/MC-197271

diff --git a/src/main/java/net/minecraft/data/BuiltinRegistries.java b/src/main/java/net/minecraft/data/BuiltinRegistries.java
index d64cebb4431664762a14670c7d9d782dd7894ed5..0c403ea85f7ea20f2f978e06313f8675abf204b6 100644
--- a/src/main/java/net/minecraft/data/BuiltinRegistries.java
+++ b/src/main/java/net/minecraft/data/BuiltinRegistries.java
@@ -48,11 +48,11 @@ public class BuiltinRegistries {
     public static final Registry<StructureProcessorList> PROCESSOR_LIST = registerSimple(Registry.PROCESSOR_LIST_REGISTRY, () -> {
         return ProcessorLists.b;
     });
-    public static final Registry<StructureTemplatePool> TEMPLATE_POOL = registerSimple(Registry.TEMPLATE_POOL_REGISTRY, Pools::bootstrap);
+    public static final Registry<StructureTemplatePool> TEMPLATE_POOL = registerSimple(Registry.TEMPLATE_POOL_REGISTRY, () -> Pools.bootstrap()); // Paper - MC-197271
     public static final Registry<Biome> BIOME = registerSimple(Registry.BIOME_REGISTRY, () -> {
         return Biomes.PLAINS;
     });
-    public static final Registry<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = registerSimple(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY, NoiseGeneratorSettings::bootstrap);
+    public static final Registry<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = registerSimple(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY, () -> NoiseGeneratorSettings.bootstrap()); // Paper - MC-197271
 
     private static <T> Registry<T> registerSimple(ResourceKey<? extends Registry<T>> registryRef, Supplier<T> defaultValueSupplier) {
         return registerSimple(registryRef, Lifecycle.stable(), defaultValueSupplier);
@@ -66,9 +66,9 @@ public class BuiltinRegistries {
         ResourceLocation minecraftkey = registryRef.location();
 
         BuiltinRegistries.LOADERS.put(minecraftkey, defaultValueSupplier);
-        WritableRegistry<R> iregistrywritable = BuiltinRegistries.WRITABLE_REGISTRY;
+        WritableRegistry<R> iregistrywritable = (WritableRegistry<R>) BuiltinRegistries.WRITABLE_REGISTRY; // Paper - decompile fix
 
-        return (WritableRegistry) iregistrywritable.register(registryRef, (Object) registry, lifecycle);
+        return (R) iregistrywritable.register((ResourceKey<R>) registryRef, registry, lifecycle); // Paper - decompile fix
     }
 
     public static <T> T register(Registry<? super T> registry, String id, T object) {
@@ -76,11 +76,11 @@ public class BuiltinRegistries {
     }
 
     public static <V, T extends V> T register(Registry<V> registry, ResourceLocation id, T object) {
-        return ((WritableRegistry) registry).register(ResourceKey.create(registry.key(), id), object, Lifecycle.stable());
+        return (T) ((WritableRegistry) registry).register(ResourceKey.create(registry.key(), id), object, Lifecycle.stable()); // Paper - decompile fix
     }
 
     public static <V, T extends V> T registerMapping(Registry<V> iregistry, int rawId, ResourceKey<V> resourcekey, T object) {
-        return ((WritableRegistry) iregistry).registerMapping(rawId, resourcekey, object, Lifecycle.stable());
+        return (T) ((WritableRegistry) iregistry).registerMapping(rawId, resourcekey, object, Lifecycle.stable()); // Paper - decompile fix
     }
 
     public static void bootstrap() {}
