Closed SizableShrimp closed 4 years ago
@SizableShrimp
Thank you for this - I am reviewing this over this weekend,
This brings up a thing we should address in this project, Code Style, at the moment nothing is enforced and quite a lot of the changes in this PR is around style changes so I will look at adding a code style to the project again :)
@SizableShrimp Can you please open up the PR to allow me to make edits? I have fixed the merge conflicts that I have introduced with applying the style changes.
This would hopefully make it easier to review :)
Thank you
@KasperFranz I have already enabled allowing edits by maintainers. You should already be able to push commits to SizableShrimp/sponge-7
.
@SizableShrimp All looks good, If we want to add new items to it, it is just as simple as adding to the correct nodes?
Thanks
Yes. You annotate the field in question with @Setting
to notify Configurate that it is a field you want the ObjectMapper to track. You can change the location of the setting by changing the value field on the annotation, along with adding a comment.
For multi-level structures, you must create node classes that are annotated with @ConfigSerializable
along with any fields you want to store in the config annotated with @Setting
. The value of the field becomes the default value if it doesn't yet exist in the config, otherwise it is overwritten if a value in the config does exist.
All of this I found through the Sponge wiki section of Configurate. The Transformations
class is also what is used if you want to move around config nodes or force update a comment or other stuff. So that is another useful feature that I used to move the item
section to Items
and rename the field to Selector
. Configurate is really powerful!
Yes, That seems very powerful.
Thank you for taking the time to create this PR - It will be out with release 3.9
This pull request entirely refactors the config section of BetterChunkLoader. In the old version, default values had to be repeated twice in the code to be functional. This PR properly implements classes that uses the full power of Configurate with comments, default values, and more. When Configurate 4.0 is released, it might be beneficial to upgrade using a relocated shaded resource of Configurate 4.0. This PR just uses Configurate 3.6 included with SpongeAPI 7.1.0.
This has been tested and confirmed to work. Contact me on this thread or on the Discord server at SizableShrimp#0755 for questions.