Tool
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
Description
Represents the tool properties of an item, including mining speed, damage per block, and rules for specific blocks. This class is used to define how a tool interacts with blocks in the game.Members
Getter
Retrieves the amount of damage the tool takes per block mined.
Return Type:
int
Getter
Retrieves the default mining speed of the tool when no specific rule applies.
Return Type:
float
getMiningSpeed(state as BlockState) as float
Retrieves the mining speed of the tool for the given block state.
Returns: The mining speed of the tool for the given block state.
Parameters:
Return Type:
float
isCorrectForDrops(state as BlockState) as bool
Checks if the tool is correct for harvesting drops from the given block state.
Returns: True if the tool is correct for harvesting drops, false otherwise.
Parameters:
Return Type:
bool
static of(rules as List<Rule>, defaultMiningSpeed as float, damagePerBlock as int) as Tool
Creates a new Tool instance with the specified rules, default mining speed, and damage per block.
Returns: A new Tool instance.
Parameters:
rules: List<ToolRule>
Type: List<ToolRule>
- The list of rules that define how the tool interacts with specific blocks. defaultMiningSpeed: float
Type: float
- The default mining speed of the tool when no specific rule applies. damagePerBlock: int
Type: int
- The amount of damage the tool takes per block mined.
Return Type:
Tool
Getter
Retrieves the list of rules that define how the tool interacts with specific blocks.
Return Type:
List<ToolRule>