Skip to content

2.1 Structure

Yanbing Zhao edited this page Jun 20, 2019 · 2 revisions

The structure of the configuration is usually like this:

virtualchest {
  TextTitle = "Example"
  Rows = 6
  Slot0 {
    // configuration for slot 0 (1st slot)
  }
  Slot1 {
    // configuration for slot 1 (2nd slot)
  }
  Slot2 {
    // configuration for slot 2 (3rd slot)
  }
  TriggerItem {
    ItemType = "minecraft:compass"
  }
}

The example shown above contains the options commonly used to configure a menu.

All the configurations are surrounded by a virtualchest section, so you can put something out of this section for better readability, such as aliases. For example, if you want to set all the items in the menu to panes of stained glass, the configuration file could be like this:

aliases {
  white-pane-item {
    // configuration of the white stained glass pane
  }
}
virtualchest {
  TextTitle = "Example"
  Rows = 6
  Slot0 = ${aliases.white-pane-item}
  Slot1 = ${aliases.white-pane-item}
  Slot2 = ${aliases.white-pane-item}
  // ...
  Slot52 = ${aliases.white-pane-item}
  Slot53 = ${aliases.white-pane-item}
  TriggerItem {
    ItemType = "minecraft:compass"
  }
}

For more information about HOCON, please refer to the related documentation.