Class Item

java.lang.Object
net.minecraft.item.Item
Direct Known Subclasses:
ArmorItem, ArmorStandItem, BedItem, BlockItem, BoatItem, BookItem, BowItem, BucketItem, CarrotOnAStickItem, CoalItem, DyeItem, EggItem, EnchantedBookItem, EnderEyeItem, EnderPearlItem, ExperienceBottleItem, FireChargeItem, FireworkChargeItem, FireworkItem, FishingRodItem, FlintAndSteelItem, FoodItem, GlassBottleItem, HoeItem, LeadItem, MilkBucketItem, MinecartItem, MusicDiscItem, NameTagItem, NetherStarItem, NetworkSyncedItem, PlaceableItem, PotionItem, RedstoneItem, SaddleItem, ShearsItem, SignItem, SkullItem, SnowballItem, SpawnEggItem, SwordItem, ToolItem, WallHangableItem, WheatSeedsItem, WoodenDoorItem, WritableBookItem, WrittenBookItem

public class Item
extends Object
The Item class provides useful methods and fields for creation of Items. All items extend the Item class. The Item class also registers all items.
See Also:
Items
Mappings:
Namespace Name
official zw
intermediary net/minecraft/class_2054
named net/minecraft/item/Item
  • Field Details

    • REGISTRY

      public static final SimpleRegistry<Identifier,​Item> REGISTRY
      The Registry where all items get registered to.
      Mappings:
      Namespace Name Mixin selector
      official e Lzw;e:Lcx;
      intermediary field_8633 Lnet/minecraft/class_2054;field_8633:Lnet/minecraft/class_1393;
      named REGISTRY Lnet/minecraft/item/Item;REGISTRY:Lnet/minecraft/util/registry/SimpleRegistry;
    • BLOCK_ITEMS

      private static final Map<Block,​Item> BLOCK_ITEMS
      A map containing all BlockItems, with their corresponding Block and Item variants
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a:Ljava/util/Map;
      intermediary field_8629 Lnet/minecraft/class_2054;field_8629:Ljava/util/Map;
      named BLOCK_ITEMS Lnet/minecraft/item/Item;BLOCK_ITEMS:Ljava/util/Map;
    • ATTACK_DAMAGE_MODIFIER_UUID

      protected static final UUID ATTACK_DAMAGE_MODIFIER_UUID
      Mappings:
      Namespace Name Mixin selector
      official f Lzw;f:Ljava/util/UUID;
      intermediary field_8634 Lnet/minecraft/class_2054;field_8634:Ljava/util/UUID;
      named ATTACK_DAMAGE_MODIFIER_UUID Lnet/minecraft/item/Item;ATTACK_DAMAGE_MODIFIER_UUID:Ljava/util/UUID;
    • RANDOM

      protected static Random RANDOM
      Mappings:
      Namespace Name Mixin selector
      official g Lzw;g:Ljava/util/Random;
      intermediary field_8635 Lnet/minecraft/class_2054;field_8635:Ljava/util/Random;
      named RANDOM Lnet/minecraft/item/Item;RANDOM:Ljava/util/Random;
    • group

      private ItemGroup group
      The Item's ItemGroup
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b:Lyz;
      intermediary field_8630 Lnet/minecraft/class_2054;field_8630:Lnet/minecraft/class_2029;
      named group Lnet/minecraft/item/Item;group:Lnet/minecraft/item/ItemGroup;
    • maxCount

      protected int maxCount
      The maximum stack size of an item
      Mappings:
      Namespace Name Mixin selector
      official h Lzw;h:I
      intermediary field_8636 Lnet/minecraft/class_2054;field_8636:I
      named maxCount Lnet/minecraft/item/Item;maxCount:I
    • maxDamage

      private int maxDamage
      The maximum durability of an Item
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c:I
      intermediary field_8631 Lnet/minecraft/class_2054;field_8631:I
      named maxDamage Lnet/minecraft/item/Item;maxDamage:I
    • handheld

      protected boolean handheld
      Sets whether the item is handheld
      Mappings:
      Namespace Name Mixin selector
      official i Lzw;i:Z
      intermediary field_8637 Lnet/minecraft/class_2054;field_8637:Z
      named handheld Lnet/minecraft/item/Item;handheld:Z
    • damageable

      protected boolean damageable
      Sets whether the item has durability
      Mappings:
      Namespace Name Mixin selector
      official j Lzw;j:Z
      intermediary field_8638 Lnet/minecraft/class_2054;field_8638:Z
      named damageable Lnet/minecraft/item/Item;damageable:Z
    • recipeRemainder

      private Item recipeRemainder
      The item's recipe remainder. Used by Buckets and potions.
      See Also:
      PotionItem, BucketItem
      Mappings:
      Namespace Name Mixin selector
      official d Lzw;d:Lzw;
      intermediary field_8632 Lnet/minecraft/class_2054;field_8632:Lnet/minecraft/class_2054;
      named recipeRemainder Lnet/minecraft/item/Item;recipeRemainder:Lnet/minecraft/item/Item;
    • statusEffectString

      private String statusEffectString
      A description of the brewing recipe for their ingredients
      Mappings:
      Namespace Name Mixin selector
      official k Lzw;k:Ljava/lang/String;
      intermediary field_8639 Lnet/minecraft/class_2054;field_8639:Ljava/lang/String;
      named statusEffectString Lnet/minecraft/item/Item;statusEffectString:Ljava/lang/String;
    • translationKey

      private String translationKey
      The Item's translation key.
      Mappings:
      Namespace Name Mixin selector
      official l Lzw;l:Ljava/lang/String;
      intermediary field_8640 Lnet/minecraft/class_2054;field_8640:Ljava/lang/String;
      named translationKey Lnet/minecraft/item/Item;translationKey:Ljava/lang/String;
  • Constructor Details

    • Item

      public Item()
      Sets the max stack size of an Item to 64
      Mappings:
      Namespace Name Mixin selector
      official <init> Lzw;<init>()V
      intermediary <init> Lnet/minecraft/class_2054;<init>()V
      named <init> Lnet/minecraft/item/Item;<init>()V
  • Method Details

    • getRawId

      public static int getRawId​(Item item)
      Returns a numeric id for an Item
      Returns:
      Numeric Id
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b(Lzw;)I
      intermediary method_8272 Lnet/minecraft/class_2054;method_8272(Lnet/minecraft/class_2054;)I
      named getRawId Lnet/minecraft/item/Item;getRawId(Lnet/minecraft/item/Item;)I
    • byRawId

      public static Item byRawId​(int id)
      Returns an Item for its numeric Id
      Returns:
      Item
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b(I)Lzw;
      intermediary method_8270 Lnet/minecraft/class_2054;method_8270(I)Lnet/minecraft/class_2054;
      named byRawId Lnet/minecraft/item/Item;byRawId(I)Lnet/minecraft/item/Item;
    • fromBlock

      public static Item fromBlock​(Block block)
      Returns a BlockItem from a block
      Returns:
      Block
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lafh;)Lzw;
      intermediary method_8251 Lnet/minecraft/class_2054;method_8251(Lnet/minecraft/class_160;)Lnet/minecraft/class_2054;
      named fromBlock Lnet/minecraft/item/Item;fromBlock(Lnet/minecraft/block/Block;)Lnet/minecraft/item/Item;
    • getFromId

      public static Item getFromId​(String id)
      Returns an Item from its name or its numeric Id as a String
      Returns:
      Item
      Mappings:
      Namespace Name Mixin selector
      official d Lzw;d(Ljava/lang/String;)Lzw;
      intermediary method_8280 Lnet/minecraft/class_2054;method_8280(Ljava/lang/String;)Lnet/minecraft/class_2054;
      named getFromId Lnet/minecraft/item/Item;getFromId(Ljava/lang/String;)Lnet/minecraft/item/Item;
    • postProcessTag

      public boolean postProcessTag​(CompoundTag tag)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Ldn;)Z
      intermediary method_8253 Lnet/minecraft/class_2054;method_8253(Lnet/minecraft/class_1405;)Z
      named postProcessTag Lnet/minecraft/item/Item;postProcessTag(Lnet/minecraft/nbt/CompoundTag;)Z
    • setMaxCount

      public Item setMaxCount​(int count)
      Sets the max stack size of the Item
      Parameters:
      count - Maximum stack size
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c(I)Lzw;
      intermediary method_8275 Lnet/minecraft/class_2054;method_8275(I)Lnet/minecraft/class_2054;
      named setMaxCount Lnet/minecraft/item/Item;setMaxCount(I)Lnet/minecraft/item/Item;
    • use

      public boolean use​(ItemStack itemStack, PlayerEntity player, World world, BlockPos pos, Direction direction, float facingX, float facingY, float facingZ)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lwn;Ladm;Lcj;Lcq;FFF)Z
      intermediary method_8264 Lnet/minecraft/class_2054;method_8264(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Lnet/minecraft/class_99;Lnet/minecraft/class_1372;Lnet/minecraft/class_1383;FFF)Z
      named use Lnet/minecraft/item/Item;use(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FFF)Z
    • getMiningSpeedMultiplier

      public float getMiningSpeedMultiplier​(ItemStack stack, Block block)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lafh;)F
      intermediary method_8262 Lnet/minecraft/class_2054;method_8262(Lnet/minecraft/class_2056;Lnet/minecraft/class_160;)F
      named getMiningSpeedMultiplier Lnet/minecraft/item/Item;getMiningSpeedMultiplier(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/Block;)F
    • onStartUse

      public ItemStack onStartUse​(ItemStack stack, World world, PlayerEntity player)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Ladm;Lwn;)Lzx;
      intermediary method_8260 Lnet/minecraft/class_2054;method_8260(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)Lnet/minecraft/class_2056;
      named onStartUse Lnet/minecraft/item/Item;onStartUse(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
    • onFinishUse

      public ItemStack onFinishUse​(ItemStack stack, World world, PlayerEntity player)
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b(Lzx;Ladm;Lwn;)Lzx;
      intermediary method_8273 Lnet/minecraft/class_2054;method_8273(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)Lnet/minecraft/class_2056;
      named onFinishUse Lnet/minecraft/item/Item;onFinishUse(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
    • getMaxCount

      public int getMaxCount()
      Returns the max stack size of an Item
      Returns:
      Max stack Size
      Mappings:
      Namespace Name Mixin selector
      official j Lzw;j()I
      intermediary method_8292 Lnet/minecraft/class_2054;method_8292()I
      named getMaxCount Lnet/minecraft/item/Item;getMaxCount()I
    • getMeta

      public int getMeta​(int i)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(I)I
      intermediary method_8247 Lnet/minecraft/class_2054;method_8247(I)I
      named getMeta Lnet/minecraft/item/Item;getMeta(I)I
    • isUnbreakable

      public boolean isUnbreakable()
      Returns whether the item is unbreakable
      Returns:
      Whether the item is unbreakable
      Mappings:
      Namespace Name Mixin selector
      official k Lzw;k()Z
      intermediary method_8294 Lnet/minecraft/class_2054;method_8294()Z
      named isUnbreakable Lnet/minecraft/item/Item;isUnbreakable()Z
    • setUnbreakable

      protected Item setUnbreakable​(boolean unbreakable)
      Sets the current item as unbreakable.
      Parameters:
      unbreakable - Unbreakable
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Z)Lzw;
      intermediary method_8268 Lnet/minecraft/class_2054;method_8268(Z)Lnet/minecraft/class_2054;
      named setUnbreakable Lnet/minecraft/item/Item;setUnbreakable(Z)Lnet/minecraft/item/Item;
    • getMaxDamage

      public int getMaxDamage()
      Returns the maximum durability of the current Item.
      Returns:
      Max Durability
      Mappings:
      Namespace Name Mixin selector
      official l Lzw;l()I
      intermediary method_8296 Lnet/minecraft/class_2054;method_8296()I
      named getMaxDamage Lnet/minecraft/item/Item;getMaxDamage()I
    • setMaxDamage

      protected Item setMaxDamage​(int damage)
      Sets the maximum durability of the current Item.
      Parameters:
      damage - Maximum durability
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official d Lzw;d(I)Lzw;
      intermediary method_8279 Lnet/minecraft/class_2054;method_8279(I)Lnet/minecraft/class_2054;
      named setMaxDamage Lnet/minecraft/item/Item;setMaxDamage(I)Lnet/minecraft/item/Item;
    • isDamageable

      public boolean isDamageable()
      Returns whether the current item is damageable. Used by tools, armor, bows, etc.
      See Also:
      net.minecraft.item.Toolitem, BowItem, ArmorItem
      Mappings:
      Namespace Name Mixin selector
      official m Lzw;m()Z
      intermediary method_8298 Lnet/minecraft/class_2054;method_8298()Z
      named isDamageable Lnet/minecraft/item/Item;isDamageable()Z
    • onEntityHit

      public boolean onEntityHit​(ItemStack stack, LivingEntity entity1, LivingEntity entity2)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lpr;Lpr;)Z
      intermediary method_8263 Lnet/minecraft/class_2054;method_8263(Lnet/minecraft/class_2056;Lnet/minecraft/class_1752;Lnet/minecraft/class_1752;)Z
      named onEntityHit Lnet/minecraft/item/Item;onEntityHit(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/LivingEntity;)Z
    • onBlockBroken

      public boolean onBlockBroken​(ItemStack stack, World world, Block block, BlockPos pos, LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Ladm;Lafh;Lcj;Lpr;)Z
      intermediary method_8258 Lnet/minecraft/class_2054;method_8258(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_160;Lnet/minecraft/class_1372;Lnet/minecraft/class_1752;)Z
      named onBlockBroken Lnet/minecraft/item/Item;onBlockBroken(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/LivingEntity;)Z
    • isEffectiveOn

      public boolean isEffectiveOn​(Block block)
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b(Lafh;)Z
      intermediary method_8271 Lnet/minecraft/class_2054;method_8271(Lnet/minecraft/class_160;)Z
      named isEffectiveOn Lnet/minecraft/item/Item;isEffectiveOn(Lnet/minecraft/block/Block;)Z
    • canUseOnEntity

      public boolean canUseOnEntity​(ItemStack stack, PlayerEntity player, LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lwn;Lpr;)Z
      intermediary method_8266 Lnet/minecraft/class_2054;method_8266(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Lnet/minecraft/class_1752;)Z
      named canUseOnEntity Lnet/minecraft/item/Item;canUseOnEntity(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/LivingEntity;)Z
    • setHandheld

      public Item setHandheld()
      Sets the item to look as handheld.
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official n Lzw;n()Lzw;
      intermediary method_8299 Lnet/minecraft/class_2054;method_8299()Lnet/minecraft/class_2054;
      named setHandheld Lnet/minecraft/item/Item;setHandheld()Lnet/minecraft/item/Item;
    • isHandheld

      @Environment(CLIENT) public boolean isHandheld()
      Returns whether the item is supposed to look as handheld.
      Mappings:
      Namespace Name Mixin selector
      official w_ Lzw;w_()Z
      intermediary method_8305 Lnet/minecraft/class_2054;method_8305()Z
      named isHandheld Lnet/minecraft/item/Item;isHandheld()Z
    • shouldRotate

      @Environment(CLIENT) public boolean shouldRotate()
      Mappings:
      Namespace Name Mixin selector
      official e Lzw;e()Z
      intermediary method_8283 Lnet/minecraft/class_2054;method_8283()Z
      named shouldRotate Lnet/minecraft/item/Item;shouldRotate()Z
    • setTranslationKey

      public Item setTranslationKey​(String translationKey)
      Sets the current item's translation key.
      Parameters:
      translationKey - Translation key
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c(Ljava/lang/String;)Lzw;
      intermediary method_8277 Lnet/minecraft/class_2054;method_8277(Ljava/lang/String;)Lnet/minecraft/class_2054;
      named setTranslationKey Lnet/minecraft/item/Item;setTranslationKey(Ljava/lang/String;)Lnet/minecraft/item/Item;
    • getItemstackTranslatedName

      public String getItemstackTranslatedName​(ItemStack stack)
      Returns the translated name of an ItemStack
      Parameters:
      stack - The ItemStack
      Returns:
      Translated name
      See Also:
      CommonI18n
      Mappings:
      Namespace Name Mixin selector
      official k Lzw;k(Lzx;)Ljava/lang/String;
      intermediary method_8295 Lnet/minecraft/class_2054;method_8295(Lnet/minecraft/class_2056;)Ljava/lang/String;
      named getItemstackTranslatedName Lnet/minecraft/item/Item;getItemstackTranslatedName(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
    • getTranslationKey

      public String getTranslationKey()
      Returns the translation key of the current Item
      Returns:
      Translation key
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a()Ljava/lang/String;
      intermediary method_8246 Lnet/minecraft/class_2054;method_8246()Ljava/lang/String;
      named getTranslationKey Lnet/minecraft/item/Item;getTranslationKey()Ljava/lang/String;
    • getTranslationKey

      public String getTranslationKey​(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official e_ Lzw;e_(Lzx;)Ljava/lang/String;
      intermediary method_8286 Lnet/minecraft/class_2054;method_8286(Lnet/minecraft/class_2056;)Ljava/lang/String;
      named getTranslationKey Lnet/minecraft/item/Item;getTranslationKey(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
    • setRecipeRemainder

      public Item setRecipeRemainder​(Item recipeRemainder)
      Sets the item's recipe remainder
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c(Lzw;)Lzw;
      intermediary method_8278 Lnet/minecraft/class_2054;method_8278(Lnet/minecraft/class_2054;)Lnet/minecraft/class_2054;
      named setRecipeRemainder Lnet/minecraft/item/Item;setRecipeRemainder(Lnet/minecraft/item/Item;)Lnet/minecraft/item/Item;
    • shouldSyncTagToClient

      public boolean shouldSyncTagToClient()
      Mappings:
      Namespace Name Mixin selector
      official p Lzw;p()Z
      intermediary method_8300 Lnet/minecraft/class_2054;method_8300()Z
      named shouldSyncTagToClient Lnet/minecraft/item/Item;shouldSyncTagToClient()Z
    • getRecipeRemainder

      public Item getRecipeRemainder()
      Returns the current Item's recipe remainder
      Returns:
      recipeRemainder
      Mappings:
      Namespace Name Mixin selector
      official q Lzw;q()Lzw;
      intermediary method_8301 Lnet/minecraft/class_2054;method_8301()Lnet/minecraft/class_2054;
      named getRecipeRemainder Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/Item;
    • isFood

      public boolean isFood()
      Mappings:
      Namespace Name Mixin selector
      official r Lzw;r()Z
      intermediary method_8302 Lnet/minecraft/class_2054;method_8302()Z
      named isFood Lnet/minecraft/item/Item;isFood()Z
    • getDisplayColor

      @Environment(CLIENT) public int getDisplayColor​(ItemStack stack, int color)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;I)I
      intermediary method_8257 Lnet/minecraft/class_2054;method_8257(Lnet/minecraft/class_2056;I)I
      named getDisplayColor Lnet/minecraft/item/Item;getDisplayColor(Lnet/minecraft/item/ItemStack;I)I
    • inventoryTick

      public void inventoryTick​(ItemStack stack, World world, Entity entity, int slot, boolean selected)
      Runs every tick when the item is in an inventory.
      Parameters:
      stack - The item in an ItemStack form
      world - The world where the item is ticking
      entity - The entity whose inventory contains the item
      slot - The slot in which the item is placed
      selected - Whether the item is currently selected by the entity
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Ladm;Lpk;IZ)V
      intermediary method_8259 Lnet/minecraft/class_2054;method_8259(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1745;IZ)V
      named inventoryTick Lnet/minecraft/item/Item;inventoryTick(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;IZ)V
    • onCraft

      public void onCraft​(ItemStack stack, World world, PlayerEntity player)
      Runs when the item is crafted
      Parameters:
      stack - The item in an ItemStack form
      world - The world where the crafting happened
      player - The player who crafted the item
      Mappings:
      Namespace Name Mixin selector
      official d Lzw;d(Lzx;Ladm;Lwn;)V
      intermediary method_8282 Lnet/minecraft/class_2054;method_8282(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)V
      named onCraft Lnet/minecraft/item/Item;onCraft(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)V
    • isNetworkSynced

      public boolean isNetworkSynced()
      Mappings:
      Namespace Name Mixin selector
      official f Lzw;f()Z
      intermediary method_8287 Lnet/minecraft/class_2054;method_8287()Z
      named isNetworkSynced Lnet/minecraft/item/Item;isNetworkSynced()Z
    • getUseAction

      public UseAction getUseAction​(ItemStack stack)
      Returns the UseAction for an item when the item is used. Used by food, potions, bows, etc.
      Parameters:
      stack - The ItemStack that was used
      See Also:
      BowItem, PotionItem
      Mappings:
      Namespace Name Mixin selector
      official e Lzw;e(Lzx;)Laba;
      intermediary method_8285 Lnet/minecraft/class_2054;method_8285(Lnet/minecraft/class_2056;)Lnet/minecraft/class_30;
      named getUseAction Lnet/minecraft/item/Item;getUseAction(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/UseAction;
    • getMaxUseTime

      public int getMaxUseTime​(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official d Lzw;d(Lzx;)I
      intermediary method_8281 Lnet/minecraft/class_2054;method_8281(Lnet/minecraft/class_2056;)I
      named getMaxUseTime Lnet/minecraft/item/Item;getMaxUseTime(Lnet/minecraft/item/ItemStack;)I
    • onUseStopped

      public void onUseStopped​(ItemStack stack, World world, PlayerEntity player, int remainingTicks)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Ladm;Lwn;I)V
      intermediary method_8261 Lnet/minecraft/class_2054;method_8261(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;I)V
      named onUseStopped Lnet/minecraft/item/Item;onUseStopped(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;I)V
    • setStatusEffectString

      protected Item setStatusEffectString​(String statusEffectString)
      Sets the status effect string for the current item. Used by glowstone, spider eye, sugar, etc.
      Parameters:
      statusEffectString - The status effect string
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official e Lzw;e(Ljava/lang/String;)Lzw;
      intermediary method_8284 Lnet/minecraft/class_2054;method_8284(Ljava/lang/String;)Lnet/minecraft/class_2054;
      named setStatusEffectString Lnet/minecraft/item/Item;setStatusEffectString(Ljava/lang/String;)Lnet/minecraft/item/Item;
    • getStatusEffectString

      public String getStatusEffectString​(ItemStack stack)
      Returns the status effect string for the current item.
      Returns:
      The status effect string
      Mappings:
      Namespace Name Mixin selector
      official j Lzw;j(Lzx;)Ljava/lang/String;
      intermediary method_8293 Lnet/minecraft/class_2054;method_8293(Lnet/minecraft/class_2056;)Ljava/lang/String;
      named getStatusEffectString Lnet/minecraft/item/Item;getStatusEffectString(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
    • hasStatusEffectString

      public boolean hasStatusEffectString​(ItemStack stack)
      Returns whether the current item has a status effect string
      Returns:
      Whether the current item has a status effect string
      Mappings:
      Namespace Name Mixin selector
      official l Lzw;l(Lzx;)Z
      intermediary method_8297 Lnet/minecraft/class_2054;method_8297(Lnet/minecraft/class_2056;)Z
      named hasStatusEffectString Lnet/minecraft/item/Item;hasStatusEffectString(Lnet/minecraft/item/ItemStack;)Z
    • appendTooltip

      @Environment(CLIENT) public void appendTooltip​(ItemStack stack, PlayerEntity player, List<String> lines, boolean advanced)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lwn;Ljava/util/List;Z)V
      intermediary method_8265 Lnet/minecraft/class_2054;method_8265(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Ljava/util/List;Z)V
      named appendTooltip Lnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Ljava/util/List;Z)V
    • getDisplayName

      public String getDisplayName​(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;)Ljava/lang/String;
      intermediary method_8256 Lnet/minecraft/class_2054;method_8256(Lnet/minecraft/class_2056;)Ljava/lang/String;
      named getDisplayName Lnet/minecraft/item/Item;getDisplayName(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
    • hasEnchantmentGlint

      @Environment(CLIENT) public boolean hasEnchantmentGlint​(ItemStack stack)
      Returns whether the current item has an enchantment glint. Used by enchanted golden apples and enchanted items.
      See Also:
      net.minecraft.item.GoldenAppleItem
      Mappings:
      Namespace Name Mixin selector
      official f Lzw;f(Lzx;)Z
      intermediary method_8288 Lnet/minecraft/class_2054;method_8288(Lnet/minecraft/class_2056;)Z
      named hasEnchantmentGlint Lnet/minecraft/item/Item;hasEnchantmentGlint(Lnet/minecraft/item/ItemStack;)Z
    • getRarity

      public Rarity getRarity​(ItemStack stack)
      Returns the rarity of the current Item. Used by golden apples, enchanted items and potions.
      Parameters:
      stack - The item in an ItemStack form
      Returns:
      The rarity of the ItemStack
      See Also:
      net.minecraft.item.GoldenAppleItem, PotionItem
      Mappings:
      Namespace Name Mixin selector
      official g Lzw;g(Lzx;)Laaj;
      intermediary method_8290 Lnet/minecraft/class_2054;method_8290(Lnet/minecraft/class_2056;)Lnet/minecraft/class_12;
      named getRarity Lnet/minecraft/item/Item;getRarity(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/Rarity;
    • isEnchantable

      public boolean isEnchantable​(ItemStack stack)
      Returns whether the current item can have enchantments. It does this by verifying that the item's maximum stack size is 1 and the item can break.
      Mappings:
      Namespace Name Mixin selector
      official f_ Lzw;f_(Lzx;)Z
      intermediary method_8289 Lnet/minecraft/class_2054;method_8289(Lnet/minecraft/class_2056;)Z
      named isEnchantable Lnet/minecraft/item/Item;isEnchantable(Lnet/minecraft/item/ItemStack;)Z
    • onHit

      protected HitResult onHit​(World world, PlayerEntity player, boolean liquid)
      Returns the HitResult for an item when the player's arm is swung while holding the item.
      Parameters:
      world - The world that the item is in
      player - The player holding the item
      Returns:
      HitResult
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Ladm;Lwn;Z)Lauh;
      intermediary method_8250 Lnet/minecraft/class_2054;method_8250(Lnet/minecraft/class_99;Lnet/minecraft/class_1963;Z)Lnet/minecraft/class_647;
      named onHit Lnet/minecraft/item/Item;onHit(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Z)Lnet/minecraft/util/hit/HitResult;
    • getEnchantability

      public int getEnchantability()
      Returns the enchantability of an Item. Used by tools and armor
      Returns:
      Enchantability
      See Also:
      ToolItem, ArmorItem
      Mappings:
      Namespace Name Mixin selector
      official b Lzw;b()I
      intermediary method_8269 Lnet/minecraft/class_2054;method_8269()I
      named getEnchantability Lnet/minecraft/item/Item;getEnchantability()I
    • appendItemStacks

      @Environment(CLIENT) public void appendItemStacks​(Item item, ItemGroup group, List<ItemStack> list)
      Registers an item's sub items
      Parameters:
      item - The Item instance
      group - The ItemGroup
      list - The list of sub items
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzw;Lyz;Ljava/util/List;)V
      intermediary method_8255 Lnet/minecraft/class_2054;method_8255(Lnet/minecraft/class_2054;Lnet/minecraft/class_2029;Ljava/util/List;)V
      named appendItemStacks Lnet/minecraft/item/Item;appendItemStacks(Lnet/minecraft/item/Item;Lnet/minecraft/item/ItemGroup;Ljava/util/List;)V
    • getItemGroup

      @Environment(CLIENT) public ItemGroup getItemGroup()
      Returns the itemgroup that the item is in
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c()Lyz;
      intermediary method_8274 Lnet/minecraft/class_2054;method_8274()Lnet/minecraft/class_2029;
      named getItemGroup Lnet/minecraft/item/Item;getItemGroup()Lnet/minecraft/item/ItemGroup;
    • setItemGroup

      public Item setItemGroup​(ItemGroup group)
      Sets the itemgroup that the current item should be in
      Parameters:
      group - The ItemGroup
      Returns:
      The current Item
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lyz;)Lzw;
      intermediary method_8254 Lnet/minecraft/class_2054;method_8254(Lnet/minecraft/class_2029;)Lnet/minecraft/class_2054;
      named setItemGroup Lnet/minecraft/item/Item;setItemGroup(Lnet/minecraft/item/ItemGroup;)Lnet/minecraft/item/Item;
    • hasSubTypes

      public boolean hasSubTypes()
      Mappings:
      Namespace Name Mixin selector
      official s Lzw;s()Z
      intermediary method_8303 Lnet/minecraft/class_2054;method_8303()Z
      named hasSubTypes Lnet/minecraft/item/Item;hasSubTypes()Z
    • canRepair

      public boolean canRepair​(ItemStack stack, ItemStack ingredient)
      Returns whether the item can be repaired via an anvil or crafting table.
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lzx;Lzx;)Z
      intermediary method_8267 Lnet/minecraft/class_2054;method_8267(Lnet/minecraft/class_2056;Lnet/minecraft/class_2056;)Z
      named canRepair Lnet/minecraft/item/Item;canRepair(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
    • getAttributeModifierMap

      public Multimap<String,​AttributeModifier> getAttributeModifierMap()
      Returns a map containing entity attributes that are modified by the item
      Mappings:
      Namespace Name Mixin selector
      official i Lzw;i()Lcom/google/common/collect/Multimap;
      intermediary method_8291 Lnet/minecraft/class_2054;method_8291()Lcom/google/common/collect/Multimap;
      named getAttributeModifierMap Lnet/minecraft/item/Item;getAttributeModifierMap()Lcom/google/common/collect/Multimap;
    • setup

      public static void setup()
      This is the main method in the Item class. Both Items and BlockItems get registered here. The Item Ids starts from 256. The fields in the class Items can not be accessed before this method is called.
      See Also:
      net.minecarft.item.Items
      Mappings:
      Namespace Name Mixin selector
      official t Lzw;t()V
      intermediary method_8304 Lnet/minecraft/class_2054;method_8304()V
      named setup Lnet/minecraft/item/Item;setup()V
    • registerBlockItem

      private static void registerBlockItem​(Block block)
      Overloaded method that registers a BlockItem to the registry
      Parameters:
      block - The block
      Mappings:
      Namespace Name Mixin selector
      official c Lzw;c(Lafh;)V
      intermediary method_8276 Lnet/minecraft/class_2054;method_8276(Lnet/minecraft/class_160;)V
      named registerBlockItem Lnet/minecraft/item/Item;registerBlockItem(Lnet/minecraft/block/Block;)V
    • registerBlockItem

      protected static void registerBlockItem​(Block block, Item blockItem)
      Registers a BlockItem to the registry
      Parameters:
      block - The Block
      blockItem - The BlockItem
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(Lafh;Lzw;)V
      intermediary method_8252 Lnet/minecraft/class_2054;method_8252(Lnet/minecraft/class_160;Lnet/minecraft/class_2054;)V
      named registerBlockItem Lnet/minecraft/item/Item;registerBlockItem(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)V
    • register

      private static void register​(int id, String name, Item item)
      Overloaded method that registers an Item to the registry
      Parameters:
      id - The Item Id
      name - The Item's name
      item - The item to be registered
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(ILjava/lang/String;Lzw;)V
      intermediary method_8248 Lnet/minecraft/class_2054;method_8248(ILjava/lang/String;Lnet/minecraft/class_2054;)V
      named register Lnet/minecraft/item/Item;register(ILjava/lang/String;Lnet/minecraft/item/Item;)V
    • register

      private static void register​(int id, Identifier name, Item item)
      Registers an item to the registry
      Parameters:
      id - The Item Id
      name - The Item's identifier
      item - The Item to be registered
      Mappings:
      Namespace Name Mixin selector
      official a Lzw;a(ILjy;Lzw;)V
      intermediary method_8249 Lnet/minecraft/class_2054;method_8249(ILnet/minecraft/class_1605;Lnet/minecraft/class_2054;)V
      named register Lnet/minecraft/item/Item;register(ILnet/minecraft/util/Identifier;Lnet/minecraft/item/Item;)V