Skip to content

GUI support for ct configs#126

Open
Nischhelm wants to merge 2 commits intofriendlyhj:masterfrom
Nischhelm:master
Open

GUI support for ct configs#126
Nischhelm wants to merge 2 commits intofriendlyhj:masterfrom
Nischhelm:master

Conversation

@Nischhelm
Copy link

This will allow to register ConfigGroups to show and be modifiable in the ingame Mod Options tab.

To register for gui, add
.withGui() or
.withGui(ConfigUtils.createMeta(modName).setXX...)
to the outermost ConfigGroup before registering.

like this:

import mods.zenutils.config.ConfigUtils;

ConfigUtils.named("test")
    .withGui(
        ConfigUtils.createMeta("Test")
            .setDescription("§4Test1234")
            .setVersion("1.0.0")
            .addAuthor("Nischhelm")
    )
    .rangedInteger("testInt", 1, 0, 10).sliding().add()
    .register();

available metadata to be shown in mod option gui are

  • modid (same as file name)
  • name (needed, set in createMeta)
  • setDescription (auto filled if not provided)
  • setCredits (auto filled if not provided)
  • setVersion
  • addAuthor
  • setLogoLocation

Modifications to the stored values will be directly transferred to the registered Configuration object, meaning that scripts in game will automatically grab the modified values.

grafik grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant