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

Code Generation for TypedKeys #9233

Merged
merged 1 commit into from
Nov 23, 2023
Merged

Code Generation for TypedKeys #9233

merged 1 commit into from
Nov 23, 2023

Conversation

Machine-Maker
Copy link
Member

@Machine-Maker Machine-Maker commented May 28, 2023

Currently includes generated key holder classes for types
used in the Registry Modification API

Tasks

Preview Give feedback

I think its acceptable that this is a manual thing, and the generated code just goes into a patch file, rather than being created for each applyPatches. Once we have source in repo, it won't be a large patch. Its also just one less build step


The reason why this is needed, and really should only be used in conjunction with the Registry Modification API, is that you have to specify the key of any value you want to modify, but you cannot use the API object itself to get the key, like for GameEvent. If you wanted to modify the range of a specific GameEvent, you can't get the key from GameEvent.BLOCK_OPEN.getKey(), because the Registry Modification API runs before those objects can be created. So doing that will throw an exception. So we have GameEventKeys which will hold some sort of TypedKey object that you can use instead. Of course for custom ones, you can create your own keys.

@Owen1212055
Copy link
Member

I'm curious, is there any better way to have auto-generated files in some sort of their own module that can be merged with the API one, therefore doesn't need to use the patch system? Not sure tho.

@MiniDigger
Copy link
Member

MiniDigger commented May 31, 2023

dependencies are gonna be fun if we do that
we could have a different source set tho I guess and commit the files from that source set? generally agree that this is a bit meh

@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 2 times, most recently from 4da5e26 to 35dd374 Compare June 4, 2023 21:30
@electronicboy
Copy link
Member

Looking at this so far, no real qualms against it, and generally looks like what I'd expect in regards to output, etc; only thing is the create methods, I'm guessing that there is still a bit of wiring up to do there

@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 3 times, most recently from bd161b8 to ca10f05 Compare June 9, 2023 18:40
Copy link
Member

@MiniDigger MiniDigger left a comment

Choose a reason for hiding this comment

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

needs paperweight release and RegistryKey PR, but looks good to me

@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch from ca10f05 to d331027 Compare June 27, 2023 02:01
@Machine-Maker Machine-Maker marked this pull request as ready for review June 27, 2023 02:02
@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch from d331027 to b39c29d Compare July 16, 2023 21:11
@Owen1212055 Owen1212055 mentioned this pull request Jul 23, 2023
19 tasks
@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 3 times, most recently from 50f4743 to e11fab5 Compare September 24, 2023 19:41
@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 4 times, most recently from adea1f6 to f0be001 Compare November 15, 2023 01:07
@Owen1212055 Owen1212055 force-pushed the feature/key-generation branch from f0be001 to 4763950 Compare November 18, 2023 23:24
@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 2 times, most recently from 5ae6266 to ee5f94a Compare November 23, 2023 02:55
@Machine-Maker Machine-Maker force-pushed the feature/key-generation branch 2 times, most recently from ba70fdf to c86bba7 Compare November 23, 2023 04:45
Currently includes generated key holder classes for types
used in the Registry Modification API
@Machine-Maker Machine-Maker changed the title Code Generation Code Generation for TypedKeys Nov 23, 2023
@Machine-Maker Machine-Maker merged commit 96d5e6c into master Nov 23, 2023
@Machine-Maker Machine-Maker deleted the feature/key-generation branch November 23, 2023 04:56
lynxplay pushed a commit to lynxplay/paper that referenced this pull request Feb 23, 2024
Currently includes generated key holder classes for types
used in the Registry Modification API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

5 participants