Package net.minecraft.world.item
Class ItemStack
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<ItemStack>
net.minecraft.world.item.ItemStack
- All Implemented Interfaces:
ICapabilityProvider,ICapabilitySerializable<CompoundTag>,IForgeItemStack,INBTSerializable<CompoundTag>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic DecimalFormatprivate BlockInWorldprivate booleanprivate BlockInWorldprivate booleanprivate CompoundTagstatic com.mojang.serialization.Codec<ItemStack>private intprivate IRegistryDelegate<Item>private static intstatic ItemStackprivate booleanprivate Entityprivate ItemDeprecated.private static org.apache.logging.log4j.Loggerprivate static Styleprivate intprivate CompoundTagprivate static Stringprivate static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringprivate static Stringstatic Stringprivate static Stringprivate static String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateItemStack(CompoundTag p_41608_)privateItemStack(ItemLike p_41604_, int p_41605_, Optional<CompoundTag> p_41606_)ItemStack(ItemLike p_41604_, int p_41605_, CompoundTag p_41606_) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, EquipmentSlot p_41646_)voidaddTagElement(String p_41701_, Tag p_41702_)static voidappendEnchantmentNames(List<Component> p_41710_, ListTag p_41711_)private static booleanareSameBlocks(BlockInWorld p_41694_, BlockInWorld p_41695_)copy()voiddeserializeNBT(CompoundTag nbt)voidenchant(Enchantment p_41664_, int p_41665_)private static Collection<Component>expandBlockState(String p_41762_)finishUsingItem(Level p_41672_, LivingEntity p_41673_)private voidSet up forge's ItemStack additions.com.google.common.collect.Multimap<Attribute,AttributeModifier>getAttributeModifiers(EquipmentSlot p_41639_)intintintintgetCount()intfloatgetDestroySpeed(BlockState p_41692_)getFrame()private intgetItem()intintgetOrCreateTagElement(String p_41699_)intgetTag()getTagElement(String p_41738_)getTooltipLines(Player p_41652_, TooltipFlag p_41653_)intvoidgrow(int p_41770_)booleanhasAdventureModeBreakTagForBlock(TagContainer p_41634_, BlockInWorld p_41635_)booleanhasAdventureModePlaceTagForBlock(TagContainer p_41724_, BlockInWorld p_41725_)booleanbooleanhasFoil()booleanhasTag()voidhideTooltipPart(ItemStack.TooltipPart p_41655_)booleanhurt(int p_41630_, Random p_41631_, ServerPlayer p_41632_)<T extends LivingEntity>
voidhurtAndBreak(int p_41623_, T p_41624_, Consumer<T> p_41625_)voidhurtEnemy(LivingEntity p_41641_, Player p_41642_)interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_)voidinventoryTick(Level p_41667_, Entity p_41668_, int p_41669_, boolean p_41670_)booleanbooleanbooleanbooleanisCorrectToolForDrops(BlockState p_41736_)booleanbooleanbooleanisEdible()booleanisEmpty()booleanbooleanbooleanisFramed()static booleanstatic booleanisSameIgnoreDurability(ItemStack p_41759_, ItemStack p_41760_)static booleanisSameItemSameTags(ItemStack p_150943_, ItemStack p_150944_)booleanprivate booleanstatic booleanvoidmineBlock(Level p_41687_, BlockState p_41688_, BlockPos p_41689_, Player p_41690_)static ItemStackof(CompoundTag p_41713_)voidonCraftedBy(Level p_41679_, Player p_41680_, int p_41681_)voidonDestroyed(ItemEntity p_150925_)private InteractionResultonItemUse(UseOnContext p_41662_, Function<UseOnContext,InteractionResult> callback)onItemUseFirst(UseOnContext p_41662_)voidonUseTick(Level p_41732_, LivingEntity p_41733_, int p_41734_)booleanoverrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_)booleanoverrideStackedOnOther(Slot p_150927_, ClickAction p_150928_, Player p_150929_)voidreleaseUsing(Level p_41675_, LivingEntity p_41676_, int p_41677_)voidremoveTagKey(String p_41750_)voidbooleanbooleansameItemStackIgnoreDurability(ItemStack p_41727_)save(CompoundTag p_41740_)voidsetCount(int p_41765_)voidsetDamageValue(int p_41722_)voidsetEntityRepresentation(Entity p_41637_)setHoverName(Component p_41715_)voidsetPopTime(int p_41755_)voidsetRepairCost(int p_41743_)voidsetTag(CompoundTag p_41752_)private static booleanshouldShowInTooltip(int p_41627_, ItemStack.TooltipPart p_41628_)voidshrink(int p_41775_)split(int p_41621_)static booleantagMatches(ItemStack p_41659_, ItemStack p_41660_)toString()private voiduse(Level p_41683_, Player p_41684_, InteractionHand p_41685_)useOn(UseOnContext p_41662_)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, canPerformAction, doesSneakBypassUse, elytraFlightTick, equals, getBurnTime, getContainerItem, getEntityLifespan, getEquipmentSlot, getHighlightTip, getItemEnchantability, getShareTag, getSweepHitBox, 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
-
TAG_ENCH
- See Also:
- Constant Field Values
-
TAG_DISPLAY
- See Also:
- Constant Field Values
-
TAG_DISPLAY_NAME
- See Also:
- Constant Field Values
-
TAG_LORE
- See Also:
- Constant Field Values
-
TAG_DAMAGE
- See Also:
- Constant Field Values
-
TAG_COLOR
- See Also:
- Constant Field Values
-
TAG_UNBREAKABLE
- See Also:
- Constant Field Values
-
TAG_REPAIR_COST
- See Also:
- Constant Field Values
-
TAG_CAN_DESTROY_BLOCK_LIST
- See Also:
- Constant Field Values
-
TAG_CAN_PLACE_ON_BLOCK_LIST
- See Also:
- Constant Field Values
-
TAG_HIDE_FLAGS
- See Also:
- Constant Field Values
-
DONT_HIDE_TOOLTIP
private static final int DONT_HIDE_TOOLTIP- See Also:
- Constant Field Values
-
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
-
getTooltipImage
-
updateEmptyCacheFlag
private void updateEmptyCacheFlag() -
of
-
isEmpty
public boolean isEmpty() -
split
-
getItem
-
is
-
is
-
useOn
-
onItemUseFirst
- Specified by:
onItemUseFirstin interfaceIForgeItemStack
-
onItemUse
private InteractionResult onItemUse(UseOnContext p_41662_, Function<UseOnContext,InteractionResult> callback) -
getDestroySpeed
-
use
public InteractionResultHolder<ItemStack> use(Level p_41683_, Player p_41684_, InteractionHand p_41685_) -
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_41722_) -
getMaxDamage
public int getMaxDamage() -
hurt
-
hurtAndBreak
-
isBarVisible
public boolean isBarVisible() -
getBarWidth
public int getBarWidth() -
getBarColor
public int getBarColor() -
overrideStackedOnOther
-
overrideOtherStackedOnMe
public boolean overrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_) -
hurtEnemy
-
mineBlock
-
isCorrectToolForDrops
-
interactLivingEntity
public InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) -
copy
-
tagMatches
-
matches
-
matches
-
isSame
-
isSameIgnoreDurability
-
sameItem
-
sameItemStackIgnoreDurability
-
isSameItemSameTags
-
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
-
shouldShowInTooltip
-
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_41743_) -
getAttributeModifiers
public com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlot p_41639_) -
addAttributeModifier
public void addAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, @Nullable EquipmentSlot p_41646_) -
getDisplayName
-
areSameBlocks
-
hasAdventureModeBreakTagForBlock
-
hasAdventureModePlaceTagForBlock
-
getPopTime
public int getPopTime() -
setPopTime
public void setPopTime(int p_41755_) -
getCount
public int getCount() -
setCount
public void setCount(int p_41765_) -
grow
public void grow(int p_41770_) -
shrink
public void shrink(int p_41775_) -
onUseTick
-
onDestroyed
-
isEdible
public boolean isEdible() -
deserializeNBT
- Specified by:
deserializeNBTin interfaceINBTSerializable<CompoundTag>
-
forgeInit
private void forgeInit()Set up forge's ItemStack additions. -
getDrinkingSound
-
getEatingSound
-
getEquipSound
-