Package net.minecraft.item
Class ItemStack
- All Implemented Interfaces:
ICapabilityProvider,ICapabilitySerializable<CompoundNBT>,IForgeItemStack,INBTSerializable<CompoundNBT>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DecimalFormatprivate CachedBlockInfoprivate booleanprivate CachedBlockInfoprivate booleanprivate CompoundNBTstatic final com.mojang.serialization.Codec<ItemStack>private intprivate final IRegistryDelegate<Item>static final ItemStackprivate booleanprivate Entityprivate final ItemDeprecated.private static final org.apache.logging.log4j.Loggerprivate static final Styleprivate intprivate CompoundNBT -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateItemStack(CompoundNBT p_i47263_1_) ItemStack(IItemProvider p_i48203_1_) ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) privateItemStack(IItemProvider p_i231596_1_, int p_i231596_2_, Optional<CompoundNBT> p_i231596_3_) ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, CompoundNBT capNBT) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributeModifier(Attribute p_185129_1_, AttributeModifier p_185129_2_, EquipmentSlotType p_185129_3_) voidaddTagElement(String p_77983_1_, INBT p_77983_2_) static voidappendEnchantmentNames(List<ITextComponent> p_222120_0_, ListNBT p_222120_1_) private static booleanareSameBlocks(CachedBlockInfo p_206846_0_, CachedBlockInfo p_206846_1_) copy()voidvoidenchant(Enchantment p_77966_1_, int p_77966_2_) private static Collection<ITextComponent>expandBlockState(String p_206845_0_) finishUsingItem(World p_77950_1_, LivingEntity p_77950_2_) private voidSet up forge's ItemStack additions.com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlotType p_111283_1_) intintgetCount()intfloatgetDestroySpeed(BlockState p_150997_1_) getFrame()private intgetItem()intintgetOrCreateTagElement(String p_190925_1_) intgetTag()getTagElement(String p_179543_1_) getTooltipLines(PlayerEntity p_82840_1_, ITooltipFlag p_82840_2_) intvoidgrow(int p_190917_1_) booleanhasAdventureModeBreakTagForBlock(ITagCollectionSupplier p_206848_1_, CachedBlockInfo p_206848_2_) booleanhasAdventureModePlaceTagForBlock(ITagCollectionSupplier p_206847_1_, CachedBlockInfo p_206847_2_) booleanbooleanhasFoil()booleanhasTag()voidhideTooltipPart(ItemStack.TooltipDisplayFlags p_242395_1_) booleanhurt(int p_96631_1_, Random p_96631_2_, ServerPlayerEntity p_96631_3_) <T extends LivingEntity>
voidhurtAndBreak(int p_222118_1_, T p_222118_2_, Consumer<T> p_222118_3_) voidhurtEnemy(LivingEntity p_77961_1_, PlayerEntity p_77961_2_) interactLivingEntity(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) voidinventoryTick(World p_77945_1_, Entity p_77945_2_, int p_77945_3_, boolean p_77945_4_) booleanisCorrectToolForDrops(BlockState p_150998_1_) booleanbooleanbooleanisEdible()booleanisEmpty()booleanbooleanbooleanisFramed()static booleanstatic booleanisSameIgnoreDurability(ItemStack p_185132_0_, ItemStack p_185132_1_) booleanprivate booleanstatic booleanvoidmineBlock(World p_179548_1_, BlockState p_179548_2_, BlockPos p_179548_3_, PlayerEntity p_179548_4_) static ItemStackof(CompoundNBT p_199557_0_) voidonCraftedBy(World p_77980_1_, PlayerEntity p_77980_2_, int p_77980_3_) private ActionResultTypeonItemUse(ItemUseContext p_196084_1_, Function<ItemUseContext, ActionResultType> callback) onItemUseFirst(ItemUseContext p_196084_1_) voidonUseTick(World p_222121_1_, LivingEntity p_222121_2_, int p_222121_3_) voidreleaseUsing(World p_77974_1_, LivingEntity p_77974_2_, int p_77974_3_) voidremoveTagKey(String p_196083_1_) voidbooleanbooleansameItemStackIgnoreDurability(ItemStack p_185136_1_) save(CompoundNBT p_77955_1_) voidsetCount(int p_190920_1_) voidsetDamageValue(int p_196085_1_) voidsetEntityRepresentation(Entity p_234695_1_) setHoverName(ITextComponent p_200302_1_) voidsetPopTime(int p_190915_1_) voidsetRepairCost(int p_82841_1_) voidsetTag(CompoundNBT p_77982_1_) private static booleanshouldShowInTooltip(int p_242394_0_, ItemStack.TooltipDisplayFlags p_242394_1_) voidshrink(int p_190918_1_) split(int p_77979_1_) static booleantagMatches(ItemStack p_77970_0_, ItemStack p_77970_1_) toString()private voiduse(World p_77957_1_, PlayerEntity p_77957_2_, Hand p_77957_3_) useOn(ItemUseContext p_196084_1_) booleanMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapabilityMethods inherited from interface net.minecraftforge.common.extensions.IForgeItemStack
areShareTagsEqual, canApplyAtEnchantingTable, canDisableShield, canElytraFly, canEquip, doesSneakBypassUse, elytraFlightTick, equals, getBurnTime, getBurnTime, getContainerItem, getEntityLifespan, getEquipmentSlot, getHarvestLevel, getHighlightTip, getItemEnchantability, getShareTag, getStack, getToolTypes, getXpRepairRatio, hasContainerItem, isBookEnchantable, isEnderMask, isPiglinCurrency, isRepairable, isShield, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onUsingTick, readShareTag, serializeNBT, shouldCauseBlockBreakReset
-
Field Details
-
CODEC
-
delegate
-
capNBT
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
EMPTY
-
ATTRIBUTE_MODIFIER_FORMAT
-
LORE_STYLE
-
count
private int count -
popTime
private int popTime -
item
Deprecated. -
tag
-
emptyCacheFlag
private boolean emptyCacheFlag -
entityRepresentation
-
cachedBreakBlock
-
cachedBreakBlockResult
private boolean cachedBreakBlockResult -
cachedPlaceBlock
-
cachedPlaceBlockResult
private boolean cachedPlaceBlockResult
-
-
Constructor Details
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
-
Method Details
-
updateEmptyCacheFlag
private void updateEmptyCacheFlag() -
of
-
isEmpty
public boolean isEmpty() -
split
-
getItem
-
useOn
-
onItemUseFirst
- Specified by:
onItemUseFirstin interfaceIForgeItemStack
-
onItemUse
private ActionResultType onItemUse(ItemUseContext p_196084_1_, Function<ItemUseContext, ActionResultType> callback) -
getDestroySpeed
-
use
-
finishUsingItem
-
save
-
getMaxStackSize
public int getMaxStackSize() -
isStackable
public boolean isStackable() -
isDamageableItem
public boolean isDamageableItem() -
isDamaged
public boolean isDamaged() -
getDamageValue
public int getDamageValue() -
setDamageValue
public void setDamageValue(int p_196085_1_) -
getMaxDamage
public int getMaxDamage() -
hurt
-
hurtAndBreak
public <T extends LivingEntity> void hurtAndBreak(int p_222118_1_, T p_222118_2_, Consumer<T> p_222118_3_) -
hurtEnemy
-
mineBlock
public void mineBlock(World p_179548_1_, BlockState p_179548_2_, BlockPos p_179548_3_, PlayerEntity p_179548_4_) -
isCorrectToolForDrops
-
interactLivingEntity
public ActionResultType interactLivingEntity(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) -
copy
-
tagMatches
-
matches
-
matches
-
isSame
-
isSameIgnoreDurability
-
sameItem
-
sameItemStackIgnoreDurability
-
getDescriptionId
-
toString
-
inventoryTick
-
onCraftedBy
-
getUseDuration
public int getUseDuration() -
getUseAnimation
-
releaseUsing
-
useOnRelease
public boolean useOnRelease() -
hasTag
public boolean hasTag() -
getTag
-
getOrCreateTag
-
getOrCreateTagElement
-
getTagElement
-
removeTagKey
-
getEnchantmentTags
-
setTag
-
getHoverName
-
setHoverName
-
resetHoverName
public void resetHoverName() -
hasCustomHoverName
public boolean hasCustomHoverName() -
getTooltipLines
public List<ITextComponent> getTooltipLines(@Nullable PlayerEntity p_82840_1_, ITooltipFlag p_82840_2_) -
shouldShowInTooltip
private static boolean shouldShowInTooltip(int p_242394_0_, ItemStack.TooltipDisplayFlags p_242394_1_) -
getHideFlags
private int getHideFlags() -
hideTooltipPart
-
appendEnchantmentNames
-
expandBlockState
-
hasFoil
public boolean hasFoil() -
getRarity
-
isEnchantable
public boolean isEnchantable() -
enchant
-
isEnchanted
public boolean isEnchanted() -
addTagElement
-
isFramed
public boolean isFramed() -
setEntityRepresentation
-
getFrame
-
getEntityRepresentation
-
getBaseRepairCost
public int getBaseRepairCost() -
setRepairCost
public void setRepairCost(int p_82841_1_) -
getAttributeModifiers
public com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlotType p_111283_1_) -
addAttributeModifier
public void addAttributeModifier(Attribute p_185129_1_, AttributeModifier p_185129_2_, @Nullable EquipmentSlotType p_185129_3_) -
getDisplayName
-
areSameBlocks
private static boolean areSameBlocks(CachedBlockInfo p_206846_0_, @Nullable CachedBlockInfo p_206846_1_) -
hasAdventureModeBreakTagForBlock
public boolean hasAdventureModeBreakTagForBlock(ITagCollectionSupplier p_206848_1_, CachedBlockInfo p_206848_2_) -
hasAdventureModePlaceTagForBlock
public boolean hasAdventureModePlaceTagForBlock(ITagCollectionSupplier p_206847_1_, CachedBlockInfo p_206847_2_) -
getPopTime
public int getPopTime() -
setPopTime
public void setPopTime(int p_190915_1_) -
getCount
public int getCount() -
setCount
public void setCount(int p_190920_1_) -
grow
public void grow(int p_190917_1_) -
shrink
public void shrink(int p_190918_1_) -
onUseTick
-
isEdible
public boolean isEdible() -
deserializeNBT
- Specified by:
deserializeNBTin interfaceINBTSerializable<CompoundNBT>
-
forgeInit
private void forgeInit()Set up forge's ItemStack additions. -
getDrinkingSound
-
getEatingSound
-