tutorial:mining_levels
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:mining_levels [2020/05/16 19:39] – add netherite mining level yanis48 | tutorial:mining_levels [2022/09/29 05:07] (current) – solidblock | ||
---|---|---|---|
Line 2: | Line 2: | ||
==== Introduction ==== | ==== Introduction ==== | ||
- | Vanilla has a terrible system for mining levels, values | + | The way mining levels |
- | ==== Setting Mining Level of a Block ==== | + | |
- | To start, use the '' | + | ==== Setting |
- | <code java> | + | |
- | settings.breakByTool(FabricToolTags.PICKAXES, | + | |
- | </ | + | |
- | Here' | + | To define what tool is used to harvest your block, you need to add the block' |
- | < | + | < |
- | 0 -> Wooden / Golden Pickaxe | + | { |
- | 1 -> Stone Pickaxe | + | " |
- | 2 -> Iron Pickaxe | + | " |
- | 3 -> Diamond Pickaxe | + | " |
- | 4 -> Netherite Pickaxe | + | " |
+ | ] | ||
+ | } | ||
</ | </ | ||
- | ==== Dealing with Block Material Madness ==== | + | Fabric API also provides two additional tags '' |
- | Vanilla pickaxes are effective for '' | + | |
- | Vanilla axes are effective for '' | + | ==== Setting the block's mining level ==== |
- | If you use any of these materials, the tool will break your block even if it is under the required 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: |
- | + | < | |
- | To avoid this, you must create your own clone of the material. Let's say you want to create a clone for '' | + | Stone or higher -> needs_stone_tool.json |
- | < | + | Iron or higher -> needs_iron_tool.json |
- | new Material.Builder(MaterialColor.STONE).requiresTool().build() | + | Diamond or higher -> needs_diamond_tool.json |
</ | </ | ||
- | Turn '' | + | Here we make our late-game ore variants require a diamond tool to harvest: |
- | < | + | < |
- | new FabricMaterialBuilder(MaterialColor.STONE).requiresTool().build() | + | { |
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
</ | </ | ||
- | ==== Disable drops when using the invalid tool ==== | + | 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 |
- | You will need to set '' | + | < |
- | + | { | |
- | Let's say you want to create a clone for '' | + | " |
- | < | + | " |
- | new Material.Builder(MaterialColor.WOOD).burnable().build() | + | " |
+ | " | ||
+ | ] | ||
+ | } | ||
</ | </ | ||
- | Turn '' | + | The default mining level of blocks not modified with mining level tags is -1 (the hand mining level). |
- | <code java> | + | |
- | new FabricMaterialBuilder(MaterialColor.WOOD).burnable().requiresTool().build() | + | |
- | </ | + | |
- | ==== Making a custom tool ==== | + | ==== Tool Tags ==== |
You will need to add your tool into the fabric tool tags to support modded blocks. | You will need to add your tool into the fabric tool tags to support modded blocks. | ||
Example of adding a pickaxe to the '' | Example of adding a pickaxe to the '' | ||
- | File Location: | + | <code javascript |
- | <code javascript> | + | |
{ | { | ||
" | " | ||
" | " | ||
- | "examplemod: | + | "tutorial: |
] | ] | ||
} | } | ||
</ | </ |
tutorial/mining_levels.1589657972.txt.gz · Last modified: 2020/05/16 19:39 by yanis48