wiki:olivine/dsl/types/item

Version 1 (modified by jonathan, 4 years ago) (diff)

Page introduction

Game Items

Visit core types for information on primitive and core types such as integer.

An item expresses a named game item. It is comprised of two parts, the resource group name and the sub-name. The syntax takes one of the two forms: item &group:name or item name where group is the resource group name and name is the name of the item in that resource group. As you may notice, the second form doesn't specify the group, that is because it is optional. If the item is descriptive enough on it's own then Olivine will find it, however, if there is more than one item loaded with the same name (but exist in separate resource groups) then you would use the first syntax approach to be more definitive and mitigate ambiguity.

Here is a simple example that expresses an item by name without a resource group, this will cause Olivine to go looking for it in all loaded resource groups:

   item &stone

Suppose there is another resource group that the stone item but you want the Minecraft one, here's how you express that:

   item &minecraft:stone

Attributes

You can also tack-on attributes to your item definition, the syntax is either item &group:name with attributes or item &name with attributes where attributes is described as a dictionary in the table below:

Name Type Description
nametextCustom name of the item
descriptiontextThe lore of the item (that's just a fancy name for a custom description of the item)
enchantmentslist of enchantmentThe list of enchantments the item should have
colorcolorColor of the item, only applies to leather armor right now
modifiersitem modifiersItem-specific modifiers, click the item modifiers link for more information
wearintegerHow worn the item is, this isn't how damaged it is but how much it costs to repair it when it becomes damaged

Item Modifiers

All these are modifier definitions, click on the link for information on how to define one. These modifiers affect the mob or player holding this item in their hand.

  • health - 'nuff said
  • stability - Knockback resistance
  • agility - Movement / run speed
  • strength - Attack damage dealt

Examples

Here's an item with attributes including enchantments and a modifier:

item &mmm:darksteel_leggings with {
    name -> "Me pants!"
    description -> "Git yer own pants! these be mine!"
    enchantments -> [
        { type -> fire_protection; level -> 3 }
        { type -> unbreaking; level -> 3 }
    ]
    modifiers -> {
        health -> { amount -> 2; operator -> boost }
    }
}