Class ExpandTool.ExpandToolRule
java.lang.Object
com.blamejared.crafttweaker.natives.item.component.ExpandTool.ExpandToolRule
- Enclosing class:
ExpandTool
Represents a rule that defines how a tool interacts with specific blocks.
Rules can override mining speed, determine if the tool is correct for harvesting drops, and more.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<net.minecraft.world.level.block.Block> blocks(net.minecraft.world.item.component.Tool.Rule internal) Retrieves the list of blocks that this rule applies to.static booleancorrectForDrops(net.minecraft.world.item.component.Tool.Rule internal) Retrieves whether the tool is correct for harvesting drops according to this rule.static net.minecraft.world.item.component.Tool.RuledeniesDrops(KnownTag<net.minecraft.world.level.block.Block> tag) Creates a new rule that denies drops for blocks matching the specified tag.static booleanhasCorrectToolForDrops(net.minecraft.world.item.component.Tool.Rule internal) Checks if this rule defines whether the tool is correct for harvesting drops.static net.minecraft.world.item.component.Tool.RuleminesAndDrops(KnownTag<net.minecraft.world.level.block.Block> tag, float speed) Creates a new rule that allows mining and harvesting drops for blocks matching the specified tag.static net.minecraft.world.item.component.Tool.RuleminesAndDrops(List<net.minecraft.world.level.block.Block> blocks, float speed) Creates a new rule that allows mining and harvesting drops for the specified blocks.static net.minecraft.world.item.component.Tool.RuleoverrideSpeed(KnownTag<net.minecraft.world.level.block.Block> tag, float speed) Creates a new rule that overrides the mining speed for blocks matching the specified tag.static net.minecraft.world.item.component.Tool.RuleoverrideSpeed(List<net.minecraft.world.level.block.Block> blocks, float speed) Creates a new rule that overrides the mining speed for the specified blocks.static Floatspeed(net.minecraft.world.item.component.Tool.Rule internal) Retrieves the mining speed override defined by this rule, if any.
-
Constructor Details
-
ExpandToolRule
public ExpandToolRule()
-
-
Method Details
-
hasCorrectToolForDrops
public static boolean hasCorrectToolForDrops(net.minecraft.world.item.component.Tool.Rule internal) Checks if this rule defines whether the tool is correct for harvesting drops.- Returns:
- True if the rule has a value for 'correctToolForDrops', false otherwise.
-
correctForDrops
public static boolean correctForDrops(net.minecraft.world.item.component.Tool.Rule internal) Retrieves whether the tool is correct for harvesting drops according to this rule. Throws an exception if the rule does not define this value.- Returns:
- True if the tool is correct for harvesting drops, false otherwise.
- Throws:
IllegalStateException- If the rule does not have a value for 'correctToolForDrops'.
-
speed
Retrieves the mining speed override defined by this rule, if any.- Returns:
- The mining speed override, or null if not defined.
-
blocks
public static List<net.minecraft.world.level.block.Block> blocks(net.minecraft.world.item.component.Tool.Rule internal) Retrieves the list of blocks that this rule applies to.- Returns:
- The list of blocks.
-
overrideSpeed
public static net.minecraft.world.item.component.Tool.Rule overrideSpeed(List<net.minecraft.world.level.block.Block> blocks, float speed) Creates a new rule that overrides the mining speed for the specified blocks.- Parameters:
blocks- The list of blocks this rule applies to.speed- The mining speed override.- Returns:
- A new
Tool.Ruleinstance.
-
overrideSpeed
public static net.minecraft.world.item.component.Tool.Rule overrideSpeed(KnownTag<net.minecraft.world.level.block.Block> tag, float speed) Creates a new rule that overrides the mining speed for blocks matching the specified tag.- Parameters:
tag- The tag identifying the blocks this rule applies to.speed- The mining speed override.- Returns:
- A new
Tool.Ruleinstance.
-
deniesDrops
public static net.minecraft.world.item.component.Tool.Rule deniesDrops(KnownTag<net.minecraft.world.level.block.Block> tag) Creates a new rule that denies drops for blocks matching the specified tag.- Parameters:
tag- The tag identifying the blocks this rule applies to.- Returns:
- A new
Tool.Ruleinstance.
-
minesAndDrops
public static net.minecraft.world.item.component.Tool.Rule minesAndDrops(KnownTag<net.minecraft.world.level.block.Block> tag, float speed) Creates a new rule that allows mining and harvesting drops for blocks matching the specified tag.- Parameters:
tag- The tag identifying the blocks this rule applies to.speed- The mining speed override.- Returns:
- A new
Tool.Ruleinstance.
-
minesAndDrops
public static net.minecraft.world.item.component.Tool.Rule minesAndDrops(List<net.minecraft.world.level.block.Block> blocks, float speed) Creates a new rule that allows mining and harvesting drops for the specified blocks.- Parameters:
blocks- The list of blocks this rule applies to.speed- The mining speed override.- Returns:
- A new
Tool.Ruleinstance.
-