Added Task Class

This commit is contained in:
Calclavia 2012-11-03 10:56:13 +08:00
parent ed4ee51a5e
commit 3fe2e0b919

View file

@ -0,0 +1,48 @@
package assemblyline.ai;
import net.minecraft.src.TileEntity;
/**
* An AI Task that is used by TileEntities with
* simple AI.
*
* @author Calclavia
*
*/
public abstract class Task
{
protected int ticks;
/**
* The TileEntity that is doing this task.
*/
public TileEntity handler;
private boolean shouldExecute = true;
public Task(TileEntity handler)
{
this.handler = handler;
}
/**
* Called when a task is being done.
*
* @param ticks
* - The amount of ticks this task
* has been elapsed for.
*/
protected void onDoTask()
{
this.ticks++;
}
/**
* @return Whether the task should keep
* executing.
*/
public boolean shouldExecute()
{
return this.shouldExecute;
}
}