getMiningLevel

int getMiningLevel(ItemStack stack, @Nullable() LivingEntity user)

Determines the mining level of the passed stack, which is used for calculating what blocks this tool is allowed to break.

Return

The mining level of the item. 3 is equal to a diamond pick.

Deprecated

Use getMiningLevel to detect tag and block.

Parameters

stack

The item stack being used to mine the block

user

The current user of the tool, or null if there isn't any

int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, @Nullable() LivingEntity user)

Determines the mining level of the passed stack, which is used for calculating what blocks this tool is allowed to break.

Return

The mining level of the item. 3 is equal to a diamond pick.

Parameters

tag

The tool tag the item stack is being compared to

state

The block to mine

stack

The item stack being used to mine the block

user

The current user of the tool, or null if there isn't any