diff --git a/src/constants/java/net/fabricmc/yarn/constants/MiningLevels.java b/src/constants/java/net/fabricmc/yarn/constants/MiningLevels.java new file mode 100644 index 0000000000..8643fd9d54 --- /dev/null +++ b/src/constants/java/net/fabricmc/yarn/constants/MiningLevels.java @@ -0,0 +1,50 @@ +/* + * This file is free for everyone to use under the Creative Commons Zero license. + */ + +package net.fabricmc.yarn.constants; + +/** + * Constants of Mining Levels. + *

Mining levels are used by blocks to determine the strength of the tools required to successfully harvest them. + *
All tool materials have an assigned mining level. If a tool's mining level is equal to or greater than the block's, + * the tool will apply its efficiency bonus and the block will drop its loot table. + *

Blocks without mining levels, or items that aren't tools, use {@link MiningLevels#HAND}. + * @see net.minecraft.item.ToolMaterial#getMiningLevel() ToolMaterial#getMiningLevel + */ +public final class MiningLevels { + /** + * Blocks with this level do not require a tool to harvest. + *
This is the default level for blocks and items. + */ + public static final int HAND = -1; + + /** + * Blocks with this level require a Wooden tool or better to harvest. + *
In addition to Wooden Tools, Golden Tools also use this level. + */ + public static final int WOOD = 0; + + /** + * Blocks with this level require a Stone tool or better to harvest. + */ + public static final int STONE = 1; + + /** + * Blocks with this level require an Iron tool or better to harvest. + */ + public static final int IRON = 2; + + /** + * Blocks with this level require a Diamond tool or better to harvest. + */ + public static final int DIAMOND = 3; + + /** + * Blocks with this level require a Netherite tool or better to harvest. + */ + public static final int NETHERITE = 4; + + private MiningLevels() { + } +} diff --git a/unpick-definitions/mining_levels.unpick b/unpick-definitions/mining_levels.unpick new file mode 100644 index 0000000000..21565bd871 --- /dev/null +++ b/unpick-definitions/mining_levels.unpick @@ -0,0 +1,13 @@ +v2 + +constant mining_levels net/fabricmc/yarn/constants/MiningLevels HAND +constant mining_levels net/fabricmc/yarn/constants/MiningLevels WOOD +constant mining_levels net/fabricmc/yarn/constants/MiningLevels STONE +constant mining_levels net/fabricmc/yarn/constants/MiningLevels IRON +constant mining_levels net/fabricmc/yarn/constants/MiningLevels DIAMOND +constant mining_levels net/fabricmc/yarn/constants/MiningLevels NETHERITE + +target_method net/minecraft/item/ToolMaterials (Ljava/lang/String;IIIFFILjava/util/function/Supplier;)V + param 2 mining_levels +target_method net/minecraft/item/ToolMaterial getMiningLevel ()I + return mining_levels \ No newline at end of file