yarn/mappings/net/minecraft/item/ItemStack.mapping

568 lines
26 KiB
Plaintext

CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
COMMENT Represents a stack of items. This is a data container that holds the item count
COMMENT and the stack's components. Logics for items (such as the action for using it) are delegated
COMMENT to the stack's logic container, {@link Item}. Instances can be created using one of
COMMENT the constructors and are usually stored in an {@link net.minecraft.inventory.Inventory}.
COMMENT
COMMENT <p>Item stacks should never be compared using {@code ==} operator or {@code equals}
COMMENT method. This also means they cannot be used as a map key. To check if an item stack
COMMENT is of a certain item, use {@link #isOf(Item)}. To compare two item stacks, use {@link
COMMENT #areItemsEqual} to check the item only, or {@link #areEqual} to also check the item
COMMENT count and the components. Use {@link #isEmpty} to check if an item stack is empty instead
COMMENT of doing {@code stack == ItemStack.EMPTY}.
COMMENT
COMMENT <p>When storing an item stack in an inventory or other places, make sure that an instance
COMMENT is never stored in multiple places. When two inventories hold the same instance, it
COMMENT will duplicate the item stack (and become two instances) when one is saved and reloaded.
COMMENT
COMMENT <h2 id="components">Components</h2>
COMMENT <p>Components can be used to store data specific to the item stack.
COMMENT Use {@link ComponentHolder#get} or {@link ComponentHolder#getOrDefault} to
COMMENT get the component values. Use {@link #set} or {@link #remove} to set the components.
COMMENT
COMMENT <h2 id="nbt-serialization">NBT serialization</h2>
COMMENT <p>An Item Stack can be serialized with {@link #encode(RegistryWrapper.WrapperLookup)}, and deserialized with {@link #fromNbt(RegistryWrapper.WrapperLookup, NbtCompound)}.
COMMENT
COMMENT <div class="fabric">
COMMENT <table border=1>
COMMENT <caption>Serialized NBT Structure</caption>
COMMENT <tr>
COMMENT <th>Key</th><th>Type</th><th>Purpose</th>
COMMENT </tr>
COMMENT <tr>
COMMENT <td>{@code id}</td><td>{@link net.minecraft.nbt.NbtString}</td><td>The identifier of the item.</td>
COMMENT </tr>
COMMENT <tr>
COMMENT <td>{@code count}</td><td>{@link net.minecraft.nbt.NbtInt}</td><td>The count of items in the stack.</td>
COMMENT </tr>
COMMENT <tr>
COMMENT <td>{@code components}</td><td>{@link ComponentChanges}</td><td>The item stack's components.</td>
COMMENT </tr>
COMMENT </table>
COMMENT </div>
FIELD field_24093 holder Lnet/minecraft/class_1297;
FIELD field_24671 CODEC Lcom/mojang/serialization/Codec;
FIELD field_40211 DISABLED_TEXT Lnet/minecraft/class_2561;
FIELD field_47312 ITEM_CODEC Lcom/mojang/serialization/Codec;
FIELD field_48349 PACKET_CODEC Lnet/minecraft/class_9139;
FIELD field_48350 LIST_PACKET_CODEC Lnet/minecraft/class_9139;
FIELD field_49266 OPTIONAL_CODEC Lcom/mojang/serialization/Codec;
FIELD field_49267 REGISTRY_ENTRY_CODEC Lcom/mojang/serialization/Codec;
FIELD field_49268 OPTIONAL_PACKET_CODEC Lnet/minecraft/class_9139;
FIELD field_49269 OPTIONAL_LIST_PACKET_CODEC Lnet/minecraft/class_9139;
FIELD field_49270 components Lnet/minecraft/class_9335;
FIELD field_49747 COOKING_RECIPE_RESULT_CODEC Lcom/mojang/serialization/Codec;
FIELD field_8030 bobbingAnimationTime I
FIELD field_8031 count I
FIELD field_8033 LOGGER Lorg/slf4j/Logger;
FIELD field_8037 EMPTY Lnet/minecraft/class_1799;
COMMENT The empty item stack that holds no item.
COMMENT
COMMENT <p>This should never be mutated.
COMMENT
COMMENT @see ItemStack#isEmpty
FIELD field_8038 item Lnet/minecraft/class_1792;
METHOD <init> (Ljava/lang/Void;)V
ARG 1 v
METHOD <init> (Lnet/minecraft/class_1935;)V
ARG 1 item
METHOD <init> (Lnet/minecraft/class_1935;I)V
ARG 1 item
ARG 2 count
METHOD <init> (Lnet/minecraft/class_1935;ILnet/minecraft/class_9335;)V
ARG 1 item
ARG 2 count
ARG 3 components
METHOD <init> (Lnet/minecraft/class_6880;)V
ARG 1 entry
METHOD <init> (Lnet/minecraft/class_6880;I)V
ARG 1 itemEntry
ARG 2 count
METHOD <init> (Lnet/minecraft/class_6880;ILnet/minecraft/class_9326;)V
ARG 1 item
ARG 2 count
ARG 3 changes
METHOD method_19267 isFood ()Z
METHOD method_21832 getDrinkSound ()Lnet/minecraft/class_3414;
METHOD method_21833 getEatSound ()Lnet/minecraft/class_3414;
METHOD method_27319 getHolder ()Lnet/minecraft/class_1297;
COMMENT {@return the entity that holds the stack, or {@code null} if inapplicable}
COMMENT
COMMENT @see #isInFrame
COMMENT @see #getFrame
COMMENT @see #setHolder
METHOD method_27320 setHolder (Lnet/minecraft/class_1297;)V
COMMENT Sets the stack's holder to {@code holder}.
COMMENT
COMMENT <p>This is used by item frames and item entities, and does not need to be called
COMMENT for other entities.
COMMENT
COMMENT @see #isInFrame
COMMENT @see #getFrame
COMMENT @see #getHolder
ARG 1 holder
METHOD method_31573 isIn (Lnet/minecraft/class_6862;)Z
COMMENT {@return whether the item is in {@code tag}}
ARG 1 tag
METHOD method_31574 isOf (Lnet/minecraft/class_1792;)Z
COMMENT {@return whether the item is {@code item}}
ARG 1 item
METHOD method_31575 onStackClicked (Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Z
ARG 1 slot
ARG 2 clickType
ARG 3 player
METHOD method_31576 onClicked (Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;Lnet/minecraft/class_5630;)Z
ARG 1 stack
ARG 2 slot
ARG 3 clickType
ARG 4 player
ARG 5 cursorStackReference
METHOD method_31577 areItemsAndComponentsEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
COMMENT {@return whether the given item stacks' items and components are equal}
COMMENT
COMMENT <p>If this returns {@code true}, the two item stacks can be combined into one,
COMMENT as long as the resulting item count does not exceed {@linkplain Item#getMaxCount
COMMENT the maximum item count}
COMMENT
COMMENT @see #areEqual
COMMENT @see #areItemsEqual
ARG 0 stack
ARG 1 otherStack
METHOD method_31578 isItemBarVisible ()Z
METHOD method_31579 getItemBarStep ()I
COMMENT {@return the length of the filled section of the durability bar in pixels (out of 13)}
METHOD method_31580 getItemBarColor ()I
COMMENT {@return the color of the filled section of the durability bar}
METHOD method_32347 getTooltipData ()Ljava/util/Optional;
METHOD method_33262 onItemEntityDestroyed (Lnet/minecraft/class_1542;)V
ARG 1 entity
METHOD method_40133 streamTags ()Ljava/util/stream/Stream;
COMMENT {@return a stream of all tags the item is in}
COMMENT
COMMENT @see #isIn(TagKey)
METHOD method_41406 itemMatches (Lnet/minecraft/class_6880;)Z
COMMENT {@return whether the item's registry entry matches {@code itemEntry}}
COMMENT
COMMENT @see #itemMatches(Predicate)
COMMENT @see #isOf(Item)
ARG 1 itemEntry
METHOD method_41407 itemMatches (Ljava/util/function/Predicate;)Z
COMMENT {@return whether the item's registry entry passes the {@code predicate}}
COMMENT
COMMENT @see #itemMatches(RegistryEntry)
COMMENT @see #isOf(Item)
ARG 1 predicate
METHOD method_41409 getRegistryEntry ()Lnet/minecraft/class_6880;
METHOD method_45435 isItemEnabled (Lnet/minecraft/class_7699;)Z
ARG 1 enabledFeatures
METHOD method_46651 copyWithCount (I)Lnet/minecraft/class_1799;
COMMENT {@return a copy of this item stack, including the components, and {@linkplain #getBobbingAnimationTime bobbing animation time}},
COMMENT with the item count set to {@code count}
COMMENT
COMMENT @see #copy
COMMENT @see #copyComponentsToNewStack
COMMENT @see #copyComponentsToNewStackIgnoreEmpty
ARG 1 count
COMMENT the item count of the resultant stack
METHOD method_51164 copyAndEmpty ()Lnet/minecraft/class_1799;
METHOD method_53187 itemMatches (Lnet/minecraft/class_6885;)Z
ARG 1 registryEntryList
METHOD method_54466 onCraftByCrafter (Lnet/minecraft/class_1937;)V
ARG 1 world
METHOD method_56700 (Lnet/minecraft/class_1799;)Ljava/util/Optional;
ARG 0 stack
METHOD method_56701 copyComponentsToNewStack (Lnet/minecraft/class_1935;I)Lnet/minecraft/class_1799;
COMMENT {@return a new item stack with the components copied from this item stack}
COMMENT
COMMENT @see #copy
COMMENT @see #copyWithCount
COMMENT @see #copyComponentsToNewStackIgnoreEmpty
ARG 1 item
COMMENT the item of the resultant stack
ARG 2 count
COMMENT the item count of the resultant stack
METHOD method_56702 createOptionalCodec (Ljava/lang/String;)Lcom/mojang/serialization/MapCodec;
ARG 0 fieldName
METHOD method_56703 (Ljava/util/Optional;)Lnet/minecraft/class_1799;
ARG 0 optional
METHOD method_56704 copyComponentsToNewStackIgnoreEmpty (Lnet/minecraft/class_1935;I)Lnet/minecraft/class_1799;
COMMENT {@return a new item stack with the components copied from this item stack, even if this stack is empty}
COMMENT
COMMENT @see #copy
COMMENT @see #copyWithCount
COMMENT @see #copyComponentsToNewStack
ARG 1 item
COMMENT the item of the resultant stack
ARG 2 count
COMMENT the item count of the resultant stack
METHOD method_57008 decrementUnlessCreative (ILnet/minecraft/class_1309;)V
COMMENT Decrements the count of items in this item stack, unless {@code entity}
COMMENT is a creative mode player.
ARG 1 amount
ARG 2 entity
METHOD method_57351 getBreakSound ()Lnet/minecraft/class_3414;
METHOD method_57354 applyAttributeModifiers (Lnet/minecraft/class_1304;Ljava/util/function/BiConsumer;)V
ARG 1 slot
ARG 2 attributeModifierConsumer
METHOD method_57355 hashCode (Lnet/minecraft/class_1799;)I
ARG 0 stack
METHOD method_57356 (Lnet/minecraft/class_1887;ILnet/minecraft/class_9304$class_9305;)V
ARG 2 builder
METHOD method_57357 canPlaceOn (Lnet/minecraft/class_2694;)Z
ARG 1 pos
METHOD method_57358 encode (Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2520;
ARG 1 registries
METHOD method_57359 fromNbtOrEmpty (Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2487;)Lnet/minecraft/class_1799;
ARG 0 registries
ARG 1 nbt
METHOD method_57360 fromNbt (Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2520;)Ljava/util/Optional;
ARG 0 registries
ARG 1 nbt
METHOD method_57361 listHashCode (Ljava/util/List;)I
ARG 0 stacks
METHOD method_57362 stacksEqual (Ljava/util/List;Ljava/util/List;)Z
ARG 0 left
ARG 1 right
METHOD method_57363 appendAttributeModifiersTooltip (Ljava/util/function/Consumer;Lnet/minecraft/class_1657;)V
ARG 1 textConsumer
ARG 2 player
METHOD method_57364 appendAttributeModifierTooltip (Ljava/util/function/Consumer;Lnet/minecraft/class_1657;Lnet/minecraft/class_6880;Lnet/minecraft/class_1322;)V
ARG 1 textConsumer
ARG 2 player
ARG 3 attribute
ARG 4 modifier
METHOD method_57365 applyComponentsFrom (Lnet/minecraft/class_9323;)V
ARG 1 components
METHOD method_57366 applyChanges (Lnet/minecraft/class_9326;)V
ARG 1 changes
METHOD method_57367 apply (Lnet/minecraft/class_9331;Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
COMMENT Sets the component {@code type} by passing the current value and {@code change}
COMMENT to {@code applier}, then setting its return value as the value. If the component is
COMMENT missing, {@code defaultValue} is used as the default.
COMMENT
COMMENT <p>In practice, {@code applier} is a reference to a method of the component
COMMENT class with one parameter, that returns a new instance of the component with the
COMMENT specific value changed to {@code change}. For example, adding a lore can be accomplished
COMMENT by passing reference to {@link net.minecraft.component.type.LoreComponent#with}
COMMENT and the added lore, like
COMMENT {@code stack.apply(DataComponentTypes.LORE, LoreComponent.DEFAULT, text, LoreComponent::with)}.
COMMENT
COMMENT @implNote This is the same as setting {@code applier.apply(stack.getOrDefault(type, defaultValue), change)}.
COMMENT
COMMENT @return the previous value set
COMMENT @see #apply(DataComponentType, Object, UnaryOperator)
COMMENT @see #set
ARG 1 type
ARG 2 defaultValue
ARG 3 change
ARG 4 applier
METHOD method_57368 apply (Lnet/minecraft/class_9331;Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/lang/Object;
COMMENT Sets the component {@code type} by passing the current value (or {@code defaultValue}
COMMENT if the component is missing) to {@code applier} and then setting its return value as
COMMENT the value.
COMMENT
COMMENT @implNote This is the same as setting {@code applier.apply(stack.getOrDefault(type, defaultValue))}.
COMMENT
COMMENT @return the previous value set
COMMENT @see #set
COMMENT @see #apply(DataComponentType, Object, Object, BiFunction)
ARG 1 type
ARG 2 defaultValue
ARG 3 applier
METHOD method_57369 appendTooltip (Lnet/minecraft/class_9331;Ljava/util/function/Consumer;Lnet/minecraft/class_1836;)V
ARG 1 componentType
ARG 2 textConsumer
ARG 3 context
METHOD method_57370 (Lorg/apache/commons/lang3/mutable/MutableBoolean;Ljava/util/function/Consumer;Lnet/minecraft/class_1304;Lnet/minecraft/class_1657;Lnet/minecraft/class_6880;Lnet/minecraft/class_1322;)V
ARG 5 attribute
ARG 6 modifier
METHOD method_57371 (Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App;
ARG 0 instance
METHOD method_57372 validate (Lnet/minecraft/class_1799;)Lcom/mojang/serialization/DataResult;
ARG 0 stack
METHOD method_57373 canBreak (Lnet/minecraft/class_2694;)Z
ARG 1 pos
METHOD method_57374 (Lnet/minecraft/class_6880;)Lcom/mojang/serialization/DataResult;
ARG 0 entry
METHOD method_57375 encodeAllowEmpty (Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2520;
ARG 1 registries
METHOD method_57376 encode (Lnet/minecraft/class_7225$class_7874;Lnet/minecraft/class_2520;)Lnet/minecraft/class_2520;
ARG 1 registries
ARG 2 prefix
METHOD method_57377 (Ljava/lang/String;)V
ARG 0 error
METHOD method_57378 (Ljava/util/Optional;)Lnet/minecraft/class_1799;
ARG 0 optional
METHOD method_57379 set (Lnet/minecraft/class_9331;Ljava/lang/Object;)Ljava/lang/Object;
COMMENT Sets the component {@code type} for this item stack to {@code value}.
COMMENT
COMMENT <p>If {@code value} is {@code null}, the component is removed and the base component
COMMENT is unset. To reverse the stack-specific change, instead pass the default value
COMMENT as {@code value}.
COMMENT
COMMENT @return the previous value set
COMMENT @see #apply(DataComponentType, Object, UnaryOperator)
COMMENT @see #apply(DataComponentType, Object, Object, BiFunction)
ARG 1 type
ARG 2 value
METHOD method_57380 getComponentChanges ()Lnet/minecraft/class_9326;
METHOD method_57381 remove (Lnet/minecraft/class_9331;)Ljava/lang/Object;
COMMENT Removes the component {@code type}. If it is in the stack's base component,
COMMENT it is unset and the component becomes missing. To reverse the stack-specific change,
COMMENT instead pass the default value as {@code value}.
COMMENT
COMMENT @return the previous value set
ARG 1 type
METHOD method_57382 (Lnet/minecraft/class_1799;)Ljava/util/Optional;
ARG 0 stack
METHOD method_57385 (Lnet/minecraft/class_1799;)Lnet/minecraft/class_9326;
ARG 0 stack
METHOD method_58092 (Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App;
ARG 0 instance
METHOD method_58093 (Lnet/minecraft/class_6880;Lnet/minecraft/class_9326;)Lnet/minecraft/class_1799;
ARG 0 item
ARG 1 components
METHOD method_58094 (Lnet/minecraft/class_1799;)Lnet/minecraft/class_9326;
ARG 0 stack
METHOD method_7909 getItem ()Lnet/minecraft/class_1792;
COMMENT {@return the item of this stack}
COMMENT
COMMENT @see #isOf(Item)
METHOD method_7910 finishUsing (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;)Lnet/minecraft/class_1799;
ARG 1 world
ARG 2 user
METHOD method_7912 setBobbingAnimationTime (I)V
ARG 1 bobbingAnimationTime
METHOD method_7913 use (Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
ARG 1 world
ARG 2 user
ARG 3 hand
METHOD method_7914 getMaxCount ()I
METHOD method_7917 inventoryTick (Lnet/minecraft/class_1937;Lnet/minecraft/class_1297;IZ)V
ARG 1 world
ARG 2 entity
ARG 3 slot
ARG 4 selected
METHOD method_7919 getDamage ()I
COMMENT {@return the damage (lost durability) of the item stack}
COMMENT
COMMENT <p>Note that this method does not check if the item is {@linkplain #isDamageable
COMMENT damageable}, unlike {@link #isDamaged}.
COMMENT
COMMENT @see #isDamageable
COMMENT @see #isDamaged
COMMENT @see #setDamage
METHOD method_7920 useOnEntity (Lnet/minecraft/class_1657;Lnet/minecraft/class_1309;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1269;
ARG 1 user
ARG 2 entity
ARG 3 hand
METHOD method_7922 getTranslationKey ()Ljava/lang/String;
METHOD method_7923 isEnchantable ()Z
COMMENT {@return whether this item stack can be enchanted with an enchanting table}
COMMENT
COMMENT <p>This is not used for other methods of enchanting like anvils.
METHOD method_7924 getMiningSpeedMultiplier (Lnet/minecraft/class_2680;)F
ARG 1 state
METHOD method_7930 onStoppedUsing (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V
ARG 1 world
ARG 2 user
ARG 3 remainingUseTicks
METHOD method_7932 getRarity ()Lnet/minecraft/class_1814;
METHOD method_7933 increment (I)V
COMMENT Increments the count of items in this item stack.
ARG 1 amount
COMMENT the amount to increment
METHOD method_7934 decrement (I)V
COMMENT Decrements the count of items in this item stack.
ARG 1 amount
COMMENT the amount to decrement
METHOD method_7935 getMaxUseTime ()I
METHOD method_7936 getMaxDamage ()I
METHOD method_7939 setCount (I)V
COMMENT Sets the count of items in this item stack.
ARG 1 count
COMMENT the count of items
METHOD method_7942 hasEnchantments ()Z
COMMENT {@return whether the item stack has any enchantments}
COMMENT
COMMENT <p>This will return {@code false} for enchanted books, as the book itself is not
COMMENT enchanted and therefore does not store enchantments under {@link
COMMENT net.minecraft.component.DataComponentTypes#ENCHANTMENTS}.
COMMENT
COMMENT @see net.minecraft.enchantment.EnchantmentHelper#getEnchantments
METHOD method_7945 getFrame ()Lnet/minecraft/class_1533;
COMMENT {@return the item frame that holds the stack, or {@code null} if inapplicable}
COMMENT
COMMENT @see #isInFrame
COMMENT @see #setHolder
COMMENT @see #getHolder
METHOD method_7946 isStackable ()Z
COMMENT {@return whether the item stack can have item count above {@code 1}}
COMMENT
COMMENT <p>Stackable items must have {@linkplain Item#getMaxCount the maximum count} that is more
COMMENT than {@code 1} and cannot be damaged.
METHOD method_7947 getCount ()I
COMMENT {@return the count of items in this item stack}
METHOD method_7949 usageTick (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V
ARG 1 world
ARG 2 user
ARG 3 remainingUseTicks
METHOD method_7950 getTooltip (Lnet/minecraft/class_1657;Lnet/minecraft/class_1836;)Ljava/util/List;
ARG 1 player
ARG 2 context
METHOD method_7951 isSuitableFor (Lnet/minecraft/class_2680;)Z
COMMENT Determines whether this item can be used as a suitable tool for mining the specified block.
COMMENT <p>
COMMENT Depending on block implementation, when combined together, the correct item and block may achieve a better mining speed and yield
COMMENT drops that would not be obtained when mining otherwise.
COMMENT
COMMENT @return values consistent with calls to {@link Item#isSuitableFor}
COMMENT @see Item#isSuitableFor(BlockState)
ARG 1 state
METHOD method_7952 postMine (Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;)V
ARG 1 world
ARG 2 state
ARG 3 pos
ARG 4 miner
METHOD method_7954 toHoverableText ()Lnet/minecraft/class_2561;
COMMENT {@return a text consisting of the bracketed {@linkplain #getName stack name} that
COMMENT can be hovered to show the item stack's tooltip}
METHOD method_7956 damage (ILnet/minecraft/class_5819;Lnet/minecraft/class_3222;Ljava/lang/Runnable;)V
COMMENT Damages this item stack. This method should be used when a non-entity, such as a
COMMENT dispenser, damages the stack. This does not damage {@linkplain #isDamageable non-damageable}
COMMENT stacks, and the {@linkplain net.minecraft.enchantment.UnbreakingEnchantment
COMMENT unbreaking enchantment} is applied to {@code amount} before damaging.
COMMENT
COMMENT <p>If {@code player} is not {@code null}, this triggers {@link
COMMENT net.minecraft.advancement.criterion.Criteria#ITEM_DURABILITY_CHANGED}.
COMMENT
COMMENT <p>When the item "breaks", that is, the stack's damage is equal to or above
COMMENT {@linkplain Item#getMaxDamage the maximum damage}, {@code breakCallback} is run.
COMMENT Callers should decrement the stack size inside the callback.
ARG 1 amount
ARG 2 random
ARG 3 player
COMMENT the player that damaged the stack, or {@code null} if no player is involved
ARG 4 breakCallback
COMMENT a callback run when the item "breaks"
METHOD method_7958 hasGlint ()Z
METHOD method_7960 isEmpty ()Z
COMMENT {@return whether this item stack is empty}
METHOD method_7961 isInFrame ()Z
COMMENT {@return whether the item stack is in an item frame}
COMMENT
COMMENT @see #setHolder
COMMENT @see #getFrame
COMMENT @see #getHolder
METHOD method_7963 isDamageable ()Z
COMMENT {@return whether the item can be damaged (lose durability)}
COMMENT
COMMENT <p>Items with {@linkplain Item#getMaxDamage 0 max damage} or item stacks with {@link
COMMENT net.minecraft.component.DataComponentTypes#UNBREAKABLE} component cannot be damaged.
COMMENT
COMMENT @see Item#getMaxDamage
COMMENT @see #isDamaged
COMMENT @see #getDamage
METHOD method_7964 getName ()Lnet/minecraft/class_2561;
COMMENT {@return the custom name of the stack if it exists, or the item's name}
METHOD method_7965 getBobbingAnimationTime ()I
METHOD method_7966 (Lnet/minecraft/class_2583;)Lnet/minecraft/class_2583;
ARG 1 style
METHOD method_7967 isUsedOnRelease ()Z
METHOD method_7970 damage (ILnet/minecraft/class_1309;Lnet/minecraft/class_1304;)V
COMMENT Damages this item stack. This method should be used when an entity, including a player,
COMMENT damages the stack. This does not damage {@linkplain #isDamageable non-damageable}
COMMENT stacks, and the {@linkplain net.minecraft.enchantment.UnbreakingEnchantment
COMMENT unbreaking enchantment} is applied to {@code amount} before damaging. Additionally,
COMMENT if {@code entity} is a player in creative mode, the stack will not be damaged.
COMMENT
COMMENT <p>If {@code entity} is a player, this triggers {@link
COMMENT net.minecraft.advancement.criterion.Criteria#ITEM_DURABILITY_CHANGED}.
COMMENT
COMMENT <p>If the stack's damage is equal to or above {@linkplain Item#getMaxDamage the maximum
COMMENT damage} (i.e. the item is "broken"), this will {@linkplain
COMMENT LivingEntity#sendEquipmentBreakStatus send the equipment break status}, decrement the
COMMENT stack, and increment {@link net.minecraft.stat.Stats#BROKEN} if the stack is held
COMMENT by a player.
ARG 1 amount
ARG 2 entity
ARG 3 slot
COMMENT the slot in which the stack is held
METHOD method_7971 split (I)Lnet/minecraft/class_1799;
COMMENT {@return the copy of the stack "split" from the current stack with item count
COMMENT being at most {@code amount}}
COMMENT
COMMENT <p>Splitting an item stack mutates this stack so that the sum of the stacks' item
COMMENT counts does not change. See the example below:
COMMENT
COMMENT <pre>{@code
COMMENT ItemStack stack = new ItemStack(Items.APPLE, 64);
COMMENT ItemStack newStack = stack.split(10);
COMMENT // stack has 54 apples
COMMENT // newStack has 10 apples
COMMENT
COMMENT ItemStack smallStack = new ItemStack(Items.APPLE, 4);
COMMENT ItemStack newSmallStack = smallStack.split(10);
COMMENT // smallStack is now empty
COMMENT // newSmallStack has 4 apples
COMMENT }</pre>
ARG 1 amount
METHOD method_7972 copy ()Lnet/minecraft/class_1799;
COMMENT {@return a copy of this item stack, including the item count, components, and
COMMENT {@linkplain #getBobbingAnimationTime bobbing animation time}}
COMMENT
COMMENT @see #copyWithCount
COMMENT @see #copyComponentsToNewStack
COMMENT @see #copyComponentsToNewStackIgnoreEmpty
METHOD method_7973 areEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
COMMENT {@return whether the given item stacks are equal, including the item count and components}
COMMENT
COMMENT @see #areItemsEqual
COMMENT @see #areItemsAndComponentsEqual
ARG 0 left
ARG 1 right
METHOD method_7974 setDamage (I)V
COMMENT Sets the stack's damage to {@code damage}.
COMMENT
COMMENT <p>This does not break the item if the damage reaches {@linkplain Item#getMaxDamage
COMMENT the maximum}, unlike {@link #damage(int, LivingEntity, EquipmentSlot)}.
COMMENT
COMMENT @see #getDamage
COMMENT @see #damage(int, Random, ServerPlayerEntity, Runnable)
COMMENT @see #damage(int, LivingEntity, EquipmentSlot)
ARG 1 damage
METHOD method_7976 getUseAction ()Lnet/minecraft/class_1839;
METHOD method_7978 addEnchantment (Lnet/minecraft/class_1887;I)V
COMMENT Enchants this item with the given enchantment and level.
COMMENT
COMMENT <p>This should not be used with enchanted books, as the book itself is not
COMMENT enchanted and therefore does not store enchantments under {@link
COMMENT net.minecraft.component.DataComponentTypes#ENCHANTMENTS}.
COMMENT
COMMENT @see net.minecraft.enchantment.EnchantmentHelper
ARG 1 enchantment
ARG 2 level
METHOD method_7979 postHit (Lnet/minecraft/class_1309;Lnet/minecraft/class_1657;)V
ARG 1 target
ARG 2 attacker
METHOD method_7981 useOnBlock (Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269;
ARG 1 context
METHOD method_7982 onCraftByPlayer (Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;I)V
ARG 1 world
ARG 2 player
ARG 3 amount
METHOD method_7984 areItemsEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
COMMENT {@return whether the given item stacks contain the same item, regardless of item count or components}
COMMENT
COMMENT @see #areEqual
COMMENT @see #areItemsAndComponentsEqual
ARG 0 left
ARG 1 right
METHOD method_7986 isDamaged ()Z
COMMENT {@return whether the item stack is {@linkplain #isDamageable damageable} and has damage}
COMMENT
COMMENT @see #isDamageable
COMMENT @see #getDamage
CLASS 1
FIELD field_48351 ITEM_PACKET_CODEC Lnet/minecraft/class_9139;