mirror of https://github.com/FabricMC/yarn.git
Document Item (#3230)
* Document Item * Document ItemStack * Apply suggestions from code review Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> * Update mappings/net/minecraft/item/Item.mapping Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> * Add some javadocs, see enbrain's review * Document more ItemStack stuff * Finish documenting Item * Apply suggestions from code review Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
c776c77b69
commit
522923b3ff
|
@ -1,4 +1,28 @@
|
|||
CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
||||
COMMENT An item usable by players and other entities.
|
||||
COMMENT
|
||||
COMMENT <p>Like {@link Block}, this class handles logics for a type of item, and does not
|
||||
COMMENT hold any data. Any data about a particular stack of item in a world, such as item count,
|
||||
COMMENT is held by an {@link ItemStack} which represents a stack of specific item. Therefore,
|
||||
COMMENT there is one - and only one - instance of Item for one item (like apples, oak planks, etc),
|
||||
COMMENT while there can be infinite amounts of {@link ItemStack} instances. This also means that
|
||||
COMMENT items themselves cannot hold NBT data. To append item stacks with NBT data to the
|
||||
COMMENT creative inventory, override {@link #appendStacks}.
|
||||
COMMENT
|
||||
COMMENT <p>Items with no custom behavior, like diamonds, can call the constructor of Item
|
||||
COMMENT directly. If a custom behavior is needed, this should be subclassed. Items also have
|
||||
COMMENT to be registered in the {@link net.minecraft.util.registry.Registry#ITEM} registry.
|
||||
COMMENT
|
||||
COMMENT <p>Many methods of this class are called on both the logical client and logical server,
|
||||
COMMENT so take caution when using those methods. The logical side can be checked using
|
||||
COMMENT {@link World#isClient}. See also <a href="https://fabricmc.net/wiki/tutorial:side">
|
||||
COMMENT the Fabric Wiki article</a>. It is also important that methods that take {@link LivingEntity}
|
||||
COMMENT as an argument can be called by non-players (such as foxes eating food), which causes
|
||||
COMMENT a crash if the code performs unchecked casting.
|
||||
COMMENT
|
||||
COMMENT @see BlockItem
|
||||
COMMENT @see ItemStack
|
||||
COMMENT @see net.minecraft.inventory.Inventory
|
||||
FIELD field_18672 foodComponent Lnet/minecraft/class_4174;
|
||||
FIELD field_21979 fireproof Z
|
||||
FIELD field_27017 LOGGER Lorg/slf4j/Logger;
|
||||
|
@ -16,46 +40,113 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
METHOD <init> (Lnet/minecraft/class_1792$class_1793;)V
|
||||
ARG 1 settings
|
||||
METHOD method_16698 isNetworkSynced ()Z
|
||||
COMMENT {@return whether the item needs to sync additional data to clients}
|
||||
COMMENT
|
||||
COMMENT <p>Items should ideally store all necessary information on the stack's NBT.
|
||||
COMMENT However, this is not always possible for things like maps. In those cases,
|
||||
COMMENT items can send a packet to the player holding it that syncs additional data.
|
||||
COMMENT Such items must subclass {@link NetworkSyncedItem}.
|
||||
COMMENT
|
||||
COMMENT @see NetworkSyncedItem
|
||||
METHOD method_19263 isFood ()Z
|
||||
COMMENT Checks if this item is food and therefore is edible.
|
||||
METHOD method_19264 getFoodComponent ()Lnet/minecraft/class_4174;
|
||||
COMMENT {@return this item's {@link #foodComponent FoodComponent}, or {@code null} if none was set}
|
||||
METHOD method_21830 getEatSound ()Lnet/minecraft/class_3414;
|
||||
COMMENT {@return the sound for eating the item}
|
||||
METHOD method_21831 getDrinkSound ()Lnet/minecraft/class_3414;
|
||||
COMMENT {@return the sound for drinking the item}
|
||||
METHOD method_24357 damage (Lnet/minecraft/class_1282;)Z
|
||||
COMMENT {@return whether this item can be damaged by the given {@link DamageSource source}}
|
||||
ARG 1 source
|
||||
METHOD method_24358 isFireproof ()Z
|
||||
COMMENT {@return whether this item is immune to fire and lava damage}
|
||||
METHOD method_31565 onStackClicked (Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Z
|
||||
COMMENT Called when the item at the cursor is clicked at {@code slot}.
|
||||
COMMENT
|
||||
COMMENT <p>While this method is usually called on the logical server, it can also be called on
|
||||
COMMENT the logical client, so take caution when overriding this method. The logical side can be
|
||||
COMMENT checked using {@link World#isClient}.
|
||||
COMMENT
|
||||
COMMENT <p>For example, this is called on {@link BundleItem} when the cursor holds
|
||||
COMMENT a bundle and the player clicks on the slot.
|
||||
COMMENT
|
||||
COMMENT @return whether the action was successful
|
||||
ARG 1 stack
|
||||
COMMENT the stack the cursor holds
|
||||
ARG 2 slot
|
||||
COMMENT the clicked slot
|
||||
ARG 3 clickType
|
||||
ARG 4 player
|
||||
METHOD method_31566 onClicked (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;Lnet/minecraft/class_5630;)Z
|
||||
COMMENT Called when the item at {@code slot} gets clicked by the cursor
|
||||
COMMENT holding {@code otherStack}.
|
||||
COMMENT
|
||||
COMMENT <p>While this method is usually called on the logical server, it can also be called on
|
||||
COMMENT the logical client, so take caution when overriding this method. The logical side can be
|
||||
COMMENT checked using {@link World#isClient}.
|
||||
COMMENT
|
||||
COMMENT <p>For example, this is called on {@link BundleItem} when the cursor holds
|
||||
COMMENT an item and the player clicks on the slot that has a bundle.
|
||||
COMMENT
|
||||
COMMENT @return whether the action was successful
|
||||
ARG 1 stack
|
||||
COMMENT the slot's stack
|
||||
ARG 2 otherStack
|
||||
COMMENT the stack the cursor holds
|
||||
ARG 3 slot
|
||||
COMMENT the clicked slot
|
||||
ARG 4 clickType
|
||||
ARG 5 player
|
||||
ARG 6 cursorStackReference
|
||||
METHOD method_31567 isItemBarVisible (Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether to show the item bar for {@code stack}}
|
||||
COMMENT
|
||||
COMMENT <p>Item bar is usually used to display durability of the stack.
|
||||
COMMENT
|
||||
COMMENT <p>When overriding this, {@link #getItemBarStep} and {@link #getItemBarColor} should
|
||||
COMMENT also be overridden.
|
||||
ARG 1 stack
|
||||
METHOD method_31568 canBeNested ()Z
|
||||
COMMENT @return true if the item can be placed inside of shulker boxes or bundles.
|
||||
METHOD method_31569 getItemBarStep (Lnet/minecraft/class_1799;)I
|
||||
COMMENT {@return the step, or the length of the colored area of the item bar, for
|
||||
COMMENT {@code stack}}
|
||||
COMMENT
|
||||
COMMENT <p>This is between {@code 0.0f} and {code 13.0f}. By default, this is
|
||||
COMMENT {@code durability * 13.0f / maxDurability}.
|
||||
COMMENT
|
||||
COMMENT <p>When overriding this, {@link #isItemBarVisible} and {@link #getItemBarColor} should
|
||||
COMMENT also be overridden.
|
||||
ARG 1 stack
|
||||
METHOD method_31570 getEquipSound ()Lnet/minecraft/class_3414;
|
||||
COMMENT {@return the sound for equipping the item, or {@code null} if no sound is played}
|
||||
METHOD method_31571 getItemBarColor (Lnet/minecraft/class_1799;)I
|
||||
COMMENT {@return the RGB color of the item bar, usually used for durability display}
|
||||
COMMENT
|
||||
COMMENT <p>When overriding this, {@link #isItemBarVisible} and {@link #getItemBarStep} should
|
||||
COMMENT also be overridden.
|
||||
ARG 1 stack
|
||||
METHOD method_32346 getTooltipData (Lnet/minecraft/class_1799;)Ljava/util/Optional;
|
||||
ARG 1 stack
|
||||
METHOD method_33261 onItemEntityDestroyed (Lnet/minecraft/class_1542;)V
|
||||
COMMENT Called on the server when an {@link ItemEntity} holding this item gets destroyed.
|
||||
COMMENT This can happen due to fire, lava, cactus, explosion, etc. Items that can hold
|
||||
COMMENT other items should override this to drop its contents.
|
||||
COMMENT
|
||||
COMMENT @see ItemUsage#spawnItemContents
|
||||
ARG 1 entity
|
||||
METHOD method_40131 getRegistryEntry ()Lnet/minecraft/class_6880$class_6883;
|
||||
METHOD method_7836 use (Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
|
||||
COMMENT Called when an item is used by a player.
|
||||
COMMENT Called when the player uses (or starts using) the item.
|
||||
COMMENT The use action, by default, is bound to the right mouse button.
|
||||
COMMENT This method checks the player's hunger when the item is a food, and will
|
||||
COMMENT {@linkplain TypedActionResult#pass pass} in all other cases by default.
|
||||
COMMENT
|
||||
COMMENT <p>If the item {@linkplain #getMaxUseTime can be used for multiple ticks}, then
|
||||
COMMENT this will only be called when the player starts using it. After that,
|
||||
COMMENT {@link #usageTick} is called every tick until the player {@linkplain #finishUsing
|
||||
COMMENT finishes using the item}.
|
||||
COMMENT
|
||||
COMMENT <p>This method is called on both the logical client and logical server, so take caution when overriding this method.
|
||||
COMMENT The logical side can be checked using {@link net.minecraft.world.World#isClient() world.isClient()}.
|
||||
|
@ -77,6 +168,16 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
METHOD method_7838 isUsedOnRelease (Lnet/minecraft/class_1799;)Z
|
||||
ARG 1 stack
|
||||
METHOD method_7840 onStoppedUsing (Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V
|
||||
COMMENT Called on both the client and the server when an entity stops using an item
|
||||
COMMENT before reaching the {@linkplain #getMaxUseTime maximum use time}. If the time was
|
||||
COMMENT reached, {@link #finishUsing} is called instead.
|
||||
COMMENT
|
||||
COMMENT <p>This method is called on both the logical client and logical server, so take caution
|
||||
COMMENT when overriding this method. The logical side can be checked using {@link
|
||||
COMMENT World#isClient}.
|
||||
COMMENT
|
||||
COMMENT <p>{@code user} might not be a player in some cases. For example, this occurs when
|
||||
COMMENT an entity uses a crossbow.
|
||||
ARG 1 stack
|
||||
ARG 2 world
|
||||
ARG 3 user
|
||||
|
@ -89,10 +190,23 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
ARG 2 world
|
||||
ARG 3 player
|
||||
METHOD method_7844 getAttributeModifiers (Lnet/minecraft/class_1304;)Lcom/google/common/collect/Multimap;
|
||||
COMMENT {@return the attribute modifiers the item provides}
|
||||
COMMENT
|
||||
COMMENT <p>Tools and armor should override this to specify the attack damage or armor points.
|
||||
ARG 1 slot
|
||||
METHOD method_7846 isDamageable ()Z
|
||||
COMMENT {@return whether this item can lose durability}
|
||||
METHOD method_7847 useOnEntity (Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_1309;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1269;
|
||||
COMMENT Called on both the client and the server when a player uses the item on an entity.
|
||||
COMMENT
|
||||
COMMENT <p>This method is called on both the logical client and logical server, so take caution
|
||||
COMMENT when overriding this method. The logical side can be checked using {@link
|
||||
COMMENT World#isClient}.
|
||||
COMMENT
|
||||
COMMENT <p>This should be used if the item can be used on multiple types of entities,
|
||||
COMMENT such as name tags or saddles.
|
||||
COMMENT
|
||||
COMMENT @return the action result
|
||||
ARG 1 stack
|
||||
ARG 2 user
|
||||
ARG 3 entity
|
||||
|
@ -101,22 +215,41 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
METHOD method_7850 appendStacks (Lnet/minecraft/class_1761;Lnet/minecraft/class_2371;)V
|
||||
COMMENT Appends the stacks of this item shown in the item group to the list.
|
||||
COMMENT
|
||||
COMMENT <p>This can be overridden to append item stacks with custom NBT data to the
|
||||
COMMENT creative inventory.
|
||||
COMMENT
|
||||
COMMENT @see #isIn(ItemGroup)
|
||||
ARG 1 group
|
||||
ARG 2 stacks
|
||||
METHOD method_7851 appendTooltip (Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Ljava/util/List;Lnet/minecraft/class_1836;)V
|
||||
COMMENT Called by the client to append tooltips to an item. Subclasses can override
|
||||
COMMENT this and add custom tooltips to {@code tooltip} list.
|
||||
ARG 1 stack
|
||||
ARG 2 world
|
||||
ARG 3 tooltip
|
||||
COMMENT the list of tooltips to show
|
||||
ARG 4 context
|
||||
METHOD method_7852 usageTick (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;I)V
|
||||
COMMENT Called on both the server and the client every tick while an entity uses
|
||||
COMMENT the item. Currently used by {@link CrossbowItem} to charge the crossbow.
|
||||
COMMENT If this is overridden, {@link #getMaxUseTime} should also be overridden to
|
||||
COMMENT return a positive value.
|
||||
COMMENT
|
||||
COMMENT @see #finishUsing
|
||||
COMMENT @see #use
|
||||
ARG 1 world
|
||||
ARG 2 user
|
||||
ARG 3 stack
|
||||
ARG 4 remainingUseTicks
|
||||
COMMENT how long it's left until the entity finishes using the item, in ticks
|
||||
METHOD method_7853 getUseAction (Lnet/minecraft/class_1799;)Lnet/minecraft/class_1839;
|
||||
COMMENT {@return the use action the item should perform}
|
||||
ARG 1 stack
|
||||
METHOD method_7854 getDefaultStack ()Lnet/minecraft/class_1799;
|
||||
COMMENT {@return the default stack for this item}
|
||||
COMMENT
|
||||
COMMENT <p>Items that expect certain NBT data in the item stack should override
|
||||
COMMENT this method to return the stack with the NBT data.
|
||||
METHOD method_7856 isSuitableFor (Lnet/minecraft/class_2680;)Z
|
||||
COMMENT Determines whether this item can be used as a suitable tool for mining the specified block.
|
||||
COMMENT Depending on block implementation, when combined together, the correct item and block may achieve a better mining speed and yield
|
||||
|
@ -132,8 +265,22 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
COMMENT Gets the remainder item that should be left behind when this item is used as a crafting ingredient.
|
||||
METHOD method_7859 getGroup ()Lnet/minecraft/class_1761;
|
||||
METHOD method_7860 postProcessNbt (Lnet/minecraft/class_2487;)V
|
||||
COMMENT Processes the NBT applied to an item stack of this item.
|
||||
COMMENT
|
||||
COMMENT <p>This is only used in vanilla to process player head NBT data.
|
||||
ARG 1 nbt
|
||||
METHOD method_7861 finishUsing (Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;)Lnet/minecraft/class_1799;
|
||||
COMMENT Called when an entity finishes using the item, such as eating food or drinking a potion.
|
||||
COMMENT This method handles eating food by default.
|
||||
COMMENT
|
||||
COMMENT <p>This method is called on both the logical client and logical server, so take caution
|
||||
COMMENT when overriding this method. The logical side can be checked using {@link
|
||||
COMMENT World#isClient}.
|
||||
COMMENT
|
||||
COMMENT <p>{@code user} might not be a player in some cases. For example, this occurs when a fox
|
||||
COMMENT eats food or when a wandering trader drinks milk.
|
||||
COMMENT
|
||||
COMMENT @return the new item stack after using the item
|
||||
ARG 1 stack
|
||||
ARG 2 world
|
||||
ARG 3 user
|
||||
|
@ -149,6 +296,14 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
METHOD method_7864 getName (Lnet/minecraft/class_1799;)Lnet/minecraft/class_2561;
|
||||
ARG 1 stack
|
||||
METHOD method_7865 getMiningSpeedMultiplier (Lnet/minecraft/class_1799;Lnet/minecraft/class_2680;)F
|
||||
COMMENT {@return the multiplier applied to the mining speed of {@code stack} when mining
|
||||
COMMENT {@code state}}
|
||||
COMMENT
|
||||
COMMENT <p>The default value is {@code 1.0f}. Returning larger integer will cause the block
|
||||
COMMENT to be mined faster. Enchantments, status effects, and other effects that affect
|
||||
COMMENT mining speed are instead handled in {@link PlayerEntity#getBlockBreakingSpeed}.
|
||||
COMMENT
|
||||
COMMENT @see MiningToolItem
|
||||
ARG 1 stack
|
||||
ARG 2 state
|
||||
METHOD method_7866 getTranslationKey (Lnet/minecraft/class_1799;)Ljava/lang/String;
|
||||
|
@ -168,10 +323,17 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
ARG 1 player
|
||||
ARG 2 fluidHandling
|
||||
METHOD method_7873 postHit (Lnet/minecraft/class_1799;Lnet/minecraft/class_1309;Lnet/minecraft/class_1309;)Z
|
||||
COMMENT Called on the server when the item is used to hit an entity.
|
||||
COMMENT
|
||||
COMMENT <p>Tools and melee weapons should override this to damage the stack.
|
||||
COMMENT
|
||||
COMMENT @return whether the item's use stat should be incremented
|
||||
COMMENT @see ItemStack#damage(int, LivingEntity, java.util.function.Consumer)
|
||||
ARG 1 stack
|
||||
ARG 2 target
|
||||
ARG 3 attacker
|
||||
METHOD method_7875 byRawId (I)Lnet/minecraft/class_1792;
|
||||
COMMENT {@return the item from its raw ID}
|
||||
ARG 0 id
|
||||
METHOD method_7876 getTranslationKey ()Ljava/lang/String;
|
||||
COMMENT Gets the translation key of this item.
|
||||
|
@ -181,15 +343,28 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
COMMENT @return true if the item is in the specified item group or the item group is {@link net.minecraft.item.ItemGroup#SEARCH}.
|
||||
ARG 1 group
|
||||
METHOD method_7878 canRepair (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether {@code stack} can be repaired using {@code ingredient}}
|
||||
COMMENT
|
||||
COMMENT <p>This only handles repairing using the ingredient such as diamonds, and does
|
||||
COMMENT not handle combining tools or armor.
|
||||
ARG 1 stack
|
||||
ARG 2 ingredient
|
||||
METHOD method_7879 postMine (Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_2680;Lnet/minecraft/class_2338;Lnet/minecraft/class_1309;)Z
|
||||
COMMENT Called on the server when the item is used to break a block.
|
||||
COMMENT
|
||||
COMMENT <p>Tools and melee weapons should override this to damage the stack, after
|
||||
COMMENT checking if the block's hardness is larger than {@code 0.0f}.
|
||||
COMMENT
|
||||
COMMENT @return whether the item's use stat should be incremented
|
||||
COMMENT @see net.minecraft.block.AbstractBlock.AbstractBlockState#getHardness
|
||||
COMMENT @see ItemStack#damage(int, LivingEntity, java.util.function.Consumer)
|
||||
ARG 1 stack
|
||||
ARG 2 world
|
||||
ARG 3 state
|
||||
ARG 4 pos
|
||||
ARG 5 miner
|
||||
METHOD method_7880 getRawId (Lnet/minecraft/class_1792;)I
|
||||
COMMENT {@return the raw ID of {@code item}, or 0 if passed {@code null}}
|
||||
ARG 0 item
|
||||
METHOD method_7881 getMaxUseTime (Lnet/minecraft/class_1799;)I
|
||||
COMMENT {@return the maximum use (right-click) time of this item, in ticks}
|
||||
|
@ -207,7 +382,12 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
ARG 1 context
|
||||
COMMENT the usage context
|
||||
METHOD method_7885 canMine (Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;)Z
|
||||
COMMENT Checks if a player can break a block while holding the item.
|
||||
COMMENT {@return whether a player can break a block while holding the item}
|
||||
COMMENT
|
||||
COMMENT <p>This is to check whether the player can start breaking the block in the
|
||||
COMMENT first place; this does not check if the item is a correct tool to mine the block.
|
||||
COMMENT Melee weapons should override this to return {@code false}, unless it is also
|
||||
COMMENT intended to be used as a tool.
|
||||
ARG 1 state
|
||||
ARG 2 world
|
||||
ARG 3 pos
|
||||
|
@ -222,12 +402,22 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item
|
|||
COMMENT
|
||||
COMMENT <p>If an item is damageable, this method is ignored and data is always synced to client.
|
||||
METHOD method_7888 inventoryTick (Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1297;IZ)V
|
||||
COMMENT Called on both the client and the server every tick if the item is in the player's inventory.
|
||||
COMMENT
|
||||
COMMENT <p>This method is called on both the logical client and logical server, so take caution
|
||||
COMMENT when overriding this method. The logical side can be checked using {@link
|
||||
COMMENT World#isClient}.
|
||||
ARG 1 stack
|
||||
ARG 2 world
|
||||
ARG 3 entity
|
||||
COMMENT the entity holding the item; usually a player
|
||||
ARG 4 slot
|
||||
ARG 5 selected
|
||||
COMMENT whether the item is in the selected hotbar slot
|
||||
CLASS class_1793 Settings
|
||||
COMMENT Item settings configure behaviors common to all items, such as the stack's max
|
||||
COMMENT count and the item group. An instance of this must be passed to the constructor
|
||||
COMMENT of {@link Item} (or most of its subclasses).
|
||||
FIELD field_18673 foodComponent Lnet/minecraft/class_4174;
|
||||
FIELD field_21980 fireproof Z
|
||||
FIELD field_8016 rarity Lnet/minecraft/class_1814;
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
CLASS net/minecraft/class_1761 net/minecraft/item/ItemGroup
|
||||
COMMENT A group of items that the items belong to. This is used by the creative inventory.
|
||||
COMMENT Use {@link Item.Settings#group(ItemGroup)} to assign an item group to an item.
|
||||
COMMENT
|
||||
COMMENT @see Item#appendStacks
|
||||
COMMENT @see Item#isIn(ItemGroup)
|
||||
FIELD field_26391 displayName Lnet/minecraft/class_2561;
|
||||
FIELD field_7914 REDSTONE Lnet/minecraft/class_1761;
|
||||
FIELD field_7915 SEARCH Lnet/minecraft/class_1761;
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
||||
COMMENT Represents a stack of items.
|
||||
COMMENT Represents a stack of items. This is a data container that holds the item count
|
||||
COMMENT and the stack's NBT. 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 NBT. Use {@link #isEmpty} to check if an item stack is empty instead of
|
||||
COMMENT 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="nbt-operations">NBT operations</h2>
|
||||
COMMENT
|
||||
|
@ -47,7 +61,7 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
COMMENT <td>Custom NBT</td><td>{@link #getNbt()}</td><td>Returns the custom NBT of the item stack.</td>
|
||||
COMMENT </tr>
|
||||
COMMENT <tr>
|
||||
COMMENT <td>Custom NBT</td><td>{@link #getOrCreateNbt()}</td><td>Returns the custom NBT of the item stack, or creates one if absent.</td>
|
||||
COMMENT <td>Custom NBT</td><td>{@link #getOrCreateNbt()}</td><td>Returns the custom NBT of the item stack, or creates one if absent, mutating the stack.</td>
|
||||
COMMENT </tr>
|
||||
COMMENT <tr>
|
||||
COMMENT <td>Custom NBT</td><td>{@link #setNbt(NbtCompound)}</td><td>Sets the custom NBT of the item stack.</td>
|
||||
|
@ -56,7 +70,7 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
COMMENT <td>Sub Custom NBT</td><td>{@link #getSubNbt(String)}</td><td>Returns the sub NBT compound at the specified key.</td>
|
||||
COMMENT </tr>
|
||||
COMMENT <tr>
|
||||
COMMENT <td>Sub Custom NBT</td><td>{@link #getOrCreateSubNbt(String)}</td><td>Returns the sub NBT compound at the specified key, or create one if absent.</td>
|
||||
COMMENT <td>Sub Custom NBT</td><td>{@link #getOrCreateSubNbt(String)}</td><td>Returns the sub NBT compound at the specified key, or create one if absent, mutating the stack.</td>
|
||||
COMMENT </tr>
|
||||
COMMENT <tr>
|
||||
COMMENT <td>Sub Custom NBT</td><td>{@link #removeSubNbt(String)}</td><td>Removes the sub NBT element at the specified key.</td>
|
||||
|
@ -96,6 +110,11 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
FIELD field_8033 LOGGER Lorg/slf4j/Logger;
|
||||
FIELD field_8036 empty Z
|
||||
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;
|
||||
FIELD field_8040 nbt Lnet/minecraft/class_2487;
|
||||
COMMENT Represents the item stack's custom NBT.
|
||||
|
@ -130,7 +149,20 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
METHOD method_26963 (Ljava/text/DecimalFormat;)V
|
||||
ARG 0 decimalFormat
|
||||
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_28376 (Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App;
|
||||
ARG 0 instance
|
||||
|
@ -149,8 +181,10 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
ARG 1 tooltipSection
|
||||
METHOD method_31572 getEquipSound ()Lnet/minecraft/class_3414;
|
||||
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
|
||||
|
@ -163,6 +197,14 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
ARG 4 player
|
||||
ARG 5 cursorStackReference
|
||||
METHOD method_31577 canCombine (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether the given item stacks' items and NBT 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
|
||||
|
@ -174,17 +216,35 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
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_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_7911 getOrCreateSubNbt (Ljava/lang/String;)Lnet/minecraft/class_2487;
|
||||
COMMENT {@return the compound NBT at the specified key in this item stack's NBT, or a new compound if absent}
|
||||
COMMENT {@return the compound NBT at the specified key in this item stack's NBT, or a
|
||||
COMMENT new compound added to the stack if absent}
|
||||
COMMENT
|
||||
COMMENT <p>This should not be used when reading the NBT, as this can modify the item stack.
|
||||
COMMENT Use {@link #getSubNbt} with a check for {@code null} instead.
|
||||
COMMENT
|
||||
COMMENT @see <a href="#nbt-operations">Item Stack NBT Operations</a>
|
||||
ARG 1 key
|
||||
|
@ -196,11 +256,15 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
ARG 3 hand
|
||||
METHOD method_7914 getMaxCount ()I
|
||||
METHOD method_7915 fromNbt (Lnet/minecraft/class_2487;)Lnet/minecraft/class_1799;
|
||||
COMMENT Deserializes an item stack from NBT.
|
||||
COMMENT {@return the item stack deserialized from the NBT, or {@link #EMPTY} if
|
||||
COMMENT it fails to deserialize}
|
||||
COMMENT
|
||||
COMMENT @see <a href="#nbt-operations">Item Stack NBT Operations</a>
|
||||
ARG 0 nbt
|
||||
METHOD method_7916 addAttributeModifier (Lnet/minecraft/class_1320;Lnet/minecraft/class_1322;Lnet/minecraft/class_1304;)V
|
||||
COMMENT Adds an attribute modifier to this stack.
|
||||
COMMENT
|
||||
COMMENT @see #getAttributeModifiers
|
||||
ARG 1 attribute
|
||||
ARG 2 modifier
|
||||
ARG 3 slot
|
||||
|
@ -210,22 +274,62 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
ARG 3 slot
|
||||
ARG 4 selected
|
||||
METHOD method_7919 getDamage ()I
|
||||
COMMENT {@return the damage (lost durability) of the item stack}
|
||||
COMMENT
|
||||
COMMENT <p>The damage is stored in NBT under {@value #DAMAGE_KEY} key. Note that this method
|
||||
COMMENT does not check if the item is {@linkplain #isDamageable damageable}, unlike {@link
|
||||
COMMENT #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_7921 getEnchantments ()Lnet/minecraft/class_2499;
|
||||
COMMENT {@return an NBT list of enchantments}
|
||||
COMMENT
|
||||
COMMENT <p>This will return an empty list for enchanted books, as the book itself is not
|
||||
COMMENT enchanted and therefore does not store enchantments under {@value #ENCHANTMENTS_KEY} key.
|
||||
COMMENT
|
||||
COMMENT @see net.minecraft.enchantment.EnchantmentHelper#getLevel
|
||||
COMMENT @see #addEnchantment
|
||||
COMMENT @see #hasEnchantments
|
||||
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_7925 removeCustomName ()V
|
||||
COMMENT Removes the custom name and other NBT compounds that are now empty after the
|
||||
COMMENT removal of the custom name from this item stack.
|
||||
COMMENT
|
||||
COMMENT @see #setCustomName
|
||||
COMMENT @see #hasCustomName
|
||||
METHOD method_7926 getAttributeModifiers (Lnet/minecraft/class_1304;)Lcom/google/common/collect/Multimap;
|
||||
COMMENT {@return a multimap of attribute modifiers for {@code slot}}
|
||||
COMMENT
|
||||
COMMENT <p>If a custom attribute modifier exists under the {@code AttributeModifiers} key,
|
||||
COMMENT this returns those modifiers only; otherwise, this returns the item's default
|
||||
COMMENT attribute modifier.
|
||||
COMMENT
|
||||
COMMENT @see Item#getAttributeModifiers
|
||||
COMMENT @see #addAttributeModifier
|
||||
ARG 1 slot
|
||||
METHOD method_7927 setRepairCost (I)V
|
||||
COMMENT Sets the stack's repair cost used in anvils to {@code repairCost}.
|
||||
COMMENT
|
||||
COMMENT <p>This is the the value of the {@value #REPAIR_COST_KEY} key in NBT.
|
||||
ARG 1 repairCost
|
||||
METHOD method_7928 getRepairCost ()I
|
||||
COMMENT {@return the stack's repair cost used in anvils}
|
||||
COMMENT
|
||||
COMMENT <p>This is the the value of the {@value #REPAIR_COST_KEY} key in NBT.
|
||||
METHOD method_7929 isItemEqual (Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether this stack and {@code stack} hold the same item}
|
||||
ARG 1 stack
|
||||
METHOD method_7930 onStoppedUsing (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V
|
||||
ARG 1 world
|
||||
|
@ -245,6 +349,10 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
METHOD method_7937 parseBlockTag (Ljava/lang/String;)Ljava/util/Collection;
|
||||
ARG 0 tag
|
||||
METHOD method_7938 hasCustomName ()Z
|
||||
COMMENT {@return whether this item stack has a custom name}
|
||||
COMMENT
|
||||
COMMENT @see #setCustomName
|
||||
COMMENT @see #removeCustomName
|
||||
METHOD method_7939 setCount (I)V
|
||||
COMMENT Sets the count of items in this item stack.
|
||||
ARG 1 count
|
||||
|
@ -258,15 +366,34 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
COMMENT @see <a href="#nbt-operations">Item Stack NBT Operations</a>
|
||||
ARG 1 key
|
||||
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 {@value #ENCHANTMENTS_KEY} key.
|
||||
COMMENT
|
||||
COMMENT @see #getEnchantments
|
||||
METHOD method_7944 canPlaceOn (Lnet/minecraft/class_2378;Lnet/minecraft/class_2694;)Z
|
||||
ARG 1 blockRegistry
|
||||
ARG 2 pos
|
||||
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_7948 getOrCreateNbt ()Lnet/minecraft/class_2487;
|
||||
COMMENT Returns the custom NBT of this item stack, or creates the custom NBT if the item stack did not have a custom NBT previously.
|
||||
COMMENT Returns the custom NBT of this item stack, or creates the custom NBT if the
|
||||
COMMENT item stack did not have a custom NBT previously, mutating the stack.
|
||||
COMMENT
|
||||
COMMENT <p>This should not be used when reading the NBT, as this can modify the item stack.
|
||||
COMMENT Use {@link #getNbt} with a check for {@code null} instead.
|
||||
COMMENT
|
||||
COMMENT @return the custom NBT of this item stack
|
||||
COMMENT
|
||||
|
@ -300,10 +427,29 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
ARG 1 nbt
|
||||
COMMENT the NBT compound to write to
|
||||
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_1309;Ljava/util/function/Consumer;)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 UnbreakingEnchantment unbreaking enchantment} is applied to
|
||||
COMMENT {@code amount} before damaging. Additionally, if {@code entity} is a player in creative
|
||||
COMMENT mode, the stack will not be damaged.
|
||||
COMMENT
|
||||
COMMENT <p>If {@code entity} is a player, this triggers {@link
|
||||
COMMENT 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 call {@code breakCallback}, decrement the
|
||||
COMMENT stack, and increment {@link Stats#BROKEN} if the stack is held by a player. The callback
|
||||
COMMENT should call {@link LivingEntity#sendEquipmentBreakStatus} or {@link
|
||||
COMMENT LivingEntity#sendToolBreakStatus}.
|
||||
ARG 1 amount
|
||||
ARG 2 entity
|
||||
COMMENT the entity that holds the stack to be damaged
|
||||
ARG 3 breakCallback
|
||||
COMMENT the callback that takes the entity holding the stack and is executed
|
||||
COMMENT when the item breaks
|
||||
METHOD method_7957 updateEmptyState ()V
|
||||
METHOD method_7958 hasGlint ()Z
|
||||
METHOD method_7959 setSubNbt (Ljava/lang/String;Lnet/minecraft/class_2520;)V
|
||||
|
@ -317,41 +463,114 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
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_7962 isItemEqualIgnoreDamage (Lnet/minecraft/class_1799;)Z
|
||||
ARG 1 stack
|
||||
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 {@value
|
||||
COMMENT #UNBREAKABLE_KEY} NBT set to {@code 1b} 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_7968 isEqual (Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether this stack and {@code stack} are equal, including the item count and NBT}
|
||||
ARG 1 stack
|
||||
METHOD method_7969 getNbt ()Lnet/minecraft/class_2487;
|
||||
COMMENT {@return the custom NBT of this item stack, may be {@code null}}
|
||||
COMMENT
|
||||
COMMENT @see <a href="#nbt-operations">Item Stack NBT Operations</a>
|
||||
METHOD method_7970 damage (ILnet/minecraft/class_5819;Lnet/minecraft/class_3222;)Z
|
||||
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 UnbreakingEnchantment unbreaking enchantment} is applied to
|
||||
COMMENT {@code amount} before damaging.
|
||||
COMMENT
|
||||
COMMENT <p>If {@code player} is not {@code null}, this triggers {@link
|
||||
COMMENT Criteria#ITEM_DURABILITY_CHANGED}.
|
||||
COMMENT
|
||||
COMMENT <p>This method does not decrement the item count when the item "breaks". Callers should
|
||||
COMMENT check the returned value and decrement themselves.
|
||||
COMMENT
|
||||
COMMENT @return whether the stack's damage is equal to or above {@linkplain Item#getMaxDamage
|
||||
COMMENT the maximum damage} (i.e. whether the item is "broken")
|
||||
ARG 1 amount
|
||||
ARG 2 random
|
||||
ARG 3 player
|
||||
COMMENT the player that holds the stack to be damaged, or {@code null} if inapplicable
|
||||
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 Creates and returns a copy of this item stack.
|
||||
COMMENT {@return a copy of this item stack, including the item count, NBT, and
|
||||
COMMENT {@linkplain #getBobbingAnimationTime bobbing animation time}}
|
||||
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 NBT}
|
||||
COMMENT
|
||||
COMMENT @see #areItemsEqual
|
||||
COMMENT @see #canCombine
|
||||
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, Consumer)}.
|
||||
COMMENT
|
||||
COMMENT @see #getDamage
|
||||
COMMENT @see #damage(int, Random, ServerPlayerEntity)
|
||||
COMMENT @see #damage(int, LivingEntity, Consumer)
|
||||
ARG 1 damage
|
||||
METHOD method_7975 areNbtEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether the given item stacks have equivalent custom NBT}
|
||||
COMMENT {@return whether the given item stacks have equivalent NBT data}
|
||||
ARG 0 left
|
||||
ARG 1 right
|
||||
METHOD method_7976 getUseAction ()Lnet/minecraft/class_1839;
|
||||
METHOD method_7977 setCustomName (Lnet/minecraft/class_2561;)Lnet/minecraft/class_1799;
|
||||
COMMENT Sets the custom name of this item stack to {@code name}. If {@code null} is
|
||||
COMMENT passed, this will remove the custom name (but does not remove other NBT compounds
|
||||
COMMENT even if they are empty).
|
||||
COMMENT
|
||||
COMMENT @return this item stack
|
||||
COMMENT
|
||||
COMMENT @see #removeCustomName
|
||||
COMMENT @see #hasCustomName
|
||||
ARG 1 name
|
||||
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 {@value #ENCHANTMENTS_KEY} key.
|
||||
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
|
||||
|
@ -382,7 +601,15 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack
|
|||
COMMENT
|
||||
COMMENT @see <a href="#nbt-operations">Item Stack NBT Operations</a>
|
||||
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
|
||||
METHOD method_7987 areItemsEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
|
||||
COMMENT {@return whether the given item stacks' items are equal}
|
||||
COMMENT
|
||||
COMMENT @see #areEqual
|
||||
COMMENT @see #canCombine
|
||||
ARG 0 left
|
||||
ARG 1 right
|
||||
CLASS class_5422 TooltipSection
|
||||
|
|
|
@ -1,18 +1,46 @@
|
|||
CLASS net/minecraft/class_5328 net/minecraft/item/ItemUsage
|
||||
COMMENT Utility methods related to item usage.
|
||||
METHOD method_29282 consumeHeldItem (Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
|
||||
COMMENT Consumes the item that {@code player} holds. This should be called inside
|
||||
COMMENT {@link Item#use} for consumable items, such as milk bucket.
|
||||
COMMENT
|
||||
COMMENT @return the action result of consuming
|
||||
ARG 0 world
|
||||
ARG 1 player
|
||||
ARG 2 hand
|
||||
METHOD method_30012 exchangeStack (Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)Lnet/minecraft/class_1799;
|
||||
COMMENT {@return the stack to put in the player's hand after exchanging stacks}
|
||||
COMMENT
|
||||
COMMENT <p>Exchanging stacks causes the input stack to be decremented and the output stack to
|
||||
COMMENT be inserted to the player's invetory (or dropped if it cannot be inserted.)
|
||||
COMMENT For example, milking a cow exchanges one empty bucket and one milk bucket.
|
||||
COMMENT If the player is in creative mode, the player only receives the new stack when
|
||||
COMMENT they do not have the output stack.
|
||||
COMMENT
|
||||
COMMENT @see #exchangeStack(ItemStack, PlayerEntity, ItemStack, boolean)
|
||||
ARG 0 inputStack
|
||||
ARG 1 player
|
||||
ARG 2 outputStack
|
||||
METHOD method_30270 exchangeStack (Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;Z)Lnet/minecraft/class_1799;
|
||||
COMMENT {@return the stack to put in the player's hand after exchanging stacks}
|
||||
COMMENT
|
||||
COMMENT <p>Exchanging stacks causes the input stack to be decremented and the output stack to
|
||||
COMMENT be inserted to the player's invetory (or dropped if it cannot be inserted.)
|
||||
COMMENT For example, milking a cow exchanges one empty bucket and one milk bucket.
|
||||
COMMENT If {@code creativeOverride} is {@code true} and the player is in creative mode,
|
||||
COMMENT the player only receives the new stack when they do not have the output stack.
|
||||
COMMENT
|
||||
COMMENT @see #exchangeStack(ItemStack, PlayerEntity, ItemStack)
|
||||
ARG 0 inputStack
|
||||
ARG 1 player
|
||||
ARG 2 outputStack
|
||||
ARG 3 creativeOverride
|
||||
METHOD method_33263 spawnItemContents (Lnet/minecraft/class_1542;Ljava/util/stream/Stream;)V
|
||||
COMMENT Spawns item entity's contents at the item entity's position. This should be
|
||||
COMMENT called inside {@link Item#onItemEntityDestroyed} for items that hold other items,
|
||||
COMMENT such as shulker boxes.
|
||||
COMMENT
|
||||
COMMENT @see Item#onItemEntityDestroyed
|
||||
ARG 0 itemEntity
|
||||
ARG 1 contents
|
||||
METHOD method_33265 (Lnet/minecraft/class_1937;Lnet/minecraft/class_1542;Lnet/minecraft/class_1799;)V
|
||||
|
|
Loading…
Reference in New Issue