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

Added conditions to RegistriesDatapackGenerator #1216

Open
wants to merge 5 commits into
base: 1.21.x
Choose a base branch
from

Conversation

Rover656
Copy link
Contributor

@Rover656 Rover656 commented Jul 2, 2024

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!

@Rover656 Rover656 force-pushed the feat/conditional-datapack-registry branch from 97c59f9 to 7935929 Compare July 2, 2024 21:54
@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@Technici4n
Copy link
Member

I don't think that this works too well. The conditions should ideally be per-entry.

@Rover656
Copy link
Contributor Author

Rover656 commented Jul 2, 2024

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

@Technici4n
Copy link
Member

Yeah, I suppose that having a "builder" for the ResourceKey -> ICondition[] mapping is not too bad.

@Rover656
Copy link
Contributor Author

Rover656 commented Jul 2, 2024

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).

@Technici4n
Copy link
Member

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.
(Note: I haven't looked at it yet).

@Rover656
Copy link
Contributor Author

Rover656 commented Jul 3, 2024

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. (Note: I haven't looked at it yet).

I'll look at doing that just now :)

@Rover656
Copy link
Contributor Author

Rover656 commented Jul 3, 2024

I've added some tests now that should demonstrate the behaviour :)

@Rover656 Rover656 force-pushed the feat/conditional-datapack-registry branch from e687124 to e533321 Compare July 3, 2024 21:28
@Matyrobbrt Matyrobbrt added enhancement New (or improvement to existing) feature or request 1.21 Targeted at Minecraft 1.21 data driven This request involves a data driven system labels Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21 Targeted at Minecraft 1.21 data driven This request involves a data driven system enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants