From 2c832e33262ffab521f8f0ab73f7ecd3eee4d97a Mon Sep 17 00:00:00 2001 From: Draylar <17728338+Draylar@users.noreply.github.com> Date: Sat, 22 Oct 2022 03:19:12 -0500 Subject: [PATCH 1/3] Add documentation for ToolMaterial & ToolItem classes --- mappings/net/minecraft/item/ToolItem.mapping | 17 +++++++++ .../net/minecraft/item/ToolMaterial.mapping | 37 +++++++++++++++++++ .../net/minecraft/item/ToolMaterials.mapping | 1 + 3 files changed, 55 insertions(+) diff --git a/mappings/net/minecraft/item/ToolItem.mapping b/mappings/net/minecraft/item/ToolItem.mapping index c070fb3198..46f5687896 100644 --- a/mappings/net/minecraft/item/ToolItem.mapping +++ b/mappings/net/minecraft/item/ToolItem.mapping @@ -1,6 +1,23 @@ CLASS net/minecraft/class_1831 net/minecraft/item/ToolItem + COMMENT An {@link Item} used as a tool, typically used for harvesting blocks or killing entities. + COMMENT + COMMENT

+ COMMENT Each {@link ToolItem} has a {@link ToolMaterial} which defines base tool statistics for it. + COMMENT By default, {@link ToolItem#getEnchantability()} and {@link ToolItem#canRepair(ItemStack, ItemStack)} will + COMMENT delegate to this material for values. Behavior for other material properties is implemented in {@link net.minecraft.item.MiningToolItem}. + COMMENT + COMMENT

+ COMMENT A list of default vanilla tool classes can be found below: + COMMENT

FIELD field_8921 material Lnet/minecraft/class_1832; METHOD (Lnet/minecraft/class_1832;Lnet/minecraft/class_1792$class_1793;)V ARG 1 material ARG 2 settings METHOD method_8022 getMaterial ()Lnet/minecraft/class_1832; + COMMENT @return the {@link ToolMaterial} used by this {@link ToolItem} diff --git a/mappings/net/minecraft/item/ToolMaterial.mapping b/mappings/net/minecraft/item/ToolMaterial.mapping index 119f977725..5894cd1585 100644 --- a/mappings/net/minecraft/item/ToolMaterial.mapping +++ b/mappings/net/minecraft/item/ToolMaterial.mapping @@ -1,7 +1,44 @@ CLASS net/minecraft/class_1832 net/minecraft/item/ToolMaterial + COMMENT Defines the material stats of a {@link net.minecraft.item.ToolItem} item. + COMMENT

+ COMMENT To view available vanilla tool materials, visit {@link net.minecraft.item.ToolMaterials}. METHOD method_8023 getRepairIngredient ()Lnet/minecraft/class_1856; + COMMENT Returns the {@link Ingredient} used to repair items using this {@link ToolMaterial}. + COMMENT

+ COMMENT By default, {@link net.minecraft.item.ToolMaterial} will delegate {@link net.minecraft.item.Item#canRepair(ItemStack, ItemStack)} + COMMENT back to this method. + COMMENT @return the {@link Ingredient} required to repair items with this {@link ToolMaterial} METHOD method_8024 getMiningLevel ()I + COMMENT Returns the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}. + COMMENT To prevent this tool from succesfully harvesting any mining level gated blocks, return {@link net.fabricmc.yarn.constants.MiningLevels#HAND}. + COMMENT

+ COMMENT For more information on mining levels, visit {@link net.fabricmc.yarn.constants.MiningLevels}. + COMMENT @return the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} METHOD method_8025 getDurability ()I + COMMENT Returns the total amount of durability a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} has. + COMMENT

