2023-02-28 03:28:39 +01:00
--- a/net/minecraft/server/ReloadableServerRegistries.java
+++ b/net/minecraft/server/ReloadableServerRegistries.java
2023-02-28 03:28:39 +01:00
@@ -50,8 +50,9 @@
);
HolderLookup.Provider provider = HolderLookup.Provider.create(list.stream());
RegistryOps<JsonElement> registryOps = provider.createSerializationContext(JsonOps.INSTANCE);
+ final io.papermc.paper.registry.data.util.Conversions conversions = new io.papermc.paper.registry.data.util.Conversions(registryOps.lookupProvider); // Paper
List<CompletableFuture<WritableRegistry<?>>> list2 = LootDataType.values()
- .map(type -> scheduleRegistryLoad((LootDataType<?>)type, registryOps, resourceManager, prepareExecutor))
+ .map(type -> scheduleRegistryLoad((LootDataType<?>)type, registryOps, resourceManager, prepareExecutor, conversions)) // Paper
.toList();
CompletableFuture<List<WritableRegistry<?>>> completableFuture = Util.sequence(list2);
return completableFuture.thenApplyAsync(
2024-06-20 18:40:57 +02:00
@@ -60,14 +61,15 @@
2023-02-28 03:28:39 +01:00
}
private static <T> CompletableFuture<WritableRegistry<?>> scheduleRegistryLoad(
- LootDataType<T> type, RegistryOps<JsonElement> ops, ResourceManager resourceManager, Executor prepareExecutor
+ LootDataType<T> type, RegistryOps<JsonElement> ops, ResourceManager resourceManager, Executor prepareExecutor, io.papermc.paper.registry.data.util.Conversions conversions // Paper
2023-02-28 03:28:39 +01:00
) {
return CompletableFuture.supplyAsync(() -> {
WritableRegistry<T> writableRegistry = new MappedRegistry<>(type.registryKey(), Lifecycle.experimental());
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerReloadableRegistry(type.registryKey(), writableRegistry); // Paper - register reloadable registry
Map<ResourceLocation, T> map = new HashMap<>();
SimpleJsonResourceReloadListener.scanDirectory(resourceManager, type.registryKey(), ops, type.codec(), map);
2023-02-28 03:28:39 +01:00
- map.forEach((id, value) -> writableRegistry.register(ResourceKey.create(type.registryKey(), id), (T)value, DEFAULT_REGISTRATION_INFO));
2024-06-20 18:40:57 +02:00
- TagLoader.loadTagsForRegistry(resourceManager, writableRegistry);
2023-02-28 03:28:39 +01:00
+ map.forEach((id, value) -> io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.registerWithListeners(writableRegistry, ResourceKey.create(type.registryKey(), id), value, DEFAULT_REGISTRATION_INFO, conversions)); // Paper - register with listeners
2024-06-20 18:40:57 +02:00
+ TagLoader.loadTagsForRegistry(resourceManager, writableRegistry, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD); // Paper - tag life cycle - reload
2023-02-28 03:28:39 +01:00
return writableRegistry;
}, prepareExecutor);
2024-06-20 18:40:57 +02:00
}