Class MiningLevelManager
java.lang.Object
net.fabricmc.fabric.api.mininglevel.v1.MiningLevelManager
Provides access to block mining levels.
Mining level tags
MiningLevelManager
supports the vanilla minimum mining level tags:
#needs_stone_tool
,
#needs_iron_tool
and
#needs_diamond_tool
.
In addition to them, you can use dynamic mining level tags for any mining level (such as wood, netherite
or a custom one). The dynamic tags are checked automatically.
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
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getRequiredMiningLevel
(net.minecraft.block.BlockState state) Gets the tool mining level required to effectively mine and drop a block state.
-
Method Details
-
getRequiredMiningLevel
public static int getRequiredMiningLevel(net.minecraft.block.BlockState state) Gets the tool mining level required to effectively mine and drop a block state.Note: this method does not take into account tool-specific mining levels declared with the tool attribute API.
The default mining level of blocks not modified with mining level tags is -1 (the hand mining level).
- Parameters:
state
- the block state- Returns:
- the mining level of the block state
-