Skip to content

FAQ: What's the difference between an Item and a Material?

ricochet1k edited this page Oct 8, 2012 · 4 revisions

A Material is merely a reference to a specific type of item, while an ItemStack refers to a type and a quantity.

Applied to usage in ModDamage, Material references and aliases are simple. ModDamage generates tool aliases by default, because they're so commonly used:

Aliases:
    Material:
        axe:
            - 'WOOD_AXE'
            - 'STONE_AXE'
            - 'IRON_AXE'
            - 'GOLD_AXE'
            - 'DIAMOND_AXE'
        hoe:
            - 'WOOD_HOE'
            - 'STONE_HOE'
            - 'IRON_HOE'
            - 'GOLD_HOE'
            - 'DIAMOND_HOE'
        pickaxe:
            - 'WOOD_PICKAXE'
            - 'STONE_PICKAXE'
            - 'IRON_PICKAXE'
            - 'GOLD_PICKAXE'
            - 'DIAMOND_PICKAXE'
        spade:
            - 'WOOD_SPADE'
            - 'STONE_SPADE'
            - 'IRON_SPADE'
            - 'GOLD_SPADE'
            - 'DIAMOND_SPADE'
        sword:
            - 'WOOD_SWORD'
            - 'STONE_SWORD'
            - 'IRON_SWORD'
            - 'GOLD_SWORD'
            - 'DIAMOND_SWORD'
Damage: 
    - 'switch.attacker.wielding':
        - '_sword':
            - 'message.attacker': "I see you are wielding a sword!"
        - '_axe':
            - 'message.attacker': "I see you are wielding an axe!"
        - '_pickaxe':
            - 'message.attacker': "I see you are wielding a pickaxe!"

Contrast this with ItemStacks, whose format is $material*#quantity.

Aliases:
    Item:
        oneOfEach:
            - 'IRON_INGOT*1'
            - 'GOLD_INGOT*1'
            - 'LAPIS_ORE*1'
            - 'DIAMOND*1'
            - 'REDSTONE*1'
Damage: # Attacking innocent wolves makes them drop loot, but you still piss 'em off.
    - 'if target.type.wolf_wild':
        - 'targeteffect.dropitem._oneOfEach': '1'
    - 'if target.type.wolf_angry':
        - 'targeteffect.dropitem.WOOD*1': '1'
Clone this wiki locally