Class ExpandTool.ExpandToolRule

java.lang.Object
com.blamejared.crafttweaker.natives.item.component.ExpandTool.ExpandToolRule
Enclosing class:
ExpandTool

@ZenRegister public static class ExpandTool.ExpandToolRule extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static boolean
    correctForDrops(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.Rule
    deniesDrops(KnownTag<net.minecraft.world.level.block.Block> tag)
    Creates a new rule that denies drops for blocks matching the specified tag.
    static boolean
    hasCorrectToolForDrops(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.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.
    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.
    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.
    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.
    static Float
    speed(net.minecraft.world.item.component.Tool.Rule internal)
    Retrieves the mining speed override defined by this rule, if any.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static Float speed(net.minecraft.world.item.component.Tool.Rule internal)
      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.Rule instance.
    • 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.Rule instance.
    • 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.Rule instance.
    • 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.Rule instance.
    • 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.Rule instance.