LogoLogo
  • Introduction
  • Documentation License
  • Modding Basics
  • Getting Started
  • Configuration
    • Creating a Config
    • Config Options
      • Boolean Configs
      • Number Configs
      • Selector Configs
      • Text Configs
      • Buttons, Colors and Keybinds
      • Decorative Components
      • Custom options
    • Migration
  • Events
    • Event Basics
    • Available Events
      • ChatReceiveEvent
      • TickEvent
      • InitializationEvent
      • HudRenderEvent
      • Packet Events
      • LocrawEvent
  • Graphics & UI
    • Render Manager
      • Font Rendering
    • Elements
    • Pages
  • Commands
    • Commands
    • An Example Command
  • HUDs
    • HUD Basics
  • Utilities
    • OneConfig's Utilities
      • Notifications
      • HypixelUtils
    • OneColor
    • OneUIScreen
Powered by GitBook
On this page
  • Getting Started
  • Building the bare bones
  • Additional cosmetics
  • Initializing on launch
  • Example Config GUI

Was this helpful?

  1. Configuration

Creating a Config

Find out how to create Configs with OneConfig

Getting Started

Building the bare bones

To create a new config, you need to create a new class that extends Config, just like this:

public class MyConfig extends Config {
}

Simple! Now, it needs a constructor. The Mod object stores both its name and category, along with the mod's file name. Usually, named "yourmodname.json".

public MyConfig() {
    // Available mod types: PVP, HUD, UTIL_QOL, HYPIXEL, SKYBLOCK
    super(new Mod("My Mod", ModType.UTIL_QOL), "config.json");
    initialize();
}

Additional cosmetics

If you wish, you can specify an icon for your mod that will be shown in the GUI. All you need to do is add a third argument that specifies your icon's file path.

public MyConfig() {
    // Available mod types: PVP, HUD, UTIL_QOL, HYPIXEL, SKYBLOCK
    super(new Mod("My Mod", ModType.UTIL_QOL, "/filepath/to/icon.png"), "config.json");
    initialize();
}

OneConfig supports both the PNG and SVG (vector) image formats.

Initializing on launch

Finally, you have to initialize your config when the game launches. This can easily be done using the Events system, with the InitializationEvent, most commonly in your main class:

public class MyMod {
    public static MyConfig config;

    @Subscribe
    public void onInit(InitializationEvent event) {
        config = new MyConfig();
    }
}

And you're done, pretty simple huh? Your config is now registered and can be seen in the GUI. So naturally, it's time to add some options.

Example Config GUI

Here is an example config GUI, if you are looking for a sneak peek or some inspiration :)

PreviousGetting StartedNextConfig Options

Last updated 2 years ago

Was this helpful?

Config Options
Example Config GUI for inspiration