package projectzombie.tiles;

import projectzombie.init.Items;
import projectzombie.init.Models;
import projectzombie.items.ItemTool;
import projectzombie.items.ItemToolType;
import projectzombie.items.modifier.ItemModifierMeta;
import projectzombie.model.Model;
import projectzombie.util.ItemStack;
import projectzombie.util.TileState;

public class TileOre extends Tile
{
	public TileOre()
	{
		this.tileSolid = true;
		this.tileHitbox = 0.4;
		this.hardness = 500;
	}

	@Override
	public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool)
	{
		if(tool == null || tool.toolType(stack) != ItemToolType.PICK) {
			return false;
		}
		
		switch(state.meta)
		{
		case 0: return tool.toolPower(stack) > 0;
		case 1: return tool.toolPower(stack) > 1;
		case 2: return tool.toolPower(stack) > 1;
		case 3: return tool.toolPower(stack) > 1;
		case 4: return tool.toolPower(stack) > 1;
		default: return false;
		}
	}
	
	@Override
	public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
		return canTileBreak(state, stack, tool);
	}
	
	@Override
	public ItemStack[] getTileDrops(TileState state) {
		return new ItemStack[] {new ItemStack(Items.ORE, 1, new ItemModifierMeta(state.meta))};
	}
	
	@Override
	public Model getModel(byte meta) {
		switch(meta)
		{
		case 0: return Models.TILE_ROCK_IRON;
		case 1: return Models.TILE_ROCK_COPPER;
		case 2: return Models.TILE_ROCK_TIN;
		case 3: return Models.TILE_ROCK_GOLD;
		case 4: return Models.TILE_ROCK_URANIUM;
		default: return Models.TILE_MISSING;
		}
	}

}
