net.minecraft.world.item

public final class ItemStack

implements DataComponentHolder

cwq
net.minecraft.world.item.ItemStack
net.minecraft.class_1799
net.minecraft.item.ItemStack
net.minecraft.world.item.ItemStack

Field summary

Modifier and TypeField
private static final List<Component>
k
OP_NBT_WARNING
field_55546
OPERATOR_WARNINGS
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
l
LOGGER
field_8033
LOGGER
public static final ItemStack
j
EMPTY
field_8037
EMPTY
private static final Component
m
DISABLED_ITEM_TOOLTIP
field_40211
DISABLED_TEXT
private int
n
count
field_8031
count
private int
o
popTime
field_8030
bobbingAnimationTime
private final Item
p
item
field_8038
item
final PatchedDataComponentMap
q
components
field_49270
components
private Entity
r
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(cwq arg0)
validateStrict(ItemStack arg0)
method_57372(class_1799 arg0)
validate(ItemStack stack)
public static StreamCodec<RegistryFriendlyByteBuf, ItemStack>
a(yn<wa, cwq> 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 DataComponentMap
c()
getPrototype()
method_58658()
getDefaultComponents()
public DataComponentPatch
d()
getComponentsPatch()
method_57380()
getComponentChanges()
public DataComponentMap
e()
immutableComponents()
method_65359()
getImmutableComponents()
public boolean
c(ku<?> arg0)
hasNonDefault(DataComponentType<?> arg0)
method_65797(class_9331<?> arg0)
hasChangedComponent(ComponentType<?> type)
public static com.mojang.serialization.DataResult<Unit>
a(kr arg0)
validateComponents(DataComponentMap arg0)
method_59691(class_9323 arg0)
validateComponents(ComponentMap components)
public static Optional<ItemStack>
a(jt$a arg0, un 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(jt$a arg0, tq 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(cru 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(axf<cwm> arg0)
is(TagKey<Item> arg0)
method_31573(class_6862<class_1792> arg0)
isIn(TagKey<Item> tag)
public boolean
a(cwm arg0)
is(Item arg0)
method_31574(class_1792 arg0)
isOf(Item item)
public boolean
a(Predicate<jr<cwm>> arg0)
is(Predicate<Holder<Item>> arg0)
method_41407(Predicate<class_6880<class_1792>> arg0)
itemMatches(Predicate<RegistryEntry<Item>> predicate)
public boolean
a(jr<cwm> arg0)
is(Holder<Item> arg0)
method_41406(class_6880<class_1792> arg0)
itemMatches(RegistryEntry<Item> itemEntry)
public boolean
a(jv<cwm> 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(daj arg0)
useOn(UseOnContext arg0)
method_7981(class_1838 arg0)
useOnBlock(ItemUsageContext context)
public float
a(dwy arg0)
getDestroySpeed(BlockState arg0)
method_7924(class_2680 arg0)
getMiningSpeedMultiplier(BlockState state)
public InteractionResult
a(dgj arg0, coy arg1, bsk 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(dgj arg0, bvi arg1)
finishUsingItem(Level arg0, LivingEntity arg1)
method_7910(class_1937 arg0, class_1309 arg1)
finishUsing(World world, LivingEntity user)
private ItemStack
a(bvi arg0, cwq arg1)
applyAfterUseComponentSideEffects(LivingEntity arg0, ItemStack arg1)
method_62837(class_1309 arg0, class_1799 arg1)
applyRemainderAndCooldown(LivingEntity user, ItemStack stack)
public Tag
b(jt$a arg0, un 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(jt$a arg0)
save(HolderLookup$Provider arg0)
method_57358(class_7225$class_7874 arg0)
toNbt(RegistryWrapper$WrapperLookup registries)
public Tag
b(jt$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, ard arg1, are arg2, Consumer<cwm> 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, ard arg1, are 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, are arg1, Consumer<cwm> 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, coy arg1)
hurtWithoutBreaking(int arg0, Player arg1)
method_61653(int arg0, class_1657 arg1)
damage(int amount, PlayerEntity player)
public void
a(int arg0, bvi arg1, buu 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, dgi arg1, bvi arg2, buu 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(cua arg0, csn arg1, coy 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(cwq arg0, cua arg1, csn arg2, coy arg3, bwa 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(bvi arg0, bvi arg1)
hurtEnemy(LivingEntity arg0, LivingEntity arg1)
method_7979(class_1309 arg0, class_1309 arg1)
postHit(LivingEntity target, LivingEntity user)
public void
b(bvi arg0, bvi arg1)
postHurtEnemy(LivingEntity arg0, LivingEntity arg1)
method_59979(class_1309 arg0, class_1309 arg1)
postDamageEntity(LivingEntity target, LivingEntity user)
public void
a(dgj arg0, dwy arg1, ji arg2, coy 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(dwy arg0)
isCorrectToolForDrops(BlockState arg0)
method_7951(class_2680 arg0)
isSuitableFor(BlockState state)
public InteractionResult
a(coy arg0, bvi arg1, bsk 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(dgi arg0)
transmuteCopy(ItemLike arg0)
method_60503(class_1935 arg0)
withItem(ItemConvertible item)
public ItemStack
a(dgi arg0, int arg1)
transmuteCopy(ItemLike arg0, int arg1)
method_56701(class_1935 arg0, int arg1)
copyComponentsToNewStack(ItemConvertible item, int count)
private ItemStack
b(dgi arg0, int arg1)
transmuteCopyIgnoreEmpty(ItemLike arg0, int arg1)
method_56704(class_1935 arg0, int arg1)
copyComponentsToNewStackIgnoreEmpty(ItemConvertible item, int count)
public static boolean
a(cwq arg0, cwq arg1)
matches(ItemStack arg0, ItemStack arg1)
method_7973(class_1799 arg0, class_1799 arg1)
areEqual(ItemStack left, ItemStack right)
public static boolean
a(List<cwq> arg0, List<cwq> 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(cwq arg0, cwq arg1)
isSameItem(ItemStack arg0, ItemStack arg1)
method_7984(class_1799 arg0, class_1799 arg1)
areItemsEqual(ItemStack left, ItemStack right)
public static boolean
c(cwq arg0, cwq 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(cwq arg0)
hashItemAndComponents(ItemStack arg0)
method_57355(class_1799 arg0)
hashCode(ItemStack stack)
public static int
a(List<cwq> arg0)
hashStackList(List<ItemStack> arg0)
method_57361(List<class_1799> arg0)
listHashCode(List<ItemStack> stacks)
public void
a(dgj arg0, bum 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(dgj arg0, coy 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(dgj arg0)
onCraftedBySystem(Level arg0)
method_54466(class_1937 arg0)
onCraftByCrafter(World world)
public int
a(bvi arg0)
getUseDuration(LivingEntity arg0)
method_7935(class_1309 arg0)
getMaxUseTime(LivingEntity user)
public ItemUseAnimation
w()
getUseAnimation()
method_7976()
getUseAction()
public void
a(dgj arg0, bvi 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(ku<? 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(ku<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(ku<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
d(ku<? extends T> arg0)
remove(DataComponentType<? extends T> arg0)
method_57381(class_9331<? extends T> arg0)
remove(ComponentType<? extends T> type)
public void
a(ks arg0)
applyComponentsAndValidate(DataComponentPatch arg0)
method_59692(class_9326 arg0)
applyChanges(ComponentChanges changes)
public void
b(ks arg0)
applyComponents(DataComponentPatch arg0)
method_57366(class_9326 arg0)
applyUnvalidatedChanges(ComponentChanges changes)
public void
b(kr arg0)
applyComponents(DataComponentMap arg0)
method_57365(class_9323 arg0)
applyComponentsFrom(ComponentMap components)
public Component
y()
getHoverName()
method_7964()
getName()
public Component
z()
getCustomName()
method_65130()
getCustomName()
public Component
A()
getItemName()
method_63693()
getItemName()
public Component
B()
getStyledHoverName()
method_63015()
getFormattedName()
private <T extends TooltipProvider> void
a(ku<T> arg0, cwm$b arg1, Consumer<wp> arg2, cyi 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(cwm$b arg0, coy arg1, cyi 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<wp> arg0, coy 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<wp> arg0, coy arg1, jr<bwl> arg2, bwo 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
C()
hasFoil()
method_7958()
hasGlint()
public Rarity
D()
getRarity()
method_7932()
getRarity()
public boolean
E()
isEnchantable()
method_7923()
isEnchantable()
public void
a(jr<dda> 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
F()
isEnchanted()
method_7942()
hasEnchantments()
public ItemEnchantments
G()
getEnchantments()
method_58657()
getEnchantments()
public boolean
H()
isFramed()
method_7961()
isInFrame()
public void
a(bum arg0)
setEntityRepresentation(Entity arg0)
method_27320(class_1297 arg0)
setHolder(Entity holder)
public ItemFrame
I()
getFrame()
method_7945()
getFrame()
public Entity
J()
getEntityRepresentation()
method_27319()
getHolder()
public void
a(buv arg0, BiConsumer<jr<bwl>, bwo> 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(buu arg0, BiConsumer<jr<bwl>, bwo> 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
K()
getDisplayName()
method_7954()
toHoverableText()
public boolean
a(dxc arg0)
canPlaceOnBlockInAdventureMode(BlockInWorld arg0)
method_57357(class_2694 arg0)
canPlaceOn(CachedBlockPosition pos)
public boolean
b(dxc arg0)
canBreakBlockInAdventureMode(BlockInWorld arg0)
method_57373(class_2694 arg0)
canBreak(CachedBlockPosition pos)
public int
L()
getPopTime()
method_7965()
getBobbingAnimationTime()
public void
d(int arg0)
setPopTime(int arg0)
method_7912(int arg0)
setBobbingAnimationTime(int bobbingAnimationTime)
public int
M()
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, bvi arg1)
consume(int arg0, LivingEntity arg1)
method_57008(int arg0, class_1309 arg1)
decrementUnlessCreative(int amount, LivingEntity entity)
public ItemStack
b(int arg0, bvi arg1)
consumeAndReturn(int arg0, LivingEntity arg1)
method_60504(int arg0, class_1309 arg1)
splitUnlessCreative(int amount, LivingEntity entity)
public void
b(dgj arg0, bvi 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(cld arg0)
onDestroyed(ItemEntity arg0)
method_33262(class_1542 arg0)
onItemEntityDestroyed(ItemEntity entity)
public SoundEvent
N()
getBreakingSound()
method_57351()
getBreakSound()
public boolean
a(btc arg0)
canBeHurtBy(DamageSource arg0)
method_58407(class_1282 arg0)
takesDamageFrom(DamageSource source)
public boolean
b(cwq arg0)
isValidRepairItem(ItemStack arg0)
method_61655(class_1799 arg0)
canRepairWith(ItemStack ingredient)