Class EntityPredicate
java.lang.Object
com.github.darksoulq.abyssallib.world.entity.EntityPredicate
- All Implemented Interfaces:
Predicate<SavedEntity>
A predicate used to evaluate and filter
SavedEntity instances based on their identity
and raw serialized data. This class allows for complex conditional checks against an entity's
JSON-like data structure, identity keys, and nested predicate logic.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA fluent builder pattern class designed to easily constructEntityPredicateinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<EntityPredicate> The primary codec used to serialize and deserialize entireEntityPredicateinstances. -
Constructor Summary
ConstructorsConstructorDescriptionEntityPredicate(net.kyori.adventure.key.Key id, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> data, List<Condition<EntityPredicate>> predicates) Constructs a new EntityPredicate with the specified conditional rules. -
Method Summary
Modifier and TypeMethodDescriptionstatic EntityPredicate.Builderbuilder()Creates a new fluent builder instance for constructing an EntityPredicate.booleanCompares this predicate against another object for logical equivalence.inthashCode()Generates a hash code based on the predicate's underlying conditions.booleantest(SavedEntity info) Evaluates aSavedEntityagainst all configured conditions within this predicate.
-
Field Details
-
CODEC
The primary codec used to serialize and deserialize entireEntityPredicateinstances. Supports resolving registered predicates by their String ID or parsing full nested objects.
-
-
Constructor Details
-
EntityPredicate
public EntityPredicate(net.kyori.adventure.key.Key id, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> data, List<Condition<EntityPredicate>> predicates) Constructs a new EntityPredicate with the specified conditional rules.- Parameters:
id- The identity Key that must match (nullable for any entity).data- The list of specific value-matching JSON data conditions.predicates- The list of nested predicate conditions.
-
-
Method Details
-
builder
Creates a new fluent builder instance for constructing an EntityPredicate.- Returns:
- A new
EntityPredicate.Builderinstance.
-
equals
-
hashCode
-
test
Evaluates aSavedEntityagainst all configured conditions within this predicate.- Specified by:
testin interfacePredicate<SavedEntity>- Parameters:
info- TheSavedEntityto test.- Returns:
- True if the entity satisfies all identity, data, and nested rules; false otherwise.
-