Polyfrost / OneConfig

Next generation configuration library for Minecraft

Home Page:https://polyfrost.org/projects/oneconfig

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic config values

kingstefan26 opened this issue · comments

Why

currently, there are no ways to create fields and associated config options on runtime without class reloading,
the current annotation design is simple and well put together, but it breaks down when the project gets big. You end up with a massive class and all of your code ties back to one class

Why not

I can't really think how this would affect other parts of the code base in a meaningfully bad way, it would definitely be a advanced feature not intended for simple small mods

How it would look

I propose a api that would bypass the annotation part, and allow the dev to manually register an option, and retrieve its value. Something like config.registerOption(id, new Slider(min, max, name, category)) and then config.getOptionValue(id)

This would also allow devs to create their own abstracts around the config, like bundles of options that always go together could be created with one function call

Another downside i can think of is someone relying too much on oneconfigs internal structure, but that can be avoided with strong encapsulation and a stable API