YetAnotherConfigLib

YetAnotherConfigLib (yacl) is just that. A builder-based configuration library for Minecraft.

LGPL-3.0 License

Stars
79

Bot releases are hidden (Show)

YetAnotherConfigLib - v3.2.2+1.20 Latest Release

Published by isXander 8 months ago

YetAnotherConfigLib 3.2.1 for 1.20.1-0

Bug Fixes

  • Backport a very important Forge fix to 1.20.1 (#143) Enjarai
YetAnotherConfigLib - v3.3.2+1.20.4

Published by isXander 9 months ago

YetAnotherConfigLib v3.3.2 for 1.20.4

  • Hook into the resource reloader to preload any webp/gif files that are used.
    This should make loading images when opening GUIs appear instantaneous.
  • Fix issue where buttons got stuck and appeared as though nothing had saved.
  • Fix an issue on NeoForged where the access widener was not transformed to an access transformer.
YetAnotherConfigLib - v3.3.1+1.20.4

Published by isXander 11 months ago

YetAnotherConfigLib v3.3.1 for 1.20.4

  • Fix version constraint issue on Fabric
YetAnotherConfigLib - v3.3.0+1.20.4

Published by isXander 11 months ago

YetAnotherConfigLib v3.3.0 for 1.20.4

Updates to support 1.20.4.

YetAnotherConfigLib - v3.3.0-beta.1+1.20.3

Published by isXander 11 months ago

YetAnotherConfigLib v3.3.0-beta.1 for 1.20.3

Updates to support 1.20.3.

Known Issues

  • Tooltips flicker when hovering over save button.
YetAnotherConfigLib - v3.3.0-beta.1+1.20.2

Published by isXander 12 months ago

YetAnotherConfigLib 3.3.0 (Beta 1) for Minecraft 1.20.2

As you can see, a lot of the contributions to this release are from other people! That's incredible, and I'm very
thankful for the community commitment to this project!

This release is a beta release, which just means that I'm not 100% sure that everything works as intended.
I encourage developers to at least try this build out, and if there are no problems, you're safe to release (I hope!).

New Features

  • Added new methods to add options to groups and categories, including conditional adding and option suppliers.
    This increases the chances you don't need to break the huge builder chain present of YACL, so you can just keep writing,
    even if you need to conditionally add an option, or run some code around the option. Look for optionIf!

Changes

  • Support for the Home and End keys. (#108)
  • Add functionality for Ctrl + Left/Right (you can now jump over words, without selecting it). (#108)
  • Make the 'finding the next word' functionality more consistent with other programs. (#108)
  • Caret now pauses flickering when moving it. (#108)
  • Position the caret and the highlight area being the same height as the text. (#108)
  • Render the caret above the selection, instead of below. (#108)

Fixes

  • Fix NumberFieldController increasing their values by a power of 10 when clicking on the screen. Issue @ #103 PR @ #108
  • Fix values not updating when unfocusing a string controller. (#108)
  • Fix a bug where the caret is not rendered at the beginning of the text in string/number field controllers. (#108)
  • Fix dropdowns not being sorted correctly with capital letters. (#114)

Misc

  • Added debug JVM property -Dyacl3.debug.imageFiltering=true/false which applies experimental filtering to images
    to make them look better. I'd like your feedback on this!
  • You now no longer need to add additional repositories to your build.gradle.
    You can safely remove:
    • https://maven.quiltmc.org/repository/release/
    • https://oss.sonatype.org/content/repositories/snapshots/

Translation Updates

  • Add Dutch translation. (#121)
  • Add Italian translation. (#107)
YetAnotherConfigLib - v3.2.1+1.20

Published by isXander about 1 year ago

YetAnotherConfigLib 3.2.1 for 1.20.1-0

Changes

Config API

  • Added ConfigClassHandler#save and ConfigClassHandler#load and deprecated ConfigClassHandler#serializer.
    • The serializer should now never be called directly.
    • New load method tells serializer to load into a new instance of the config class. Only applied if the load was fully successful.
    • Deprecated ConfigSerializer#load for ConfigSerializer#loadSafely.
  • Added new parameter on SerialEntry, called required.
    • If set to true, and the entry is not found in the config, the config will be re-saved with the default value.
    • If set to false, and the entry is not found in the config, the default value will be used, but the config will not be re-saved.
  • Added new parameter on SerialEntry, called nullable.
    • If set to false, and the entry is found in the config, but the value is null, the default value will be used, and the config will be re-saved.

Bug Fixes

  • Fixed error when using the same image twice.
  • Removed debug log from WEBP and GIF image loaders.
YetAnotherConfigLib - v3.2.1+1.20.2

Published by isXander about 1 year ago

YetAnotherConfigLib 3.2.1 for 1.20.2

Changes

Config API

  • Added ConfigClassHandler#save and ConfigClassHandler#load and deprecated ConfigClassHandler#serializer.
    • The serializer should now never be called directly.
    • New load method tells serializer to load into a new instance of the config class. Only applied if the load was fully successful.
    • Deprecated ConfigSerializer#load for ConfigSerializer#loadSafely.
  • Added new parameter on SerialEntry, called required.
    • If set to true, and the entry is not found in the config, the config will be re-saved with the default value.
    • If set to false, and the entry is not found in the config, the default value will be used, but the config will not be re-saved.
  • Added new parameter on SerialEntry, called nullable.
    • If set to false, and the entry is found in the config, but the value is null, the default value will be used, and the config will be re-saved.

Bug Fixes

  • Fixed error when using the same image twice.
  • Removed debug log from WEBP and GIF image loaders.
YetAnotherConfigLib - v3.2.0+1.20

Published by isXander about 1 year ago

YetAnotherConfigLib 3.2 for 1.20.1 & 1.20.0

The artifact for this release is
dev.isxander.yacl:yet-another-config-lib-fabric:3.2.0+1.20 (assuming Fabric)

Config API V2

Starting this update, the previous config api is now deprecated.

The new API is much more modular, and is now fully API-safe.

What does it look like?

public class MyConfig {
    public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
            .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
            .serializer(config -> GsonConfigSerializerBuilder.create(config)
                    .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
                    .setJson5(true) // json5 support, with GSON!
                    .build()) 
            .build();
    
    @SerialEntry(comment = "optional comment!")
    public boolean myOption = true;
    
    public static void save() {
        MyConfig.HANDLER.serializer().save();
    }
    
    public static void load() {
        MyConfig.HANDLER.serializer().load();
    }
}

As you can see from the above example, it's syntactically quite similar
to the old API, but with a few key differences:

  • The method of serialization has been separated from the class handler itself,
    allowing an API safe implementation without needing to override the class handler.
  • Supports abstract serialization.
  • Names make a lot more sense.

Auto-gen

The new API can now fully auto-generate your config into a YACL GUI with annotations.
I have been very wary of this feature, since usually it can be very limiting, destroying most
of the core values of the powerful YACL builder interface. However, I believe I've found a great
modular way so that developers can extend the auto-gen feature with their own custom annotations,
adding support for their own custom controllers!

public class MyConfig {
    public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
            .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
            .serializer(config -> GsonConfigSerializerBuilder.create(config)
                    .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
                    .setJson5(true) // json5 support, with GSON!
                    .build()) 
            .build();
    
    @AutoGen(category = "my_category", group = "my_group")
    @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true)
    public boolean myOption = true;
    
    public static Screen createScreen(Screen parent) {
        return MyConfig.HANDLER.generateGui().generateScreen(parent);
    }
}

Above is an example of auto-generating a BooleanController. Notice how
the field does not require @SerialEntry. These are completely separate,
and you can use both at the same time.

For the full range of auto-gen annotations, check the source!

Documentation for the new API is still a work in progress. For now, it's best
to look at the following class: dev.isxander.yacl3.test.AutogenConfigTest (not available on the artifact).

Fix Sodium crash

This is bringing the off-branch hotfix 3.1.1 to the main branch.

Dropdown controllers

Crendgrim has PRed a dropdown controller! Which is in this release!

This adds two new controller builders, DropdownStringControllerBuilder and ItemControllerBuilder.
The latter renders the item in the dropdown, and suggests only the items.

YetAnotherConfigLib - v3.2.0+1.20.2

Published by isXander about 1 year ago

YetAnotherConfigLib 3.2 for 1.20.2

The artifact for this release is
dev.isxander.yacl:yet-another-config-lib-fabric:3.2.0+1.20.2 (assuming Fabric)

Config API V2

Starting this update, the previous config api is now deprecated.

The new API is much more modular, and is now fully API-safe.

What does it look like?

public class MyConfig {
    public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
            .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
            .serializer(config -> GsonConfigSerializerBuilder.create(config)
                    .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
                    .setJson5(true) // json5 support, with GSON!
                    .build()) 
            .build();
    
    @SerialEntry(comment = "optional comment!")
    public boolean myOption = true;
    
    public static void save() {
        MyConfig.HANDLER.serializer().save();
    }
    
    public static void load() {
        MyConfig.HANDLER.serializer().load();
    }
}

As you can see from the above example, it's syntactically quite similar
to the old API, but with a few key differences:

  • The method of serialization has been separated from the class handler itself,
    allowing an API safe implementation without needing to override the class handler.
  • Supports abstract serialization.
  • Names make a lot more sense.

Auto-gen

The new API can now fully auto-generate your config into a YACL GUI with annotations.
I have been very wary of this feature, since usually it can be very limiting, destroying most
of the core values of the powerful YACL builder interface. However, I believe I've found a great
modular way so that developers can extend the auto-gen feature with their own custom annotations,
adding support for their own custom controllers!

public class MyConfig {
    public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
            .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
            .serializer(config -> GsonConfigSerializerBuilder.create(config)
                    .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
                    .setJson5(true) // json5 support, with GSON!
                    .build()) 
            .build();
    
    @AutoGen(category = "my_category", group = "my_group")
    @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true)
    public boolean myOption = true;
    
    public static Screen createScreen(Screen parent) {
        return MyConfig.HANDLER.generateGui().generateScreen(parent);
    }
}

Above is an example of auto-generating a BooleanController. Notice how
the field does not require @SerialEntry. These are completely separate,
and you can use both at the same time.

For the full range of auto-gen annotations, check the source!

Documentation for the new API is still a work in progress. For now, it's best
to look at the following class: dev.isxander.yacl3.test.AutogenConfigTest (not available on the artifact).

Fix Sodium crash

This is bringing the off-branch hotfix 3.1.1 to the main branch.

Dropdown controllers

Crendgrim has PRed a dropdown controller! Which is in this release!

This adds two new controller builders, DropdownStringControllerBuilder and ItemControllerBuilder.
The latter renders the item in the dropdown, and suggests only the items.

YetAnotherConfigLib - v3.1.1+1.19.4

Published by isXander about 1 year ago

YetAnotherConfigLib v3.1.1 for 1.19.4

Rewrote gui-scope ImageRenderer API

The ImageRenderer API has been rewritten internally to use a dual-thread
initialization. Before, GL calls were made on a separate thread, which silently
threw errors. Sodium 0.5 introduced an option called No Error Context, which turned
these warnings into complete JVM crashes.

Because of this, this rewrite was unavailable.

In the process of a huge YACL update, this commit was buried under a lot more changes
that are not ready for production yet, so I decided to branch from 3.1.0 and cherrypick
this commit to fix the issue.

Does it affect me as a developer?

Most likely not, declaring images through OptionDescription.Builder is unaffected as that
is part of the safe API. However, if you use the ImageRenderer directly to create your own
custom renderers, you will have to update your code to use the new API.

Does it affect me as a user?

Most likely, yes. Zoomify and a few other popular mods use the ImageRenderer API directly,
these mods will need updating, and will fail to load the images or even crash if they are not updated.

YetAnotherConfigLib - v3.1.1+1.20

Published by isXander about 1 year ago

YetAnotherConfigLib v3.1.1 for 1.20.1

Rewrote gui-scope ImageRenderer API

The ImageRenderer API has been rewritten internally to use a dual-thread
initialization. Before, GL calls were made on a separate thread, which silently
threw errors. Sodium 0.5 introduced an option called No Error Context, which turned
these warnings into complete JVM crashes.

Because of this, this rewrite was unavailable.

In the process of a huge YACL update, this commit was buried under a lot more changes
that are not ready for production yet, so I decided to branch from 3.1.0 and cherrypick
this commit to fix the issue.

Does it affect me as a developer?

Most likely not, declaring images through OptionDescription.Builder is unaffected as that
is part of the safe API. However, if you use the ImageRenderer directly to create your own
custom renderers, you will have to update your code to use the new API.

Does it affect me as a user?

Most likely, yes. Zoomify and a few other popular mods use the ImageRenderer API directly,
these mods will need updating, and will fail to load the images or even crash if they are not updated.

YetAnotherConfigLib - v3.1.0+1.20

Published by isXander about 1 year ago

YetAnotherConfigLib 3.1.0 for 1.20

API Changes

ListOption changes

A PR by Crendgrim - thanks a lot!

  • Allow to specify size limits for option lists.
    • This allows to set a minimum and maximum length for the option list with the minimumNumberOfEntries
      and maximumNumberOfEntries builder methods.
  • Allow "reversed" lists that add new options at their end.
    • List options until now always grew at the top. This patch allows you to manipulate this behaviour with the
      insertEntriesAtEnd builder method.

ImageRenderer changes

Added a tick() method to image renderers that allows to update the image in a regular interval.

Bug Fixes

  • Fixed a bug where image renderers were rendered twice per frame.
  • Updated the ImageIO dependency to fix sometimes buggy animated WebP rendering.
  • Fixed the name of the list being rendered on every entry of said list.

Language Updates

YetAnotherConfigLib - v3.1.0+1.19.4

Published by isXander about 1 year ago

YetAnotherConfigLib 3.1.0 for 1.19.4

API Changes

ListOption changes

A PR by Crendgrim - thanks a lot!

  • Allow to specify size limits for option lists.
    • This allows to set a minimum and maximum length for the option list with the minimumNumberOfEntries
      and maximumNumberOfEntries builder methods.
  • Allow "reversed" lists that add new options at their end.
    • List options until now always grew at the top. This patch allows you to manipulate this behaviour with the
      insertEntriesAtEnd builder method.

ImageRenderer changes

Added a tick() method to image renderers that allows to update the image in a regular interval.

Bug Fixes

  • Fixed a bug where image renderers were rendered twice per frame.
  • Updated the ImageIO dependency to fix sometimes buggy animated WebP rendering.
  • Fixed the name of the list being rendered on every entry of said list.

Language Updates

YetAnotherConfigLib - v3.0.4+1.19.4

Published by isXander over 1 year ago

  • Allow transparency for WEBP and GIF images.
  • Fix crash when reading single-frame WEBPs.
YetAnotherConfigLib - v3.0.3+1.20

Published by isXander over 1 year ago

  • Allow transparency for WEBP and GIF images.
  • Fix crash when reading single-frame WEBPs.
YetAnotherConfigLib - v3.0.3+1.19.4

Published by isXander over 1 year ago

  • Fix crashing in some circumstances
YetAnotherConfigLib - v3.0.2+1.20

Published by isXander over 1 year ago

  • Fix IntegerFieldController and LongFieldController not allowing negative values.
  • Reimplement ButtonOption changing the 'EXECUTE' text with ButtonOption.Builder#text()
YetAnotherConfigLib - v3.0.2+1.19.4

Published by isXander over 1 year ago

  • Fix IntegerFieldController and LongFieldController not allowing negative values.
  • Reimplement ButtonOption changing the 'EXECUTE' text with ButtonOption.Builder#text()
  • Fix a crash on some loads when viewing list widgets.
YetAnotherConfigLib - v3.0.1+1.20

Published by isXander over 1 year ago

  • Fix crash when loading YACL images
Badges
Extracted from project README
Java 17 Discord Modrinth CurseForge Ko-fi