From 9b4665a6b5a5ae1c7745cbe6677d7f9babac2a06 Mon Sep 17 00:00:00 2001 From: Henry Mao Date: Fri, 11 Jan 2013 22:41:57 +0800 Subject: [PATCH] Added repeat command --- .../common/machine/command/CommandRepeat.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/minecraft/assemblyline/common/machine/command/CommandRepeat.java diff --git a/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java new file mode 100644 index 000000000..313b90101 --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java @@ -0,0 +1,27 @@ +package assemblyline.common.machine.command; + +/** + * This task resets all previous tasks and does them again in a loop. + * + * @author Calclavia + * + */ +public class CommandRepeat extends Command +{ + /** + * The amount of tasks above this task to repeat. + */ + private int tasksToRepeat; + + public void onTaskStart() + { + this.tasksToRepeat = this.getIntArg(0); + } + + @Override + protected boolean doTask() + { + this.commandManager.setCurrentTask(this.commandManager.getCurrentTask() - this.tasksToRepeat); + return false; + } +}