package projectzombie.tiles;

import gl_engine.vec.Vec2i;
import projectzombie.Main;
import projectzombie.entity.Entity;
import projectzombie.init.Models;
import projectzombie.inventory.Crafting;
import projectzombie.items.ItemTool;
import projectzombie.items.ItemToolType;
import projectzombie.menu.MenuInventoryBasic;
import projectzombie.model.Model;
import projectzombie.util.ItemStack;
import projectzombie.util.TileState;
import projectzombie.world.layer.Layer;

public class TileWorkbench extends Tile
{
	public TileWorkbench() {
		tileSolid = true;
		tileHitbox = 0.4;
		hardness = 200;
	}

	@Override
	public Model getModel(byte meta) {
		return Models.TILE_WORKBENCH;
	}
	
	@Override
	public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
		return true;
	}
	
	@Override
	public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
		return (tool != null && tool.toolType(stack) == ItemToolType.HATCHET);
	}
	
	@Override
	public boolean onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
		super.onActivated(layer, tpos, entity, state);
		
		Main.menu = new MenuInventoryBasic(Main.menu, Crafting.WOODEN_WORKBENCH);
		
		return true;
	}

}
