Added Task Class
This commit is contained in:
parent
ed4ee51a5e
commit
3fe2e0b919
1 changed files with 48 additions and 0 deletions
48
src/common/assemblyline/ai/Task.java
Normal file
48
src/common/assemblyline/ai/Task.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue