====== Mining Levels ====== ==== Introduction ==== The way mining levels and preferred tools are assigned has changed significantly in 1.17. Making your tools and blocks interact properly now requires adding them to specific tags. ==== Setting the preferred tool for your block ==== To define what tool is used to harvest your block, you need to add the block's identifier to a tag inside of ''tags/blocks/mineable'' that corresponds to your tool ("''pickaxe.json''","''axe.json''", etc.): { "replace": false, "values": [ "tutorial:example_ore_block", "tutorial:example_cobblestone_block" ] } Fabric API also provides two additional tags ''fabric:mineable/sword'' and ''fabric:mineable/shears'' for blocks that can be harvested with a sword or shears. You put these tags in ''resources/data/fabric/tags/blocks/mineable/''. ==== Setting the block's mining level ==== To add a mining level requirement to your block that is under netherite, you'll need to add it to one of these three tags inside tags/blocks: Stone or higher -> needs_stone_tool.json Iron or higher -> needs_iron_tool.json Diamond or higher -> needs_diamond_tool.json Here we make our late-game ore variants require a diamond tool to harvest: { "replace": false, "values": [ "tutorial:example_late_game_ore", "tutorial:example_late_game_deepslate_ore" ] } Fabric API provides dynamic tags for mining levels above diamond, as well as for wood (mining level 0). Dynamic mining level tags are in the format ''fabric:needs_tool_level_N'', where ''N'' is the wanted tool level as an integer. For example, a mining level tag for netherite (mining level 4) would be ''fabric:needs_tool_level_4''. Dynamic tags are checked automatically. You put these tags in ''resources/fabric/tags/blocks/''. { "replace": false, "values": [ "tutorial:example_tough_block", "tutorial:example_netherite_anvil_block" ] } The default mining level of blocks not modified with mining level tags is -1 (the hand mining level). ==== Tool Tags ==== You will need to add your tool into the fabric tool tags to support modded blocks. Example of adding a pickaxe to the ''pickaxes'' tag: { "replace": false, "values": [ "tutorial:example_pickaxe" ] }