Class ItemStack
- All Implemented Interfaces:
ComponentHolder
Item. Instances can be created using one of
the constructors and are usually stored in an Inventory.
Item stacks should never be compared using == operator or equals
method. This also means they cannot be used as a map key. To check if an item stack
is of a certain item, use isOf(Item). To compare two item stacks, use areItemsEqual(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) to check the item only, or areEqual(net.minecraft.item.ItemStack, net.minecraft.item.ItemStack) to also check the item
count and the components. Use isEmpty() to check if an item stack is empty instead
of doing stack == ItemStack.EMPTY.
When storing an item stack in an inventory or other places, make sure that an instance is never stored in multiple places. When two inventories hold the same instance, it will duplicate the item stack (and become two instances) when one is saved and reloaded.
NBT operations
NBT serialization
An Item Stack can be serialized withencode(RegistryWrapper.WrapperLookup), and deserialized with fromNbt(RegistryWrapper.WrapperLookup, NbtCompound).
| Key | Type | Purpose |
|---|---|---|
id | NbtString | The identifier of the item. |
count | NbtInt | The count of items in the stack. |
components | ComponentChanges | The item stack's components. |
- Mappings:
Namespace Name official crsintermediary net/minecraft/class_1799named net/minecraft/item/ItemStack
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intstatic final com.mojang.serialization.Codec<ItemStack> (package private) final ComponentMapImplprivate intprivate static final Textstatic final ItemStackThe empty item stack that holds no item.static final com.mojang.serialization.Codec<ItemStack> Deprecated.private static final com.mojang.serialization.Codec<RegistryEntry<Item>> static final PacketCodec<RegistryByteBuf, List<ItemStack>> private static final Loggerstatic final com.mojang.serialization.Codec<ItemStack> static final PacketCodec<RegistryByteBuf, List<ItemStack>> static final PacketCodec<RegistryByteBuf, ItemStack> static final PacketCodec<RegistryByteBuf, ItemStack> static final com.mojang.serialization.Codec<ItemStack> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateItemStack(ItemConvertible item) ItemStack(ItemConvertible item, int count) privateItemStack(ItemConvertible item, int count, ComponentMapImpl components) ItemStack(RegistryEntry<Item> entry) ItemStack(RegistryEntry<Item> itemEntry, int count) ItemStack(RegistryEntry<Item> item, int count, ComponentChanges changes) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEnchantment(Enchantment enchantment, int level) Enchants this item with the given enchantment and level.private voidappendAttributeModifiersTooltip(Consumer<Text> textConsumer, @Nullable PlayerEntity player) private voidappendAttributeModifierTooltip(Consumer<Text> textConsumer, @Nullable PlayerEntity player, RegistryEntry<EntityAttribute> attribute, EntityAttributeModifier modifier) private <T extends TooltipAppender>
voidappendTooltip(DataComponentType<T> componentType, Consumer<Text> textConsumer, TooltipContext context) <T> Tapply(DataComponentType<T> type, T defaultValue, UnaryOperator<T> applier) <T,U> T apply(DataComponentType<T> type, T defaultValue, U change, BiFunction<T, U, T> applier) voidapplyAttributeModifiers(EquipmentSlot slot, BiConsumer<RegistryEntry<EntityAttribute>, EntityAttributeModifier> attributeModifierConsumer) voidapplyChanges(ComponentChanges changes) voidapplyComponentsFrom(ComponentMap components) static booleanReturns whether the given item stacks are equal, including the item count and components.static booleanareItemsAndComponentsEqual(ItemStack stack, ItemStack otherStack) Returns whether the given item stacks' items and components are equal.static booleanareItemsEqual(ItemStack left, ItemStack right) Returns whether the given item stacks contain the same item, regardless of item count or components.booleanbooleancopy()Returns a copy of this item stack, including the item count, components, and bobbing animation time.copyComponentsToNewStack(ItemConvertible item, int count) Returns a new item stack with the components copied from this item stack.copyComponentsToNewStackIgnoreEmpty(ItemConvertible item, int count) Returns a new item stack with the components copied from this item stack, even if this stack is empty.copyWithCount(int count) Returns a copy of this item stack, including the components, and bobbing animation time.static com.mojang.serialization.MapCodec<ItemStack> createOptionalCodec(String fieldName) voiddamage(int amount, LivingEntity entity, EquipmentSlot slot) Damages this item stack.voiddamage(int amount, Random random, @Nullable ServerPlayerEntity player, Runnable breakCallback) Damages this item stack.voiddecrement(int amount) Decrements the count of items in this item stack.voiddecrementUnlessCreative(int amount, @Nullable LivingEntity entity) Decrements the count of items in this item stack, unlessentityis a creative mode player.encode(RegistryWrapper.WrapperLookup registries) encode(RegistryWrapper.WrapperLookup registries, NbtElement prefix) encodeAllowEmpty(RegistryWrapper.WrapperLookup registries) finishUsing(World world, LivingEntity user) fromNbt(RegistryWrapper.WrapperLookup registries, NbtElement nbt) static ItemStackfromNbtOrEmpty(RegistryWrapper.WrapperLookup registries, NbtCompound nbt) intintgetCount()Returns the count of items in this item stack.intReturns the damage (lost durability) of the item stack.getFrame()Returns the item frame that holds the stack, ornullif inapplicable.Returns the entity that holds the stack, ornullif inapplicable.getItem()Returns the item of this stack.intReturns the color of the filled section of the durability bar.intReturns the length of the filled section of the durability bar in pixels (out of 13).intintintfloatgetName()Returns the custom name of the stack if it exists, or the item's name.getTooltip(@Nullable PlayerEntity player, TooltipContext context) booleanReturns whether the item stack has any enchantments.booleanhasGlint()static intvoidincrement(int amount) Increments the count of items in this item stack.voidinventoryTick(World world, Entity entity, int slot, boolean selected) booleanReturns whether the item can be damaged (lose durability).booleanReturns whether the item stack is damageable and has damage.booleanisEmpty()Returns whether this item stack is empty.booleanReturns whether this item stack can be enchanted with an enchanting table.booleanisFood()booleanReturns whether the item is intag.booleanReturns whether the item stack is in an item frame.booleanbooleanisItemEnabled(FeatureSet enabledFeatures) booleanReturns whether the item isitem.booleanReturns whether the item stack can have item count above1.booleanisSuitableFor(BlockState state) Determines whether this item can be used as a suitable tool for mining the specified block.booleanbooleanitemMatches(Predicate<RegistryEntry<Item>> predicate) Returns whether the item's registry entry passes thepredicate.booleanitemMatches(RegistryEntry<Item> itemEntry) Returns whether the item's registry entry matchesitemEntry.booleanitemMatches(RegistryEntryList<Item> registryEntryList) static intlistHashCode(List<ItemStack> stacks) Deprecated.booleanonClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) voidonCraftByCrafter(World world) voidonCraftByPlayer(World world, PlayerEntity player, int amount) voidonItemEntityDestroyed(ItemEntity entity) booleanonStackClicked(Slot slot, ClickType clickType, PlayerEntity player) voidonStoppedUsing(World world, LivingEntity user, int remainingUseTicks) voidpostHit(LivingEntity target, PlayerEntity attacker) voidpostMine(World world, BlockState state, BlockPos pos, PlayerEntity miner) <T> Tremove(DataComponentType<? extends T> type) <T> Tset(DataComponentType<? super T> type, T value) voidsetBobbingAnimationTime(int bobbingAnimationTime) voidsetCount(int count) Sets the count of items in this item stack.voidsetDamage(int damage) Sets the stack's damage todamage.voidSets the stack's holder toholder.split(int amount) Returns the copy of the stack "split" from the current stack with item count being at mostamount.static booleanstacksEqual(List<ItemStack> left, List<ItemStack> right) Deprecated.Returns a stream of all tags the item is in.Returns a text consisting of the bracketed stack name that can be hovered to show the item stack's tooltip.toString()voidusageTick(World world, LivingEntity user, int remainingUseTicks) use(World world, PlayerEntity user, Hand hand) useOnBlock(ItemUsageContext context) useOnEntity(PlayerEntity user, LivingEntity entity, Hand hand) private static com.mojang.serialization.DataResult<ItemStack> Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.component.ComponentHolder
contains, get, getOrDefault
-
Field Details
-
ITEM_CODEC
- Mappings:
Namespace Name Mixin selector official jLcrs;j:Lcom/mojang/serialization/Codec;intermediary field_47312Lnet/minecraft/class_1799;field_47312:Lcom/mojang/serialization/Codec;named ITEM_CODECLnet/minecraft/item/ItemStack;ITEM_CODEC:Lcom/mojang/serialization/Codec;
-
CODEC
- Mappings:
Namespace Name Mixin selector official aLcrs;a:Lcom/mojang/serialization/Codec;intermediary field_24671Lnet/minecraft/class_1799;field_24671:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/item/ItemStack;CODEC:Lcom/mojang/serialization/Codec;
-
field_49747
- Mappings:
Namespace Name Mixin selector official bLcrs;b:Lcom/mojang/serialization/Codec;intermediary field_49747Lnet/minecraft/class_1799;field_49747:Lcom/mojang/serialization/Codec;named field_49747Lnet/minecraft/item/ItemStack;field_49747:Lcom/mojang/serialization/Codec;
-
OPTIONAL_CODEC
- Mappings:
Namespace Name Mixin selector official cLcrs;c:Lcom/mojang/serialization/Codec;intermediary field_49266Lnet/minecraft/class_1799;field_49266:Lcom/mojang/serialization/Codec;named OPTIONAL_CODECLnet/minecraft/item/ItemStack;OPTIONAL_CODEC:Lcom/mojang/serialization/Codec;
-
REGISTRY_ENTRY_CODEC
- Mappings:
Namespace Name Mixin selector official dLcrs;d:Lcom/mojang/serialization/Codec;intermediary field_49267Lnet/minecraft/class_1799;field_49267:Lcom/mojang/serialization/Codec;named REGISTRY_ENTRY_CODECLnet/minecraft/item/ItemStack;REGISTRY_ENTRY_CODEC:Lcom/mojang/serialization/Codec;
-
OPTIONAL_PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official eLcrs;e:Lyg;intermediary field_49268Lnet/minecraft/class_1799;field_49268:Lnet/minecraft/class_9139;named OPTIONAL_PACKET_CODECLnet/minecraft/item/ItemStack;OPTIONAL_PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official fLcrs;f:Lyg;intermediary field_48349Lnet/minecraft/class_1799;field_48349:Lnet/minecraft/class_9139;named PACKET_CODECLnet/minecraft/item/ItemStack;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
OPTIONAL_LIST_PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official gLcrs;g:Lyg;intermediary field_49269Lnet/minecraft/class_1799;field_49269:Lnet/minecraft/class_9139;named OPTIONAL_LIST_PACKET_CODECLnet/minecraft/item/ItemStack;OPTIONAL_LIST_PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
LIST_PACKET_CODEC
- Mappings:
Namespace Name Mixin selector official hLcrs;h:Lyg;intermediary field_48350Lnet/minecraft/class_1799;field_48350:Lnet/minecraft/class_9139;named LIST_PACKET_CODECLnet/minecraft/item/ItemStack;LIST_PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
-
LOGGER
- Mappings:
Namespace Name Mixin selector official kLcrs;k:Lorg/slf4j/Logger;intermediary field_8033Lnet/minecraft/class_1799;field_8033:Lorg/slf4j/Logger;named LOGGERLnet/minecraft/item/ItemStack;LOGGER:Lorg/slf4j/Logger;
-
EMPTY
The empty item stack that holds no item.This should never be mutated.
- See Also:
- Mappings:
Namespace Name Mixin selector official iLcrs;i:Lcrs;intermediary field_8037Lnet/minecraft/class_1799;field_8037:Lnet/minecraft/class_1799;named EMPTYLnet/minecraft/item/ItemStack;EMPTY:Lnet/minecraft/item/ItemStack;
-
DISABLED_TEXT
- Mappings:
Namespace Name Mixin selector official lLcrs;l:Lwi;intermediary field_40211Lnet/minecraft/class_1799;field_40211:Lnet/minecraft/class_2561;named DISABLED_TEXTLnet/minecraft/item/ItemStack;DISABLED_TEXT:Lnet/minecraft/text/Text;
-
count
private int count- Mappings:
Namespace Name Mixin selector official mLcrs;m:Iintermediary field_8031Lnet/minecraft/class_1799;field_8031:Inamed countLnet/minecraft/item/ItemStack;count:I
-
bobbingAnimationTime
private int bobbingAnimationTime- Mappings:
Namespace Name Mixin selector official nLcrs;n:Iintermediary field_8030Lnet/minecraft/class_1799;field_8030:Inamed bobbingAnimationTimeLnet/minecraft/item/ItemStack;bobbingAnimationTime:I
-
item
Deprecated.- Mappings:
Namespace Name Mixin selector official oLcrs;o:Lcrn;intermediary field_8038Lnet/minecraft/class_1799;field_8038:Lnet/minecraft/class_1792;named itemLnet/minecraft/item/ItemStack;item:Lnet/minecraft/item/Item;
-
components
- Mappings:
Namespace Name Mixin selector official pLcrs;p:Ljs;intermediary field_49270Lnet/minecraft/class_1799;field_49270:Lnet/minecraft/class_9335;named componentsLnet/minecraft/item/ItemStack;components:Lnet/minecraft/component/ComponentMapImpl;
-
holder
- Mappings:
Namespace Name Mixin selector official qLcrs;q:Lbqa;intermediary field_24093Lnet/minecraft/class_1799;field_24093:Lnet/minecraft/class_1297;named holderLnet/minecraft/item/ItemStack;holder:Lnet/minecraft/entity/Entity;
-
-
Constructor Details
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lczf;)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_1935;)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/item/ItemConvertible;)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lin;)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_6880;)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/registry/entry/RegistryEntry;)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lin;ILjo;)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_6880;ILnet/minecraft/class_9326;)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/registry/entry/RegistryEntry;ILnet/minecraft/component/ComponentChanges;)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lin;I)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_6880;I)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/registry/entry/RegistryEntry;I)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lczf;I)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_1935;I)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/item/ItemConvertible;I)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Lczf;ILjs;)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Lnet/minecraft/class_1935;ILnet/minecraft/class_9335;)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Lnet/minecraft/item/ItemConvertible;ILnet/minecraft/component/ComponentMapImpl;)V
-
ItemStack
- Mappings:
Namespace Name Mixin selector official <init>Lcrs;<init>(Ljava/lang/Void;)Vintermediary <init>Lnet/minecraft/class_1799;<init>(Ljava/lang/Void;)Vnamed <init>Lnet/minecraft/item/ItemStack;<init>(Ljava/lang/Void;)V
-
-
Method Details
-
validate
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lcrs;)Lcom/mojang/serialization/DataResult;intermediary method_57372Lnet/minecraft/class_1799;method_57372(Lnet/minecraft/class_1799;)Lcom/mojang/serialization/DataResult;named validateLnet/minecraft/item/ItemStack;validate(Lnet/minecraft/item/ItemStack;)Lcom/mojang/serialization/DataResult;
-
getTooltipData
- Mappings:
Namespace Name Mixin selector official bLcrs;b()Ljava/util/Optional;intermediary method_32347Lnet/minecraft/class_1799;method_32347()Ljava/util/Optional;named getTooltipDataLnet/minecraft/item/ItemStack;getTooltipData()Ljava/util/Optional;
-
getComponents
- Specified by:
getComponentsin interfaceComponentHolder- Mappings:
Namespace Name Mixin selector official aLjm;a()Ljn;intermediary method_57353Lnet/minecraft/class_9322;method_57353()Lnet/minecraft/class_9323;named getComponentsLnet/minecraft/component/ComponentHolder;getComponents()Lnet/minecraft/component/ComponentMap;
-
getComponentChanges
- Mappings:
Namespace Name Mixin selector official cLcrs;c()Ljo;intermediary method_57380Lnet/minecraft/class_1799;method_57380()Lnet/minecraft/class_9326;named getComponentChangesLnet/minecraft/item/ItemStack;getComponentChanges()Lnet/minecraft/component/ComponentChanges;
-
fromNbt
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lip$a;Lul;)Ljava/util/Optional;intermediary method_57360Lnet/minecraft/class_1799;method_57360(Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2520;)Ljava/util/Optional;named fromNbtLnet/minecraft/item/ItemStack;fromNbt(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;Lnet/minecraft/nbt/NbtElement;)Ljava/util/Optional;
-
fromNbtOrEmpty
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lip$a;Lto;)Lcrs;intermediary method_57359Lnet/minecraft/class_1799;method_57359(Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2487;)Lnet/minecraft/class_1799;named fromNbtOrEmptyLnet/minecraft/item/ItemStack;fromNbtOrEmpty(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/item/ItemStack;
-
isEmpty
public boolean isEmpty()Returns whether this item stack is empty.- Returns:
- whether this item stack is empty
- Mappings:
Namespace Name Mixin selector official dLcrs;d()Zintermediary method_7960Lnet/minecraft/class_1799;method_7960()Znamed isEmptyLnet/minecraft/item/ItemStack;isEmpty()Z
-
isItemEnabled
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcmn;)Zintermediary method_45435Lnet/minecraft/class_1799;method_45435(Lnet/minecraft/class_7699;)Znamed isItemEnabledLnet/minecraft/item/ItemStack;isItemEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Z
-
split
Returns the copy of the stack "split" from the current stack with item count being at mostamount.Splitting an item stack mutates this stack so that the sum of the stacks' item counts does not change. See the example below:
ItemStack stack = new ItemStack(Items.APPLE, 64); ItemStack newStack = stack.split(10); // stack has 54 apples // newStack has 10 apples ItemStack smallStack = new ItemStack(Items.APPLE, 4); ItemStack newSmallStack = smallStack.split(10); // smallStack is now empty // newSmallStack has 4 apples- Returns:
- the copy of the stack "split" from the current stack with item count
being at most
amount - Mappings:
Namespace Name Mixin selector official aLcrs;a(I)Lcrs;intermediary method_7971Lnet/minecraft/class_1799;method_7971(I)Lnet/minecraft/class_1799;named splitLnet/minecraft/item/ItemStack;split(I)Lnet/minecraft/item/ItemStack;
-
copyAndEmpty
- Mappings:
Namespace Name Mixin selector official eLcrs;e()Lcrs;intermediary method_51164Lnet/minecraft/class_1799;method_51164()Lnet/minecraft/class_1799;named copyAndEmptyLnet/minecraft/item/ItemStack;copyAndEmpty()Lnet/minecraft/item/ItemStack;
-
getItem
Returns the item of this stack.- Returns:
- the item of this stack
- See Also:
- Mappings:
Namespace Name Mixin selector official fLcrs;f()Lcrn;intermediary method_7909Lnet/minecraft/class_1799;method_7909()Lnet/minecraft/class_1792;named getItemLnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;
-
getRegistryEntry
- Mappings:
Namespace Name Mixin selector official gLcrs;g()Lin;intermediary method_41409Lnet/minecraft/class_1799;method_41409()Lnet/minecraft/class_6880;named getRegistryEntryLnet/minecraft/item/ItemStack;getRegistryEntry()Lnet/minecraft/registry/entry/RegistryEntry;
-
isIn
Returns whether the item is intag.- Returns:
- whether the item is in
tag - Mappings:
Namespace Name Mixin selector official aLcrs;a(Lavt;)Zintermediary method_31573Lnet/minecraft/class_1799;method_31573(Lnet/minecraft/class_6862;)Znamed isInLnet/minecraft/item/ItemStack;isIn(Lnet/minecraft/registry/tag/TagKey;)Z
-
isOf
Returns whether the item isitem.- Returns:
- whether the item is
item - Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcrn;)Zintermediary method_31574Lnet/minecraft/class_1799;method_31574(Lnet/minecraft/class_1792;)Znamed isOfLnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z
-
itemMatches
Returns whether the item's registry entry passes thepredicate.- Returns:
- whether the item's registry entry passes the
predicate - See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/util/function/Predicate;)Zintermediary method_41407Lnet/minecraft/class_1799;method_41407(Ljava/util/function/Predicate;)Znamed itemMatchesLnet/minecraft/item/ItemStack;itemMatches(Ljava/util/function/Predicate;)Z
-
itemMatches
Returns whether the item's registry entry matchesitemEntry.- Returns:
- whether the item's registry entry matches
itemEntry - See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lin;)Zintermediary method_41406Lnet/minecraft/class_1799;method_41406(Lnet/minecraft/class_6880;)Znamed itemMatchesLnet/minecraft/item/ItemStack;itemMatches(Lnet/minecraft/registry/entry/RegistryEntry;)Z
-
itemMatches
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lir;)Zintermediary method_53187Lnet/minecraft/class_1799;method_53187(Lnet/minecraft/class_6885;)Znamed itemMatchesLnet/minecraft/item/ItemStack;itemMatches(Lnet/minecraft/registry/entry/RegistryEntryList;)Z
-
streamTags
Returns a stream of all tags the item is in.- Returns:
- a stream of all tags the item is in
- See Also:
- Mappings:
Namespace Name Mixin selector official hLcrs;h()Ljava/util/stream/Stream;intermediary method_40133Lnet/minecraft/class_1799;method_40133()Ljava/util/stream/Stream;named streamTagsLnet/minecraft/item/ItemStack;streamTags()Ljava/util/stream/Stream;
-
useOnBlock
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcuz;)Lbof;intermediary method_7981Lnet/minecraft/class_1799;method_7981(Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269;named useOnBlockLnet/minecraft/item/ItemStack;useOnBlock(Lnet/minecraft/item/ItemUsageContext;)Lnet/minecraft/util/ActionResult;
-
getMiningSpeedMultiplier
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ldpi;)Fintermediary method_7924Lnet/minecraft/class_1799;method_7924(Lnet/minecraft/class_2680;)Fnamed getMiningSpeedMultiplierLnet/minecraft/item/ItemStack;getMiningSpeedMultiplier(Lnet/minecraft/block/BlockState;)F
-
use
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Lcka;Lboe;)Lbog;intermediary method_7913Lnet/minecraft/class_1799;method_7913(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;named useLnet/minecraft/item/ItemStack;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
-
finishUsing
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Lbqt;)Lcrs;intermediary method_7910Lnet/minecraft/class_1799;method_7910(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;)Lnet/minecraft/class_1799;named finishUsingLnet/minecraft/item/ItemStack;finishUsing(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;)Lnet/minecraft/item/ItemStack;
-
encode
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lip$a;Lul;)Lul;intermediary method_57376Lnet/minecraft/class_1799;method_57376(Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2520;)Lnet/minecraft/class_2520;named encodeLnet/minecraft/item/ItemStack;encode(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;Lnet/minecraft/nbt/NbtElement;)Lnet/minecraft/nbt/NbtElement;
-
encode
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lip$a;)Lul;intermediary method_57358Lnet/minecraft/class_1799;method_57358(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2520;named encodeLnet/minecraft/item/ItemStack;encode(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/nbt/NbtElement;
-
encodeAllowEmpty
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lip$a;)Lul;intermediary method_57375Lnet/minecraft/class_1799;method_57375(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2520;named encodeAllowEmptyLnet/minecraft/item/ItemStack;encodeAllowEmpty(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/nbt/NbtElement;
-
getMaxCount
public int getMaxCount()- Mappings:
Namespace Name Mixin selector official iLcrs;i()Iintermediary method_7914Lnet/minecraft/class_1799;method_7914()Inamed getMaxCountLnet/minecraft/item/ItemStack;getMaxCount()I
-
isStackable
public boolean isStackable()Returns whether the item stack can have item count above1.Stackable items must have the maximum count that is more than
1and cannot be damaged.- Returns:
- whether the item stack can have item count above
1 - Mappings:
Namespace Name Mixin selector official jLcrs;j()Zintermediary method_7946Lnet/minecraft/class_1799;method_7946()Znamed isStackableLnet/minecraft/item/ItemStack;isStackable()Z
-
isDamageable
public boolean isDamageable()Returns whether the item can be damaged (lose durability).Items with 0 max damage or item stacks with
DataComponentTypes.UNBREAKABLEcomponent cannot be damaged.- Returns:
- whether the item can be damaged (lose durability)
- See Also:
- Mappings:
Namespace Name Mixin selector official kLcrs;k()Zintermediary method_7963Lnet/minecraft/class_1799;method_7963()Znamed isDamageableLnet/minecraft/item/ItemStack;isDamageable()Z
-
isDamaged
public boolean isDamaged()Returns whether the item stack is damageable and has damage.- Returns:
- whether the item stack is damageable and has damage
- See Also:
- Mappings:
Namespace Name Mixin selector official lLcrs;l()Zintermediary method_7986Lnet/minecraft/class_1799;method_7986()Znamed isDamagedLnet/minecraft/item/ItemStack;isDamaged()Z
-
getDamage
public int getDamage()Returns the damage (lost durability) of the item stack.Note that this method does not check if the item is damageable, unlike
isDamaged().- Returns:
- the damage (lost durability) of the item stack
- See Also:
- Mappings:
Namespace Name Mixin selector official mLcrs;m()Iintermediary method_7919Lnet/minecraft/class_1799;method_7919()Inamed getDamageLnet/minecraft/item/ItemStack;getDamage()I
-
setDamage
public void setDamage(int damage) Sets the stack's damage todamage.This does not break the item if the damage reaches the maximum, unlike
damage(int, LivingEntity, EquipmentSlot).- See Also:
- Mappings:
Namespace Name Mixin selector official bLcrs;b(I)Vintermediary method_7974Lnet/minecraft/class_1799;method_7974(I)Vnamed setDamageLnet/minecraft/item/ItemStack;setDamage(I)V
-
getMaxDamage
public int getMaxDamage()- Mappings:
Namespace Name Mixin selector official nLcrs;n()Iintermediary method_7936Lnet/minecraft/class_1799;method_7936()Inamed getMaxDamageLnet/minecraft/item/ItemStack;getMaxDamage()I
-
damage
public void damage(int amount, Random random, @Nullable @Nullable ServerPlayerEntity player, Runnable breakCallback) Damages this item stack. This method should be used when a non-entity, such as a dispenser, damages the stack. This does not damage non-damageable stacks, and the unbreaking enchantment is applied toamountbefore damaging.If
playeris notnull, this triggersCriteria.ITEM_DURABILITY_CHANGED.When the item "breaks", that is, the stack's damage is equal to or above the maximum damage,
breakCallbackis run. Callers should decrement the stack size inside the callback.- Parameters:
player- the player that damaged the stack, ornullif no player is involvedbreakCallback- a callback run when the item "breaks"- Mappings:
Namespace Name Mixin selector official aLcrs;a(ILaxt;Lapv;Ljava/lang/Runnable;)Vintermediary method_7956Lnet/minecraft/class_1799;method_7956(ILnet/minecraft/class_5819;Lnet/minecraft/class_3222;Ljava/lang/Runnable;)Vnamed damageLnet/minecraft/item/ItemStack;damage(ILnet/minecraft/util/math/random/Random;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/lang/Runnable;)V
-
damage
Damages this item stack. This method should be used when an entity, including a player, damages the stack. This does not damage non-damageable stacks, and the unbreaking enchantment is applied toamountbefore damaging. Additionally, ifentityis a player in creative mode, the stack will not be damaged.If
entityis a player, this triggersCriteria.ITEM_DURABILITY_CHANGED.If the stack's damage is equal to or above the maximum damage (i.e. the item is "broken"), this will send the equipment break status, decrement the stack, and increment
Stats.BROKENif the stack is held by a player.- Parameters:
slot- the slot in which the stack is held- Mappings:
Namespace Name Mixin selector official aLcrs;a(ILbqt;Lbqh;)Vintermediary method_7970Lnet/minecraft/class_1799;method_7970(ILnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Vnamed damageLnet/minecraft/item/ItemStack;damage(ILnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)V
-
isItemBarVisible
public boolean isItemBarVisible()- Mappings:
Namespace Name Mixin selector official oLcrs;o()Zintermediary method_31578Lnet/minecraft/class_1799;method_31578()Znamed isItemBarVisibleLnet/minecraft/item/ItemStack;isItemBarVisible()Z
-
getItemBarStep
public int getItemBarStep()Returns the length of the filled section of the durability bar in pixels (out of 13).- Returns:
- the length of the filled section of the durability bar in pixels (out of 13)
- Mappings:
Namespace Name Mixin selector official pLcrs;p()Iintermediary method_31579Lnet/minecraft/class_1799;method_31579()Inamed getItemBarStepLnet/minecraft/item/ItemStack;getItemBarStep()I
-
getItemBarColor
public int getItemBarColor()Returns the color of the filled section of the durability bar.- Returns:
- the color of the filled section of the durability bar
- Mappings:
Namespace Name Mixin selector official qLcrs;q()Iintermediary method_31580Lnet/minecraft/class_1799;method_31580()Inamed getItemBarColorLnet/minecraft/item/ItemStack;getItemBarColor()I
-
onStackClicked
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcos;Lcne;Lcka;)Zintermediary method_31575Lnet/minecraft/class_1799;method_31575(Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Znamed onStackClickedLnet/minecraft/item/ItemStack;onStackClicked(Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)Z
-
onClicked
public boolean onClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcrs;Lcos;Lcne;Lcka;Lbrk;)Zintermediary method_31576Lnet/minecraft/class_1799;method_31576(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;Lnet/minecraft/class_5630;)Znamed onClickedLnet/minecraft/item/ItemStack;onClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/inventory/StackReference;)Z
-
postHit
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lbqt;Lcka;)Vintermediary method_7979Lnet/minecraft/class_1799;method_7979(Lnet/minecraft/class_1309;Lnet/minecraft/class_1657;)Vnamed postHitLnet/minecraft/item/ItemStack;postHit(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/player/PlayerEntity;)V
-
postMine
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Ldpi;Lid;Lcka;)Vintermediary method_7952Lnet/minecraft/class_1799;method_7952(Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;)Vnamed postMineLnet/minecraft/item/ItemStack;postMine(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;)V
-
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:
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Ldpi;)Zintermediary method_7951Lnet/minecraft/class_1799;method_7951(Lnet/minecraft/class_2680;)Znamed isSuitableForLnet/minecraft/item/ItemStack;isSuitableFor(Lnet/minecraft/block/BlockState;)Z
-
useOnEntity
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcka;Lbqt;Lboe;)Lbof;intermediary method_7920Lnet/minecraft/class_1799;method_7920(Lnet/minecraft/class_1657;Lnet/minecraft/class_1309;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1269;named useOnEntityLnet/minecraft/item/ItemStack;useOnEntity(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;
-
copy
Returns a copy of this item stack, including the item count, components, and bobbing animation time.- Returns:
- a copy of this item stack, including the item count, components, and bobbing animation time
- See Also:
- Mappings:
Namespace Name Mixin selector official rLcrs;r()Lcrs;intermediary method_7972Lnet/minecraft/class_1799;method_7972()Lnet/minecraft/class_1799;named copyLnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;
-
copyWithCount
Returns a copy of this item stack, including the components, and bobbing animation time., with the item count set tocount- Parameters:
count- the item count of the resultant stack- Returns:
- a copy of this item stack, including the components, and bobbing animation time
- See Also:
- Mappings:
Namespace Name Mixin selector official cLcrs;c(I)Lcrs;intermediary method_46651Lnet/minecraft/class_1799;method_46651(I)Lnet/minecraft/class_1799;named copyWithCountLnet/minecraft/item/ItemStack;copyWithCount(I)Lnet/minecraft/item/ItemStack;
-
copyComponentsToNewStack
Returns a new item stack with the components copied from this item stack.- Parameters:
item- the item of the resultant stackcount- the item count of the resultant stack- Returns:
- a new item stack with the components copied from this item stack
- See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczf;I)Lcrs;intermediary method_56701Lnet/minecraft/class_1799;method_56701(Lnet/minecraft/class_1935;I)Lnet/minecraft/class_1799;named copyComponentsToNewStackLnet/minecraft/item/ItemStack;copyComponentsToNewStack(Lnet/minecraft/item/ItemConvertible;I)Lnet/minecraft/item/ItemStack;
-
copyComponentsToNewStackIgnoreEmpty
Returns a new item stack with the components copied from this item stack, even if this stack is empty.- Parameters:
item- the item of the resultant stackcount- the item count of the resultant stack- Returns:
- a new item stack with the components copied from this item stack, even if this stack is empty
- See Also:
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lczf;I)Lcrs;intermediary method_56704Lnet/minecraft/class_1799;method_56704(Lnet/minecraft/class_1935;I)Lnet/minecraft/class_1799;named copyComponentsToNewStackIgnoreEmptyLnet/minecraft/item/ItemStack;copyComponentsToNewStackIgnoreEmpty(Lnet/minecraft/item/ItemConvertible;I)Lnet/minecraft/item/ItemStack;
-
areEqual
Returns whether the given item stacks are equal, including the item count and components.- Returns:
- whether the given item stacks are equal, including the item count and components
- See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcrs;Lcrs;)Zintermediary method_7973Lnet/minecraft/class_1799;method_7973(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Znamed areEqualLnet/minecraft/item/ItemStack;areEqual(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
stacksEqual
Deprecated.- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/util/List;Ljava/util/List;)Zintermediary method_57362Lnet/minecraft/class_1799;method_57362(Ljava/util/List;Ljava/util/List;)Znamed stacksEqualLnet/minecraft/item/ItemStack;stacksEqual(Ljava/util/List;Ljava/util/List;)Z
-
areItemsEqual
Returns whether the given item stacks contain the same item, regardless of item count or components.- Returns:
- whether the given item stacks contain the same item, regardless of item count or components
- See Also:
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lcrs;Lcrs;)Zintermediary method_7984Lnet/minecraft/class_1799;method_7984(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Znamed areItemsEqualLnet/minecraft/item/ItemStack;areItemsEqual(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
areItemsAndComponentsEqual
Returns whether the given item stacks' items and components are equal.If this returns
true, the two item stacks can be combined into one, as long as the resulting item count does not exceed the maximum item count- Returns:
- whether the given item stacks' items and components are equal
- See Also:
- Mappings:
Namespace Name Mixin selector official cLcrs;c(Lcrs;Lcrs;)Zintermediary method_31577Lnet/minecraft/class_1799;method_31577(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Znamed areItemsAndComponentsEqualLnet/minecraft/item/ItemStack;areItemsAndComponentsEqual(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
createOptionalCodec
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/lang/String;)Lcom/mojang/serialization/MapCodec;intermediary method_56702Lnet/minecraft/class_1799;method_56702(Ljava/lang/String;)Lcom/mojang/serialization/MapCodec;named createOptionalCodecLnet/minecraft/item/ItemStack;createOptionalCodec(Ljava/lang/String;)Lcom/mojang/serialization/MapCodec;
-
hashCode
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcrs;)Iintermediary method_57355Lnet/minecraft/class_1799;method_57355(Lnet/minecraft/class_1799;)Inamed hashCodeLnet/minecraft/item/ItemStack;hashCode(Lnet/minecraft/item/ItemStack;)I
-
listHashCode
Deprecated.- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/util/List;)Iintermediary method_57361Lnet/minecraft/class_1799;method_57361(Ljava/util/List;)Inamed listHashCodeLnet/minecraft/item/ItemStack;listHashCode(Ljava/util/List;)I
-
getTranslationKey
- Mappings:
Namespace Name Mixin selector official sLcrs;s()Ljava/lang/String;intermediary method_7922Lnet/minecraft/class_1799;method_7922()Ljava/lang/String;named getTranslationKeyLnet/minecraft/item/ItemStack;getTranslationKey()Ljava/lang/String;
-
toString
-
inventoryTick
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Lbqa;IZ)Vintermediary method_7917Lnet/minecraft/class_1799;method_7917(Lnet/minecraft/class_1937;Lnet/minecraft/class_1297;IZ)Vnamed inventoryTickLnet/minecraft/item/ItemStack;inventoryTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;IZ)V
-
onCraftByPlayer
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Lcka;I)Vintermediary method_7982Lnet/minecraft/class_1799;method_7982(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;I)Vnamed onCraftByPlayerLnet/minecraft/item/ItemStack;onCraftByPlayer(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;I)V
-
onCraftByCrafter
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;)Vintermediary method_54466Lnet/minecraft/class_1799;method_54466(Lnet/minecraft/class_1937;)Vnamed onCraftByCrafterLnet/minecraft/item/ItemStack;onCraftByCrafter(Lnet/minecraft/world/World;)V
-
getMaxUseTime
public int getMaxUseTime()- Mappings:
Namespace Name Mixin selector official tLcrs;t()Iintermediary method_7935Lnet/minecraft/class_1799;method_7935()Inamed getMaxUseTimeLnet/minecraft/item/ItemStack;getMaxUseTime()I
-
getUseAction
- Mappings:
Namespace Name Mixin selector official uLcrs;u()Lctk;intermediary method_7976Lnet/minecraft/class_1799;method_7976()Lnet/minecraft/class_1839;named getUseActionLnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;
-
onStoppedUsing
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lczg;Lbqt;I)Vintermediary method_7930Lnet/minecraft/class_1799;method_7930(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)Vnamed onStoppedUsingLnet/minecraft/item/ItemStack;onStoppedUsing(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V
-
isUsedOnRelease
public boolean isUsedOnRelease()- Mappings:
Namespace Name Mixin selector official vLcrs;v()Zintermediary method_7967Lnet/minecraft/class_1799;method_7967()Znamed isUsedOnReleaseLnet/minecraft/item/ItemStack;isUsedOnRelease()Z
-
set
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Ljq;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_57379Lnet/minecraft/class_1799;method_57379(Lnet/minecraft/class_9331;Ljava/lang/Object;)Ljava/lang/Object;named setLnet/minecraft/item/ItemStack;set(Lnet/minecraft/component/DataComponentType;Ljava/lang/Object;)Ljava/lang/Object;
-
apply
@Nullable public <T,U> T apply(DataComponentType<T> type, T defaultValue, U change, BiFunction<T, U, T> applier) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljq;Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;intermediary method_57367Lnet/minecraft/class_1799;method_57367(Lnet/minecraft/class_9331;Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;named applyLnet/minecraft/item/ItemStack;apply(Lnet/minecraft/component/DataComponentType;Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
-
apply
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljq;Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/lang/Object;intermediary method_57368Lnet/minecraft/class_1799;method_57368(Lnet/minecraft/class_9331;Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/lang/Object;named applyLnet/minecraft/item/ItemStack;apply(Lnet/minecraft/component/DataComponentType;Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/lang/Object;
-
remove
- Mappings:
Namespace Name Mixin selector official cLcrs;c(Ljq;)Ljava/lang/Object;intermediary method_57381Lnet/minecraft/class_1799;method_57381(Lnet/minecraft/class_9331;)Ljava/lang/Object;named removeLnet/minecraft/item/ItemStack;remove(Lnet/minecraft/component/DataComponentType;)Ljava/lang/Object;
-
applyChanges
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljo;)Vintermediary method_57366Lnet/minecraft/class_1799;method_57366(Lnet/minecraft/class_9326;)Vnamed applyChangesLnet/minecraft/item/ItemStack;applyChanges(Lnet/minecraft/component/ComponentChanges;)V
-
applyComponentsFrom
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljn;)Vintermediary method_57365Lnet/minecraft/class_1799;method_57365(Lnet/minecraft/class_9323;)Vnamed applyComponentsFromLnet/minecraft/item/ItemStack;applyComponentsFrom(Lnet/minecraft/component/ComponentMap;)V
-
getName
Returns the custom name of the stack if it exists, or the item's name.- Returns:
- the custom name of the stack if it exists, or the item's name
- Mappings:
Namespace Name Mixin selector official wLcrs;w()Lwi;intermediary method_7964Lnet/minecraft/class_1799;method_7964()Lnet/minecraft/class_2561;named getNameLnet/minecraft/item/ItemStack;getName()Lnet/minecraft/text/Text;
-
appendTooltip
private <T extends TooltipAppender> void appendTooltip(DataComponentType<T> componentType, Consumer<Text> textConsumer, TooltipContext context) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljq;Ljava/util/function/Consumer;Lcti;)Vintermediary method_57369Lnet/minecraft/class_1799;method_57369(Lnet/minecraft/class_9331;Ljava/util/function/Consumer;Lnet/minecraft/class_1836;)Vnamed appendTooltipLnet/minecraft/item/ItemStack;appendTooltip(Lnet/minecraft/component/DataComponentType;Ljava/util/function/Consumer;Lnet/minecraft/client/item/TooltipContext;)V
-
getTooltip
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcka;Lcti;)Ljava/util/List;intermediary method_7950Lnet/minecraft/class_1799;method_7950(Lnet/minecraft/class_1657;Lnet/minecraft/class_1836;)Ljava/util/List;named getTooltipLnet/minecraft/item/ItemStack;getTooltip(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/client/item/TooltipContext;)Ljava/util/List;
-
appendAttributeModifiersTooltip
private void appendAttributeModifiersTooltip(Consumer<Text> textConsumer, @Nullable @Nullable PlayerEntity player) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/util/function/Consumer;Lcka;)Vintermediary method_57363Lnet/minecraft/class_1799;method_57363(Ljava/util/function/Consumer;Lnet/minecraft/class_1657;)Vnamed appendAttributeModifiersTooltipLnet/minecraft/item/ItemStack;appendAttributeModifiersTooltip(Ljava/util/function/Consumer;Lnet/minecraft/entity/player/PlayerEntity;)V
-
appendAttributeModifierTooltip
private void appendAttributeModifierTooltip(Consumer<Text> textConsumer, @Nullable @Nullable PlayerEntity player, RegistryEntry<EntityAttribute> attribute, EntityAttributeModifier modifier) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Ljava/util/function/Consumer;Lcka;Lin;Lbry;)Vintermediary method_57364Lnet/minecraft/class_1799;method_57364(Ljava/util/function/Consumer;Lnet/minecraft/class_1657;Lnet/minecraft/class_6880;Lnet/minecraft/class_1322;)Vnamed appendAttributeModifierTooltipLnet/minecraft/item/ItemStack;appendAttributeModifierTooltip(Ljava/util/function/Consumer;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/entity/attribute/EntityAttributeModifier;)V
-
hasGlint
public boolean hasGlint()- Mappings:
Namespace Name Mixin selector official xLcrs;x()Zintermediary method_7958Lnet/minecraft/class_1799;method_7958()Znamed hasGlintLnet/minecraft/item/ItemStack;hasGlint()Z
-
getRarity
- Mappings:
Namespace Name Mixin selector official yLcrs;y()Lcsj;intermediary method_7932Lnet/minecraft/class_1799;method_7932()Lnet/minecraft/class_1814;named getRarityLnet/minecraft/item/ItemStack;getRarity()Lnet/minecraft/util/Rarity;
-
isEnchantable
public boolean isEnchantable()Returns whether this item stack can be enchanted with an enchanting table.This is not used for other methods of enchanting like anvils.
- Returns:
- whether this item stack can be enchanted with an enchanting table
- Mappings:
Namespace Name Mixin selector official zLcrs;z()Zintermediary method_7923Lnet/minecraft/class_1799;method_7923()Znamed isEnchantableLnet/minecraft/item/ItemStack;isEnchantable()Z
-
addEnchantment
Enchants this item with the given enchantment and level.This should not be used with enchanted books, as the book itself is not enchanted and therefore does not store enchantments under
DataComponentTypes.ENCHANTMENTS.- See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcwz;I)Vintermediary method_7978Lnet/minecraft/class_1799;method_7978(Lnet/minecraft/class_1887;I)Vnamed addEnchantmentLnet/minecraft/item/ItemStack;addEnchantment(Lnet/minecraft/enchantment/Enchantment;I)V
-
hasEnchantments
public boolean hasEnchantments()Returns whether the item stack has any enchantments.This will return
falsefor enchanted books, as the book itself is not enchanted and therefore does not store enchantments underDataComponentTypes.ENCHANTMENTS.- Returns:
- whether the item stack has any enchantments
- See Also:
- Mappings:
Namespace Name Mixin selector official ALcrs;A()Zintermediary method_7942Lnet/minecraft/class_1799;method_7942()Znamed hasEnchantmentsLnet/minecraft/item/ItemStack;hasEnchantments()Z
-
isInFrame
public boolean isInFrame()Returns whether the item stack is in an item frame.- Returns:
- whether the item stack is in an item frame
- See Also:
- Mappings:
Namespace Name Mixin selector official BLcrs;B()Zintermediary method_7961Lnet/minecraft/class_1799;method_7961()Znamed isInFrameLnet/minecraft/item/ItemStack;isInFrame()Z
-
setHolder
Sets the stack's holder toholder.This is used by item frames and item entities, and does not need to be called for other entities.
- See Also:
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lbqa;)Vintermediary method_27320Lnet/minecraft/class_1799;method_27320(Lnet/minecraft/class_1297;)Vnamed setHolderLnet/minecraft/item/ItemStack;setHolder(Lnet/minecraft/entity/Entity;)V
-
getFrame
Returns the item frame that holds the stack, ornullif inapplicable.- Returns:
- the item frame that holds the stack, or
nullif inapplicable - See Also:
- Mappings:
Namespace Name Mixin selector official CLcrs;C()Lcgd;intermediary method_7945Lnet/minecraft/class_1799;method_7945()Lnet/minecraft/class_1533;named getFrameLnet/minecraft/item/ItemStack;getFrame()Lnet/minecraft/entity/decoration/ItemFrameEntity;
-
getHolder
Returns the entity that holds the stack, ornullif inapplicable.- Returns:
- the entity that holds the stack, or
nullif inapplicable - See Also:
- Mappings:
Namespace Name Mixin selector official DLcrs;D()Lbqa;intermediary method_27319Lnet/minecraft/class_1799;method_27319()Lnet/minecraft/class_1297;named getHolderLnet/minecraft/item/ItemStack;getHolder()Lnet/minecraft/entity/Entity;
-
applyAttributeModifiers
public void applyAttributeModifiers(EquipmentSlot slot, BiConsumer<RegistryEntry<EntityAttribute>, EntityAttributeModifier> attributeModifierConsumer) - Mappings:
Namespace Name Mixin selector official aLcrs;a(Lbqh;Ljava/util/function/BiConsumer;)Vintermediary method_57354Lnet/minecraft/class_1799;method_57354(Lnet/minecraft/class_1304;Ljava/util/function/BiConsumer;)Vnamed applyAttributeModifiersLnet/minecraft/item/ItemStack;applyAttributeModifiers(Lnet/minecraft/entity/EquipmentSlot;Ljava/util/function/BiConsumer;)V
-
toHoverableText
Returns a text consisting of the bracketed stack name that can be hovered to show the item stack's tooltip.- Returns:
- a text consisting of the bracketed stack name that can be hovered to show the item stack's tooltip
- Mappings:
Namespace Name Mixin selector official ELcrs;E()Lwi;intermediary method_7954Lnet/minecraft/class_1799;method_7954()Lnet/minecraft/class_2561;named toHoverableTextLnet/minecraft/item/ItemStack;toHoverableText()Lnet/minecraft/text/Text;
-
canPlaceOn
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Ldpm;)Zintermediary method_57357Lnet/minecraft/class_1799;method_57357(Lnet/minecraft/class_2694;)Znamed canPlaceOnLnet/minecraft/item/ItemStack;canPlaceOn(Lnet/minecraft/block/pattern/CachedBlockPosition;)Z
-
canBreak
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Ldpm;)Zintermediary method_57373Lnet/minecraft/class_1799;method_57373(Lnet/minecraft/class_2694;)Znamed canBreakLnet/minecraft/item/ItemStack;canBreak(Lnet/minecraft/block/pattern/CachedBlockPosition;)Z
-
getBobbingAnimationTime
public int getBobbingAnimationTime()- Mappings:
Namespace Name Mixin selector official FLcrs;F()Iintermediary method_7965Lnet/minecraft/class_1799;method_7965()Inamed getBobbingAnimationTimeLnet/minecraft/item/ItemStack;getBobbingAnimationTime()I
-
setBobbingAnimationTime
public void setBobbingAnimationTime(int bobbingAnimationTime) - Mappings:
Namespace Name Mixin selector official dLcrs;d(I)Vintermediary method_7912Lnet/minecraft/class_1799;method_7912(I)Vnamed setBobbingAnimationTimeLnet/minecraft/item/ItemStack;setBobbingAnimationTime(I)V
-
getCount
public int getCount()Returns the count of items in this item stack.- Returns:
- the count of items in this item stack
- Mappings:
Namespace Name Mixin selector official GLcrs;G()Iintermediary method_7947Lnet/minecraft/class_1799;method_7947()Inamed getCountLnet/minecraft/item/ItemStack;getCount()I
-
setCount
public void setCount(int count) Sets the count of items in this item stack.- Parameters:
count- the count of items- Mappings:
Namespace Name Mixin selector official eLcrs;e(I)Vintermediary method_7939Lnet/minecraft/class_1799;method_7939(I)Vnamed setCountLnet/minecraft/item/ItemStack;setCount(I)V
-
increment
public void increment(int amount) Increments the count of items in this item stack.- Parameters:
amount- the amount to increment- Mappings:
Namespace Name Mixin selector official fLcrs;f(I)Vintermediary method_7933Lnet/minecraft/class_1799;method_7933(I)Vnamed incrementLnet/minecraft/item/ItemStack;increment(I)V
-
decrement
public void decrement(int amount) Decrements the count of items in this item stack.- Parameters:
amount- the amount to decrement- Mappings:
Namespace Name Mixin selector official gLcrs;g(I)Vintermediary method_7934Lnet/minecraft/class_1799;method_7934(I)Vnamed decrementLnet/minecraft/item/ItemStack;decrement(I)V
-
decrementUnlessCreative
Decrements the count of items in this item stack, unlessentityis a creative mode player.- Mappings:
Namespace Name Mixin selector official aLcrs;a(ILbqt;)Vintermediary method_57008Lnet/minecraft/class_1799;method_57008(ILnet/minecraft/class_1309;)Vnamed decrementUnlessCreativeLnet/minecraft/item/ItemStack;decrementUnlessCreative(ILnet/minecraft/entity/LivingEntity;)V
-
usageTick
- Mappings:
Namespace Name Mixin selector official bLcrs;b(Lczg;Lbqt;I)Vintermediary method_7949Lnet/minecraft/class_1799;method_7949(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)Vnamed usageTickLnet/minecraft/item/ItemStack;usageTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V
-
onItemEntityDestroyed
- Mappings:
Namespace Name Mixin selector official aLcrs;a(Lcgk;)Vintermediary method_33262Lnet/minecraft/class_1799;method_33262(Lnet/minecraft/class_1542;)Vnamed onItemEntityDestroyedLnet/minecraft/item/ItemStack;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)V
-
isFood
public boolean isFood()- Mappings:
Namespace Name Mixin selector official HLcrs;H()Zintermediary method_19267Lnet/minecraft/class_1799;method_19267()Znamed isFoodLnet/minecraft/item/ItemStack;isFood()Z
-
getDrinkSound
- Mappings:
Namespace Name Mixin selector official ILcrs;I()Laun;intermediary method_21832Lnet/minecraft/class_1799;method_21832()Lnet/minecraft/class_3414;named getDrinkSoundLnet/minecraft/item/ItemStack;getDrinkSound()Lnet/minecraft/sound/SoundEvent;
-
getEatSound
- Mappings:
Namespace Name Mixin selector official JLcrs;J()Laun;intermediary method_21833Lnet/minecraft/class_1799;method_21833()Lnet/minecraft/class_3414;named getEatSoundLnet/minecraft/item/ItemStack;getEatSound()Lnet/minecraft/sound/SoundEvent;
-
getBreakSound
- Mappings:
Namespace Name Mixin selector official KLcrs;K()Laun;intermediary method_57351Lnet/minecraft/class_1799;method_57351()Lnet/minecraft/class_3414;named getBreakSoundLnet/minecraft/item/ItemStack;getBreakSound()Lnet/minecraft/sound/SoundEvent;
-