Fabric API

Fabric API

108M Downloads

Resource reloaders are context-less

Gaming32 opened this issue ยท 2 comments

commented

Problem

Vanilla's resource reloaders are constructed anew on each reload get access to some context, notably the parameters to DataPackContents. Since 1.20.5, I need access to the RegistryWrapper.WrapperLookup for deserialization context.

Potential Solution

Instead of just having a global list of pre-created of resource loaders, create an event to register reload listeners with context arguments passed in (ideally the DataPackContents and RegistryWrapper.WrapperLookup). This would be similar to fabric-networking-api, where both global and context-based receivers may be registered.

commented

#3083 This PR has been shelved since 1.20, maybe someone wants to revive that?

In the meantime, I have to inject the reloaders myself, which doesn't sound very safe. (I'm not even sure if reloaders are sorted by the resource loader) DataPackContentsMixin

commented

Reloaders added not through the API will always be grouped where they're added. Any reloaders added by the API are sorted and inserted after all other reloaders.