Interface BlockPattern<L,M>

Type Parameters:
L - the location type (platform-specific)
M - the material/block type (platform-specific)

public interface BlockPattern<L,M>
Represents a block pattern for games like Block Party, TNT Run, etc.

Block patterns define collections of blocks with their locations and materials. They are used for games that manipulate floor blocks, such as removing random blocks in TNT Run or matching colors in Block Party.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies this pattern to the world by placing all blocks.
    Gets all blocks in this pattern mapped to their locations.
    Gets all unique materials used in this pattern.
    Gets a random material from the pattern's available materials.
  • Method Details

    • getBlocks

      Map<L,M> getBlocks()
      Gets all blocks in this pattern mapped to their locations.
      Returns:
      a map of locations to block materials
    • getMaterials

      List<M> getMaterials()
      Gets all unique materials used in this pattern.

      This is useful for games that need to select from available block types.

      Returns:
      a list of unique materials in the pattern
    • getRandomMaterial

      M getRandomMaterial()
      Gets a random material from the pattern's available materials.

      Commonly used in Block Party to select which color players must stand on.

      Returns:
      a randomly selected material from the pattern
    • apply

      void apply()
      Applies this pattern to the world by placing all blocks.

      This materializes the pattern, setting all blocks at their defined locations to their configured materials.