Examples v2 - RealMegaMinds/ActionInventoryMod GitHub Wiki

This are just some examples of different parts.

Action Inventory

This creates an action inventory named "example" which is displayed as "Example Action Inventory" in dark green, with 1 row, no openers, no action items, and be opened by commands and signs but not action items.

Example
{
  "name": "example",
  "displayName": {
    "text": "Example Action Inventory",
    "color": "dark_green"
  },
  "rows": 1,
  "disableCommand": false,
  "disableSign": false,
  "disableAction": true,
  "openers": [],
  "items": []
}

Opener

This creates an opener that opens the action inventory when a stick is used.

Example
{
  "type": "identifier",
  "clickType": "use",
  "what": "itemstack",
  "id": "minecraft:stick"
}

Action Item

This creates an action item in the seventh slot that is represented by an enchanted diamond sword and has no requirements or actions.

Example
{
  "slot": 7,
  "representation": {
    "item": "minecraft:diamond_sword",
    "count": 1,
    "nbt": "{Enchantments:[{lvl: 3, id: \"looting\"}, {lvl: 5, id: \"sharpness\"}]}"
  },
  "requirements": [],
  "actions": []
}

Requirement

This creates a requirement that makes a player have at least 1 xp level to see the action item (doesn't use any levels).

Example
{
  "type": "xp",
  "when": "view",
  "requiredCost": 1,
  "consumes": false
}

Action

This creates an action that gives the player an enchanted diamond sword.

Example
{
  "type": "give",
  "itemStack": {
  "item": "minecraft:diamond_sword",
  "count": 1,
  "nbt": "{Enchantments:[{lvl: 3, id: \"looting\"}, {lvl: 5, id: \"sharpness\"}]}"
}

Here Is A Complete Example

This creates an action inventory that incorporates all the above examples with some extra.

Example
{
  "name": "example",
  "displayName": {
    "text": "Example Action Inventory",
    "color": "dark_green"
  },
  "rows": 1,
  "disableCommand": false,
  "disableSign": false,
  "disableAction": true,
  "openers": [
    {
      "type": "identifier",
      "clickType": "use",
      "what": "itemstack",
      "id": "minecraft:stick"
    }
  ],
  "items": [
    {
      "slot": 7,
      "representation": {
        "item": "minecraft:diamond_sword",
        "count": 1,
        "nbt": "{Enchantments:[{lvl: 3, id: \"looting\"}, {lvl: 5, id: \"sharpness\"}]}"
      },
      "requirements": [
        {
          "type": "xp",
          "when": "view",
          "requiredCost": 1,
          "consumes": false
        },
        {
          "type": "xp",
          "when": "click",
          "requiredCost": 2,
          "consumes": true,
          "allowPartial": true,
          "resets": true
        }
      ],
      "actions": [
        {
          "type": "give",
          "itemStack": {
            "item": "minecraft:diamond_sword",
            "count": 1,
            "nbt": "{Enchantments:[{lvl: 3, id: \"looting\"}, {lvl: 5, id: \"sharpness\"}]}"
          }
        },
        {
          "type": "sound",
          "sound": "minecraft:ui.toast.challenge_complete",
          "pitch": 1,
          "volume": 1
        }
      ]
    }
  ]
}
⚠️ **GitHub.com Fallback** ⚠️