package projectzombie.tiles;

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

public class TileRock extends Tile implements TileBulletBreakable
{

	public TileRock()
	{
		// Set some settings
		this.tileSolid = true;
		this.tileHitbox = 0.4;
		this.hardness = 200;
	}
	
	@Override
	public double getLightDissipation(TileState state) {
		return 1/8.0;
	}
	
	@Override
	public int getBulletBreakChance() {
		return 15;
	}
	
	@Override
	public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
		return true;
	}
	
	@Override
	public ItemStack[] getTileDrops(TileState state) {
		return new ItemStack[] {
				new ItemStack(Items.ROCK, 1, new ItemModifierMeta(state.meta)),
				new ItemStack(Items.FLINT, state.meta == 0 && Math.random() > 0.75 ? 1 : 0),
		};
	}
	
	@Override
	public Model getModel(byte meta) {
		switch(meta)
		{
		case 0: return Models.TILE_ROCK;
		case 1: return Models.TILE_ROCK_ICE;
		case 2: return Models.TILE_ROCK_SANDSTONE;
		default: return Models.TILE_ROCK;
		}
	}
	
}
