Package net.minecraft.world.item
Class PotionItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.PotionItem
- All Implemented Interfaces:
FeatureElement
,ItemLike
,IItemExtension
- Direct Known Subclasses:
ThrowablePotionItem
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext
-
Field Summary
FieldsFields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTH
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendHoverText
(ItemStack pStack, Item.TooltipContext pContext, List<Component> pTooltipComponents, TooltipFlag pTooltipFlag) finishUsingItem
(ItemStack pStack, Level pLevel, LivingEntity pEntityLiving) Called when the player finishes using this Item (E.g. finishes eating.).getDescriptionId
(ItemStack pStack) Returns the unlocalized name of this item.getUseAnimation
(ItemStack pStack) Returns the action that specifies what animation to play when the item is being used.int
getUseDuration
(ItemStack pStack, LivingEntity pEntity) use
(Level pLevel, Player pPlayer, InteractionHand pHand) Called to trigger the item's "innate" right click behavior.useOn
(UseOnContext pContext) Called when this item is used when targeting a BlockMethods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultMaxStackSize, getDescription, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, useOnRelease, verifyComponentsAfterLoad
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
applyEnchantments, canBeHurtBy, 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, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
-
Field Details
-
DRINK_DURATION
private static final int DRINK_DURATION- See Also:
-
-
Constructor Details
-
PotionItem
-
-
Method Details
-
getDefaultInstance
- Overrides:
getDefaultInstance
in classItem
-
finishUsingItem
Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using the Item before the action is complete.- Overrides:
finishUsingItem
in classItem
-
useOn
Called when this item is used when targeting a Block -
getUseDuration
- Overrides:
getUseDuration
in classItem
-
getUseAnimation
Returns the action that specifies what animation to play when the item is being used.- Overrides:
getUseAnimation
in classItem
-
use
Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, seeinvalid reference
#onItemUse
-
getDescriptionId
Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.- Overrides:
getDescriptionId
in classItem
-
appendHoverText
public void appendHoverText(ItemStack pStack, Item.TooltipContext pContext, List<Component> pTooltipComponents, TooltipFlag pTooltipFlag) - Overrides:
appendHoverText
in classItem
-