package projectzombie.items;

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

public class ItemHempSeed extends Item
{

	@Override
	public ModelItem getModel(short meta) {
		return Models.ITEM_HEMP_SEED;
	}

	@Override
	public String getName(short meta) {
		return "Hemp Seed";
	}
	
	@Override
	public boolean onPlayerRightClick(ItemStack stack, Layer layer, Chunk chunk, EntityPlayer player) {
		
		Vec2i tpos = player.getPos().xz().toInt();
		
		if(chunk.getBackTile(tpos).tile == Tiles.GRASS && chunk.getFrontTile(tpos).tile == Tiles.VOID) {
			chunk.setFrontTile(Tiles.HEMP.getDefaultState(), tpos);
			stack.count -= 1;
			return true;
		}
		
		return false;
	}
	
}
