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

Support nested classes in Configs even if they're not inner static classes. Recursively finds all Comments from a root Config class. #21

Open
wants to merge 1 commit into
base: 1.18
Choose a base branch
from

Conversation

spoorn
Copy link

@spoorn spoorn commented Aug 1, 2022

Support nested classes in Configs even if they're not inner static classes. Recursively finds all Comments from a root Config class.

Fixes #22

Changes I made:

  • OmegaConfig properly traverses recursively from the root Config class all other classes referenced via Fields to recursively find comments. I needed this to support my own mod https://www.curseforge.com/minecraft/mc-mods/spoorn-bounty-mobs without putting all my configs into inner static classes, and changing variable names
    • Fixes comments being incorrect when multiple fields in the json have the same name, which can happen with nested classes
    • Nested classes in the root config no longer have to be an inner static class
    • Instead of the old behavior of recursing through declared classes, this now recurses through classes of each Field in the config, which should be more accurate (?)
  • Added a runTestMod gradle task under the fabric category that runs the Minecraft client with the testmod
    • This let me just click runTestMod to trigger creation of the configs in the testmod package. Not sure if you were doing this a different way, but I thought this made it pretty easy
  • Since runTestMod is now there, I added expected config files to the resources/ folder, and validate it against the run/config/ files, so triggering the runTestMod task automatically validates all configs are as expected
    • Also not sure if you had a different way of testing, but this also seemed to make it pretty easy to test

classes.  Recursively finds all Comments from a root Config class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant