diff --git a/mappings/net/minecraft/item/Item.mapping b/mappings/net/minecraft/item/Item.mapping index b574e1c16e..b60b93c179 100644 --- a/mappings/net/minecraft/item/Item.mapping +++ b/mappings/net/minecraft/item/Item.mapping @@ -215,8 +215,8 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item COMMENT COMMENT

By default, returns true if the item has enchantments. ARG 1 stack - METHOD method_7887 shouldSyncTagToClient ()Z - COMMENT Checks if an item should have its NBT data stored in {@link ItemStack#tag} sent to the client. + METHOD method_7887 isNbtSynced ()Z + COMMENT Checks if an item should have its NBT data stored in {@link ItemStack#nbt} sent to the client. COMMENT COMMENT

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 @@ -263,7 +263,7 @@ CLASS net/minecraft/class_1792 net/minecraft/item/Item METHOD method_7894 rarity (Lnet/minecraft/class_1814;)Lnet/minecraft/class_1792$class_1793; COMMENT Sets the {@link Rarity} of any item configured with this Settings instance, which changes the color of its name. COMMENT - COMMENT

An item's rarity defaults to {@link Rarity.COMMON}. + COMMENT

An item's rarity defaults to {@link Rarity#COMMON}. COMMENT COMMENT @return this instance ARG 1 rarity diff --git a/mappings/net/minecraft/item/ItemStack.mapping b/mappings/net/minecraft/item/ItemStack.mapping index 72eccc2230..dfa687c18e 100644 --- a/mappings/net/minecraft/item/ItemStack.mapping +++ b/mappings/net/minecraft/item/ItemStack.mapping @@ -1,15 +1,90 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack + COMMENT Represents a stack of items. + COMMENT + COMMENT

NBT operations

+ COMMENT + COMMENT

NBT serialization

+ COMMENT + COMMENT An Item Stack can be serialized with {@link #writeNbt(NbtCompound)}, and deserialized with {@link #fromNbt(NbtCompound)}. + COMMENT + COMMENT
+ COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT
Serialized NBT Structure
KeyTypePurpose
{@code id}{@link net.minecraft.nbt.NbtString}The identifier of the item.
{@code Count}{@link net.minecraft.nbt.NbtByte}The count of items in the stack.
{@code tag}{@link NbtCompound}The item stack's custom NBT.
+ COMMENT
+ COMMENT + COMMENT

Custom NBT

+ COMMENT + COMMENT The item stack's custom NBT may be used to store extra information, + COMMENT like the block entity data for shulker boxes, + COMMENT or the damage of a damageable item, etc. + COMMENT

+ COMMENT Various methods are available to interact with the custom NBT, some methods might refer to a "sub NBT", + COMMENT a sub NBT is a child element of the custom NBT. + COMMENT + COMMENT

+ COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT + COMMENT
Custom NBT operations
CategoryMethodSummary
Custom NBT{@link #hasNbt()}Returns whether the item stack has custom NBT.
Custom NBT{@link #getNbt()}Returns the custom NBT of the item stack.
Custom NBT{@link #getOrCreateNbt()}Returns the custom NBT of the item stack, or creates one if absent.
Custom NBT{@link #setNbt(NbtCompound)}Sets the custom NBT of the item stack.
Sub Custom NBT{@link #getSubNbt(String)}Returns the sub NBT compound at the specified key.
Sub Custom NBT{@link #getOrCreateSubNbt(String)}Returns the sub NBT compound at the specified key, or create one if absent.
Sub Custom NBT{@link #removeSubNbt(String)}Removes the sub NBT element at the specified key.
Sub Custom NBT{@link #setSubNbt(String, NbtElement)}Sets the sub NBT element at the specified key.
+ COMMENT
FIELD field_24092 LORE_STYLE Lnet/minecraft/class_2583; FIELD field_24093 holder Lnet/minecraft/class_1297; FIELD field_24671 CODEC Lcom/mojang/serialization/Codec; FIELD field_30890 ENCHANTMENTS_KEY Ljava/lang/String; + COMMENT The key of the enchantments in an item stack's custom NBT, whose value is {@value}. FIELD field_30893 DISPLAY_KEY Ljava/lang/String; + COMMENT The key of the display NBT in an item stack's custom NBT, whose value is {@value}. FIELD field_30894 NAME_KEY Ljava/lang/String; + COMMENT The key of the item stack's name in the {@linkplain #DISPLAY_KEY display NBT}, whose value is {@value}. FIELD field_30895 LORE_KEY Ljava/lang/String; + COMMENT The key of the item stack's lore in the {@linkplain #DISPLAY_KEY display NBT}, whose value is {@value}. FIELD field_30896 DAMAGE_KEY Ljava/lang/String; + COMMENT The key of the damage in an item stack's custom NBT, whose value is {@value}. FIELD field_30897 COLOR_KEY Ljava/lang/String; + COMMENT The key of the item's color in the {@linkplain #DISPLAY_KEY display NBT}, whose value is {@value}. FIELD field_30898 UNBREAKABLE_KEY Ljava/lang/String; + COMMENT The key of the unbreakable boolean in an item stack's custom NBT, whose value is {@value}. FIELD field_30899 REPAIR_COST_KEY Ljava/lang/String; + COMMENT The key of the repair cost in an item stack's custom NBT, whose value is {@value}. FIELD field_30900 CAN_DESTROY_KEY Ljava/lang/String; FIELD field_30901 CAN_PLACE_ON_KEY Ljava/lang/String; FIELD field_30902 HIDE_FLAGS_KEY Ljava/lang/String; @@ -24,7 +99,12 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack FIELD field_8037 EMPTY Lnet/minecraft/class_1799; FIELD field_8038 item Lnet/minecraft/class_1792; FIELD field_8039 lastDestroyPos Lnet/minecraft/class_2694; - FIELD field_8040 tag Lnet/minecraft/class_2487; + FIELD field_8040 nbt Lnet/minecraft/class_2487; + COMMENT Repesents the item stack's custom NBT. + COMMENT

+ COMMENT Stored at the key {@code tag} in the serialized item stack NBT. + COMMENT + COMMENT @see Item Stack NBT Operations METHOD (Lnet/minecraft/class_1935;)V ARG 1 item METHOD (Lnet/minecraft/class_1935;I)V @@ -33,9 +113,9 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack METHOD (Lnet/minecraft/class_1935;ILjava/util/Optional;)V ARG 1 item ARG 2 count - ARG 3 tag + ARG 3 nbt METHOD (Lnet/minecraft/class_2487;)V - ARG 1 tag + ARG 1 nbt METHOD method_17869 (Ljava/util/List;Lnet/minecraft/class_2487;Lnet/minecraft/class_1887;)V ARG 2 e METHOD method_17870 appendEnchantments (Ljava/util/List;Lnet/minecraft/class_2499;)V @@ -92,7 +172,10 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack 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 getOrCreateSubTag (Ljava/lang/String;)Lnet/minecraft/class_2487; + 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 + COMMENT @see Item Stack NBT Operations ARG 1 key METHOD method_7912 setCooldown (I)V ARG 1 cooldown @@ -102,6 +185,9 @@ 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 + COMMENT @see Item Stack NBT Operations ARG 0 nbt METHOD method_7916 addAttributeModifier (Lnet/minecraft/class_1320;Lnet/minecraft/class_1322;Lnet/minecraft/class_1304;)V ARG 1 attribute @@ -139,20 +225,29 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack 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_7937 parseBlockTag (Ljava/lang/String;)Ljava/util/Collection; ARG 0 tag METHOD method_7938 hasCustomName ()Z 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_7940 canDestroy (Lnet/minecraft/class_5415;Lnet/minecraft/class_2694;)Z ARG 1 tagManager ARG 2 pos - METHOD method_7941 getSubTag (Ljava/lang/String;)Lnet/minecraft/class_2487; + METHOD method_7941 getSubNbt (Ljava/lang/String;)Lnet/minecraft/class_2487; + COMMENT {@return the NBT compound at the specified key in this item stack's custom NBT, may be {@code null}} + COMMENT + COMMENT @see Item Stack NBT Operations ARG 1 key METHOD method_7942 hasEnchantments ()Z METHOD method_7944 canPlaceOn (Lnet/minecraft/class_5415;Lnet/minecraft/class_2694;)Z @@ -161,7 +256,13 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack METHOD method_7945 getFrame ()Lnet/minecraft/class_1533; METHOD method_7946 isStackable ()Z METHOD method_7947 getCount ()I - METHOD method_7948 getOrCreateTag ()Lnet/minecraft/class_2487; + 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 + COMMENT @return the custom NBT of this item stack + COMMENT + COMMENT @see Item Stack NBT Operations METHOD method_7949 usageTick (Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V ARG 1 world ARG 2 user @@ -184,7 +285,12 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack ARG 3 pos ARG 4 miner METHOD method_7953 writeNbt (Lnet/minecraft/class_2487;)Lnet/minecraft/class_2487; + COMMENT Writes the serialized item stack into the given {@link NbtCompound}. + COMMENT + COMMENT @return the written NBT compound + COMMENT @see Item Stack NBT Operations ARG 1 nbt + COMMENT the NBT compound to write to METHOD method_7954 toHoverableText ()Lnet/minecraft/class_2561; METHOD method_7955 (Lnet/minecraft/class_5250;)Lnet/minecraft/class_5250; ARG 0 text @@ -194,10 +300,16 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack ARG 3 breakCallback METHOD method_7957 updateEmptyState ()V METHOD method_7958 hasGlint ()Z - METHOD method_7959 putSubTag (Ljava/lang/String;Lnet/minecraft/class_2520;)V + METHOD method_7959 setSubNbt (Ljava/lang/String;Lnet/minecraft/class_2520;)V + COMMENT Sets the given NBT element in the item stack's custom NBT at the specified key. + COMMENT + COMMENT @see Item Stack NBT Operations ARG 1 key - ARG 2 tag + COMMENT the key where to put the given {@link NbtElement} + ARG 2 element + COMMENT the NBT element to put METHOD method_7960 isEmpty ()Z + COMMENT {@return whether this item stack is empty} METHOD method_7961 isInFrame ()Z METHOD method_7962 isItemEqualIgnoreDamage (Lnet/minecraft/class_1799;)Z ARG 1 stack @@ -209,7 +321,10 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack METHOD method_7967 isUsedOnRelease ()Z METHOD method_7968 isEqual (Lnet/minecraft/class_1799;)Z ARG 1 stack - METHOD method_7969 getTag ()Lnet/minecraft/class_2487; + METHOD method_7969 getNbt ()Lnet/minecraft/class_2487; + COMMENT {@return the custom NBT of this item stack, may be {@code null}} + COMMENT + COMMENT @see Item Stack NBT Operations METHOD method_7970 damage (ILjava/util/Random;Lnet/minecraft/class_3222;)Z ARG 1 amount ARG 2 random @@ -217,12 +332,14 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack METHOD method_7971 split (I)Lnet/minecraft/class_1799; ARG 1 amount METHOD method_7972 copy ()Lnet/minecraft/class_1799; + COMMENT Creates and returns a copy of this item stack. METHOD method_7973 areEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z ARG 0 left ARG 1 right METHOD method_7974 setDamage (I)V ARG 1 damage - METHOD method_7975 areTagsEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z + METHOD method_7975 areNbtEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z + COMMENT {@return whether the given item stacks have equivalent custom NBT} ARG 0 left ARG 1 right METHOD method_7976 getUseAction ()Lnet/minecraft/class_1839; @@ -234,20 +351,30 @@ CLASS net/minecraft/class_1799 net/minecraft/item/ItemStack METHOD method_7979 postHit (Lnet/minecraft/class_1309;Lnet/minecraft/class_1657;)V ARG 1 target ARG 2 attacker - METHOD method_7980 setTag (Lnet/minecraft/class_2487;)V - ARG 1 tag + METHOD method_7980 setNbt (Lnet/minecraft/class_2487;)V + COMMENT Sets the custom NBT of this item stack. + COMMENT + COMMENT @see Item Stack NBT Operations + ARG 1 nbt + COMMENT the custom NBT compound, may be {@code null} to reset METHOD method_7981 useOnBlock (Lnet/minecraft/class_1838;)Lnet/minecraft/class_1269; ARG 1 context METHOD method_7982 onCraft (Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;I)V ARG 1 world ARG 2 player ARG 3 amount - METHOD method_7983 removeSubTag (Ljava/lang/String;)V + METHOD method_7983 removeSubNbt (Ljava/lang/String;)V + COMMENT Removes the sub NBT element at the specified key in this item stack's custom NBT. + COMMENT + COMMENT @see Item Stack NBT Operations ARG 1 key METHOD method_7984 areItemsEqualIgnoreDamage (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z ARG 0 left ARG 1 right - METHOD method_7985 hasTag ()Z + METHOD method_7985 hasNbt ()Z + COMMENT {@return whether this item stack has custom NBT} + COMMENT + COMMENT @see Item Stack NBT Operations METHOD method_7986 isDamaged ()Z METHOD method_7987 areItemsEqual (Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z ARG 0 left