Class ArmorItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.ArmorItem
All Implemented Interfaces:
ItemConvertible, Vanishable, Wearable
Direct Known Subclasses:
DyeableArmorItem

public class ArmorItem
extends Item
implements Wearable
  • Field Details

    • MODIFIERS

      private static final UUID[] MODIFIERS
    • DISPENSER_BEHAVIOR

      public static final DispenserBehavior DISPENSER_BEHAVIOR
    • slot

      protected final EquipmentSlot slot
    • protection

      private final int protection
    • toughness

      private final float toughness
    • knockbackResistance

      protected final float knockbackResistance
    • type

      protected final ArmorMaterial type
    • attributeModifiers

      private final Multimap<EntityAttribute,​EntityAttributeModifier> attributeModifiers
  • Constructor Details

  • Method Details

    • dispenseArmor

      public static boolean dispenseArmor​(BlockPointer pointer, ItemStack armor)
    • getSlotType

      public EquipmentSlot getSlotType()
    • getEnchantability

      public int getEnchantability()
      Gets the enchantability of an item. This specifies the ability of an item to receive enchantments when enchanted using an enchanting table. As the value increases, the amount and level of enchantments applied increase.

      If the value of this method is 0, the item cannot be enchanted using an enchanting table.

      Overrides:
      getEnchantability in class Item
    • getMaterial

      public ArmorMaterial getMaterial()
    • canRepair

      public boolean canRepair​(ItemStack stack, ItemStack ingredient)
      Overrides:
      canRepair in class Item
    • use

      public TypedActionResult<ItemStack> use​(World world, PlayerEntity user, Hand hand)
      Called when an item is used by a player. The use action, by default, is bound to the right mouse button.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using world.isClient().

      Overrides:
      use in class Item
      Parameters:
      world - the world the item was used in
      user - the player who used the item
      hand - the hand used
      Returns:
      a typed action result that specifies whether using the item was successful. The action result contains the new item stack that the player's hand will be set to.
    • getAttributeModifiers

      public Multimap<EntityAttribute,​EntityAttributeModifier> getAttributeModifiers​(EquipmentSlot slot)
      Overrides:
      getAttributeModifiers in class Item
    • getProtection

      public int getProtection()
    • getToughness

      public float getToughness()
    • getEquipSound

      @Nullable public SoundEvent getEquipSound()
      Overrides:
      getEquipSound in class Item