Configuration

Configuration

2M Downloads

Setup/usage Confusion

DePhoegon opened this issue ยท 7 comments

commented

I don't know what I'm doing wrong, but while it gets up & going with the assigned default values. It creates the config file as expected except it doesn't put the config values in.
https://github.com/DePhoegon/delchoco-fabric/blob/master/src/main/java/com/dephoegon/delchoco/DelChoco.java

I also have another setup i think in the same way (or atleast I am lost at the difference functionally speaking)
https://github.com/DePhoegon/delbase-fabric/blob/main/src/main/java/com/dephoegon/delbase/Delbase.java

It now creates and saves the values it has..

Also, I would genuinely like to actually have some sort of comment near the config if possible within the file, but as to how I am actually a bit lost.

I've seriously been having nasty luck with fabric and files. it's honestly getting on my nerves to almost no and I keep runing into issues that seem to make no sense and change how they behave... though I am sure it's something i am doing seemingly unrelated to it but I honestly just don't know.

commented

Regarding the missing values in config - that is caused by missing @Configurable annotation on the config fields, but this is present in the second example you have provided. You can also look at implementation in one of my mods.

Also, I would genuinely like to actually have some sort of comment near the config if possible within the file, but as to how I am actually a bit lost.

Could you please expand little bit on this question? I'm not exactly sure what feature you are looking for

commented

What I mean is that like for the one that outputting the values. { "stationCraftTime": 50, "woodSalvageRolls": 2, "stoneSalvageRolls": 2, "netherriteBonusRolls": 2, "netherriteChestDiamondBonus": 3, "netherriteHelmetDiamondBonus": 2, "netherriteLeggingsDiamondBonus": 3, "netherriteBootsDiamondBonus": 1, "netherriteSwordDiamondBonus": 1, "netherriteAxeDiamondBonus": 1, "netherritePickAxeDiamondBonus": 1 } It doesn't put in comments in the file. (or I'm just not understanding what the point of the @Configurable.Comment() is meant to be)

I was hoping that I could get the comments a line under or above the value they are for.

commented

JSON fileformat does not support comments (atleast the JSON version used by Minecraft natively), therefore with JSON format you will never have comments in the config file. However the comments will be always visible in GUI.

If you want the comments in file, I suggest you to use the .yaml config format

commented

Just 1 Last thing. I'm entirely unsure if I've stored the Floats correctly and if double in range was valid option. also what GUI? also will the range enforce the limit I assumed it would?

commented

Yes, using the @DecimalRange is correct for Double and Float datatypes. And yes, of course it will enforce the ranges. In GUI it will show error when entering value outside of the range and otherwise it will log warning in console and correct the value

commented

That's good to hear, but ... I've not seen anything extra GUI wise, past JEI I have to admit I'm confused about that. Though at the very least I have something to work forward. Have a good day X}

commented

If you are using Fabric then I believe you also need the ModMenu mod, which adds configuration buttons for mods which support it. Forge has it by default inside Mods screen