Skip to content

Variable: stack

Misat11 edited this page Dec 3, 2020 · 5 revisions

stack

Stack variable is an item that will be displayed in inventory slot. There are more ways to set this variable:

Yaml

Using SimpleInventories ShortStack:

- stack: APPLE;1;"Armor";"Some lore";"Some lore"
# the format looks like this: material_identificator[;amount[;display name[;lore line[;lore line .. and many lore lines .. ]]]]
# material_identificator could be material_name, legacy_material_name or legacy_id or legacy_id:legacy_data

Using SimpleInventories Stack:

- stack:
    type: APPLE # this variable is just ShortStack 

    # only type is needed, things below are just optional 
    amount: 1
    display-name: "Armor"
    loc-name: "Localized name"
    custom-model-data: 99
    repair-cost: 2
    ItemFlags:
    - HIDE_ENCHANTS
    Unbreakable: false
    lore:
    - "Some lore"
    - "Some lore"
    enchants:
      LOOT_BONUS_BLOCKS: 3
    potion-type: healing

    # For legacy versions
    damage: 3
    # Or (durability is just alias for damage)
    durability: 3
    
    # If you need to use Bukkit's ItemMeta, you can
    meta:
      ==: ItemMeta
      meta-type: UNSPECIFIC
      display-name: "Armor"

Groovy

Using SimpleInventories ShortStack:

inventory {
  item('APPLE;1;"Armor";"Some lore";"Some lore"')
  // the format looks like this: material_identificator[;amount[;display name[;lore line[;lore line .. and many lore lines .. ]]]]
  // material_identificator could be material_name, legacy_material_name or legacy_id or legacy_id:legacy_data
}

Using SimpleInventories Stack:

inventory {
  item('APPLE') { // this variable is just ShortStack 
    stack {
      // only type is needed, things below are just optional 
      amount(1)
      name 'Armor'
      customModelData(99)
      repair(2)
      flags (['HIDE_ENCHANTS'])
      unbreakable(false)
      lore ([
        'Some lore', 
        'Some lore'
      ])
      enchant 'LOOT_BONUS_BLOCKS', 3

      // For legacy versions
      damage(3)
      // Or (durability is just alias for damage)
      durability(3)
    }
  }
}