Skip to content

How to make custom category by JSON format file

RedLime edited this page Jul 5, 2023 · 13 revisions

What is 'Custom Category' for SpeedRunIGT?

It is added timer category by the user, so not build-in categories in SpeedRunIGT.
There are two ways to add custom categories.

in this document explains how to add a custom categories using a JSON format file.

Where is the directory for custom categories?

  • Windows : C:\Users\USER_NAME\speedrunigt\categories
  • MacOS : /Users/USER_NAME/speedrunigt/categories
  • Linux : /home/USER_NAME/speedrunigt/categories

it is same as user.home java system property

Make your custom category

JSON format

Base format :

{
  "id": String,
  "name": String,
  "version": String,
  "src_category": String, 
  "conditions": Condition[][]
}

"conditions" format :

{
  "type": String,
  "name": String,
  "version: String (Optional),
  ...
}

Explain Base format

  • id: it is a string for identifying categories. If the IDs match each other, the category will not be added.
  • name: The name of the category that will be displayed in the Timer Categories option.
  • version: The minecraft version string for the category. You can put a specific version or version ranges. here is examples.
    • any versions : *
    • 1.16.1 only : 1.16.1
    • 1.16's all subversions : 1.16.x
    • 1.16.x to 1.18.x : >=1.16- <=1.18-
    • 1.16.5 or below : <=1.16.5
    • 1.13 or above : >=1.13
  • src_category: The speedrun.com url of category that "More" button of Timer Categories option.
    • Example : mcce#Obtain_Item -> Result URL : https://speedrun.com/mcce#Obtain_Item
  • conditions:
    • version: The version of Minecraft to apply the condition to. This is optional and will be applies to all versions if not present. same format with version in category.

otherwise is check the below

Condition types

SpeedRunIGT have 4 types of condition for the custom category.
achieve_advancement, obtain_item, player_stat and dummy

achieve_advancement

It is trigger when the notified(a.k.a Toast) in your client that it has complete advancement or unlock recipe.
Condition format :

{
  "type": "achieve_advancement",
  "name": String,
  "advancement": String
}
  • name: The name of the category condition. When the condition is completed, it will be included with this name in the Timeline of the Record file..
  • advancement: The ID of Advancement or recipe. Example: minecraft:end/the_end.
    In Pre 1.12, it is used as the ID of the Achievement.

obtain_item

It is trigger when the player does have an item in your client.
Condition format :

{
  "type": "obtain_item",
  "name": String,
  "item_id": String, (BUT in Pre 1.8, it is Integer)
  "item_amount": Integer, [Optional]
  "item_data": Integer or null [Optional]
  "item_nbt": String [Optional]
  "strict_mode": Boolean [Optional]
}
  • name: The name of the category condition. When the condition is completed, it will be included with this name in the Timeline of the Record file..
  • item_id: The ID of the item that the player should have.
    But Pre 1.8 does use integers instead of string, so you need to set integers for Pre 1.8.
  • item_amount: [Optional. default: 1] The number of items that the player should have.
  • item_data: [Optional. default: null] The data(damage) of items that the player should have.
  • item_tag: [Optional. default: (EMPTY STRING)] The nbt tag of items that the player should have. it must be JSON string.
  • strict_mode: [Optional. default: true] This means that all obtain_item in the same condition array must be included in your inventory for the condition to be complete.
    if you set to false this parameter, If you have obtained the item at least once, the condition will be complete even if you don't have that item at the end.

player_stat

It is trigger when the player's statistics are updated on the server.
Condition format :

{
  "type": "player_stat",
  "name": String,
  "category": String, (BUT in Pre 1.13, not use this parameter)
  "stat": String,
  "goal": Integer
}
  • name: The name of the category condition. When the condition is completed, it will be included with this name in the Timeline of the Record file..
  • category: The type of the statistics. See Resource location in Minecraft Wiki for more information.
    But in Pre 1.13, Statistics doesn't have a type, so it is not used.
  • stat: The ID of the stats. See Resource location in Minecraft Wiki for more information.
  • goal: The goal value of the stats that the player should achieve.

dummy

It isn't will be normally triggered. it is for other Mods only
Condition format :

{
  "type": "player_stat",
  "name": String
}
  • name: The name of the category condition. When the condition is completed, it will be included with this name in the Timeline of the Record file..

Conditions Array

Custom Category Conditions supports OR/AND conditioners similar to Minecraft datapacks.\

Not too hard!
In the below case, the conditions is correct if (you have a diamond and killed 10+ slimes) or (complete the end/root advancement):

...
"conditions": [
    // OR block
    [
        // AND block
        {
            "type": "obtain_item",
            "name": "diamond",
            "item_id": "minecraft:diamond"
        },
        {
            "type": "player_stat",
            "name": "kill_slime",
            "category": "minecraft:killed",
            "stat": "minecraft:slime",
            "goal": 10
        }
    ],

    // OR block
    [
        // AND block
        {
            "type": "achieve_advancement",
            "name": "enter_end",
            "advancement": "minecraft:end/root"
        }
    ]
]

Add Custom Category

If you have done with this format file, save or insert the file with the .json extension in the directory I mentioned before.
and then run your client!

Example Custom Category Files

Example (Download File)
{
  "id": "sample_your_category",
  "name": "My Challenge!",
  "version": ">=1.13",
  "src_category": "mc#idk",
  "conditions": [
    [
      {
        "type": "obtain_item",
        "name": "diamond",
        "item_id": "minecraft:diamond"
      },
      {
        "type": "player_stat",
        "name": "kill_slime",
        "category": "minecraft:killed",
        "stat": "minecraft:slime",
        "goal": 10
      },
      {
        "type": "player_stat",
        "name": "update_stat",
        "category": "minecraft:custom",
        "stat": "minecraft:jump",
        "goal": 10
      }
    ],
    [
      {
        "type": "achieve_advancement",
        "name": "enter_end",
        "advancement": "minecraft:end/root"
      }
    ]
  ]
}