Minecraft AttributesAPI mod 2026 download
logo
minecraft mod AttributesAPI

AttributesAPI

Game Version: CB 1.7.9-R0.1
Total Downloads: 2,561
Updated: May 31, 2014
Created: May 4, 2014
Download AttributesAPIDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
AttributesAPI 1.1 release 34.00 KB May 31, 2014 CB 1.7.9-R0.1 2,014 download AttributesAPI AttributesAPI 1.1 releaseDownload
AttributesAPI 1.0.1 release 31.23 KB May 18, 2014 CB 1.7.9-R0.1 185 download AttributesAPI AttributesAPI 1.0.1 releaseDownload
AttributesAPI 1.0 for Bukkit 1.7 release 31.13 KB May 4, 2014 1.7.4 362 download AttributesAPI AttributesAPI 1.0 for Bukkit 1.7 releaseDownload

Description

Share this:

This plugin currently works only with versions of Bukkit 1.7

Introduction

Using the AttributesAPI, it is possible to apply Attributes to items. This allows you to, for example, make shoes that make you run really quickly, or a sword that makes you resistive to knockbacks. Usage is really simple, you only need an item in your hand and run a command. There is also a simple API available for other plugin developers to use this and add attributes to their plugin items.

Usage for server admins

People with the permission attributes can hold an item in their hand and run the following command:
/attribute <type> <operation> <value>

For type, the following options are available: attack_damage, follow_range, jump_strength (horses), knockback_resistance, max_health, movement_speed and spawn_reinforcements (zombies). Detailed information about every type can be found here.

For operation, the following options are available: add_number, add_percentage and multiply_percentage. They are quite self-explanatory, but you can find the exact usage here.

For value, you can input any number. If your operation asks for a percentage, you need to use a number where 0.0 = 0% and 1.0 = 100%.

Usage for plugin developers

After including this plugin's JAR file, you have access to the API. There are two classes and two enumerations that are important to use attributes: Attribute,
Attributes
AttributeType and Operation.

  • An Attribute is one instance of a single attribute
  • Attributes is a class containing static methods to apply attributes, or retrieve existing attributes from an ItemStack.
  • An AttributeType is one of the types listed in the previous section
  • An Operation is one of the operations listed in the previous section

You can simply make an Attribute:

Attribute a = new Attribute(AttributeType.MAX_HEALTH,Operation.ADD_NUMBER,20.0);

This will create an Attribute increasing your health by 10 hearts (20.0 life points). You can also use methods like setType and setAmount to edit your Attribute after constructing it.

Apply your attributes to an ItemStack:

Bukkit.getServer().getPlayer("Arfie99").getInventory().addItem(
    Attributes.apply(new ItemStack(Material.DIAMOND_SWORD),a,true));

The method apply accepts an ItemStack and a boolean argument. The ItemStack is a copy of the returned stack, without the attributes. The boolean will indicate if this Attribute should remove contingent other attributes that were already on the stack.

In short, everything is possible with this single line of code:

Bukkit.getServer().getPlayer("Arfie99").getInventory().addItem(Attributes.apply(new ItemStack(Material.DIAMOND_SWORD),new Attribute(AttributeType.MAX_HEALTH,Operation.ADD_NUMBER,20.0),true));

You can also add collections containing attributes:

List<Attribute> list = Arrays.asList(new Attribute{a1, a2, /*...*/});
ItemStack is = Attributes.apply(new ItemStack(Material.DIAMOND_SWORD),list,true);

Source code

Source code for this plugin is available on GitHub, containing javadocs for explaining the API. Feel free to use it in any way you want, or do pull requests if you have made another awesome feature.
https://github.com/arfie/AttributesAPI

Comments

Add a comment