public final class MaterialRegistry
- Object
- MaterialRegistry
Process-wide registry of pluggable
Materials, 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.Fields
Methods
public static void register(Material m) | Registers (or replaces) a material by its id. |
public static Material get(String id) | Resolves a material by id, never null (returns a grey placeholder for unknown ids). |
public static boolean contains(String id) | |
public static Collection<Material> all() | All registered materials in registration order. |
public static List<String> ids() | The ids of all registered materials, in registration order. |
Inherited methods
Field details
GRASS
public static final String GRASS = "grass"Well-known built-in material ids.
ROAD
public static final String ROAD = "road"STONE
public static final String STONE = "stone"SAND
public static final String SAND = "sand"WATER
public static final String WATER = "water"DIRT
public static final String DIRT = "dirt"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.