Package net.minecraft.item
Class ItemStack
java.lang.Object
net.minecraft.item.ItemStack
public final class ItemStack extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classItemStack.TooltipSection -
Field Summary
Fields Modifier and Type Field Description static com.mojang.serialization.Codec<ItemStack>CODECprivate intcooldownprivate intcountprivate booleanemptystatic ItemStackEMPTYprivate Entityholderprivate ItemitemDeprecated.private CachedBlockPositionlastDestroyPosprivate booleanlastDestroyResultprivate CachedBlockPositionlastPlaceOnPosprivate booleanlastPlaceOnResultprivate static LoggerLOGGERprivate static StyleLORE_STYLEstatic DecimalFormatMODIFIER_FORMATprivate CompoundTagtag -
Constructor Summary
Constructors Modifier Constructor Description ItemStack(ItemConvertible item)ItemStack(ItemConvertible item, int count)privateItemStack(ItemConvertible item, int count, Optional<CompoundTag> tag)privateItemStack(CompoundTag tag) -
Method Summary
-
Field Details
-
CODEC
-
LOGGER
-
EMPTY
-
MODIFIER_FORMAT
-
LORE_STYLE
-
count
private int count -
cooldown
private int cooldown -
item
Deprecated. -
tag
-
empty
private boolean empty -
holder
-
lastDestroyPos
-
lastDestroyResult
private boolean lastDestroyResult -
lastPlaceOnPos
-
lastPlaceOnResult
private boolean lastPlaceOnResult
-
-
Constructor Details
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
-
Method Details
-
getTooltipData
-
updateEmptyState
private void updateEmptyState() -
fromTag
-
isEmpty
public boolean isEmpty() -
split
-
getItem
-
isIn
-
isOf
-
useOnBlock
-
getMiningSpeedMultiplier
-
use
-
finishUsing
-
toTag
-
getMaxCount
public int getMaxCount() -
isStackable
public boolean isStackable() -
isDamageable
public boolean isDamageable() -
isDamaged
public boolean isDamaged() -
getDamage
public int getDamage() -
setDamage
public void setDamage(int damage) -
getMaxDamage
public int getMaxDamage() -
damage
-
damage
-
isItemBarVisible
@Environment(CLIENT) public boolean isItemBarVisible() -
getItemBarStep
@Environment(CLIENT) public int getItemBarStep() -
getItemBarColor
@Environment(CLIENT) public int getItemBarColor() -
onStackClicked
-
onClicked
public boolean onClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerInventory playerInventory) -
postHit
-
postMine
-
isSuitableFor
Determines whether this item can be used as a suitable tool for mining the specified block.Depending on block implementation, when combined together, the correct item and block may achieve a better mining speed and yield drops that would not be obtained when mining otherwise.
- Returns:
- values consistent with calls to
Item.isSuitableFor(net.minecraft.block.BlockState) - See Also:
Item.isSuitableFor(net.minecraft.block.BlockState)
-
useOnEntity
-
copy
-
areTagsEqual
-
areEqual
-
isEqual
-
areItemsEqualIgnoreDamage
-
areItemsEqual
-
isItemEqualIgnoreDamage
-
isItemEqual
-
canCombine
-
getTranslationKey
-
toString
-
inventoryTick
-
onCraft
-
getMaxUseTime
public int getMaxUseTime() -
getUseAction
-
onStoppedUsing
-
isUsedOnRelease
public boolean isUsedOnRelease() -
hasTag
public boolean hasTag() -
getTag
-
getOrCreateTag
-
getOrCreateSubTag
-
getSubTag
-
removeSubTag
-
getEnchantments
-
setTag
-
getName
-
setCustomName
-
removeCustomName
public void removeCustomName() -
hasCustomName
public boolean hasCustomName() -
getTooltip
@Environment(CLIENT) public List<Text> getTooltip(@Nullable PlayerEntity player, TooltipContext context) -
isSectionHidden
@Environment(CLIENT) private static boolean isSectionHidden(int flags, ItemStack.TooltipSection tooltipSection) -
getHideFlags
@Environment(CLIENT) private int getHideFlags() -
addHideFlag
-
appendEnchantments
-
parseBlockTag
-
hasGlint
public boolean hasGlint() -
getRarity
-
isEnchantable
public boolean isEnchantable() -
addEnchantment
-
hasEnchantments
public boolean hasEnchantments() -
putSubTag
-
isInFrame
public boolean isInFrame() -
setHolder
-
getFrame
-
getHolder
-
getRepairCost
public int getRepairCost() -
setRepairCost
public void setRepairCost(int repairCost) -
getAttributeModifiers
public Multimap<EntityAttribute,EntityAttributeModifier> getAttributeModifiers(EquipmentSlot slot) -
addAttributeModifier
public void addAttributeModifier(EntityAttribute attribute, EntityAttributeModifier modifier, @Nullable EquipmentSlot slot) -
toHoverableText
-
areBlocksEqual
private static boolean areBlocksEqual(CachedBlockPosition first, @Nullable CachedBlockPosition second) -
canDestroy
-
canPlaceOn
-
getCooldown
public int getCooldown() -
setCooldown
public void setCooldown(int cooldown) -
getCount
public int getCount() -
setCount
public void setCount(int count) -
increment
public void increment(int amount) -
decrement
public void decrement(int amount) -
usageTick
-
method_33262
-
isFood
public boolean isFood() -
getDrinkSound
-
getEatSound
-
getEquipSound
-