Class BlockPredicate
java.lang.Object
com.github.darksoulq.abyssallib.world.block.BlockPredicate
A sophisticated predicate used to evaluate and filter
BlockInfo instances.
This class allows for complex conditional checks against a block's identity,
visual states, custom block entity properties, vanilla NBT data, and evaluation
of nested predicates.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA fluent builder pattern class designed to easily constructBlockPredicateinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<BlockPredicate> The primary codec used to serialize and deserialize entireBlockPredicateinstances. -
Constructor Summary
ConstructorsConstructorDescriptionBlockPredicate(net.kyori.adventure.key.Key id, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> states, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> properties, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> nbt, List<Condition<BlockPredicate>> predicates) Constructs a new BlockPredicate with the specified conditional rules. -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockPredicate.Builderbuilder()Creates a new fluent builder instance for constructing a BlockPredicate.booleanCompares this predicate against another object for logical equivalence.inthashCode()Generates a hash code based on the predicate's underlying conditions.booleanEvaluates aBlockInfoagainst all configured conditions within this predicate.
-
Field Details
-
CODEC
The primary codec used to serialize and deserialize entireBlockPredicateinstances. Supports resolving registered predicates by their String ID or parsing full nested objects.
-
-
Constructor Details
-
BlockPredicate
public BlockPredicate(net.kyori.adventure.key.Key id, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> states, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> properties, List<Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>>> nbt, List<Condition<BlockPredicate>> predicates) Constructs a new BlockPredicate with the specified conditional rules.- Parameters:
id- The base block Key that must match (nullable for any block).states- The list of state-matching JSON data conditions.properties- The list of property-matching JSON data conditions.nbt- The list of NBT-matching JSON data conditions.predicates- The list of nested predicate conditions.
-
-
Method Details
-
builder
Creates a new fluent builder instance for constructing a BlockPredicate.- Returns:
- A new
BlockPredicate.Builderinstance.
-
equals
-
hashCode
-
test
Evaluates aBlockInfoagainst all configured conditions within this predicate.
-