You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
575 B
26 lines
575 B
package mightypork.rogue.world.tile;
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
|
|
public final class Tiles {
|
|
|
|
private static final Map<Integer, TileModel> registered = new HashMap<>();
|
|
|
|
|
|
static void register(int id, TileModel model)
|
|
{
|
|
if (registered.containsKey(id)) throw new IllegalArgumentException("Tile ID " + id + " already in use.");
|
|
registered.put(id, model);
|
|
}
|
|
|
|
|
|
public static TileModel get(int id)
|
|
{
|
|
final TileModel m = registered.get(id);
|
|
if (m == null) throw new IllegalArgumentException("No tile with ID " + id + ".");
|
|
return m;
|
|
}
|
|
}
|
|
|