Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 3.51 KB

2. Palettes.md

File metadata and controls

78 lines (64 loc) · 3.51 KB

Palettes

Palette files define how items are grouped together. They are used to create the palettes that are displayed in the game. Each palette file defines a single palette.

File Format

The file is a JSON object with the following keys:

  • type: (string) Required. Must be set to "palette".
  • priority: (integer) Optional. Determines the order of palettes. Defaults to 100.
  • fallbackLink: (string) Optional. A resource location string for the fallback link. (See Links)
  • forceLink: (string) Optional. A resource location string for the forced link. (See Links)
  • disableAutoLink: (boolean) Optional. If true, disables auto-linking other palettes to this one. Defaults to false.
  • displayName: (string) Optional. A translation key for the palette display name. (See Language Files)
  • items: (array) Required. An array of items in the palette. Items can be specified as a simple string (resource location), or as an object with additional properties.
  • openOnlyItems: (array) Optional. An array of items that should link to the palette, without being part of it.
  • ignoreItems: (array) Optional. An array of items that should not cause the palette to be linked to, even if they are part of it.
  • shortcuts: (array) Optional. An array of shortcut objects to be displayed in the palette.
  • icon: (string) Optional. A resource location string for the icon of the palette.

Items

Items can be specified as a simple string (resource location), or as an object with the following properties:

  • id: (string) Required. The item's resource location.
  • link: (string) Optional. A resource location string for the linked palette. (See Links)
  • name: (string) Optional. A translation key for the custom display name of the item. (See Language Files)
  • actAsLink: (boolean) Optional. If true, the item acts as a link/shortcut to another palette(clicking it activates the link, instead of selecting the item). Defaults to false.

Shortcuts

Shortcuts get shown on the left side of the palette. Shortcuts are objects with the following properties:

  • type: (string) Required. Must be set to "link".
  • target: (string) Required. A resource location string for the target palette or list. (See Links)
  • displayName: (string) Optional. A translation key for the shortcut display name. (See Language Files)
  • icon: (string) Optional. A resource location string for the icon of the shortcut.

Example JSON

{
  "type": "palette",
  "priority": 50,
  "fallbackLink": "modid:fallback_palette",
  "forceLink": "modid:forced_palette",
  "disableAutoLink": true,
  "displayName": "item_group.custom_palette",
  "items": [
    "minecraft:stone",
    {
      "id": "minecraft:grass_block",
      "link": "modid:linked_palette",
      "name": "block.custom_grass",
      "actAsLink": false
    },
    "minecraft:bedrock"
  ],
  "openOnlyItems": [
    "minecraft:dirt"
  ],
  "ignoreItems": [
    "minecraft:bedrock"
  ],
  "shortcuts": [
    {
      "type": "link",
      "target": "modid:shortcut_target",
      "displayName": "item_group.shortcut",
      "icon": "minecraft:compass"
    }
  ],
  "icon": "minecraft:chest"
}

In this example, a custom item group is defined with a priority of 50, a fallback link, a forced link, auto-linking disabled, a display name, a list of items (including a grass block with custom properties), open-only items, ignored items, a list of shortcuts, and an icon.