package projectzombie.tiles;

import gl_engine.vec.Vec2i;
import projectzombie.entity.Entity;
import projectzombie.items.ItemTool;
import projectzombie.model.Model;
import projectzombie.util.ItemStack;
import projectzombie.util.TileState;
import projectzombie.world.chunk.Chunk;
import projectzombie.world.layer.Layer;

public abstract class Tile
{
	public short id;
	public boolean tileSolid = false;
	public boolean tileWalkable = true;
	public double tileHitbox = 0;
	public double slowness = 0;
	public boolean unbreakable = false;
	protected double light_dissipation = 1/8.0;
	public boolean emitsLight = false;
	public boolean passNaturalLight = true;
	public int hardness = -1;
	
	public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
	}
	
	public TileState getDefaultState() {
		return new TileState(this, 0);
	}

	public boolean onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
		return false;
	}
	
	public ItemStack[] getTileDrops(TileState state) {
		return new ItemStack[0];
	}
	
	public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
		return false;
	}
	
	public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
		return false;
	}
	
	public double getLightDissipation(TileState state) {
		return light_dissipation;
	}
	
	public double getLightLevel(TileState state, Vec2i pos) {
		return 0;
	}
	
	public void tickRandomly(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
		
	}
	
	public double getSlipperiness(TileState state) {
		return 0.75;
	}
	
	public double getResistance(TileState state) {
		return 0;
	}
	
	public abstract Model getModel(byte meta);
	
	public void onGenerate(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
		
	}
	
	public boolean doBreak(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
		return true;
	}
	
	public void onDestroy(Layer layer, Chunk chunk, TileState oldState, TileState newState, Vec2i pos) {
		
	}
}
