Class BlockPredicate.Builder
java.lang.Object
com.github.darksoulq.abyssallib.world.block.BlockPredicate.Builder
- Enclosing class:
BlockPredicate
A fluent builder pattern class designed to easily construct
BlockPredicate instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finalizes construction and returns the built BlockPredicate.check(Condition<BlockPredicate> condition) Adds a nested predicate condition.check(BlockPredicate predicate) Evaluates a sub-predicate against the block.checkAny(BlockPredicate... predicates) Requires the block to satisfy at least one of the provided sub-predicates.id(net.kyori.adventure.key.Key id) Mandates that the block matches a specific identity Key.material(org.bukkit.Material material) Mandates that the block matches a specific vanilla material.Adds an exact value-matching condition against the block's NBT data.Requires an exact match for a specific key-value pair within the block's NBT.final BlockPredicate.BuilderRequires the block's NBT to match at least one of the provided key-value data entries.Adds an exact value-matching condition against the block's custom properties.Requires an exact match for a specific key-value pair within the block's properties.final BlockPredicate.BuilderpropertyAny(Map.Entry<String, Object>... entries) Requires the block's properties to match at least one of the provided key-value data entries.Adds an exact value-matching condition against the block's state data.Requires an exact match for a specific key-value pair within the block's states.final BlockPredicate.BuilderRequires the block's states to match at least one of the provided key-value data entries.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Mandates that the block matches a specific identity Key.- Parameters:
id- TheKeyto match.- Returns:
- This builder instance.
-
material
Mandates that the block matches a specific vanilla material.- Parameters:
material- TheMaterialto match.- Returns:
- This builder instance.
-
state
public BlockPredicate.Builder state(Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>> condition) Adds an exact value-matching condition against the block's state data.- Parameters:
condition- TheConditionwrapping a JSON node entry.- Returns:
- This builder instance.
-
property
public BlockPredicate.Builder property(Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>> condition) Adds an exact value-matching condition against the block's custom properties.- Parameters:
condition- TheConditionwrapping a JSON node entry.- Returns:
- This builder instance.
-
nbt
public BlockPredicate.Builder nbt(Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>> condition) Adds an exact value-matching condition against the block's NBT data.- Parameters:
condition- TheConditionwrapping a JSON node entry.- Returns:
- This builder instance.
-
check
Adds a nested predicate condition.- Parameters:
condition- TheConditionwrapping a nested block predicate.- Returns:
- This builder instance.
-
state
Requires an exact match for a specific key-value pair within the block's states.- Parameters:
key- The state key to inspect.value- The expected value object to match against.- Returns:
- This builder instance.
-
property
Requires an exact match for a specific key-value pair within the block's properties.- Parameters:
key- The property key to inspect.value- The expected value object to match against.- Returns:
- This builder instance.
-
nbt
Requires an exact match for a specific key-value pair within the block's NBT.- Parameters:
key- The NBT key to inspect.value- The expected value object to match against.- Returns:
- This builder instance.
-
check
Evaluates a sub-predicate against the block.- Parameters:
predicate- The nestedBlockPredicateto test.- Returns:
- This builder instance.
-
stateAny
Requires the block's states 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.
-
propertyAny
Requires the block's properties 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.
-
nbtAny
Requires the block's NBT 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
Requires the block to satisfy at least one of the provided sub-predicates.- Parameters:
predicates- The varargs array of nestedBlockPredicates to check.- Returns:
- This builder instance.
-
build
Finalizes construction and returns the built BlockPredicate.- Returns:
- The configured
BlockPredicateinstance.
-