Skip to content

Predicates (Roots 3)

Description

Predicates are used in Transmutation and RunicShearBlock. They either match all blockstates of a block, or all blockstates that have the given properties that match the input blockstate.

Identifier

The identifier mods.roots.predicates will be used as the default on this page.

All Identifiers

Any of these can be used to refer to this compat:

groovy
mods.roots.predicates/* Used as page default */
mods.roots.Predicates

Adding Entries

Recipe Builder

Just like other recipe types, the Predicates also uses a recipe builder.

Don't know what a builder is? Check the builder info page out.

State Builder
  • Create a builder for custom State Predicates for other Roots methods.

    groovy
    mods.roots.predicates.stateBuilder()

  • boolean. Sets if the predicate checks the block above for validation. Requires that only at most one of either above or below may be true. (Default false).

    groovy
    above()
  • boolean. Sets if the predicate checks the block below for validation. Requires that only at most one of either above or below may be true. (Default false).

    groovy
    below()
  • IBlockState. Sets the IBlockState compared against. Requires not null.

    groovy
    block(Block)
    blockstate(IBlockState)
  • Collection<String>. Sets what properties of the blockstate are checked, where any properties not checked are. Requires that each property must be a valid property of the provided blockstate.

    groovy
    properties(String...)
    properties(Collection<String>)

  • First validates the builder, returning null and outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returns null or epicsquid.roots.recipe.transmutation.MatchingStates).

    groovy
    register()

Example
groovy
mods.roots.predicates.stateBuilder()
    .blockstate(blockstate('minecraft:red_flower'))
    .register()

mods.roots.predicates.stateBuilder()
    .block(block('minecraft:red_flower'))
    .register()

mods.roots.predicates.stateBuilder()
    .blockstate(blockstate('minecraft:red_flower:type=poppy'))
    .properties('type')
    .register()

mods.roots.predicates.stateBuilder()
    .blockstate(blockstate('minecraft:log:axis=z:variant=oak'))
    .properties('axis')
    .above()
    .register()

mods.roots.predicates.stateBuilder()
    .blockstate(blockstate('minecraft:log'))
    .below()
    .register()

Contributors

© 2024 CleanroomMC. All Rights Reserved.