Skip to main content

Overview

Spell entity predicates allow you to conditionally target or filter entities based on their state or properties. The More RPG Library provides custom predicates that extend the base Spell Engine predicate system.

Usage

Entity predicates are typically used in spell configurations to filter which entities a spell can affect:
spell.json
"impact": [
  {
    "entity_predicate": "more_rpg_classes:is_on_ground",
    "action": {
      "type": "DAMAGE",
      "damage": 10
    }
  }
]

Available Predicates

is_on_ground

Predicate ID: more_rpg_classes:is_on_ground Tests whether an entity is NOT on the ground.
Predicate
boolean
Returns true if the entity is airborne (not on ground)Returns false if the entity is on the ground
Source: CustomSpellEntityPredicate.java:11 Implementation:
SpellEntityPredicates.register(
    Identifier.of(MOD_ID, "is_on_ground"),
    entity -> !entity.entity().isOnGround()
);
Example Use Cases:
  • Aerial combat spells that only affect flying enemies
  • Anti-air abilities that target airborne entities
  • Spells that deal bonus damage to jumping targets
  • Abilities that require the target to be in mid-air
Aerial Damage Spell
{
  "name": "Skyfall Strike",
  "impact": [
    {
      "entity_predicate": "more_rpg_classes:is_on_ground",
      "action": {
        "type": "DAMAGE",
        "damage": 15
      }
    }
  ]
}

is_wet

Predicate ID: more_rpg_classes:is_wet Tests whether an entity is NOT wet (from rain or water contact).
Predicate
boolean
Returns true if the entity is dryReturns false if the entity is wet from rain or water
Source: CustomSpellEntityPredicate.java:15 Implementation:
SpellEntityPredicates.register(
    Identifier.of(MOD_ID, "is_wet"),
    entity -> !entity.entity().isWet()
);
Example Use Cases:
  • Fire spells that only work on dry targets
  • Lightning spells with different behavior for wet/dry targets
  • Conditional effects based on weather exposure
  • Water-sensitive abilities
Fire Spell Example
{
  "name": "Flame Burst",
  "impact": [
    {
      "entity_predicate": "more_rpg_classes:is_wet",
      "action": {
        "type": "STATUS_EFFECT",
        "effect": "minecraft:fire",
        "duration": 100,
        "amplifier": 0
      }
    }
  ]
}

is_inside_water

Predicate ID: more_rpg_classes:is_inside_water Tests whether an entity is NOT inside water or a bubble column.
Predicate
boolean
Returns true if the entity is not in water or bubble columnsReturns false if the entity is submerged in water or standing in a bubble column
Source: CustomSpellEntityPredicate.java:19 Implementation:
SpellEntityPredicates.register(
    Identifier.of(MOD_ID, "is_inside_water"),
    entity -> !entity.entity().isInsideWaterOrBubbleColumn()
);
Example Use Cases:
  • Lightning spells that only affect submerged targets
  • Water magic that requires targets to be in water
  • Drowning or pressure-based abilities
  • Spells that behave differently underwater
  • Environmental hazard spells
Underwater Lightning Example
{
  "name": "Shocking Pool",
  "impact": [
    {
      "entity_predicate": "more_rpg_classes:is_inside_water",
      "action": {
        "type": "DAMAGE",
        "damage": 20
      },
      "action_if_false": {
        "type": "DAMAGE",
        "damage": 5
      }
    }
  ]
}

Predicate Logic

Note that all three predicates return the inverse of their expected condition. This is intentional and allows for specific spell filtering behavior.
The naming convention might seem counterintuitive:
  • is_on_ground returns true when entity is NOT on ground
  • is_wet returns true when entity is NOT wet
  • is_inside_water returns true when entity is NOT in water
This design allows these predicates to act as exclusion filters - the spell effect applies when the predicate returns true, which means the entity does NOT meet the named condition.

Combining Predicates

You can combine multiple predicates for complex targeting logic:
Combined Predicates Example
{
  "name": "Dry Land Strike",
  "impact": [
    {
      "entity_predicate": "more_rpg_classes:is_inside_water",
      "action": {
        "type": "CUSTOM",
        "custom": {
          "intent": "HARMFUL",
          "handler": "more_rpg_classes:knock_up"
        }
      }
    }
  ]
}

Registration

All predicates are registered during mod initialization in CustomSpellEntityPredicate.java:9:
Registration
public static void registerCustomPredicates() {
    SpellEntityPredicates.register(
        Identifier.of(MOD_ID, "is_on_ground"),
        entity -> !entity.entity().isOnGround()
    );
    SpellEntityPredicates.register(
        Identifier.of(MOD_ID, "is_wet"),
        entity -> !entity.entity().isWet()
    );
    SpellEntityPredicates.register(
        Identifier.of(MOD_ID, "is_inside_water"),
        entity -> !entity.entity().isInsideWaterOrBubbleColumn()
    );
}

Creating Custom Predicates

If you’re using More RPG Library as a dependency, you can register your own predicates:
Custom Predicate Example
SpellEntityPredicates.register(
    Identifier.of("yourmod", "is_burning"),
    entity -> entity.entity().isOnFire()
);

Predicate Interface

Predicates use the SpellEntityPredicates API from Spell Engine:
  • Parameter: SpellEntityContext - provides access to the entity and spell context
  • Return: boolean - whether the predicate condition is met
  • Usage: Filtering spell targets before applying impacts

Best Practices

Use predicates to create spells that interact with the environment and entity states, creating more dynamic and strategic gameplay.
Predicates are evaluated before impacts are applied, making them efficient for filtering large numbers of entities.

Working with Status Effects

Combine predicates with the Soaked status effect for enhanced water-based spell interactions:
Water Synergy Example
{
  "name": "Tidal Wave",
  "impact": [
    {
      "action": {
        "type": "STATUS_EFFECT",
        "effect": "more_rpg_classes:soaked",
        "duration": 200,
        "amplifier": 0
      }
    },
    {
      "entity_predicate": "more_rpg_classes:is_wet",
      "action": {
        "type": "DAMAGE",
        "damage": 25
      }
    }
  ]
}