Skip to main content

Predicates

Introduction​

Sandstone features fully-typed predicates. Like for all resources, you need to provide a name, which can include a namespace and folders. You then provide the definition of the predicate.

Syntax​

Minimal​

The minimal syntax for predicates is the following:

import { Predicate } from 'sandstone'

Predicate('predicate_name', {
type: '<condition type>',
...additionalProperties,
})

As you can see, you must provide the type of the predicate. Depending on this condition, several properties will be available.

Example​

Example of Predicate autocompletion

Additional properties​

Predicates do not have additional properties, however they have type-dependant properties. All those can be found directly via autocompletion (as shown above), or by looking at the Minecraft wiki article on Predicates.