# ToolComponentHelper.Rule

`com.jsmacrosce.jsmacros.client.api.helper.inventory.ToolComponentHelper.Rule`

**Since:** 2.3.0

Describes one mining rule: the blocks it applies to and the settings it overrides.  
```js
const tool = Player.getPlayer()?.getMainHand().getComponents().getTool();  
if (tool != null) {
  for (const rule of tool.getRules()) {
    const tag = rule.getBlockTagId();  
    if (tag !== null) Chat.log(`#${tag}: ${rule.getMiningSpeed()}`);  
  }
}
```

Nested type declared in [ToolComponentHelper](ToolComponentHelper.md).

## Methods

### getBlockIds {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ToolComponentHelper.Rule_getBlockIds-}

```js
getBlockIds(): List<String>
```

Lists the blocks in this rule. Tags whose members are not loaded have an empty list.

**Returns:** the block IDs

### getBlockTagId {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ToolComponentHelper.Rule_getBlockTagId-}

```js
getBlockTagId(): String
```

**Returns:** the block tag's ID without the leading `"#"`, or `null` for a list of blocks

### getCorrectForDrops {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ToolComponentHelper.Rule_getCorrectForDrops-}

```js
getCorrectForDrops(): Boolean
```

**Returns:** whether the rule allows drops, or `null` if it leaves this unspecified

### getMiningSpeed {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ToolComponentHelper.Rule_getMiningSpeed-}

```js
getMiningSpeed(): Float
```

**Returns:** the speed set by this rule, or `null` if it leaves the speed unspecified
