Class Item

All Implemented Interfaces:
ItemLike, IForgeItem, IForgeRegistryEntry<Item>
Direct Known Subclasses:
AirItem, ArmorItem, ArmorStandItem, ArrowItem, BannerPatternItem, BlockItem, BoatItem, BoneMealItem, BookItem, BottleItem, BowlFoodItem, BucketItem, BundleItem, ChorusFruitItem, CompassItem, ComplexItem, CustomElytraTest.CustomElytra, CustomShieldTest.CustomShieldItem, CustomTooltipTest.CustomItemWithTooltip, DebugStickItem, DyeItem, EggItem, ElytraItem, EnchantedBookItem, EnchantedGoldenAppleItem, EndCrystalItem, EnderEyeItem, EnderpearlItem, ExperienceBottleItem, FireChargeItem, FireworkRocketItem, FireworkStarItem, FishingRodItem, FlintAndSteelItem, FoodOnAStickItem, GravityAttributeTest.ItemGravityStick, HangingEntityItem, HoneyBottleItem, HoneycombItem, HorseArmorItem, ItemFluidContainer, KnowledgeBookItem, LeadItem, MilkBucketItem, MinecartItem, NameTagItem, PotionItem, ProjectileWeaponItem, RecordItem, SaddleItem, ShearsItem, ShieldItem, SimpleFoiledItem, SnowballItem, SpawnEggItem, SpyglassItem, SuspiciousStewItem, TieredItem, TridentItem, WritableBookItem, WrittenBookItem

