Class ShieldItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.ShieldItem
All Implemented Interfaces:
ItemConvertible

public class ShieldItem
extends Item
  • Constructor Details

  • Method Details

    • getTranslationKey

      public String getTranslationKey​(ItemStack stack)
      Gets the translation key of this item using the provided item stack for context.
      Overrides:
      getTranslationKey in class Item
    • appendTooltip

      @Environment(CLIENT) public void appendTooltip​(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context)
      Overrides:
      appendTooltip in class Item
    • getUseAction

      public UseAction getUseAction​(ItemStack stack)
      Overrides:
      getUseAction in class Item
    • getMaxUseTime

      public int getMaxUseTime​(ItemStack stack)
      Overrides:
      getMaxUseTime 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.
    • canRepair

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

      public static DyeColor getColor​(ItemStack stack)