Interface EntityEquipment
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the entity of all armor and held itemsGets all ItemStacks from the armor slots.getBoots()
Gets the boots currently being worn by the entityfloat
Gets the chance of the boots being dropped upon this creature's death.Gets the chest plate currently being worn by the entityfloat
Gets the chance of the chest plate being dropped upon this creature's death.float
Gets the drop chance of specified slot.Gets the helmet currently being worn by the entityfloat
Gets the chance of the helmet being dropped upon this creature's death.Get the entity this EntityEquipment belongs togetItem
(@NotNull EquipmentSlot slot) Gets the ItemStack at the given equipment slot in the inventory.Deprecated.entities can duel wield now use the methods for the specific hand insteadfloat
Deprecated.entities can duel wield now use the methods for the specific hand insteadGets the item the entity is currently holding in their main hand.float
Gets the chance of the main hand item being dropped upon this creature's death.Gets the item the entity is currently holding in their off hand.float
Gets the chance of the off hand item being dropped upon this creature's death.Gets the leggings currently being worn by the entityfloat
Gets the chance of the leggings being dropped upon this creature's death.void
setArmorContents
(@NotNull ItemStack[] items) Sets the entities armor to the provided array of ItemStacksvoid
Sets the boots worn by the entityvoid
Sets the boots worn by the entityvoid
setBootsDropChance
(float chance) Sets the chance of the boots being dropped upon this creature's death.void
setChestplate
(@Nullable ItemStack chestplate) Sets the chest plate worn by the entityvoid
setChestplate
(@Nullable ItemStack chestplate, boolean silent) Sets the chest plate worn by the entityvoid
setChestplateDropChance
(float chance) Sets the chance of the chest plate being dropped upon this creature's death.void
setDropChance
(@NotNull EquipmentSlot slot, float chance) Sets the drop chance of the specified slot.void
Sets the helmet worn by the entityvoid
Sets the helmet worn by the entityvoid
setHelmetDropChance
(float chance) Sets the chance of the helmet being dropped upon this creature's death.void
setItem
(@NotNull EquipmentSlot slot, @Nullable ItemStack item) Stores the ItemStack at the given equipment slot in the inventory.void
setItem
(@NotNull EquipmentSlot slot, @Nullable ItemStack item, boolean silent) Stores the ItemStack at the given equipment slot in the inventory.void
setItemInHand
(@Nullable ItemStack stack) Deprecated.entities can duel wield now use the methods for the specific hand insteadvoid
setItemInHandDropChance
(float chance) Deprecated.entities can duel wield now use the methods for the specific hand insteadvoid
Sets the item the entity is holding in their main hand.void
setItemInMainHand
(@Nullable ItemStack item, boolean silent) Sets the item the entity is holding in their main hand.void
setItemInMainHandDropChance
(float chance) Sets the chance of the item this creature is currently holding in their main hand being dropped upon this creature's death.void
Sets the item the entity is holding in their off hand.void
setItemInOffHand
(@Nullable ItemStack item, boolean silent) Sets the item the entity is holding in their off hand.void
setItemInOffHandDropChance
(float chance) Sets the chance of the off hand item being dropped upon this creature's death.void
setLeggings
(@Nullable ItemStack leggings) Sets the leggings worn by the entityvoid
setLeggings
(@Nullable ItemStack leggings, boolean silent) Sets the leggings worn by the entityvoid
setLeggingsDropChance
(float chance) Sets the chance of the leggings being dropped upon this creature's death.
-
Method Details
-
setItem
Stores the ItemStack at the given equipment slot in the inventory.- Parameters:
slot
- the slot to put the ItemStackitem
- the ItemStack to set- Throws:
IllegalArgumentException
- if the slot is invalid for the entity
-
setItem
void setItem(@NotNull @NotNull EquipmentSlot slot, @Nullable @Nullable ItemStack item, boolean silent) Stores the ItemStack at the given equipment slot in the inventory.- Parameters:
slot
- the slot to put the ItemStackitem
- the ItemStack to setsilent
- whether the equip sound should be silenced- Throws:
IllegalArgumentException
- if the slot is invalid for the entity
-
getItem
Gets the ItemStack at the given equipment slot in the inventory.- Parameters:
slot
- the slot to get the ItemStack- Returns:
- the ItemStack in the given slot
- Throws:
IllegalArgumentException
- if the slot is invalid for the entity
-
getItemInMainHand
Gets the item the entity is currently holding in their main hand.This returns a copy if this equipment instance is from a non-player, or it's an empty stack (has AIR as its type). For non-empty stacks from players, this returns a live mirror. You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getItemInMainHand(); // will return a mirror } else { equipment.getItemInMainHand(); // will return a copy }
- Returns:
- the currently held item
-
setItemInMainHand
Sets the item the entity is holding in their main hand.- Parameters:
item
- The item to put into the entities hand
-
setItemInMainHand
Sets the item the entity is holding in their main hand.- Parameters:
item
- The item to put into the entities handsilent
- whether or not the equip sound should be silenced
-
getItemInOffHand
Gets the item the entity is currently holding in their off hand.This returns a copy if this equipment instance is from a non-player, or it's an empty stack (has AIR as its type). For non-empty stacks from players, this returns a live mirror. You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getItemInOffHand(); // will return a mirror } else { equipment.getItemInOffHand(); // will return a copy }
- Returns:
- the currently held item
-
setItemInOffHand
Sets the item the entity is holding in their off hand.- Parameters:
item
- The item to put into the entities hand
-
setItemInOffHand
Sets the item the entity is holding in their off hand.- Parameters:
item
- The item to put into the entities handsilent
- whether or not the equip sound should be silenced
-
getItemInHand
Deprecated.entities can duel wield now use the methods for the specific hand insteadGets the item the entity is currently holdingThis returns a copy if this equipment instance is from a non-player, or it's an empty stack (has AIR as its type). For non-empty stacks from players, this returns a live mirror. You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getItemInHand(); // will return a mirror } else { equipment.getItemInHand(); // will return a copy }
- Returns:
- the currently held item
- See Also:
-
setItemInHand
Deprecated.entities can duel wield now use the methods for the specific hand insteadSets the item the entity is holding- Parameters:
stack
- The item to put into the entities hand- See Also:
-
getHelmet
Gets the helmet currently being worn by the entityThis returns a copy if this equipment instance is from a non-player. For stacks from players, this returns a live mirror (or null). You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getHelmet(); // will return a mirror } else { equipment.getHelmet(); // will return a copy }
- Returns:
- The helmet being worn
-
setHelmet
Sets the helmet worn by the entity- Parameters:
helmet
- The helmet to put on the entity
-
setHelmet
Sets the helmet worn by the entity- Parameters:
helmet
- The helmet to put on the entitysilent
- whether or not the equip sound should be silenced
-
getChestplate
Gets the chest plate currently being worn by the entityThis returns a copy if this equipment instance is from a non-player. For stacks from players, this returns a live mirror (or null). You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getChestplate(); // will return a mirror } else { equipment.getChestplate(); // will return a copy }
- Returns:
- The chest plate being worn
-
setChestplate
Sets the chest plate worn by the entity- Parameters:
chestplate
- The chest plate to put on the entity
-
setChestplate
Sets the chest plate worn by the entity- Parameters:
chestplate
- The chest plate to put on the entitysilent
- whether or not the equip sound should be silenced
-
getLeggings
Gets the leggings currently being worn by the entityThis returns a copy if this equipment instance is from a non-player. For stacks from players, this returns a live mirror (or null). You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getLeggings(); // will return a mirror } else { equipment.getLeggings(); // will return a copy }
- Returns:
- The leggings being worn
-
setLeggings
Sets the leggings worn by the entity- Parameters:
leggings
- The leggings to put on the entity
-
setLeggings
Sets the leggings worn by the entity- Parameters:
leggings
- The leggings to put on the entitysilent
- whether or not the equip sound should be silenced
-
getBoots
Gets the boots currently being worn by the entityThis returns a copy if this equipment instance is from a non-player. For stacks from players, this returns a live mirror (or null). You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getBoots(); // will return a mirror } else { equipment.getBoots(); // will return a copy }
- Returns:
- The boots being worn
-
setBoots
Sets the boots worn by the entity- Parameters:
boots
- The boots to put on the entity
-
setBoots
Sets the boots worn by the entity- Parameters:
boots
- The boots to put on the entitysilent
- whether or not the equip sound should be silenced
-
getArmorContents
@UndefinedNullability("not null elements for entities, nullable elements for players") ItemStack @NotNull [] getArmorContents()Gets all ItemStacks from the armor slots.This returns a copy if this equipment instance is from a non-player, or it's an empty stack (has AIR as its type). For non-empty stacks from players, this returns a live mirror. You can check if this will return a mirror with
EntityEquipment equipment = entity.getEquipment(); if (equipment instanceof PlayerInventory) { equipment.getArmorContents(); // will return an array of mirror } else { equipment.getArmorContents(); // will return an array of copies }
- Returns:
- all the ItemStacks from the armor slots. Individual items can be null and are returned in a fixed order starting from the boots and going up to the helmet
-
setArmorContents
Sets the entities armor to the provided array of ItemStacks- Parameters:
items
- The items to set the armor as. Individual items may be null.
-
clear
void clear()Clears the entity of all armor and held items -
getItemInHandDropChance
Deprecated.entities can duel wield now use the methods for the specific hand instead- Returns:
- drop chance
- See Also:
-
setItemInHandDropChance
Deprecated.entities can duel wield now use the methods for the specific hand instead- Parameters:
chance
- drop chance- See Also:
-
getItemInMainHandDropChance
float getItemInMainHandDropChance()Gets the chance of the main hand item being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop killed by anything
- Returns:
- chance of the currently held item being dropped (1 for non-
Mob
)
-
setItemInMainHandDropChance
void setItemInMainHandDropChance(float chance) Sets the chance of the item this creature is currently holding in their main hand being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- the chance of the main hand item being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getItemInOffHandDropChance
float getItemInOffHandDropChance()Gets the chance of the off hand item being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Returns:
- chance of the off hand item being dropped (1 for non-
Mob
)
-
setItemInOffHandDropChance
void setItemInOffHandDropChance(float chance) Sets the chance of the off hand item being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- the chance of off hand item being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getHelmetDropChance
float getHelmetDropChance()Gets the chance of the helmet being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Returns:
- the chance of the helmet being dropped (1 for non-
Mob
)
-
setHelmetDropChance
void setHelmetDropChance(float chance) Sets the chance of the helmet being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- of the helmet being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getChestplateDropChance
float getChestplateDropChance()Gets the chance of the chest plate being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Returns:
- the chance of the chest plate being dropped (1 for non-
Mob
)
-
setChestplateDropChance
void setChestplateDropChance(float chance) Sets the chance of the chest plate being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- of the chest plate being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getLeggingsDropChance
float getLeggingsDropChance()Gets the chance of the leggings being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Returns:
- the chance of the leggings being dropped (1 for non-
Mob
)
-
setLeggingsDropChance
void setLeggingsDropChance(float chance) Sets the chance of the leggings being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- chance of the leggings being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getBootsDropChance
float getBootsDropChance()Gets the chance of the boots being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Returns:
- the chance of the boots being dropped (1 for non-
Mob
)
-
setBootsDropChance
void setBootsDropChance(float chance) Sets the chance of the boots being dropped upon this creature's death.- A drop chance of 0.0F will never drop
- A drop chance of exactly 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
chance
- of the boots being dropped- Throws:
UnsupportedOperationException
- when called on non-Mob
-
getHolder
Get the entity this EntityEquipment belongs to- Returns:
- the entity this EntityEquipment belongs to
-
getDropChance
Gets the drop chance of specified slot.- A drop chance of 0.0F will never drop
- A drop chance of 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
slot
- the slot to get the drop chance of- Returns:
- the drop chance for the slot
-
setDropChance
Sets the drop chance of the specified slot.- A drop chance of 0.0F will never drop
- A drop chance of 1.0F will always drop if killed by a player
- A drop chance of greater than 1.0F will always drop if killed by anything
- Parameters:
slot
- the slot to set the drop chance ofchance
- the drop chance for the slot- Throws:
UnsupportedOperationException
- when called on non-Mob
entities
-