Class Item

All Implemented Interfaces:
IItemProvider, IForgeItem, IForgeRegistryEntry<Item>
Direct Known Subclasses:
AbstractMapItem, AirItem, ArmorItem, ArmorStandItem, ArrowItem, BannerPatternItem, BlockItem, BoatItem, BoneMealItem, BookItem, BucketItem, ChorusFruitItem, CompassItem, CustomElytraTest.CustomElytra, DebugStickItem, DyeItem, EggItem, ElytraItem, EnchantedBookItem, EnchantedGoldenAppleItem, EnderCrystalItem, EnderEyeItem, EnderPearlItem, ExperienceBottleItem, FireChargeItem, FireworkRocketItem, FireworkStarItem, FishingRodItem, FlintAndSteelItem, GlassBottleItem, GravityAttributeTest.ItemGravityStick, HangingEntityItem, HoneyBottleItem, HorseArmorItem, ItemFluidContainer, KnowledgeBookItem, LeadItem, MilkBucketItem, MinecartItem, MusicDiscItem, NameTagItem, OnAStickItem, PotionItem, SaddleItem, ShearsItem, ShieldItem, ShootableItem, SimpleFoiledItem, SnowballItem, SoupItem, SpawnEggItem, SuspiciousStewItem, TieredItem, TridentItem, WritableBookItem, WrittenBookItem

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

    • 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
    • random

      protected static final Random random
    • category

      protected final ItemGroup 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 Food foodProperties
    • ister

      @Nullable private final Supplier<ItemStackTileEntityRenderer> ister
    • toolClasses

      private final Map<ToolType,Integer> toolClasses
    • reverseTags

      private final ReverseTagWrapper<Item> reverseTags
    • canRepair

      protected final boolean canRepair
  • Constructor Details

  • Method Details

    • getId

      public static int getId(Item p_150891_0_)
    • byId

      public static Item byId(int p_150899_0_)
    • byBlock

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

      public void onUseTick(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_)
    • verifyTagAfterLoad

      public boolean verifyTagAfterLoad(CompoundNBT p_179215_1_)
    • canAttackBlock

      public boolean canAttackBlock(BlockState p_195938_1_, World p_195938_2_, BlockPos p_195938_3_, PlayerEntity p_195938_4_)
    • asItem

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

      public ActionResultType useOn(ItemUseContext p_195939_1_)
    • getDestroySpeed

      public float getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_)
    • use

      public ActionResult<ItemStack> use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_)
    • finishUsingItem

      public ItemStack finishUsingItem(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_)
    • getMaxStackSize

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

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

      public boolean canBeDepleted()
    • hurtEnemy

      public boolean hurtEnemy(ItemStack p_77644_1_, LivingEntity p_77644_2_, LivingEntity p_77644_3_)
    • mineBlock

      public boolean mineBlock(ItemStack p_179218_1_, World p_179218_2_, BlockState p_179218_3_, BlockPos p_179218_4_, LivingEntity p_179218_5_)
    • isCorrectToolForDrops

      public boolean isCorrectToolForDrops(BlockState p_150897_1_)
    • interactLivingEntity

      public ActionResultType interactLivingEntity(ItemStack p_111207_1_, PlayerEntity p_111207_2_, LivingEntity p_111207_3_, Hand p_111207_4_)
    • getDescription

      public ITextComponent getDescription()
    • toString

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

      protected String getOrCreateDescriptionId()
    • getDescriptionId

      public String getDescriptionId()
    • getDescriptionId

      public String getDescriptionId(ItemStack p_77667_1_)
    • shouldOverrideMultiplayerNbt

      public boolean shouldOverrideMultiplayerNbt()
    • getCraftingRemainingItem

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

      @Deprecated public boolean hasCraftingRemainingItem()
      Deprecated.
    • inventoryTick

      public void inventoryTick(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_)
    • onCraftedBy

      public void onCraftedBy(ItemStack p_77622_1_, World p_77622_2_, PlayerEntity p_77622_3_)
    • isComplex

      public boolean isComplex()
    • getUseAnimation

      public UseAction getUseAnimation(ItemStack p_77661_1_)
    • getUseDuration

      public int getUseDuration(ItemStack p_77626_1_)
    • releaseUsing

      public void releaseUsing(ItemStack p_77615_1_, World p_77615_2_, LivingEntity p_77615_3_, int p_77615_4_)
    • appendHoverText

      public void appendHoverText(ItemStack p_77624_1_, @Nullable World p_77624_2_, List<ITextComponent> p_77624_3_, ITooltipFlag p_77624_4_)
    • getName

      public ITextComponent getName(ItemStack p_200295_1_)
    • isFoil

      public boolean isFoil(ItemStack p_77636_1_)
    • getRarity

      public Rarity getRarity(ItemStack p_77613_1_)
    • isEnchantable

      public boolean isEnchantable(ItemStack p_77616_1_)
    • getPlayerPOVHitResult

      protected static BlockRayTraceResult getPlayerPOVHitResult(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_)
    • getEnchantmentValue

      public int getEnchantmentValue()
    • fillItemCategory

      public void fillItemCategory(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_)
    • allowdedIn

      protected boolean allowdedIn(ItemGroup p_194125_1_)
    • getItemCategory

      @Nullable public final ItemGroup getItemCategory()
    • isValidRepairItem

      public boolean isValidRepairItem(ItemStack p_82789_1_, ItemStack p_82789_2_)
    • getDefaultAttributeModifiers

      @Deprecated public com.google.common.collect.Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(EquipmentSlotType p_111205_1_)
      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
    • getToolTypes

      public Set<ToolType> getToolTypes(ItemStack stack)
      Specified by:
      getToolTypes in interface IForgeItem
    • getHarvestLevel

      public int getHarvestLevel(ItemStack stack, ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState blockState)
      Description copied from interface: IForgeItem
      Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified type
      Specified by:
      getHarvestLevel in interface IForgeItem
      Parameters:
      stack - This item stack instance
      player - The player trying to harvest the given blockstate
      blockState - The block to harvest
      Returns:
      Harvest level, or -1 if not the specified tool type.
    • getItemStackTileEntityRenderer

      public final ItemStackTileEntityRenderer getItemStackTileEntityRenderer()
      Specified by:
      getItemStackTileEntityRenderer in interface IForgeItem
      Returns:
      This Item's renderer, or the default instance if it does not have one.
    • 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_219970_1_)
    • getDefaultInstance

      public ItemStack getDefaultInstance()
    • is

      public boolean is(ITag<Item> p_206844_1_)
    • isEdible

      public boolean isEdible()
    • getFoodProperties

      @Nullable public Food getFoodProperties()
    • getDrinkingSound

      public SoundEvent getDrinkingSound()
    • getEatingSound

      public SoundEvent getEatingSound()
    • isFireResistant

      public boolean isFireResistant()
    • canBeHurtBy

      public boolean canBeHurtBy(DamageSource p_234685_1_)