Rogue: Savage Rats, a retro-themed dungeon crawler
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.
 
 
rogue-savage-rats/src/mightypork/rogue/world/Tiles.java

26 lines
571 B

package mightypork.rogue.world;
import java.util.HashMap;
import java.util.Map;
public class Tiles {
private static final Map<Integer, TileModel> registered = new HashMap<>();
public 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;
}
}