Package net.minecraft.world.item
Class Item
java.lang.Object
net.minecraft.world.item.Item
- All Implemented Interfaces:
FeatureElement
,ItemLike
,IItemExtension
- Direct Known Subclasses:
AirItem
,ArmorItem
,ArmorStandItem
,ArrowItem
,BannerPatternItem
,BlockItem
,BoatItem
,BoneMealItem
,BookItem
,BottleItem
,BrushItem
,BucketItem
,BundleItem
,ChorusFruitItem
,CompassItem
,ComplexItem
,CustomElytraTest.CustomElytra
,CustomFluidContainerTest.CustomFluidContainer
,CustomShieldTest.CustomShieldItem
,CustomTooltipTest.CustomItemWithTooltip
,DebugStickItem
,DiscFragmentItem
,DyeItem
,EggItem
,ElytraItem
,EnchantedBookItem
,EndCrystalItem
,EnderEyeItem
,EnderpearlItem
,ExperienceBottleItem
,FireChargeItem
,FireworkRocketItem
,FireworkStarItem
,FishingRodItem
,FlintAndSteelItem
,FoodOnAStickItem
,GlowInkSacItem
,HangingEntityItem
,HoneyBottleItem
,HoneycombItem
,InkSacItem
,InstrumentItem
,ItemUseAnimationTest.ThingItem
,KnowledgeBookItem
,LeadItem
,MaceItem
,MayFlyAttributeTest.InvertedTelescope
,MilkBucketItem
,MinecartItem
,NameTagItem
,OminousBottleItem
,PotionItem
,ProjectileWeaponItem
,SaddleItem
,ShearsItem
,ShieldItem
,SmithingTemplateItem
,SnowballItem
,SpawnEggItem
,SpyglassItem
,StopUsingItemTest.InvertedTelescope
,SuspiciousStewItem
,TieredItem
,TridentItem
,WindChargeItem
,WritableBookItem
,WrittenBookItem
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final ResourceLocation
static final ResourceLocation
private final Holder.Reference
<Item> protected final boolean
private DataComponentMap
private final Item
static final int
private String
private static final org.slf4j.Logger
static final int
private Object
private final FeatureFlagSet
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendHoverText
(ItemStack p_41421_, Item.TooltipContext p_339594_, List<Component> p_41423_, TooltipFlag p_41424_) asItem()
Deprecated.static Item
Deprecated.static Item
byId
(int p_41446_) boolean
canAttackBlock
(BlockState p_41441_, Level p_41442_, BlockPos p_41443_, Player p_41444_) boolean
finishUsingItem
(ItemStack p_41409_, Level p_41410_, LivingEntity p_41411_) float
getAttackDamageBonus
(Entity p_345249_, float p_336179_, DamageSource p_345403_) int
getBarColor
(ItemStack p_150901_) int
getBarWidth
(ItemStack p_150900_) final Item
Deprecated.Deprecated.int
getDescriptionId
(ItemStack p_41455_) float
getDestroySpeed
(ItemStack p_41425_, BlockState p_41426_) int
Deprecated.Neo: Use ItemStack sensitive version.static int
protected String
protected static BlockHitResult
getPlayerPOVHitResult
(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) getTooltipImage
(ItemStack p_150902_) getUseAnimation
(ItemStack p_41452_) int
getUseDuration
(ItemStack p_41454_, LivingEntity p_344979_) boolean
Deprecated.boolean
hurtEnemy
(ItemStack p_41395_, LivingEntity p_41396_, LivingEntity p_41397_) private void
void
initializeClient
(Consumer<IClientItemExtensions> consumer) interactLivingEntity
(ItemStack p_41398_, Player p_41399_, LivingEntity p_41400_, InteractionHand p_41401_) void
inventoryTick
(ItemStack p_41404_, Level p_41405_, Entity p_41406_, int p_41407_, boolean p_41408_) boolean
isBarVisible
(ItemStack p_150899_) boolean
boolean
isCorrectToolForDrops
(ItemStack p_336002_, BlockState p_41450_) boolean
isEnchantable
(ItemStack p_41456_) boolean
boolean
isRepairable
(ItemStack stack) Called by CraftingManager to determine if an item is reparable.boolean
isValidRepairItem
(ItemStack p_41402_, ItemStack p_41403_) boolean
mineBlock
(ItemStack p_41416_, Level p_41417_, BlockState p_41418_, BlockPos p_41419_, LivingEntity p_41420_) void
Deprecated.Neo: do not use, usethe event
insteadvoid
onCraftedBy
(ItemStack p_41447_, Level p_41448_, Player p_41449_) void
onCraftedPostProcess
(ItemStack p_307483_, Level p_307537_) void
onDestroyed
(ItemEntity p_150887_) Deprecated.Forge:invalid reference
Use damage source sensitive version
void
onUseTick
(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) boolean
overrideOtherStackedOnMe
(ItemStack p_150892_, ItemStack p_150893_, Slot p_150894_, ClickAction p_150895_, Player p_150896_, SlotAccess p_150897_) boolean
overrideStackedOnOther
(ItemStack p_150888_, Slot p_150889_, ClickAction p_150890_, Player p_150891_) void
postHurtEnemy
(ItemStack p_346136_, LivingEntity p_346250_, LivingEntity p_346014_) void
releaseUsing
(ItemStack p_41412_, Level p_41413_, LivingEntity p_41414_, int p_41415_) toString()
use
(Level p_41432_, Player p_41433_, InteractionHand p_41434_) useOn
(UseOnContext p_41427_) boolean
useOnRelease
(ItemStack p_41464_) void
verifyComponentsAfterLoad
(ItemStack p_331627_) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
BY_BLOCK
-
BASE_ATTACK_DAMAGE_ID
-
BASE_ATTACK_SPEED_ID
-
DEFAULT_MAX_STACK_SIZE
public static final int DEFAULT_MAX_STACK_SIZE- See Also:
-
ABSOLUTE_MAX_STACK_SIZE
public static final int ABSOLUTE_MAX_STACK_SIZE- See Also:
-
MAX_BAR_WIDTH
public static final int MAX_BAR_WIDTH- See Also:
-
builtInRegistryHolder
-
components
-
craftingRemainingItem
-
descriptionId
-
requiredFeatures
-
canRepair
protected final boolean canRepair -
renderProperties
-
-
Constructor Details
-
Item
-
-
Method Details
-
getId
-
byId
-
byBlock
Deprecated. -
builtInRegistryHolder
Deprecated. -
components
-
modifyDefaultComponentsFrom
Deprecated.Neo: do not use, usethe event
instead -
getDefaultMaxStackSize
public int getDefaultMaxStackSize() -
onUseTick
-
onDestroyed
Deprecated.Forge:invalid reference
Use damage source sensitive version
-
verifyComponentsAfterLoad
-
canAttackBlock
public boolean canAttackBlock(BlockState p_41441_, Level p_41442_, BlockPos p_41443_, Player p_41444_) -
asItem
-
useOn
-
getDestroySpeed
-
use
public InteractionResultHolder<ItemStack> use(Level p_41432_, Player p_41433_, InteractionHand p_41434_) -
finishUsingItem
-
isBarVisible
-
getBarWidth
-
getBarColor
-
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_) -
getAttackDamageBonus
-
hurtEnemy
-
postHurtEnemy
-
mineBlock
public boolean mineBlock(ItemStack p_41416_, Level p_41417_, BlockState p_41418_, BlockPos p_41419_, LivingEntity p_41420_) -
isCorrectToolForDrops
-
interactLivingEntity
public InteractionResult interactLivingEntity(ItemStack p_41398_, Player p_41399_, LivingEntity p_41400_, InteractionHand p_41401_) -
getDescription
-
toString
-
getOrCreateDescriptionId
-
getDescriptionId
-
getDescriptionId
-
getCraftingRemainingItem
Deprecated. -
hasCraftingRemainingItem
Deprecated. -
inventoryTick
-
onCraftedBy
-
onCraftedPostProcess
-
isComplex
public boolean isComplex() -
getUseAnimation
-
getUseDuration
-
releaseUsing
-
appendHoverText
public void appendHoverText(ItemStack p_41421_, Item.TooltipContext p_339594_, List<Component> p_41423_, TooltipFlag p_41424_) -
getTooltipImage
-
getName
-
isFoil
-
isEnchantable
-
getPlayerPOVHitResult
protected static BlockHitResult getPlayerPOVHitResult(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) -
getEnchantmentValue
Deprecated.Neo: Use ItemStack sensitive version. -
isValidRepairItem
-
getDefaultAttributeModifiers
Deprecated. -
isRepairable
Description copied from interface:IItemExtension
Called by CraftingManager to determine if an item is reparable.- Specified by:
isRepairable
in interfaceIItemExtension
- Returns:
- True if reparable
-
useOnRelease
-
getDefaultInstance
-
getDrinkingSound
-
getEatingSound
-
getBreakingSound
-
canFitInsideContainerItems
public boolean canFitInsideContainerItems() -
requiredFeatures
- Specified by:
requiredFeatures
in interfaceFeatureElement
-
getRenderPropertiesInternal
-
initClient
private void initClient() -
initializeClient
-
IItemExtension.getDefaultAttributeModifiers(ItemStack)