Package net.minecraft.world.item
Class SpyglassItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.SpyglassItem
- All Implemented Interfaces:
FeatureElement,ItemLike,IItemExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final floatFields 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_WIDTHFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanPerformAction(ItemStack stack, ItemAbility itemAbility) Queries if an item can perform the given action.finishUsingItem(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity) Called when the player finishes using this Item (E.g. finishes eating.).getUseAnimation(ItemStack pStack) Returns the action that specifies what animation to play when the item is being used.intgetUseDuration(ItemStack pStack, LivingEntity pEntity) voidreleaseUsing(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity, int pTimeCharged) Called when the player stops using an Item (stops holding the right mouse button).private voidstopUsing(LivingEntity pUser) use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) Called to trigger the item's "innate" right click behavior.Methods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, 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, requiredFeatures, toString, useOn, useOnRelease, verifyComponentsAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canFitInsideContainerItems, canGrindstoneRepair, 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
-
USE_DURATION
public static final int USE_DURATION- See Also:
-
ZOOM_FOV_MODIFIER
public static final float ZOOM_FOV_MODIFIER- See Also:
-
-
Constructor Details
-
SpyglassItem
-
-
Method Details
-
getUseDuration
- Overrides:
getUseDurationin classItem
-
getUseAnimation
Returns the action that specifies what animation to play when the item is being used.- Overrides:
getUseAnimationin classItem
-
use
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, seeItem.useOn(net.minecraft.world.item.context.UseOnContext). -
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:
finishUsingItemin classItem
-
releaseUsing
public void releaseUsing(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity, int pTimeCharged) Called when the player stops using an Item (stops holding the right mouse button).- Overrides:
releaseUsingin classItem
-
stopUsing
-
canPerformAction
Description copied from interface:IItemExtensionQueries if an item can perform the given action. SeeItemAbilitiesfor a description of each stock action- Parameters:
stack- The stack being useditemAbility- The action being queried- Returns:
- True if the stack can perform the action
-