Package net.minecraft.world.item
Class CompassItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.CompassItem
- 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
Fields 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 TypeMethodDescriptiongetDescriptionId
(ItemStack pStack) Returns the unlocalized name of this item.static GlobalPos
getSpawnPosition
(Level pLevel) void
inventoryTick
(ItemStack pStack, Level pLevel, Entity pEntity, int pItemSlot, boolean pIsSelected) Called each tick as long the item is in a player's inventory.boolean
Returnstrue
if this item has an enchantment glint.useOn
(UseOnContext pContext) Called when this item is used when targeting a BlockMethods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, use, 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
-
Constructor Details
-
CompassItem
-
-
Method Details
-
getSpawnPosition
-
isFoil
Returnstrue
if this item has an enchantment glint. By default, this returnsstack.isItemEnchanted()
, but other items can override it (for instance, written books always return true). Note that if you override this method, you generally want to also call the super version (onItem
) to get the glint for enchanted items. Of course, that is unnecessary if the overwritten version always returns true. -
inventoryTick
public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pItemSlot, boolean pIsSelected) Called each tick as long the item is in a player's inventory. Used by maps to check if it's in a player's hand and update its contents.- Overrides:
inventoryTick
in classItem
-
useOn
Called when this item is used when targeting a Block -
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
-