Item attribute modifier API Library 1.1

Create, modify and apply entity attribut modifiers on item stacks

  1. Michel_0
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    Item Attribute API

    This library offers you the opportunity to handle attribute modifiers on item stacks.

    Background:
    Attributes are properties of mobs and players (http://minecraft.gamepedia.com/Attribute).
    These attributes can be modified (http://minecraft.gamepedia.com/Attribute#Modifiers).
    These attribut modifiers can be deposited on items (http://minecraft.gamepedia.com/Player.dat_format#Attribute_Modifiers).
    This library allows to handle such modifiers on items.

    Features:
    • Define your own modifiers with custom definable variables:
      - attribute name
      - modifier name
      - effected slot
      - modifier operation
      - modifier amount
      - modifier UUID
    • Combine any modifiers together into an set of modifiers
    • Apply these modifiers on item stacks
    • Get modifiers back out of item stacks (modify them and apply it again)
    • Well documented
      Javadoc + Javadoc websites
    For a detailed description of attributes and their modifiers see the MC wiki (Links above)

    How to use:
    This is not a plugin. Don't paste it into a plugins folder of a MC server.
    Download the JAR and import it into your IDE.
    How to Import a external library in Eclipse -> TUTORIAL
    Code (Java):
    import minecraft.spigot.community.michel_0.api.Attribute;
    import minecraft.spigot.community.michel_0.api.AttributeModifier;
    import minecraft.spigot.community.michel_0.api.ItemAttributes;
    import minecraft.spigot.community.michel_0.api.Slot;

    ItemStack item = /* ...some item you want to modify... */;

    // First you need a new instance of ItemAttributes
    ItemAttributes attributeModifiers = new ItemAttributes();

    // Then you need to define your modifiers
    AttributeModifier speedModifier = new AttributeModifier(Attribute.MOVEMENT_SPEED, "AdditionalSpeed", Slot.MAIN_HAND, 0, 1.0d, UUID.randomUUID());
    AttributeModifier attackModifier = new AttributeModifier(Attribute.ATTACK_DAMAGE, "AdditionalDamage", Slot.MAIN_HAND, 0, 4.0d, UUID.randomUUID());

    // Next is to add these modifiers to the attribut modifiers set
    attributeModifiers.addModifier(speedModifier);
    attributeModifiers.addModifier(attackModifier);

    // Finally apply it on a item stack
    item = attributeModifiers.apply(item);
    • No external APIs used (only Spigot and vanilla Minecraft)
    • No other plugins necessary
    • Tested on Spigot 1.8.8 & 1.9 without any Problems
    • Should also be compatible with older server versions pre 1.8
      If you test it on 1.7, let me know so i can add it as supported version
    • Compiled by Java 8 SDK, your Server should be running on Java 8 JRE to use this plugin
    Need additional Features or got some interesting ideas?
    Leave a reply and i'll add this or other functions if requested.

    Special thanks @wd40bomber7 who gave me the idea for this API (here).

    Replys and ratings and suggestions welcome.

    • Add extra attack damage, on some weapon (e.g. sword)
    • Add special armor or knockback defense on some armor parts
    • Add speed boost on a special fastwalk item
    • Add additional horse jump power on horse armor
    • ... endless possibillities ...
    Matocolotoe and Kev575 like this.

Recent Updates

  1. Bugfix and extended 1.9 support

Recent Reviews

  1. UnlimitedNinjas
    UnlimitedNinjas
    1/5,
    Version: 1.1
    Plugin.yml is broken, doesnt work! I dont know about other versions i will try them out, but this one nah.
    1. Michel_0
      Author's Response
  2. petomka
    petomka
    5/5,
    Version: 1.1
    This is simple and does what it's supposed to do, you did a good job creating this as this still works in 1.12. Thank you for posting this!
    1. Michel_0
      Author's Response
      Thanks for the reply.
      I never expected, this would work on 1.12.
  3. grosvalpin
    grosvalpin
    4/5,
    Version: 1.1
    Good API, this is helpful.
    But, how to modify attributs ?
    I talk when the attribut is on the sword...
    1. Michel_0
      Author's Response
  4. Franz-san
    Franz-san
    5/5,
    Version: 1.0
    it is good api useful.
    however some flaws. the author is good tho and fixes it.

    i think this plugin = way to go for item attributes
    it is lightweight it is good