package projectzombie.tiles;

import gl_engine.vec.Vec2i;
import mainloop.task.IMainloopTask;
import projectzombie.Main;
import projectzombie.entity.Entity;
import projectzombie.entity.player.EntityPlayer;
import projectzombie.init.Models;
import projectzombie.mainloop.MainloopEventHandler;
import projectzombie.model.Model;
import projectzombie.task.TaskLadderDown;
import projectzombie.util.math.TileState;
import projectzombie.world.chunk.ChunkEventHandler;
import projectzombie.world.layer.Layer;

public class TilePortalDown extends Tile
{

	public TilePortalDown() {
		
		this.unbreakable = true;
	}
	
	@Override
	public void onActivated(Layer layer, Vec2i pos, Entity entity, TileState state)
	{
		// Call super
		super.onActivated(layer, pos, entity, state);
		
		// Is the entity the player
		if(entity == Main.player)
		{
			// Cast to player
			EntityPlayer player = (EntityPlayer)entity;
			if(player.in_animation) return;
			
			player.addTask(new TaskLadderDown(player, state.meta));
		}
	}
	
	@Override
	public Model getModel(byte meta) {
		return Models.TILE_PORTAL;
	}

}
