Class BlockPredicate.Builder

java.lang.Object
com.github.darksoulq.abyssallib.world.block.BlockPredicate.Builder
Enclosing class:
BlockPredicate

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

    • Builder

      public Builder()
  • Method Details

    • id

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

      public BlockPredicate.Builder material(org.bukkit.Material material)
      Mandates that the block matches a specific vanilla material.
      Parameters:
      material - The Material to 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 - The Condition wrapping 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 - The Condition wrapping 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 - The Condition wrapping a JSON node entry.
      Returns:
      This builder instance.
    • check

      public BlockPredicate.Builder check(Condition<BlockPredicate> condition)
      Adds a nested predicate condition.
      Parameters:
      condition - The Condition wrapping a nested block predicate.
      Returns:
      This builder instance.
    • state

      public BlockPredicate.Builder state(String key, Object value)
      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

      public BlockPredicate.Builder property(String key, Object value)
      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

      public BlockPredicate.Builder nbt(String key, Object value)
      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

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

      @SafeVarargs public final BlockPredicate.Builder stateAny(Map.Entry<String,Object>... entries)
      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

      @SafeVarargs public final BlockPredicate.Builder propertyAny(Map.Entry<String,Object>... entries)
      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

      @SafeVarargs public final BlockPredicate.Builder nbtAny(Map.Entry<String,Object>... entries)
      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

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

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