Vanilla Options API

Quick rating

Community listing page, reviews here may not be monitored by the author.

Vanilla Options API

By EmbinOwner

No reviews yet

Allow mods to use vanilla's systems to add custom options

Mod Loaders
Minecraft
26.2

About

Description

Library that easily allows mod developers to create custom options using vanilla's systems, and add options to vanilla's option screens.

Code example:

public class MyMod implements ClientModInitializer {
  private static final OptionInstance<Boolean> OPTION = ...;

  public static OptionInstance<Boolean> option() {
    return OPTION;
  }

  @Override
  public void onInitializeClient() {
    Identifier optionId = Identifier.fromNamespaceAndPath("modid", "custom_option");
    VanillaOptionsAPI.register(optionId, OptionsMenuLocation.ACCESSIBILITY, MyMod::option);
  }
}

The following would add a boolean option that saves to options.txt as modid.custom_option, appearing in the accessibilty options menu.