+ COMMENT The value returned here will set the {@link net.minecraft.item.Item.Settings} max durability option when passed + COMMENT into {@link net.minecraft.item.ToolItem#ToolItem(net.minecraft.item.ToolMaterial, net.minecraft.item.Item.Settings)} + COMMENT if the value was not already specified. + COMMENT @return the total durability a {@link net.minecraft.item.ToolItem} with this {@link ToolMaterial} has METHOD method_8026 getEnchantability ()I + COMMENT Returns the base enchantment value used by {@link ToolMaterial} with this material. + COMMENT

+ COMMENT By default, {@link ToolMaterial} will override {@link net.minecraft.item.Item#getEnchantability()} + COMMENT and delegate the call back to this method. + COMMENT

+ COMMENT A higher return value will result in better enchantment results when using an {@code Enchanting Table}. + COMMENT The highest enchantability value in vanilla is Netherite, at {@code 37}. + COMMENT @return the enchantment value sent back to {@link net.minecraft.item.Item#getEnchantability()} for armor using this material METHOD method_8027 getMiningSpeedMultiplier ()F + COMMENT Returns the mining speed bonus applied when a {@link net.minecraft.item.ToolItem} using this material is breaking an appropriate block. + COMMENT {@code 1.0f} will result in no speed change. + COMMENT

+ COMMENT Note: for default vanilla tool classes, this bonus is only applied in {@link net.minecraft.item.MiningToolItem#getMiningSpeedMultiplier(ItemStack, BlockState)}. + COMMENT @return the mining speed bonus applied when a {@link net.minecraft.item.ToolItem} using this material is breaking an appropriate block, with {@code 1.0f} being no change METHOD method_8028 getAttackDamage ()F + COMMENT Returns the attack damage bonus applied to any {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}. + COMMENT

+ COMMENT In the case of {@link net.minecraft.item.MiningToolItem} or {@link net.minecraft.item.SwordItem}, the value returned + COMMENT here will be added on top of the {@code attackDamage} value passed into the tool's constructor. + COMMENT @return the attack damage bonus applied to any {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} diff --git a/mappings/net/minecraft/item/ToolMaterials.mapping b/mappings/net/minecraft/item/ToolMaterials.mapping index 3d96ba9e9c..a55d7a3870 100644 --- a/mappings/net/minecraft/item/ToolMaterials.mapping +++ b/mappings/net/minecraft/item/ToolMaterials.mapping @@ -1,4 +1,5 @@ CLASS net/minecraft/class_1834 net/minecraft/item/ToolMaterials + COMMENT Provides the default {@link ToolMaterial}s used by vanilla tools. FIELD field_8924 itemDurability I FIELD field_8925 miningLevel I FIELD field_8928 repairIngredient Lnet/minecraft/class_3528; From 4609d1226d4a6029b1f13a393c6b3771bd51787f Mon Sep 17 00:00:00 2001 From: Draylar <17728338+Draylar@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:16:20 -0500 Subject: [PATCH 2/3] Switch duplicated @ return tags to inline {@ return} --- .../net/minecraft/item/ToolMaterial.mapping | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mappings/net/minecraft/item/ToolMaterial.mapping b/mappings/net/minecraft/item/ToolMaterial.mapping index 5894cd1585..48a92c7bd0 100644 --- a/mappings/net/minecraft/item/ToolMaterial.mapping +++ b/mappings/net/minecraft/item/ToolMaterial.mapping @@ -3,42 +3,36 @@ CLASS net/minecraft/class_1832 net/minecraft/item/ToolMaterial COMMENT

COMMENT To view available vanilla tool materials, visit {@link net.minecraft.item.ToolMaterials}. METHOD method_8023 getRepairIngredient ()Lnet/minecraft/class_1856; - COMMENT Returns the {@link Ingredient} used to repair items using this {@link ToolMaterial}. + COMMENT {@return the {@link Ingredient} used to repair items using this {@link ToolMaterial}} COMMENT

COMMENT By default, {@link net.minecraft.item.ToolMaterial} will delegate {@link net.minecraft.item.Item#canRepair(ItemStack, ItemStack)} COMMENT back to this method. - COMMENT @return the {@link Ingredient} required to repair items with this {@link ToolMaterial} METHOD method_8024 getMiningLevel ()I - COMMENT Returns the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}. + COMMENT {@return the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}} COMMENT To prevent this tool from succesfully harvesting any mining level gated blocks, return {@link net.fabricmc.yarn.constants.MiningLevels#HAND}. COMMENT

COMMENT For more information on mining levels, visit {@link net.fabricmc.yarn.constants.MiningLevels}. - COMMENT @return the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} METHOD method_8025 getDurability ()I - COMMENT Returns the total amount of durability a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} has. + COMMENT {@return the total amount of durability a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} has} COMMENT

COMMENT The value returned here will set the {@link net.minecraft.item.Item.Settings} max durability option when passed COMMENT into {@link net.minecraft.item.ToolItem#ToolItem(net.minecraft.item.ToolMaterial, net.minecraft.item.Item.Settings)} COMMENT if the value was not already specified. - COMMENT @return the total durability a {@link net.minecraft.item.ToolItem} with this {@link ToolMaterial} has METHOD method_8026 getEnchantability ()I - COMMENT Returns the base enchantment value used by {@link ToolMaterial} with this material. + COMMENT {@return the enchantment value sent back to {@link net.minecraft.item.Item#getEnchantability()} for tools using this material} COMMENT

COMMENT By default, {@link ToolMaterial} will override {@link net.minecraft.item.Item#getEnchantability()} COMMENT and delegate the call back to this method. COMMENT

COMMENT A higher return value will result in better enchantment results when using an {@code Enchanting Table}. COMMENT The highest enchantability value in vanilla is Netherite, at {@code 37}. - COMMENT @return the enchantment value sent back to {@link net.minecraft.item.Item#getEnchantability()} for armor using this material METHOD method_8027 getMiningSpeedMultiplier ()F - COMMENT Returns the mining speed bonus applied when a {@link net.minecraft.item.ToolItem} using this material is breaking an appropriate block. + COMMENT {@return the mining speed bonus applied when a {@link net.minecraft.item.ToolItem} using this material is breaking an appropriate block} COMMENT {@code 1.0f} will result in no speed change. COMMENT

COMMENT Note: for default vanilla tool classes, this bonus is only applied in {@link net.minecraft.item.MiningToolItem#getMiningSpeedMultiplier(ItemStack, BlockState)}. - COMMENT @return the mining speed bonus applied when a {@link net.minecraft.item.ToolItem} using this material is breaking an appropriate block, with {@code 1.0f} being no change METHOD method_8028 getAttackDamage ()F - COMMENT Returns the attack damage bonus applied to any {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}. + COMMENT {@return the attack damage bonus applied to any {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}} COMMENT

COMMENT In the case of {@link net.minecraft.item.MiningToolItem} or {@link net.minecraft.item.SwordItem}, the value returned COMMENT here will be added on top of the {@code attackDamage} value passed into the tool's constructor. - COMMENT @return the attack damage bonus applied to any {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial} From fa1830a545fafb0425919149c243e9f815cd9247 Mon Sep 17 00:00:00 2001 From: YanisBft Date: Fri, 1 Sep 2023 06:49:43 +0200 Subject: [PATCH 3/3] typo --- mappings/net/minecraft/item/ToolMaterial.mapping | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mappings/net/minecraft/item/ToolMaterial.mapping b/mappings/net/minecraft/item/ToolMaterial.mapping index 48a92c7bd0..6bf69d8cea 100644 --- a/mappings/net/minecraft/item/ToolMaterial.mapping +++ b/mappings/net/minecraft/item/ToolMaterial.mapping @@ -9,7 +9,7 @@ CLASS net/minecraft/class_1832 net/minecraft/item/ToolMaterial COMMENT back to this method. METHOD method_8024 getMiningLevel ()I COMMENT {@return the mining level of a {@link net.minecraft.item.ToolItem} using this {@link ToolMaterial}} - COMMENT To prevent this tool from succesfully harvesting any mining level gated blocks, return {@link net.fabricmc.yarn.constants.MiningLevels#HAND}. + COMMENT To prevent this tool from successfully harvesting any mining level gated blocks, return {@link net.fabricmc.yarn.constants.MiningLevels#HAND}. COMMENT

COMMENT For more information on mining levels, visit {@link net.fabricmc.yarn.constants.MiningLevels}. METHOD method_8025 getDurability ()I