net.minecraft.world.item

public final class ItemStack

implements DataComponentHolder

cxp
net.minecraft.world.item.ItemStack
net.minecraft.class_1799
net.minecraft.item.ItemStack
net.minecraft.world.item.ItemStack

Field summary

Modifier and TypeField
public static final com.mojang.serialization.Codec<ItemStack>
a
CODEC
field_24671
CODEC
public static final com.mojang.serialization.Codec<ItemStack>
b
SINGLE_ITEM_CODEC
field_49747
UNCOUNTED_CODEC
public static final com.mojang.serialization.Codec<ItemStack>
c
STRICT_CODEC
field_51397
VALIDATED_CODEC
public static final com.mojang.serialization.Codec<ItemStack>
d
STRICT_SINGLE_ITEM_CODEC
field_51398
VALIDATED_UNCOUNTED_CODEC
public static final com.mojang.serialization.Codec<ItemStack>
e
OPTIONAL_CODEC
field_49266
OPTIONAL_CODEC
public static final com.mojang.serialization.Codec<ItemStack>
f
SIMPLE_ITEM_CODEC
field_49267
REGISTRY_ENTRY_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf, ItemStack>
g
OPTIONAL_STREAM_CODEC
field_49268
OPTIONAL_PACKET_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf, ItemStack>
h
STREAM_CODEC
field_48349
PACKET_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf, List<ItemStack>>
i
OPTIONAL_LIST_STREAM_CODEC
field_49269
OPTIONAL_LIST_PACKET_CODEC
private static final org.slf4j.Logger
k
LOGGER
field_8033
LOGGER
public static final ItemStack
j
EMPTY
field_8037
EMPTY
private static final Component
l
DISABLED_ITEM_TOOLTIP
field_40211
DISABLED_TEXT
private int
m
count
field_8031
count
private int
n
popTime
field_8030
bobbingAnimationTime
private final Item
o
item
field_8038
item
final PatchedDataComponentMap
p
components
field_49270
components
private Entity
q
entityRepresentation
field_24093
holder

Constructor summary

ModifierConstructor
public (ItemLike item)
public (Holder<Item> entry)
public (Holder<Item> item, int count, DataComponentPatch changes)
public (Holder<Item> itemEntry, int count)
public (ItemLike item, int count)
private (ItemLike item, int count, PatchedDataComponentMap components)
private (Void v)

Method summary

