Class BlockUtils

java.lang.Object
org.cloudburstmc.server.block.util.BlockUtils

public class BlockUtils extends Object
  • Field Details

    • BLOCK_STATE_COMPARATOR

      public static final Comparator<org.cloudburstmc.api.block.BlockState> BLOCK_STATE_COMPARATOR
  • Constructor Details

    • BlockUtils

      public BlockUtils()
  • Method Details

    • key

      public long key(com.nukkitx.math.vector.Vector3i position)
    • key

      public long key(int x, int y, int z)
    • fromKey

      public com.nukkitx.math.vector.Vector3i fromKey(long key)
    • parseTrait

      public <T extends Comparable<T>> T parseTrait(@NonNull @NonNull org.cloudburstmc.api.block.trait.BlockTrait<T> trait, @NonNull @NonNull String valueText)
    • convertTraitValue

      public Object convertTraitValue(String value)
    • parseState

      public static org.cloudburstmc.api.block.BlockState parseState(@NonNull @NonNull String input)
      Parses a BlockState formatted as:

      [namespace:]<id>[{trait=value[,trait2=value2[,...]]}]

      Examples:

      - minecraft:stone - stone{stone_type=granite} - minecraft:golden_rail{is_powered=true,simple_rail_direction=north_south}

      Parameters:
      input - the String to parse
      Returns:
      the parsed BlockState
      Throws:
      IllegalArgumentException - if the input could not be parsed
    • parseStateWildcard

      public static Stream<org.cloudburstmc.api.block.BlockState> parseStateWildcard(@NonNull @NonNull String input)
      Variant of parseState(String) which can process trait values with wildcards.

      Examples:

      - minecraft:stone - stone{stone_type=granite} - minecraft:golden_rail{is_powered=*,simple_rail_direction=north_south}

      Parameters:
      input - the String to parse
      Returns:
      all BlockStates which matched the input
      Throws:
      IllegalArgumentException - if the input could not be parsed