Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource reloaders are context-less #3724

Open
Gaming32 opened this issue Apr 20, 2024 · 2 comments
Open

Resource reloaders are context-less #3724

Gaming32 opened this issue Apr 20, 2024 · 2 comments

Comments

@Gaming32
Copy link

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.

@melontini
Copy link

#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

@Gaming32
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants