public class CustomItemStack
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
CustomItemStack(CustomItem cItem)
Create a new CustomItemStack.
|
CustomItemStack(CustomItem cItem,
short durability,
java.lang.String texture)
Create a new CustomItemStack.
|
CustomItemStack(org.bukkit.inventory.ItemStack item)
Create a new CustomItemStack.
|
CustomItemStack(java.lang.String idName)
Create a new CustomItemStack.
Durability and Texture will be the default values. |
CustomItemStack(java.lang.String idName,
short durability,
java.lang.String texture)
Create a new CustomItemStack.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllNBTData(java.util.Map<? extends java.lang.String,? extends java.lang.Object> nbtData)
Add all NBT Data from a Map.
|
void |
addAttribute(Attributes.AttributeType type,
java.lang.String name,
double amount,
java.util.UUID uuid,
org.bukkit.inventory.EquipmentSlot slot,
Attributes.Operation operation)
Add an attribute to the ItemStack.
|
void |
addNBTData(java.lang.String nbtKey,
java.lang.Object nbtData)
Add NBT Data.
|
CustomItemStack |
clone() |
Attributes |
getAttributes() |
CustomItem |
getCustomItem() |
int |
getFakeDurability() |
org.bukkit.inventory.ItemStack |
getItemStack() |
int |
getMaxFakeDurability() |
NbtFactory.NbtCompound |
getNBTData() |
java.lang.String |
getTexture() |
CustomItemStack |
reduceDurability(org.bukkit.entity.Player player,
int durabilityToReduce)
Reduces the durability of the CustomItemStack, whether it's using Fake
Durability or not.
|
void |
removeAttribute(Attributes.AttributeType type,
java.lang.String name,
double amount,
java.util.UUID uuid,
org.bukkit.inventory.EquipmentSlot slot,
Attributes.Operation operation)
Remove an Attribute from the Custom Item.
|
void |
removeNBTData(java.lang.String nbtKey)
Remove NBT Data from the ItemStack.
|
CustomItemStack |
setFakeDurability(int durability)
Sets the
ItemStack 's Current Fake Durability. |
CustomItemStack |
setTexture(java.lang.String texture)
Sets the Texture of the ItemStack.
|
CustomItemStack |
updateLore()
Updates the lore of the ItemStack using the
CustomItem.getFullLore(Map, int, Attributes) method. |
CustomItemStack |
updateLore(java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer> enchantsToCheck)
Updates the lore of the ItemStack using the
CustomItem.getFullLore(Map, int, Attributes) method. |
public CustomItemStack(java.lang.String idName)
idName
- The idName of the Custom Item. The Custom Item must be already
Initialized using the AdditionsAPIInitializationEvent
.public CustomItemStack(java.lang.String idName, short durability, java.lang.String texture)
idName
- The idName of the Custom Item. The Custom Item must be already
Initialized using the AdditionsAPIInitializationEvent
.durability
- The durability of the ItemStack
.texture
- The texture of the ItemStack
.public CustomItemStack(CustomItem cItem)
cItem
- The CustomItem that will be used to construct the
ItemStack
.public CustomItemStack(CustomItem cItem, short durability, java.lang.String texture)
cItem
- The CustomItem that will be used to construct the
ItemStack
.durability
- The durability of the ItemStack
.texture
- The name of the texture of the ItemStack
.public CustomItemStack(org.bukkit.inventory.ItemStack item)
item
- The ItemStack
that will be used to find the
CustomItem
, durability and texture.public CustomItem getCustomItem()
CustomItem
that is contained in the
CustomItemStack
.public java.lang.String getTexture()
ModelInjector
(in other words, it's not a
CustomTexturedItem
or similar and does not contain a
Texture) it will return null.public CustomItemStack setTexture(java.lang.String texture)
ModelInjector
and have the Texture
already Initialized with the AdditionsAPIInitializationEvent
.
texture
- The name of the Texture.public org.bukkit.inventory.ItemStack getItemStack()
ItemStack
that the CustomItemStack
contains.public int getFakeDurability()
CustomItem
has Fake Durability. If it does not, it will
return 0.public int getMaxFakeDurability()
public CustomItemStack setFakeDurability(int durability)
ItemStack
's Current Fake Durability. This is only valid
of the CustomItem
has Fake Durability.durability
- The durability to set.public CustomItemStack reduceDurability(org.bukkit.entity.Player player, int durabilityToReduce)
PlayerCustomItemDamageEvent
, so it
could be cancelled.durabilityToReduce
- The amount of durability that will be reducedpublic CustomItemStack updateLore()
CustomItem.getFullLore(Map, int, Attributes)
method. This is
necessary if you added Enchantments and will be done automatically if the
Item was enchanted in an enchantment table or had its durability changed.public CustomItemStack updateLore(java.util.Map<org.bukkit.enchantments.Enchantment,java.lang.Integer> enchantsToCheck)
CustomItem.getFullLore(Map, int, Attributes)
method. This is
necessary if you added Enchantments and will be done automatically if the
Item was enchanted in an enchantment table or had its durability changed.public void addAttribute(Attributes.AttributeType type, java.lang.String name, double amount, java.util.UUID uuid, org.bukkit.inventory.EquipmentSlot slot, Attributes.Operation operation)
type
- name
- amount
- uuid
- slot
- operation
- public Attributes getAttributes()
public void removeAttribute(Attributes.AttributeType type, java.lang.String name, double amount, java.util.UUID uuid, org.bukkit.inventory.EquipmentSlot slot, Attributes.Operation operation)
type
- name
- amount
- uuid
- slot
- operation
- public void addAllNBTData(java.util.Map<? extends java.lang.String,? extends java.lang.Object> nbtData)
nbtData
- public void addNBTData(java.lang.String nbtKey, java.lang.Object nbtData)
nbtKey
- nbtData
- public NbtFactory.NbtCompound getNBTData()
public void removeNBTData(java.lang.String nbtKey)
nbtKey
- public CustomItemStack clone()
clone
in class java.lang.Object