package projectzombie.init;

import java.util.ArrayList;

import projectzombie.tiles.Tile;
import projectzombie.tiles.TileBlastFurnace;
import projectzombie.tiles.TileBossPortal;
import projectzombie.tiles.TileCactus;
import projectzombie.tiles.TileCampfire;
import projectzombie.tiles.TileChest;
import projectzombie.tiles.TileClayPot;
import projectzombie.tiles.TileCoal;
import projectzombie.tiles.TileDirt;
import projectzombie.tiles.TileGrass;
import projectzombie.tiles.TileGrassBurnt;
import projectzombie.tiles.TileGrassInfested;
import projectzombie.tiles.TileHemp;
import projectzombie.tiles.TileIce;
import projectzombie.tiles.TileIceWall;
import projectzombie.tiles.TileLadder;
import projectzombie.tiles.TileLadderUp;
import projectzombie.tiles.TileLantern;
import projectzombie.tiles.TileLava;
import projectzombie.tiles.TileLavaFlow;
import projectzombie.tiles.TileOre;
import projectzombie.tiles.TilePortalDown;
import projectzombie.tiles.TileRock;
import projectzombie.tiles.TileSand;
import projectzombie.tiles.TileSandstone;
import projectzombie.tiles.TileSandstoneWall;
import projectzombie.tiles.TileSapling;
import projectzombie.tiles.TileSnow;
import projectzombie.tiles.TileStone;
import projectzombie.tiles.TileTallGrass;
import projectzombie.tiles.TileTree;
import projectzombie.tiles.TileVoid;
import projectzombie.tiles.TileWall;
import projectzombie.tiles.TileWater;
import projectzombie.tiles.TileWorkbench;

public class Tiles
{
	public static ArrayList<Tile> tiles = new ArrayList<Tile>();
	
	private static void register(Tile tile)
	{
		int id = tiles.size();
		
		if(id > Short.MAX_VALUE) {
			throw new RuntimeException("Too many tiles registered. Maximum tiles: " + Short.MAX_VALUE);
		}
		
		tile.id = (short)id;
		tiles.add(tile);
	}
	
	public static void init() {
		register(VOID);
		register(GRASS);
		register(SNOW);
		register(SAND);
		register(STONE);
		register(DIRT);
		register(TREE);
		register(CACTUS);
		register(ROCK);
		register(LAVA);
		register(WATER);
		register(LAVA_FLOW);
		register(LADDER);
		register(PORTAL_DOWN);
		register(WALL);
		register(LADDER_UP);
		register(CHEST);
		register(LANTERN);
		register(BOSS_PORTAL);
		register(ICE);
		register(ICE_WALL);
		register(SANDSTONE);
		register(SANDSTONE_WALL);
		register(GRASS_INFESTED);
		register(TALL_GRASS);
		register(SAPLING);
		register(CAMPFIRE);
		register(GRASS_BURNT);
		register(WORKBENCH);
		register(BLAST_FURNACE);
		register(CLAY_POT);
		register(ORE);
		register(COAL);
	}
	
	public static final Tile GRASS = new TileGrass();
	public static final Tile SNOW = new TileSnow();
	public static final Tile SAND = new TileSand();
	public static final Tile STONE = new TileStone();
	public static final Tile DIRT = new TileDirt();
	public static final Tile CACTUS = new TileCactus();
	public static final Tile TREE = new TileTree();
	public static final Tile VOID = new TileVoid();
	public static final Tile ROCK = new TileRock();
	public static final Tile LAVA = new TileLava();
	public static final Tile WATER = new TileWater();
	public static final Tile LAVA_FLOW = new TileLavaFlow();
	public static final Tile LADDER = new TileLadder();
	public static final Tile PORTAL_DOWN = new TilePortalDown();
	public static final Tile WALL = new TileWall();
	public static final Tile LADDER_UP = new TileLadderUp();
	public static final Tile CHEST = new TileChest();
	public static final Tile LANTERN = new TileLantern();
	public static final Tile BOSS_PORTAL = new TileBossPortal();
	public static final Tile ICE = new TileIce();
	public static final Tile ICE_WALL = new TileIceWall();
	public static final Tile SANDSTONE = new TileSandstone();
	public static final Tile SANDSTONE_WALL = new TileSandstoneWall();
	public static final Tile GRASS_INFESTED = new TileGrassInfested();
	public static final Tile TALL_GRASS = new TileTallGrass();
	public static final Tile SAPLING = new TileSapling();
	public static final Tile HEMP = new TileHemp();
	public static final Tile CAMPFIRE = new TileCampfire();
	public static final Tile GRASS_BURNT = new TileGrassBurnt();
	public static final Tile WORKBENCH = new TileWorkbench();
	public static final Tile BLAST_FURNACE = new TileBlastFurnace();
	public static final Tile CLAY_POT = new TileClayPot();
	public static final Tile ORE = new TileOre();
	public static final Tile COAL = new TileCoal();
}
