Interface ToolComponent.ToolRule

All Superinterfaces:
ConfigurationSerializable
Enclosing interface:
ToolComponent

public static interface ToolComponent.ToolRule extends ConfigurationSerializable
A rule governing use of this tool and overriding attributes per-block.
  • Method Details

    • getBlocks

      Get a collection of the block types to which this tool rule applies.
      Returns:
      the blocks
    • setBlocks

      void setBlocks(@NotNull @NotNull Material block)
      Set the block type to which this rule applies.
      Parameters:
      block - the block type
    • setBlocks

      void setBlocks(@NotNull @NotNull Collection<Material> blocks)
      Set the block types to which this rule applies.
      Parameters:
      blocks - the block types
    • setBlocks

      void setBlocks(@NotNull @NotNull Tag<Material> tag)
      Set the block types (represented as a block Tag) to which this rule applies.
      Parameters:
      tag - the block tag
      Throws:
      IllegalArgumentException - if the passed tag is not a block tag
    • getSpeed

      Get the mining speed of this rule. If non-null, this speed value is used in lieu of the default speed value of the tool. 1.0 is standard mining speed.
      Returns:
      the mining speed, or null if the default speed is used
    • setSpeed

      void setSpeed(@Nullable @Nullable Float speed)
      Set the mining speed of this rule. 1.0 is standard mining speed.
      Parameters:
      speed - the mining speed, or null to use the default speed
    • isCorrectForDrops

      @Nullable @Nullable Boolean isCorrectForDrops()
      Get whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items. If non-null, this value is used in lieu of the default tool checking behavior defined by Minecraft.
      Returns:
      true if correct for drops, false otherwise, or null to fallback to vanilla tool checking behavior
    • setCorrectForDrops

      void setCorrectForDrops(@Nullable @Nullable Boolean correct)
      Set whether or not this rule is considered the optimal tool for the blocks listed by this rule and will drop items.
      Parameters:
      correct - whether or not this rule is correct for drops, or null to fallback to vanilla tool checking behavior