promotional bannermobile promotional banner

ItemAPI

ItemLib makes it easy for developers to modify item attributes.

UPDATED FOR 1.9

ItemLib 2.0

This is strictly a developer's tool.

It will do no good installing on a server without anything hooked into it. It does nothing on its own! Since 1.9 is a major update, it is doubtful this version will work with pre-1.9 MC versions.

REQUIRES http://ci.dmulloy2.net/job/ProtocolLib/

Secondary dependancy (optional)

Integrates with my plugin EasyTitles for messages to be given to players in the ACTION bar rather than direct messages. (Cleaner display, less chat clutter.)

To Use ItemLib:

Once the JAR is added to your project, just use ItemAPI.<method_below>

Developers

Add the JAR to your project and simply call any of the following:

Remove all damage from an item

  • ItemStack removeDamageFromItem(ItemStack item)

Set a specific damage amount on a weapon (can send a Double or Integer)

  • ItemStack setDamageOnWeapon(ItemStack item, Integer damage)
  • ItemStack setDamageOnWeapon(ItemStack item, Double damage)

Modify (add/subtract) an amount on a weapon (can send +/- Double/Integer)

  • ItemStack modifyDamageOnWeapon(ItemStack item, Integer damage)
  • ItemStack modifyDamageOnWeapon(ItemStack item, Double damage)

Set specific amount of +Health on an item (can send Double or Integer)

  • ItemStack setHealthOnItem(ItemStack item, Integer health)
  • ItemStack setHealthOnItem(ItemStack item, Double health)

Get the current +Health of an item

  • Double getHealthOnItem(ItemStack item)

Add or remove the enchantment glow to an item

  • void addGlow(ItemStack item)
  • void removeGlow(ItemStack item)

Custom Enchantments

Armor Enchants

  • ABSORB - absorbs 1% per level
  • SHIELD - adds 1 gold heart per level

Weapon Enchants

  • DOUBLESTRIKE - chance to deal double damage
  • NIGHTBANE - +1 damage per level at night
  • LIGHTSEEKER - +1 damage per level during the day
  • SLOW - applies Slowness debuff
  • BLAZE - set target on fire, time increases with level
  • BLAZE_AOE - sets targets in an area on fire, time increases with level
  • SHOCK - strikes target with lightning, damage increases with level
  • SHOCK_AOE - strikes all targets in area with lightning, damage increases with level
  • STRENGTH - give player a strength buff, time increases with level
  • LIFESTEAL - steals % of damage dealth, increases with level
  • POISON - poisons target, time increases with level
  • POISON_AOE - poisons all in area, time increases with level
  • WITHER - withers target, time increases with level
  • WITHER_AOE - withers all in an area, time increases with level

Tool Enchants

  • BLOCKBOON - chance to receive extra drops (not implemented)
  • SUPER - not implemented

Now you can add your own custom enchants!

Simply edit the CONFIG.YML and follow what you see inside.

  • tigerblood: (use some name to identify your enchant here)
  • 'id' UNIQUE UD - continue sequence you see
  • 'display' What will display on the Item ie: 'Withering I'
  • 'enable' You can disable individual enchants
  • 'handle' Should be FALSE on all added enchants (ItemAPI handle built in customs)
  • 'maxlevel' Maximum level this enchant can be raised to
  • 'cooldown' Time in seconds this custom enchant can be used in succession

To see if an Item has an Enchant:

  • someItemStack.containsEnchantment(ItemAPI.getCustomEnch("whateverYouNamedIt"))

Add an enchant:

  • ItemAPI.addEnchantment(SomeItemStack, "nameOfCustomEnchant", levelOfEnchant)

Increment an enchant to the next level: (it will check if it is above the maxlevel)

  • ItemAPI.addEnchantment(SomeItemStack, "nameOfCustomEnchant")

Examples

To add a false glow to an item, simply send the ItemStack of the item to glow:

  • ItemAPI.addGlow(item)

Let's say you want to increase the currently held Diamond Sword's damage by 2.5

  • player.setItemInHand(ItemAPI.modifyDamageOnWeapon(player.getItemInHand(), 2.5)

Want to give a player a helmet with +2 health?

  • player.getInventory().addItem(ItemAPI.setHealthOnItem(helmet, 2)

Add a custom enchantment to an item?

  • itemAPI.addEnchantment(ItemStack itemToAddTo, CTypes.<enchant>, int levelOfEnchantment)

The ItemAPI Team

profile avatar
  • 6
    Projects
  • 24.0K
    Downloads

More from _ForgeUser11897775View all

  • Region Titles project image

    Region Titles

    • 6.0K
    • Bukkit Plugins

    Add-on for Title Manager to display Region IDs

    • 6.0K
    • February 28, 2015
    • Bukkit Plugins
    • +3
  • Skills project image

    Skills

    • 4.3K
    • Bukkit Plugins

    Skills introduces passive and active skills to Minecraft.

    • 4.3K
    • April 23, 2015
    • Bukkit Plugins
    • +4
  • Upgradable project image

    Upgradable

    • 4.6K
    • Bukkit Plugins

    Introducing tiered weapons and armor upgrades.

    • 4.6K
    • April 15, 2015
    • Bukkit Plugins
    • +3
  • Stunned project image

    Stunned

    • 3.0K
    • Bukkit Plugins

    Simple lightweight tool to "Stun/Freeze" players at a location for a defined time.

    • 3.0K
    • January 28, 2015
    • Bukkit Plugins
    • +3
  • Region Titles project image

    Region Titles

    • 6.0K
    • Bukkit Plugins

    Add-on for Title Manager to display Region IDs

    • 6.0K
    • February 28, 2015
    • Bukkit Plugins
    • +3
  • Skills project image

    Skills

    • 4.3K
    • Bukkit Plugins

    Skills introduces passive and active skills to Minecraft.

    • 4.3K
    • April 23, 2015
    • Bukkit Plugins
    • +4
  • Upgradable project image

    Upgradable

    • 4.6K
    • Bukkit Plugins

    Introducing tiered weapons and armor upgrades.

    • 4.6K
    • April 15, 2015
    • Bukkit Plugins
    • +3
  • Stunned project image

    Stunned

    • 3.0K
    • Bukkit Plugins

    Simple lightweight tool to "Stun/Freeze" players at a location for a defined time.

    • 3.0K
    • January 28, 2015
    • Bukkit Plugins
    • +3