> For the complete documentation index, see [llms.txt](https://docs.polyfrost.org/oneconfig/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.polyfrost.org/oneconfig/config/creating-a-config.md).

# 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:

```java
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"`.

```java
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.

```java
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();
}
```

{% hint style="info" %}
OneConfig supports both the PNG and SVG (vector) image formats.
{% endhint %}

## Initializing on launch

Finally, you have to initialize your config when the game launches. This can easily be done using the [Events](/oneconfig/events/event-basics.md) system, with the `InitializationEvent`, most commonly in your main class:

```java
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.

{% content-ref url="/pages/dVJbDr1lxCgVKMciTp5a" %}
[Config Options](/oneconfig/config/adding-options.md)
{% endcontent-ref %}

## Example Config GUI

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

![Example Config GUI for inspiration](https://3056662043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVPLa0wt84LweTZoNVj4Z%2Fuploads%2FDeCNcaFEGaTwEiHqTeyf%2Fimage.png?alt=media\&token=2a1d6a24-fd04-450b-8072-7b70a2197ecd)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.polyfrost.org/oneconfig/config/creating-a-config.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
