# StatePredicateHelper

`com.jsmacrosce.jsmacros.client.api.helper.StatePredicateHelper`

**Since:** 1.9.1

Tests block or fluid states against named property-value constraints. A property absent from
the condition is ignored; every named property must exist on the tested state's type and
satisfy its matcher. [BlockPredicateHelper.getStatePredicate()](BlockPredicateHelper.md#com.jsmacrosce.jsmacros.client.api.helper.BlockPredicateHelper_getStatePredicate-) may return `null`
when its condition has no state predicate.  
```js
const statePredicate = condition.getStatePredicate();  
if (statePredicate !== null) {
  Chat.log(statePredicate.test(block.getBlockStateHelper()));  
}
```

## Constructors

### new StatePredicateHelper {#com.jsmacrosce.jsmacros.client.api.helper.StatePredicateHelper_constructor-StatePropertiesPredicate-}

```js
new StatePredicateHelper(StatePropertiesPredicate base)
```

Wraps the supplied state-properties predicate.

**Parameters:**
- `base`: raw state-properties predicate to wrap

## Methods

### test {#com.jsmacrosce.jsmacros.client.api.helper.StatePredicateHelper_test-BlockStateHelper-}

```js
test(BlockStateHelper state): boolean
```

Tests whether the block state's named properties satisfy this condition; the state is not
read from the world.

**Parameters:**
- `state`: the block state to test

**Returns:** `true` when every named property matches

**Since:** 1.9.1

### test {#com.jsmacrosce.jsmacros.client.api.helper.StatePredicateHelper_test-FluidStateHelper-}

```js
test(FluidStateHelper state): boolean
```

Tests whether the fluid state's named properties satisfy this condition; the state is not
read from the world.

**Parameters:**
- `state`: the fluid state to test

**Returns:** `true` when every named property matches

**Since:** 1.9.1
