[1.21] How to obtain registry access instance for data pack reload listeners registered to `ResourceManagerHelper`?
Fuzss opened this issue ยท 3 comments
A lot of data pack reload listeners such as for recipes, tags, and loot tables in vanilla require a registry access instance for decorating JsonOps
when deserializing JsonElement
s.
Personally my JsonElement
s contain item references. How can I obtain a registry access instance for deserializing those elements?
The equivalent NeoForge event provides the necessary RegistryAccess
instance: https://github.com/neoforged/NeoForge/blob/1.21.x/src/main/java/net/neoforged/neoforge/event/AddReloadListenerEvent.java
Resource reload events are in need of big refactors - for now use ServerLifecycleEvents.
Which event in ServerLifecycleEvents
would that be?
I tried ServerLifecycleEvents.SERVER_STARTING
, ServerLifecycleEvents.SERVER_STARTED
, and ServerLifecycleEvents.START_DATA_PACK_RELOAD
and all run after the server resource manager has already reloaded all listeners. Tested on both a dedicated server and joining a singleplayer world.