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

Allow FabricCodecDataProvider to access dynamic registries #3522

Merged
merged 5 commits into from
Jan 28, 2024

Conversation

ErrorCraft
Copy link
Contributor

This PR allows FabricCodecDataProvider to access the dynamic registries if it is passed in the constructor. Now, I have a couple of issues with this implementation myself because I didn't want to cause a breaking change, the biggest one being that if you do not override the correct method in your subclass, it won't generate any files. Using the FabricCodecDataProvider#FabricCodecDataProvider(FabricDataOutput, CompletableFuture, DataOutput.OutputType, String, Codec)} constructor and then the FabricCodecDataProvider#configure(BiConsumer) method won't generate anything as it's never called.

This could all be avoided by always requiring a CompletableFuture<RegistryWrapper.WrapperLookup> in the constructor and by adding said RegistryWrapper.WrapperLookup to the configure method, but that would be a breaking change. We would end up with a much more graceful implementation though.

@deirn
Copy link
Member

deirn commented Jan 13, 2024

I'd argue that since the datagen module only used in dev, it's fine to break the API.

@modmuss50
Copy link
Member

I'd argue that since the datagen module only used in dev, it's fine to break the API.

No, I dont think this is a something we want to do. A few people actually use this in prod as well (for runtime resource gen)

@apple502j
Copy link
Contributor

I recommend breaking this in 1.20.5.

@deirn
Copy link
Member

deirn commented Jan 14, 2024

I'd argue that since the datagen module only used in dev, it's fine to break the API.

No, I dont think this is a something we want to do. A few people actually use this in prod as well (for runtime resource gen)

Interesting, I thought people uses different API for that. Still, I don't think the datagen module needs to follow the strict backwards compatibility promise as other modules.

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I always forget our stance on forRemoval I thought we generally didnt use it?

@modmuss50 modmuss50 added enhancement New feature or request last call If you care, make yourself heard right away! small change labels Jan 22, 2024
@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Jan 28, 2024
@modmuss50 modmuss50 merged commit 5c01334 into FabricMC:1.20.4 Jan 28, 2024
5 checks passed
modmuss50 pushed a commit that referenced this pull request Jan 28, 2024
* Add CompletableFuture to FabricCodecDataProvider

* Deprecate the old method and constructor, and fix the style

* Fix the style for real this time

* Add exceptions to the configure methods

* Apply suggestions from code review

---------

Co-authored-by: modmuss <modmuss50@gmail.com>

(cherry picked from commit 5c01334)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants