Class EntityPredicate.Builder

java.lang.Object
com.github.darksoulq.abyssallib.world.entity.EntityPredicate.Builder
Enclosing class:
EntityPredicate

public static class EntityPredicate.Builder extends Object
A fluent builder pattern class designed to easily construct EntityPredicate instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • id

      public EntityPredicate.Builder id(net.kyori.adventure.key.Key id)
      Mandates that the entity matches a specific identity Key.
      Parameters:
      id - The Key to match.
      Returns:
      This builder instance.
    • data

      public EntityPredicate.Builder data(Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>> condition)
      Adds an exact value-matching condition against the entity's serialized JSON data.
      Parameters:
      condition - The Condition wrapping a JSON node entry.
      Returns:
      This builder instance.
    • check

      Adds a nested predicate condition.
      Parameters:
      condition - The Condition wrapping a nested entity predicate.
      Returns:
      This builder instance.
    • data

      public EntityPredicate.Builder data(String key, Object value)
      Requires an exact match for a specific key-value pair within the entity's data.
      Parameters:
      key - The JSON key to inspect.
      value - The expected value object to match against.
      Returns:
      This builder instance.
    • check

      public EntityPredicate.Builder check(EntityPredicate predicate)
      Evaluates a sub-predicate against the entity.
      Parameters:
      predicate - The nested EntityPredicate to test.
      Returns:
      This builder instance.
    • dataAny

      @SafeVarargs public final EntityPredicate.Builder dataAny(Map.Entry<String,Object>... entries)
      Requires the entity to match at least one of the provided key-value data entries.
      Parameters:
      entries - The varargs array of map entries to check.
      Returns:
      This builder instance.
    • checkAny

      public EntityPredicate.Builder checkAny(EntityPredicate... predicates)
      Requires the entity to satisfy at least one of the provided sub-predicates.
      Parameters:
      predicates - The varargs array of nested EntityPredicates to check.
      Returns:
      This builder instance.
    • build

      public EntityPredicate build()
      Finalizes construction and returns the built EntityPredicate.
      Returns:
      The configured EntityPredicate instance.