Team-Resourceful / Resourceful-Config

MIT License
4 stars 1 forks source link

[Bug]: Config reverses the order of @Category entries #13

Closed CammiePone closed 5 months ago

CammiePone commented 5 months ago

Bug Description

When a config contains multiple @Category entries, the json generates them in the reverse order they're made within the config class.

Config class (selfShapeProperties is the very first category, with touchShapeProperties being the second): image

Generated config jsonc (selfShapeProperties is now at the bottom, with touchShapeProperties just above it): image

How to Reproduce?

  1. create a config
  2. added multiple categories
  3. register config
  4. run game to generate the config file

Expected Behavior

@Category entries would be generated in the same order they're created, like @ConfigEntry entries are

Version

2.1.1

Mod Loader Version

Quilt Loader 1.20.1 - 0.20.2

Mod Loader

No response

Logs or additional context

No response

ThatGravyBoat commented 5 months ago

can you show me the part where you do the @InlineCategory annotations and fields? because thats how it orders the categories and fields.

CammiePone commented 5 months ago

im just using @Category, not @InlineCategory

CammiePone commented 5 months ago

here, did a quick push so i could show the whole config class: https://github.com/Up-Mods/Arcanus-Continuum/blob/7cf61f2d00a8c45926e4556b4f0eaac1fefc84fc/src/main/java/dev/cammiescorner/arcanuscontinuum/ArcanusConfig.java

and here's what the full config json looks like: https://pastebin.com/PZ5WmVC2

ThatGravyBoat commented 5 months ago

oh okay, I do just pull the declared classes in java so ill have to see how the jvm is doing that to see if this is something that is common across all of them.

CammiePone commented 5 months ago

alrighty! so far im liking Resourceful Config, and this is ultimately just a small issue so it's not a big deal <3

ThatGravyBoat commented 5 months ago

Okay for now as a temporary fix in the 1.20.1 versions I have added the sortOrder parameter for category annotation.

In 1.20.4 categories will be defined in the config annotation itself as to define the order without trying to infer as JDKs do not have a standard they have to follow for such a situation so on different jvms it can be in different orders.