Skip to content

StatePredicateHelper ​

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

Since1.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() 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 ​

new StatePredicateHelper(StatePropertiesPredicate base)#
Wraps the supplied state-properties predicate.

Parameters:

  • base: raw state-properties predicate to wrap

Methods ​

test ​

test(BlockStateHelper state): booleanSince1.9.1#
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
test(FluidStateHelper state): booleanSince1.9.1#
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