Moved task out of controller
build / build (push) Failing after 2s

This commit is contained in:
2026-07-04 05:46:58 -07:00
parent 2fba8b6299
commit 431aae4f62
13 changed files with 31 additions and 25 deletions
+1 -1
View File
@@ -14,8 +14,8 @@ import org.lwjgl.glfw.GLFW;
import skybot.commands.CommandManager; import skybot.commands.CommandManager;
import skybot.controller.Controller; import skybot.controller.Controller;
import skybot.controller.task.TaskQueue;
import skybot.farmers.Farmer; import skybot.farmers.Farmer;
import skybot.task.TaskQueue;
import skybot.utilities.ChatMenu; import skybot.utilities.ChatMenu;
public class SkybotClient implements ClientModInitializer { public class SkybotClient implements ClientModInitializer {
@@ -1,11 +1,11 @@
package skybot.farmers; package skybot.farmers;
import skybot.controller.Controller; import skybot.controller.Controller;
import skybot.controller.task.HoldKeyTask; import skybot.task.HoldKeyTask;
import skybot.controller.task.PressButtonTask; import skybot.task.PressButtonTask;
import skybot.controller.task.ReleaseButtonTask; import skybot.task.ReleaseButtonTask;
import skybot.controller.task.RunCommandTask; import skybot.task.RunCommandTask;
import skybot.controller.task.TaskQueue; import skybot.task.TaskQueue;
public class CarrotFarmer implements Farmer { public class CarrotFarmer implements Farmer {
+1 -1
View File
@@ -1,6 +1,6 @@
package skybot.farmers; package skybot.farmers;
import skybot.controller.task.TaskQueue; import skybot.task.TaskQueue;
public interface Farmer { public interface Farmer {
void enqueue(TaskQueue queue); void enqueue(TaskQueue queue);
@@ -1,11 +1,11 @@
package skybot.farmers; package skybot.farmers;
import skybot.controller.Controller; import skybot.controller.Controller;
import skybot.controller.task.HoldKeyTask; import skybot.task.HoldKeyTask;
import skybot.controller.task.PressButtonTask; import skybot.task.PressButtonTask;
import skybot.controller.task.ReleaseButtonTask; import skybot.task.ReleaseButtonTask;
import skybot.controller.task.RunCommandTask; import skybot.task.RunCommandTask;
import skybot.controller.task.TaskQueue; import skybot.task.TaskQueue;
public class PotatoFarmer implements Farmer { public class PotatoFarmer implements Farmer {
@@ -2,9 +2,9 @@ package skybot.farmers;
import net.minecraft.client.util.InputUtil; import net.minecraft.client.util.InputUtil;
import skybot.controller.Controller; import skybot.controller.Controller;
import skybot.controller.task.ClickButtonTask; import skybot.task.ClickButtonTask;
import skybot.controller.task.PauseTask; import skybot.task.PauseTask;
import skybot.controller.task.TaskQueue; import skybot.task.TaskQueue;
public class TestFarmer implements Farmer { public class TestFarmer implements Farmer {
@@ -1,9 +1,12 @@
package skybot.controller.task; package skybot.task;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Consumer; import java.util.function.Consumer;
/** Clicks a button (press then release) held for a log-normally distributed duration. */ /**
* Clicks a button (press then release) held for a log-normally distributed
* duration.
*/
public class ClickButtonTask implements Task { public class ClickButtonTask implements Task {
private final Consumer<Boolean> setter; private final Consumer<Boolean> setter;
private long endTime; private long endTime;
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
/** /**
* Does nothing for a fixed duration; leaves whatever keys were already released * Does nothing for a fixed duration; leaves whatever keys were already released
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
public interface Task { public interface Task {
/** Called once, the tick this task becomes active. */ /** Called once, the tick this task becomes active. */
@@ -10,7 +10,10 @@ public interface Task {
boolean isDone(); boolean isDone();
/** Called once, right after isDone() first returns true, before the next task starts. */ /**
* Called once, right after isDone() first returns true, before the next task
* starts.
*/
default void stop() { default void stop() {
} }
@@ -1,4 +1,4 @@
package skybot.controller.task; package skybot.task;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.Deque; import java.util.Deque;