Interface EntityEquipment


public interface EntityEquipment
An interface to a creatures inventory
  • Method Details

    • setItem

      Stores the ItemStack at the given equipment slot in the inventory.
      Parameters:
      slot - the slot to put the ItemStack
      item - the ItemStack to set
    • 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 ItemStack
      item - the ItemStack to set
      silent - whether or not the equip sound should be silenced
    • 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
    • getItemInMainHand

      @NotNull @NotNull ItemStack getItemInMainHand()
      Gets a copy of the item the entity is currently holding in their main hand.
      Returns:
      the currently held item
    • setItemInMainHand

      void setItemInMainHand(@Nullable @Nullable ItemStack item)
      Sets the item the entity is holding in their main hand.
      Parameters:
      item - The item to put into the entities hand
    • setItemInMainHand

      void setItemInMainHand(@Nullable @Nullable ItemStack item, boolean silent)
      Sets the item the entity is holding in their main hand.
      Parameters:
      item - The item to put into the entities hand
      silent - whether or not the equip sound should be silenced
    • getItemInOffHand

      @NotNull @NotNull ItemStack getItemInOffHand()
      Gets a copy of the item the entity is currently holding in their off hand.
      Returns:
      the currently held item
    • setItemInOffHand

      void setItemInOffHand(@Nullable @Nullable ItemStack item)
      Sets the item the entity is holding in their off hand.
      Parameters:
      item - The item to put into the entities hand
    • setItemInOffHand

      void setItemInOffHand(@Nullable @Nullable ItemStack item, boolean silent)
      Sets the item the entity is holding in their off hand.
      Parameters:
      item - The item to put into the entities hand
      silent - whether or not the equip sound should be silenced
    • getItemInHand

      Deprecated.
      entities can duel wield now use the methods for the specific hand instead
      Gets a copy of the item the entity is currently holding
      Returns:
      the currently held item
      See Also:
      getItemInMainHand(), getItemInOffHand()
    • setItemInHand

      @Deprecated void setItemInHand(@Nullable @Nullable ItemStack stack)
      Deprecated.
      entities can duel wield now use the methods for the specific hand instead
      Sets the item the entity is holding
      Parameters:
      stack - The item to put into the entities hand
      See Also:
      setItemInMainHand(ItemStack), setItemInOffHand(ItemStack)
    • getHelmet

      Gets a copy of the helmet currently being worn by the entity
      Returns:
      The helmet being worn
    • setHelmet

      void setHelmet(@Nullable @Nullable ItemStack helmet)
      Sets the helmet worn by the entity
      Parameters:
      helmet - The helmet to put on the entity
    • setHelmet

      void setHelmet(@Nullable @Nullable ItemStack helmet, boolean silent)
      Sets the helmet worn by the entity
      Parameters:
      helmet - The helmet to put on the entity
      silent - whether or not the equip sound should be silenced
    • getChestplate

      @Nullable @Nullable ItemStack getChestplate()
      Gets a copy of the chest plate currently being worn by the entity
      Returns:
      The chest plate being worn
    • setChestplate

      void setChestplate(@Nullable @Nullable ItemStack chestplate)
      Sets the chest plate worn by the entity
      Parameters:
      chestplate - The chest plate to put on the entity
    • setChestplate

      void setChestplate(@Nullable @Nullable ItemStack chestplate, boolean silent)
      Sets the chest plate worn by the entity
      Parameters:
      chestplate - The chest plate to put on the entity
      silent - whether or not the equip sound should be silenced
    • getLeggings

      Gets a copy of the leggings currently being worn by the entity
      Returns:
      The leggings being worn
    • setLeggings

      void setLeggings(@Nullable @Nullable ItemStack leggings)
      Sets the leggings worn by the entity
      Parameters:
      leggings - The leggings to put on the entity
    • setLeggings

      void setLeggings(@Nullable @Nullable ItemStack leggings, boolean silent)
      Sets the leggings worn by the entity
      Parameters:
      leggings - The leggings to put on the entity
      silent - whether or not the equip sound should be silenced
    • getBoots

      Gets a copy of the boots currently being worn by the entity
      Returns:
      The boots being worn
    • setBoots

      void setBoots(@Nullable @Nullable ItemStack boots)
      Sets the boots worn by the entity
      Parameters:
      boots - The boots to put on the entity
    • setBoots

      void setBoots(@Nullable @Nullable ItemStack boots, boolean silent)
      Sets the boots worn by the entity
      Parameters:
      boots - The boots to put on the entity
      silent - whether or not the equip sound should be silenced
    • getArmorContents

      @NotNull @NotNull ItemStack[] getArmorContents()
      Gets a copy of all worn armor
      Returns:
      The array of worn armor. Individual items may be null.
    • setArmorContents

      void setArmorContents(@NotNull @NotNull ItemStack[] items)
      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 float getItemInHandDropChance()
      Deprecated.
      entities can duel wield now use the methods for the specific hand instead
      Returns:
      drop chance
      See Also:
      getItemInMainHandDropChance(), getItemInOffHandDropChance()
    • setItemInHandDropChance

      @Deprecated void setItemInHandDropChance(float chance)
      Deprecated.
      entities can duel wield now use the methods for the specific hand instead
      Parameters:
      chance - drop chance
      See Also:
      setItemInMainHandDropChance(float), setItemInOffHandDropChance(float)
    • 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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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 1.0F will always drop
      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

      float getDropChance(@NotNull @NotNull EquipmentSlot slot)
      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
      Parameters:
      slot - the slot to get the drop chance of
      Returns:
      the drop chance for the slot
    • setDropChance

      void setDropChance(@NotNull @NotNull EquipmentSlot slot, float chance)
      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
      Parameters:
      slot - the slot to set the drop chance of
      chance - the drop chance for the slot
      Throws:
      UnsupportedOperationException - when called on non-Mob entities