package projectzombie.items;

import gl_engine.vec.Vec2d;
import gl_engine.vec.Vec2i;
import projectzombie.entity.player.EntityPlayer;
import projectzombie.init.Models;
import projectzombie.init.Tiles;
import projectzombie.model.Model;
import projectzombie.model.ModelItem;
import projectzombie.util.ItemStack;
import projectzombie.world.chunk.Chunk;
import projectzombie.world.layer.Layer;

public class ItemCampfire extends Item
{

	@Override
	public ModelItem getModel(ItemStack stack) {
		return Models.ITEM_CAMPFIRE;
	}
	
	@Override
	public Model getPlaceModel(ItemStack stack) {
		return Models.TILE_CAMPFIRE_UNLIT;
	}
	
	@Override
	public String getName(ItemStack stack) {
		return "Campfire";
	}
	
	@Override
	public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos)
	{
		Vec2i pos = place_pos.toInt();
		
		if(layer.getFrontTile(pos).tile != Tiles.VOID) {
			return false;
		}
		
		stack.count -= 1;
		layer.setFrontTile(Tiles.CAMPFIRE.getDefaultState(), pos);
		
		return true;
	}

}
