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:
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
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.
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
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 ) ;
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
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.
Spoiler: Some possible example applications
- 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 ...
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.8, 1.9
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Item attribute modifier API Library is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9. Downloaded 1,113 times (via Spigot). Download it and open it directly in the game.