Moved tasks into commands
This commit is contained in:
parent
be43631eae
commit
410e2c1c27
7 changed files with 24 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.common.ai;
|
||||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.common.ai;
|
||||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import assemblyline.common.machine.crafter.TileEntityArmbot;
|
||||
|
||||
|
@ -8,12 +8,17 @@ import assemblyline.common.machine.crafter.TileEntityArmbot;
|
|||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public abstract class Task
|
||||
public abstract class Command
|
||||
{
|
||||
/**
|
||||
* A class of all available commands. Command IDs are the indexes of the array.
|
||||
*/
|
||||
public static Class[] COMMANDS = { CommandIdle.class };
|
||||
|
||||
protected int ticks;
|
||||
protected TileEntityArmbot tileEntity;
|
||||
|
||||
public Task(TileEntityArmbot arm)
|
||||
public Command(TileEntityArmbot arm)
|
||||
{
|
||||
this.tileEntity = arm;
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package assemblyline.common.ai;
|
||||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import assemblyline.common.machine.crafter.TileEntityArmbot;
|
||||
|
||||
public class TaskIdle extends Task
|
||||
public class CommandIdle extends Command
|
||||
{
|
||||
public TaskIdle(TileEntityArmbot arm)
|
||||
public CommandIdle(TileEntityArmbot arm)
|
||||
{
|
||||
super(arm);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.common.ai;
|
||||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -7,9 +7,9 @@ import java.util.List;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TaskManager
|
||||
public class CommandManager
|
||||
{
|
||||
private final List<Task> tasks = new ArrayList<Task>();
|
||||
private final List<Command> tasks = new ArrayList<Command>();
|
||||
|
||||
private int ticks = 0;
|
||||
|
||||
|
@ -23,8 +23,8 @@ public class TaskManager
|
|||
*/
|
||||
try
|
||||
{
|
||||
Task task;
|
||||
Iterator<Task> iter = tasks.iterator();
|
||||
Command task;
|
||||
Iterator<Command> iter = tasks.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
task = iter.next();
|
||||
|
@ -57,7 +57,7 @@ public class TaskManager
|
|||
* @param tileEntity TE instance to register the task for
|
||||
* @param task Task instance to register
|
||||
*/
|
||||
public void addTask(TileEntity tileEntity, Task task)
|
||||
public void addTask(TileEntity tileEntity, Command task)
|
||||
{
|
||||
tasks.add(task);
|
||||
task.onTaskStart();
|
|
@ -1,14 +1,14 @@
|
|||
package assemblyline.common.machine.crafter;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import assemblyline.common.ai.Task;
|
||||
import assemblyline.common.machine.armbot.Command;
|
||||
|
||||
/**
|
||||
* Used by arms to collect items in a specific region.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class TaskArmCollect extends Task
|
||||
public class TaskArmCollect extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,14 +4,14 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import assemblyline.common.ai.Task;
|
||||
import assemblyline.common.machine.armbot.Command;
|
||||
|
||||
/**
|
||||
* Used by arms to search for entities in a region
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class TaskArmSearch extends Task
|
||||
public class TaskArmSearch extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ import universalelectricity.core.implement.IJouleStorage;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
|
||||
import assemblyline.common.ai.TaskManager;
|
||||
import assemblyline.common.machine.armbot.CommandManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class TileEntityArmbot extends TileEntityElectricityReceiver implements I
|
|||
*/
|
||||
protected ItemStack[] containingItems = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
private TaskManager taskManager = new TaskManager();
|
||||
private CommandManager taskManager = new CommandManager();
|
||||
|
||||
/**
|
||||
* Entity robotic arm to be used with this tileEntity
|
||||
|
|
Loading…
Add table
Reference in a new issue