Modifier and TypeMethod
private static com.mojang.serialization.DataResult<ItemStack>
c(cxp arg0)
validateStrict(ItemStack arg0)
method_57372(class_1799 arg0)
validate(ItemStack stack)
public static StreamCodec<RegistryFriendlyByteBuf, ItemStack>
a(zt<xg, cxp> arg0)
validatedStreamCodec(StreamCodec<RegistryFriendlyByteBuf, ItemStack> arg0)
method_59693(class_9139<class_9129, class_1799> arg0)
createExtraValidatingPacketCodec(PacketCodec<RegistryByteBuf, ItemStack> basePacketCodec)
public Optional<TooltipComponent>
b()
getTooltipImage()
method_32347()
getTooltipData()
public DataComponentMap
a()
getComponents()
method_57353()
getComponents()
public void
c()
clearComponents()
method_61656()
clearComponentChanges()
public DataComponentMap
d()
getPrototype()
method_58658()
getDefaultComponents()
public DataComponentPatch
e()
getComponentsPatch()
method_57380()
getComponentChanges()
public static com.mojang.serialization.DataResult<Unit>
a(kq arg0)
validateComponents(DataComponentMap arg0)
method_59691(class_9323 arg0)
validateComponents(ComponentMap components)
public static Optional<ItemStack>
a(js$a arg0, vu arg1)
parse(HolderLookup$Provider arg0, Tag arg1)
method_57360(class_7225$class_7874 arg0, class_2520 arg1)
fromNbt(RegistryWrapper$WrapperLookup registries, NbtElement nbt)
public static ItemStack
a(js$a arg0, ux arg1)
parseOptional(HolderLookup$Provider arg0, CompoundTag arg1)
method_57359(class_7225$class_7874 arg0, class_2487 arg1)
fromNbtOrEmpty(RegistryWrapper$WrapperLookup registries, NbtCompound nbt)
public boolean
f()
isEmpty()
method_7960()
isEmpty()
public boolean
a(cst arg0)
isItemEnabled(FeatureFlagSet arg0)
method_45435(class_7699 arg0)
isItemEnabled(FeatureSet enabledFeatures)
public ItemStack
a(int arg0)
split(int arg0)
method_7971(int arg0)
split(int amount)
public ItemStack
g()
copyAndClear()
method_51164()
copyAndEmpty()
public Item
h()
getItem()
method_7909()
getItem()
public Holder<Item>
i()
getItemHolder()
method_41409()
getRegistryEntry()
public boolean
a(ayk<cxl> arg0)
is(TagKey<Item> arg0)
method_31573(class_6862<class_1792> arg0)
isIn(TagKey<Item> tag)
public boolean
a(cxl arg0)
is(Item arg0)
method_31574(class_1792 arg0)
isOf(Item item)
public boolean
a(Predicate<jq<cxl>> arg0)
is(Predicate<Holder<Item>> arg0)
method_41407(Predicate<class_6880<class_1792>> arg0)
itemMatches(Predicate<RegistryEntry<Item>> predicate)
public boolean
a(jq<cxl> arg0)
is(Holder<Item> arg0)
method_41406(class_6880<class_1792> arg0)
itemMatches(RegistryEntry<Item> itemEntry)
public boolean
a(ju<cxl> arg0)
is(HolderSet<Item> arg0)
method_53187(class_6885<class_1792> arg0)
isIn(RegistryEntryList<Item> registryEntryList)
public Stream<TagKey<Item>>
j()
getTags()
method_40133()
streamTags()
public InteractionResult
a(dbi arg0)
useOn(UseOnContext arg0)
method_7981(class_1838 arg0)
useOnBlock(ItemUsageContext context)
public float
a(dxv arg0)
getDestroySpeed(BlockState arg0)
method_7924(class_2680 arg0)
getMiningSpeedMultiplier(BlockState state)
public InteractionResult
a(dhi arg0, cpx arg1, bti arg2)
use(Level arg0, Player arg1, InteractionHand arg2)
method_7913(class_1937 arg0, class_1657 arg1, class_1268 arg2)
use(World world, PlayerEntity user, Hand hand)
public ItemStack
a(dhi arg0, bwg arg1)
finishUsingItem(Level arg0, LivingEntity arg1)
method_7910(class_1937 arg0, class_1309 arg1)
finishUsing(World world, LivingEntity user)
private ItemStack
a(bwg arg0, cxp arg1)
applyAfterUseComponentSideEffects(LivingEntity arg0, ItemStack arg1)
method_62837(class_1309 arg0, class_1799 arg1)
applyRemainderAndCooldown(LivingEntity user, ItemStack stack)
public Tag
b(js$a arg0, vu arg1)
save(HolderLookup$Provider arg0, Tag arg1)
method_57376(class_7225$class_7874 arg0, class_2520 arg1)
toNbt(RegistryWrapper$WrapperLookup registries, NbtElement prefix)
public Tag
a(js$a arg0)
save(HolderLookup$Provider arg0)
method_57358(class_7225$class_7874 arg0)
toNbt(RegistryWrapper$WrapperLookup registries)
public Tag
b(js$a arg0)
saveOptional(HolderLookup$Provider arg0)
method_57375(class_7225$class_7874 arg0)
toNbtAllowEmpty(RegistryWrapper$WrapperLookup registries)
public int
k()
getMaxStackSize()
method_7914()
getMaxCount()
public boolean
l()
isStackable()
method_7946()
isStackable()
public boolean
m()
isDamageableItem()
method_7963()
isDamageable()
public boolean
n()
isDamaged()
method_7986()
isDamaged()
public int
o()
getDamageValue()
method_7919()
getDamage()
public void
b(int arg0)
setDamageValue(int arg0)
method_7974(int arg0)
setDamage(int damage)
public int
p()
getMaxDamage()
method_7936()
getMaxDamage()
public boolean
q()
isBroken()
method_61657()
shouldBreak()
public boolean
r()
nextDamageWillBreak()
method_63692()
willBreakNextUse()
public void
a(int arg0, ash arg1, asi arg2, Consumer<cxl> arg3)
hurtAndBreak(int arg0, ServerLevel arg1, ServerPlayer arg2, Consumer<Item> arg3)
method_7956(int arg0, class_3218 arg1, class_3222 arg2, Consumer<class_1792> arg3)
damage(int amount, ServerWorld world, ServerPlayerEntity player, Consumer<Item> breakCallback)
private int
a(int arg0, ash arg1, asi arg2)
processDurabilityChange(int arg0, ServerLevel arg1, ServerPlayer arg2)
method_61651(int arg0, class_3218 arg1, class_3222 arg2)
calculateDamage(int baseDamage, ServerWorld world, ServerPlayerEntity player)
private void
a(int arg0, asi arg1, Consumer<cxl> arg2)
applyDamage(int arg0, ServerPlayer arg1, Consumer<Item> arg2)
method_61652(int arg0, class_3222 arg1, Consumer<class_1792> arg2)
onDurabilityChange(int damage, ServerPlayerEntity player, Consumer<Item> breakCallback)
public void
a(int arg0, cpx arg1)
hurtWithoutBreaking(int arg0, Player arg1)
method_61653(int arg0, class_1657 arg1)
damage(int amount, PlayerEntity player)
public void
a(int arg0, bwg arg1, bvs arg2)
hurtAndBreak(int arg0, LivingEntity arg1, EquipmentSlot arg2)
method_7970(int arg0, class_1309 arg1, class_1304 arg2)
damage(int amount, LivingEntity entity, EquipmentSlot slot)
public ItemStack
a(int arg0, dhh arg1, bwg arg2, bvs arg3)
hurtAndConvertOnBreak(int arg0, ItemLike arg1, LivingEntity arg2, EquipmentSlot arg3)
method_60986(int arg0, class_1935 arg1, class_1309 arg2, class_1304 arg3)
damage(int amount, ItemConvertible itemAfterBreaking, LivingEntity entity, EquipmentSlot slot)
public boolean
s()
isBarVisible()
method_31578()
isItemBarVisible()
public int
t()
getBarWidth()
method_31579()
getItemBarStep()
public int
u()
getBarColor()
method_31580()
getItemBarColor()
public boolean
a(cuz arg0, ctm arg1, cpx arg2)
overrideStackedOnOther(Slot arg0, ClickAction arg1, Player arg2)
method_31575(class_1735 arg0, class_5536 arg1, class_1657 arg2)
onStackClicked(Slot slot, ClickType clickType, PlayerEntity player)
public boolean
a(cxp arg0, cuz arg1, ctm arg2, cpx arg3, bwy arg4)
overrideOtherStackedOnMe(ItemStack arg0, Slot arg1, ClickAction arg2, Player arg3, SlotAccess arg4)
method_31576(class_1799 arg0, class_1735 arg1, class_5536 arg2, class_1657 arg3, class_5630 arg4)
onClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference)
public boolean
a(bwg arg0, bwg arg1)
hurtEnemy(LivingEntity arg0, LivingEntity arg1)
method_7979(class_1309 arg0, class_1309 arg1)
postHit(LivingEntity target, LivingEntity user)
public void
b(bwg arg0, bwg arg1)
postHurtEnemy(LivingEntity arg0, LivingEntity arg1)
method_59979(class_1309 arg0, class_1309 arg1)
postDamageEntity(LivingEntity target, LivingEntity user)
public void
a(dhi arg0, dxv arg1, jh arg2, cpx arg3)
mineBlock(Level arg0, BlockState arg1, BlockPos arg2, Player arg3)
method_7952(class_1937 arg0, class_2680 arg1, class_2338 arg2, class_1657 arg3)
postMine(World world, BlockState state, BlockPos pos, PlayerEntity miner)
public boolean
b(dxv arg0)
isCorrectToolForDrops(BlockState arg0)
method_7951(class_2680 arg0)
isSuitableFor(BlockState state)
public InteractionResult
a(cpx arg0, bwg arg1, bti arg2)
interactLivingEntity(Player arg0, LivingEntity arg1, InteractionHand arg2)
method_7920(class_1657 arg0, class_1309 arg1, class_1268 arg2)
useOnEntity(PlayerEntity user, LivingEntity entity, Hand hand)
public ItemStack
v()
copy()
method_7972()
copy()
public ItemStack
c(int arg0)
copyWithCount(int arg0)
method_46651(int arg0)
copyWithCount(int count)
public ItemStack
a(dhh arg0)
transmuteCopy(ItemLike arg0)
method_60503(class_1935 arg0)
withItem(ItemConvertible item)
public ItemStack
a(dhh arg0, int arg1)
transmuteCopy(ItemLike arg0, int arg1)
method_56701(class_1935 arg0, int arg1)
copyComponentsToNewStack(ItemConvertible item, int count)
private ItemStack
b(dhh arg0, int arg1)
transmuteCopyIgnoreEmpty(ItemLike arg0, int arg1)
method_56704(class_1935 arg0, int arg1)
copyComponentsToNewStackIgnoreEmpty(ItemConvertible item, int count)
public static boolean
a(cxp arg0, cxp arg1)
matches(ItemStack arg0, ItemStack arg1)
method_7973(class_1799 arg0, class_1799 arg1)
areEqual(ItemStack left, ItemStack right)
public static boolean
a(List<cxp> arg0, List<cxp> arg1)
listMatches(List<ItemStack> arg0, List<ItemStack> arg1)
method_57362(List<class_1799> arg0, List<class_1799> arg1)
stacksEqual(List<ItemStack> left, List<ItemStack> right)
public static boolean
b(cxp arg0, cxp arg1)
isSameItem(ItemStack arg0, ItemStack arg1)
method_7984(class_1799 arg0, class_1799 arg1)
areItemsEqual(ItemStack left, ItemStack right)
public static boolean
c(cxp arg0, cxp arg1)
isSameItemSameComponents(ItemStack arg0, ItemStack arg1)
method_31577(class_1799 arg0, class_1799 arg1)
areItemsAndComponentsEqual(ItemStack stack, ItemStack otherStack)
public static com.mojang.serialization.MapCodec<ItemStack>
a(String arg0)
lenientOptionalFieldOf(String arg0)
method_56702(String arg0)
createOptionalCodec(String fieldName)
public static int
a(cxp arg0)
hashItemAndComponents(ItemStack arg0)
method_57355(class_1799 arg0)
hashCode(ItemStack stack)
public static int
a(List<cxp> arg0)
hashStackList(List<ItemStack> arg0)
method_57361(List<class_1799> arg0)
listHashCode(List<ItemStack> stacks)
public void
a(dhi arg0, bvk arg1, int arg2, boolean arg3)
inventoryTick(Level arg0, Entity arg1, int arg2, boolean arg3)
method_7917(class_1937 arg0, class_1297 arg1, int arg2, boolean arg3)
inventoryTick(World world, Entity entity, int slot, boolean selected)
public void
a(dhi arg0, cpx arg1, int arg2)
onCraftedBy(Level arg0, Player arg1, int arg2)
method_7982(class_1937 arg0, class_1657 arg1, int arg2)
onCraftByPlayer(World world, PlayerEntity player, int amount)
public void
a(dhi arg0)
onCraftedBySystem(Level arg0)
method_54466(class_1937 arg0)
onCraftByCrafter(World world)
public int
a(bwg arg0)
getUseDuration(LivingEntity arg0)
method_7935(class_1309 arg0)
getMaxUseTime(LivingEntity user)
public ItemUseAnimation
w()
getUseAnimation()
method_7976()
getUseAction()
public void
a(dhi arg0, bwg arg1, int arg2)
releaseUsing(Level arg0, LivingEntity arg1, int arg2)
method_7930(class_1937 arg0, class_1309 arg1, int arg2)
onStoppedUsing(World world, LivingEntity user, int remainingUseTicks)
public boolean
x()
useOnRelease()
method_7967()
isUsedOnRelease()
public <T> T
b(kt<? super T> arg0, T arg1)
set(DataComponentType<? super T> arg0, T arg1)
method_57379(class_9331<? super T> arg0, T arg1)
set(ComponentType<? super T> type, T value)
public <T, U> T
a(kt<T> arg0, T arg1, U arg2, BiFunction<T, U, T> arg3)
update(DataComponentType<T> arg0, T arg1, U arg2, BiFunction<T, U, T> arg3)
method_57367(class_9331<T> arg0, T arg1, U arg2, BiFunction<T, U, T> arg3)
apply(ComponentType<T> type, T defaultValue, U change, BiFunction<T, U, T> applier)
public <T> T
a(kt<T> arg0, T arg1, UnaryOperator<T> arg2)
update(DataComponentType<T> arg0, T arg1, UnaryOperator<T> arg2)
method_57368(class_9331<T> arg0, T arg1, UnaryOperator<T> arg2)
apply(ComponentType<T> type, T defaultValue, UnaryOperator<T> applier)
public <T> T
c(kt<? extends T> arg0)
remove(DataComponentType<? extends T> arg0)
method_57381(class_9331<? extends T> arg0)
remove(ComponentType<? extends T> type)
public void
a(kr arg0)
applyComponentsAndValidate(DataComponentPatch arg0)
method_59692(class_9326 arg0)
applyChanges(ComponentChanges changes)
public void
b(kr arg0)
applyComponents(DataComponentPatch arg0)
method_57366(class_9326 arg0)
applyUnvalidatedChanges(ComponentChanges changes)
public void
b(kq arg0)
applyComponents(DataComponentMap arg0)
method_57365(class_9323 arg0)
applyComponentsFrom(ComponentMap components)
public Component
y()
getHoverName()
method_7964()
getName()
public Component
z()
getItemName()
method_63693()
getItemName()
public Component
A()
getStyledHoverName()
method_63015()
getFormattedName()
private <T extends TooltipProvider> void
a(kt<T> arg0, cxl$b arg1, Consumer<xv> arg2, czh arg3)
addToTooltip(DataComponentType<T> arg0, Item$TooltipContext arg1, Consumer<Component> arg2, TooltipFlag arg3)
method_57369(class_9331<T> arg0, class_1792$class_9635 arg1, Consumer<class_2561> arg2, class_1836 arg3)
appendTooltip(ComponentType<T> componentType, Item$TooltipContext context, Consumer<Text> textConsumer, TooltipType type)
public List<Component>
a(cxl$b arg0, cpx arg1, czh arg2)
getTooltipLines(Item$TooltipContext arg0, Player arg1, TooltipFlag arg2)
method_7950(class_1792$class_9635 arg0, class_1657 arg1, class_1836 arg2)
getTooltip(Item$TooltipContext context, PlayerEntity player, TooltipType type)
private void
a(Consumer<xv> arg0, cpx arg1)
addAttributeTooltips(Consumer<Component> arg0, Player arg1)
method_57363(Consumer<class_2561> arg0, class_1657 arg1)
appendAttributeModifiersTooltip(Consumer<Text> textConsumer, PlayerEntity player)
private void
a(Consumer<xv> arg0, cpx arg1, jq<bxj> arg2, bxm arg3)
addModifierTooltip(Consumer<Component> arg0, Player arg1, Holder<Attribute> arg2, AttributeModifier arg3)
method_57364(Consumer<class_2561> arg0, class_1657 arg1, class_6880<class_1320> arg2, class_1322 arg3)
appendAttributeModifierTooltip(Consumer<Text> textConsumer, PlayerEntity player, RegistryEntry<EntityAttribute> attribute, EntityAttributeModifier modifier)
public boolean
B()
hasFoil()
method_7958()
hasGlint()
public Rarity
C()
getRarity()
method_7932()
getRarity()
public boolean
D()
isEnchantable()
method_7923()
isEnchantable()
public void
a(jq<ddz> arg0, int arg1)
enchant(Holder<Enchantment> arg0, int arg1)
method_7978(class_6880<class_1887> arg0, int arg1)
addEnchantment(RegistryEntry<Enchantment> enchantment, int level)
public boolean
E()
isEnchanted()
method_7942()
hasEnchantments()
public ItemEnchantments
F()
getEnchantments()
method_58657()
getEnchantments()
public boolean
G()
isFramed()
method_7961()
isInFrame()
public void
a(bvk arg0)
setEntityRepresentation(Entity arg0)
method_27320(class_1297 arg0)
setHolder(Entity holder)
public ItemFrame
H()
getFrame()
method_7945()
getFrame()
public Entity
I()
getEntityRepresentation()
method_27319()
getHolder()
public void
a(bvt arg0, BiConsumer<jq<bxj>, bxm> arg1)
forEachModifier(EquipmentSlotGroup arg0, BiConsumer<Holder<Attribute>, AttributeModifier> arg1)
method_60617(class_9274 arg0, BiConsumer<class_6880<class_1320>, class_1322> arg1)
applyAttributeModifier(AttributeModifierSlot slot, BiConsumer<RegistryEntry<EntityAttribute>, EntityAttributeModifier> attributeModifierConsumer)
public void
a(bvs arg0, BiConsumer<jq<bxj>, bxm> arg1)
forEachModifier(EquipmentSlot arg0, BiConsumer<Holder<Attribute>, AttributeModifier> arg1)
method_57354(class_1304 arg0, BiConsumer<class_6880<class_1320>, class_1322> arg1)
applyAttributeModifiers(EquipmentSlot slot, BiConsumer<RegistryEntry<EntityAttribute>, EntityAttributeModifier> attributeModifierConsumer)
public Component
J()
getDisplayName()
method_7954()
toHoverableText()
public boolean
a(dxz arg0)
canPlaceOnBlockInAdventureMode(BlockInWorld arg0)
method_57357(class_2694 arg0)
canPlaceOn(CachedBlockPosition pos)
public boolean
b(dxz arg0)
canBreakBlockInAdventureMode(BlockInWorld arg0)
method_57373(class_2694 arg0)
canBreak(CachedBlockPosition pos)
public int
K()
getPopTime()
method_7965()
getBobbingAnimationTime()
public void
d(int arg0)
setPopTime(int arg0)
method_7912(int arg0)
setBobbingAnimationTime(int bobbingAnimationTime)
public int
L()
getCount()
method_7947()
getCount()
public void
e(int arg0)
setCount(int arg0)
method_7939(int arg0)
setCount(int count)
public void
f(int arg0)
limitSize(int arg0)
method_58408(int arg0)
capCount(int maxCount)
public void
g(int arg0)
grow(int arg0)
method_7933(int arg0)
increment(int amount)
public void
h(int arg0)
shrink(int arg0)
method_7934(int arg0)
decrement(int amount)
public void
a(int arg0, bwg arg1)
consume(int arg0, LivingEntity arg1)
method_57008(int arg0, class_1309 arg1)
decrementUnlessCreative(int amount, LivingEntity entity)
public ItemStack
b(int arg0, bwg arg1)
consumeAndReturn(int arg0, LivingEntity arg1)
method_60504(int arg0, class_1309 arg1)
splitUnlessCreative(int amount, LivingEntity entity)
public void
b(dhi arg0, bwg arg1, int arg2)
onUseTick(Level arg0, LivingEntity arg1, int arg2)
method_7949(class_1937 arg0, class_1309 arg1, int arg2)
usageTick(World world, LivingEntity user, int remainingUseTicks)
public void
a(cmb arg0)
onDestroyed(ItemEntity arg0)
method_33262(class_1542 arg0)
onItemEntityDestroyed(ItemEntity entity)
public SoundEvent
M()
getBreakingSound()
method_57351()
getBreakSound()
public boolean
a(bua arg0)
canBeHurtBy(DamageSource arg0)
method_58407(class_1282 arg0)
takesDamageFrom(DamageSource source)
public boolean
b(cxp arg0)
isValidRepairItem(ItemStack arg0)
method_61655(class_1799 arg0)
canRepairWith(ItemStack ingredient)