--- a/net/minecraft/server/ReloadableServerRegistries.java +++ b/net/minecraft/server/ReloadableServerRegistries.java @@ -48,8 +_,9 @@ List> list = TagLoader.buildUpdatedLookups(registryAccess.getAccessForLoading(RegistryLayer.RELOADABLE), postponedTags); HolderLookup.Provider provider = HolderLookup.Provider.create(list.stream()); RegistryOps 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>> list1 = LootDataType.values() - .map(lootDataType -> scheduleRegistryLoad((LootDataType)lootDataType, registryOps, resourceManager, backgroundExecutor)) + .map(lootDataType -> scheduleRegistryLoad((LootDataType)lootDataType, registryOps, resourceManager, backgroundExecutor, conversions)) // Paper .toList(); CompletableFuture>> completableFuture = Util.sequence(list1); return completableFuture.thenApplyAsync( @@ -58,19 +_,20 @@ } private static CompletableFuture> scheduleRegistryLoad( - LootDataType lootDataType, RegistryOps ops, ResourceManager resourceManager, Executor backgroundExecutor + LootDataType lootDataType, RegistryOps ops, ResourceManager resourceManager, Executor backgroundExecutor, io.papermc.paper.registry.data.util.Conversions conversions // Paper ) { return CompletableFuture.supplyAsync( () -> { WritableRegistry writableRegistry = new MappedRegistry<>(lootDataType.registryKey(), Lifecycle.experimental()); + io.papermc.paper.registry.PaperRegistryAccess.instance().registerReloadableRegistry(lootDataType.registryKey(), writableRegistry); // Paper - register reloadable registry Map map = new HashMap<>(); SimpleJsonResourceReloadListener.scanDirectory(resourceManager, lootDataType.registryKey(), ops, lootDataType.codec(), map); map.forEach( - (resourceLocation, object) -> writableRegistry.register( - ResourceKey.create(lootDataType.registryKey(), resourceLocation), (T)object, DEFAULT_REGISTRATION_INFO + (resourceLocation, object) -> io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.registerWithListeners(writableRegistry, // Paper - register with listeners + ResourceKey.create(lootDataType.registryKey(), resourceLocation), (T)object, DEFAULT_REGISTRATION_INFO, conversions // Paper - register with listeners ) ); - TagLoader.loadTagsForRegistry(resourceManager, writableRegistry); + TagLoader.loadTagsForRegistry(resourceManager, writableRegistry, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD); // Paper - tag life cycle - reload return writableRegistry; }, backgroundExecutor