-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Added conditions to RegistriesDatapackGenerator #1216
base: 1.21.x
Are you sure you want to change the base?
Added conditions to RegistriesDatapackGenerator #1216
Conversation
…f conditional datapack registry objects.
97c59f9
to
7935929
Compare
|
I don't think that this works too well. The conditions should ideally be per-entry. |
Without changing too much of the machinery, the best idea I could think of for this is accepting a Map of ResourceKeys/ResourceLocations containing a list of the conditions for those records? Unsure of what else to do given how this generator works |
…oader.RegistryData
Yeah, I suppose that having a "builder" for the |
…structed using a builder.
I've gone ahead and switched this to use a map between ResourceKey and a list of conditions, instead of applying all conditions to the whole provider. Constructors are provided both to accept the map directly, or with a builder (I can make this strongly typed instead of a Consumer<BiConsumer<...>> if preferred). |
Could you write some tests for this? No need for crazy checks of course, just a bit of datagen code. I think it would be good to get a feel for the API on the datagen side. |
I'll look at doing that just now :) |
I've added some tests now that should demonstrate the behaviour :) |
e687124
to
e533321
Compare
Added the ability to pass a list of conditions into RegistriesDatapackGenerator (+ DatapackBuiltinEntriesProvider by extension) to allow generating conditional datapack registry objects.
This was the best was I could think of implementing this functionality whilst having the smallest impact on the patches, but please let me know if I've missed anything!