# Class MaterialRegistry

java.lang.Object
com.codename1.gaming.level.MaterialRegistry

public final class MaterialRegistry extends Object
Process-wide registry of pluggable `Material`s, keyed by id. Built-in surfaces (grass, road, stone, sand, water, dirt) are registered on first use; applications add their own via `#register(Material)`. Unknown ids resolve to a neutral grey placeholder so a level that references a not-yet-registered material still loads.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DIRT`
  `static final String`
  `GRASS`
  Well-known built-in material ids.
  `static final String`
  `ROAD`
  `static final String`
  `SAND`
  `static final String`
  `STONE`
  `static final String`
  `WATER`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Collection<Material>`
  `all()`
  All registered materials in registration order.
  `static boolean`
  `contains(String id)`
  `static Material`
  `get(String id)`
  Resolves a material by id, never null (returns a grey placeholder for unknown ids).
  `static List<String>`
  `ids()`
  The ids of all registered materials, in registration order.
  `static void`
  `register(Material m)`
  Registers (or replaces) a material by its id.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### GRASS

    public static final String GRASS
    Well-known built-in material ids.
    See Also:
      - Constant Field Values

  - ### ROAD

    public static final String ROAD
    See Also:
      - Constant Field Values

  - ### STONE

    public static final String STONE
    See Also:
      - Constant Field Values

  - ### SAND

    public static final String SAND
    See Also:
      - Constant Field Values

  - ### WATER

    public static final String WATER
    See Also:
      - Constant Field Values

  - ### DIRT

    public static final String DIRT
    See Also:
      - Constant Field Values

- ## Method Details

  - ### register

    public static void register(Material m)
    Registers (or replaces) a material by its id.

  - ### get

    public static Material get(String id)
    Resolves a material by id, never null (returns a grey placeholder for unknown ids).

  - ### contains

    public static boolean contains(String id)

  - ### all

    public static Collection<Material> all()
    All registered materials in registration order.

  - ### ids

    public static List<String> ids()
    The ids of all registered materials, in registration order.