Class Blocks

java.lang.Object
fr.fidorial.world.block.Blocks

public final class Blocks extends Object
Static access to the BlockRegistry, bootstrapped by the server at startup.
Since:
0.1.0
  • Method Details

    • bootstrap

      public static void bootstrap(BlockRegistry blockRegistry)
      Installs the registry. Called once by the server.
      Parameters:
      blockRegistry - the registry
      Throws:
      IllegalStateException - if a registry is already installed
      Since:
      0.1.0
    • registry

      public static BlockRegistry registry()
      Returns the installed registry.
      Returns:
      the installed registry
      Throws:
      IllegalStateException - if the server has not bootstrapped it yet
      Since:
      0.1.0
    • type

      public static @Nullable BlockType type(@KeyPattern String key)
      Returns the block type registered under a key, or null.
      Parameters:
      key - the block key, for instance minecraft:stone
      Returns:
      the block type registered under a key, or null
      Since:
      0.1.0
    • type

      public static @Nullable BlockType type(Key key)
      Returns the block type registered under a key, or null.
      Parameters:
      key - the block key
      Returns:
      the block type registered under a key, or null
      Since:
      0.1.0
    • data

      public static @Nullable BlockData data(String input)
      Parses a state in command syntax.
      Parameters:
      input - the state to parse, for instance minecraft:oak_stairs[facing=north]
      Returns:
      the state, or null if the block is unknown
      Throws:
      IllegalArgumentException - if the syntax is malformed
      Since:
      0.1.0