public class Item extends ForgeRegistryEntry<Item> implements ItemLike, IForgeItem
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • BY_BLOCK

      public static final Map<Block,​Item> BY_BLOCK
    • BASE_ATTACK_DAMAGE_UUID

      protected static final UUID BASE_ATTACK_DAMAGE_UUID
    • BASE_ATTACK_SPEED_UUID

      protected static final UUID BASE_ATTACK_SPEED_UUID
    • MAX_STACK_SIZE

      public static final int MAX_STACK_SIZE
      See Also:
      Constant Field Values
    • EAT_DURATION

      public static final int EAT_DURATION
      See Also:
      Constant Field Values
    • MAX_BAR_WIDTH

      public static final int MAX_BAR_WIDTH
      See Also:
      Constant Field Values
    • category

      protected final CreativeModeTab category
    • rarity

      private final Rarity rarity
    • maxStackSize

      private final int maxStackSize
    • maxDamage

      private final int maxDamage
    • isFireResistant

      private final boolean isFireResistant
    • craftingRemainingItem

      private final Item craftingRemainingItem
    • descriptionId

      @Nullable private String descriptionId
    • foodProperties

      @Nullable private final FoodProperties foodProperties
    • reverseTags

      private final ReverseTagWrapper<Item> reverseTags
    • canRepair

      protected final boolean canRepair
    • renderProperties

      private Object renderProperties
  • Constructor Details

  • Method Details

    • getId

      public static int getId(Item p_41394_)
    • byId

      public static Item byId(int p_41446_)
    • byBlock

      @Deprecated public static Item byBlock(Block p_41440_)
      Deprecated.
    • onUseTick

      public void onUseTick(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_)
    • onDestroyed

      public void onDestroyed(ItemEntity p_150887_)
    • verifyTagAfterLoad

      public void verifyTagAfterLoad(CompoundTag p_150898_)
    • canAttackBlock

      public boolean canAttackBlock(BlockState p_41441_, Level p_41442_, BlockPos p_41443_, Player p_41444_)
    • asItem

      public Item asItem()
      Specified by:
      asItem in interface ItemLike
    • useOn

      public InteractionResult useOn(UseOnContext p_41427_)
    • getDestroySpeed

      public float getDestroySpeed(ItemStack p_41425_, BlockState p_41426_)
    • use

      public InteractionResultHolder<ItemStack> use(Level p_41432_, Player p_41433_, InteractionHand p_41434_)
    • finishUsingItem

      public ItemStack finishUsingItem(ItemStack p_41409_, Level p_41410_, LivingEntity p_41411_)
    • getMaxStackSize

      @Deprecated public final int getMaxStackSize()
      Deprecated.
    • getMaxDamage

      @Deprecated public final int getMaxDamage()
      Deprecated.
    • canBeDepleted

      public boolean canBeDepleted()
    • isBarVisible

      public boolean isBarVisible(ItemStack p_150899_)
    • getBarWidth

      public int getBarWidth(ItemStack p_150900_)
    • getBarColor

      public int getBarColor(ItemStack p_150901_)
    • overrideStackedOnOther

      public boolean overrideStackedOnOther(ItemStack p_150888_, Slot p_150889_, ClickAction p_150890_, Player p_150891_)
    • overrideOtherStackedOnMe

      public boolean overrideOtherStackedOnMe(ItemStack p_150892_, ItemStack p_150893_, Slot p_150894_, ClickAction p_150895_, Player p_150896_, SlotAccess p_150897_)
    • hurtEnemy

      public boolean hurtEnemy(ItemStack p_41395_, LivingEntity p_41396_, LivingEntity p_41397_)
    • mineBlock

      public boolean mineBlock(ItemStack p_41416_, Level p_41417_, BlockState p_41418_, BlockPos p_41419_, LivingEntity p_41420_)
    • isCorrectToolForDrops

      public boolean isCorrectToolForDrops(BlockState p_41450_)
    • interactLivingEntity

      public InteractionResult interactLivingEntity(ItemStack p_41398_, Player p_41399_, LivingEntity p_41400_, InteractionHand p_41401_)
    • getDescription

      public Component getDescription()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOrCreateDescriptionId

      protected String getOrCreateDescriptionId()
    • getDescriptionId

      public String getDescriptionId()
    • getDescriptionId

      public String getDescriptionId(ItemStack p_41455_)
    • shouldOverrideMultiplayerNbt

      public boolean shouldOverrideMultiplayerNbt()
    • getCraftingRemainingItem

      @Nullable @Deprecated public final Item getCraftingRemainingItem()
      Deprecated.
    • hasCraftingRemainingItem

      @Deprecated public boolean hasCraftingRemainingItem()
      Deprecated.
    • inventoryTick

      public void inventoryTick(ItemStack p_41404_, Level p_41405_, Entity p_41406_, int p_41407_, boolean p_41408_)
    • onCraftedBy

      public void onCraftedBy(ItemStack p_41447_, Level p_41448_, Player p_41449_)
    • isComplex

      public boolean isComplex()
    • getUseAnimation

      public UseAnim getUseAnimation(ItemStack p_41452_)
    • getUseDuration

      public int getUseDuration(ItemStack p_41454_)
    • releaseUsing

      public void releaseUsing(ItemStack p_41412_, Level p_41413_, LivingEntity p_41414_, int p_41415_)
    • appendHoverText

      public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_)
    • getTooltipImage

      public Optional<TooltipComponent> getTooltipImage(ItemStack p_150902_)
    • getName

      public Component getName(ItemStack p_41458_)
    • isFoil

      public boolean isFoil(ItemStack p_41453_)
    • getRarity

      public Rarity getRarity(ItemStack p_41461_)
    • isEnchantable

      public boolean isEnchantable(ItemStack p_41456_)
    • getPlayerPOVHitResult

      protected static BlockHitResult getPlayerPOVHitResult(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_)
    • getEnchantmentValue

      public int getEnchantmentValue()
    • fillItemCategory

      public void fillItemCategory(CreativeModeTab p_41391_, NonNullList<ItemStack> p_41392_)
    • allowdedIn

      protected boolean allowdedIn(CreativeModeTab p_41390_)
    • getItemCategory

      @Nullable public final CreativeModeTab getItemCategory()
    • isValidRepairItem

      public boolean isValidRepairItem(ItemStack p_41402_, ItemStack p_41403_)
    • getDefaultAttributeModifiers

      @Deprecated public com.google.common.collect.Multimap<Attribute,​AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot p_41388_)
      Deprecated.
    • isRepairable

      public boolean isRepairable(ItemStack stack)
      Description copied from interface: IForgeItem
      Called by CraftingManager to determine if an item is reparable.
      Specified by:
      isRepairable in interface IForgeItem
      Returns:
      True if reparable
    • getTags

      public Set<ResourceLocation> getTags()
      Description copied from interface: IForgeItem
      Retrieves a list of tags names this is known to be associated with. This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
      Specified by:
      getTags in interface IForgeItem
    • useOnRelease

      public boolean useOnRelease(ItemStack p_41464_)
    • getDefaultInstance

      public ItemStack getDefaultInstance()
    • isEdible

      public boolean isEdible()
    • getFoodProperties

      @Nullable public FoodProperties getFoodProperties()
    • getDrinkingSound

      public SoundEvent getDrinkingSound()
    • getEatingSound

      public SoundEvent getEatingSound()
    • isFireResistant

      public boolean isFireResistant()
    • canBeHurtBy

      public boolean canBeHurtBy(DamageSource p_41387_)
    • getEquipSound

      @Nullable public SoundEvent getEquipSound()
    • canFitInsideContainerItems

      public boolean canFitInsideContainerItems()
    • getRenderPropertiesInternal

      public Object getRenderPropertiesInternal()
    • initClient

      private void initClient()
    • initializeClient

      public void initializeClient(Consumer<IItemRenderProperties> consumer)