Skip to content

creating custom modes

ix0rai edited this page May 15, 2024 · 6 revisions

introduction

This article explains how to make a custom mode through JSON.
It includes both a tutorial and full documentation on JSON properties and available colours.

tutorial

The first step to creating a rainglow datapack is establishing the directory structure. Your normal data pack looks like this:

- /data/
- - /minecraft/
- - - most content found here
- pack.mcmeta // metadata for your pack
- pack.png // the icon for your pack

We're going to be creating a new folder in /data/ named rainglow, which corresponds to the id of the mod. Inside this folder we'll be creating another named custom_modes, from which rainglow discovers data. All files ending with .json in this folder will be loaded.
Our structure now looks like this:

- /data/
- - /minecraft/ // this folder is not used in our little datapack, it can simply be deleted
- - /rainglow/ 
- - - /custom_modes/
- - - - rainglow mode jsons go here!
- pack.mcmeta // metadata for your pack
- pack.png // the icon for your pack

Now, we get to the fun part: creating your mode! For this tutorial, our goal is to make a mode with the colours of a sunset.
In your /custom_modes/ folder, create a .json file. This can be named anything, as long as it ends with .json so that rainglow knows to load it. Our file will be named sunset.json.

{
  "id": "sunset",
  "textColour": "E07000",
  "colourIds": [
    "red",
    "orange",
    "yellow",
    "pink",
    "purple",
    "indigo",
    "purple"
  ]
}

To break down this file, we have three properties:

  • id: the name of your mode. This can only contain lowercase letters and underscores. Examples: lesbian_pride, monochrome, rainbow.
  • textColour: the colour of the text for your mode. This will be shown in the config screen. It is in a hex code format. You can get a hex code for any colour from a site like tslat's colour picker.
  • colourIds: an array of colours that will be included in your mode. These are in the format of colour ids, which denote colours built into the mod. A full list of available colours can be found here.

Finally, you need to add translations for your mode. This has to be done through a resource pack, which is defined on the client. If you're implementing a custom mode on your server, this will have to be sent to the client when they log in. Documentation on this can be found here.

In your resource pack, you must have a structure like this:

- /assets/
- - /rainglow/ 
- - - /lang/
- - - - en_us.json // an english lang file
- pack.mcmeta // metadata for your pack
- pack.png // the icon for your pack

Inside en_us.json (or a different filename if you're using a different language) you must put content like this:

{
  "rainglow.mode.sunset": "Sunset"
}

The text after rainglow.mode. must be set to your custom mode's id, and the text "Sunset" will be replaced with your custom mode's full name.
Finally, place your datapack and resource pack inside minecraft's datapacks and resourcepacks folders respectively.

With that: You're done!
You have now created a custom mode, and it can be selected in game and used.

Clone this wiki locally