diff --git a/src/client/java/skybot/SkybotClient.java b/src/client/java/skybot/SkybotClient.java index bfaa736..b71403b 100644 --- a/src/client/java/skybot/SkybotClient.java +++ b/src/client/java/skybot/SkybotClient.java @@ -24,16 +24,27 @@ public class SkybotClient implements ClientModInitializer { private static volatile Farmer activeFarmer = null; private static volatile boolean botEnabled = false; + private static final KeyBinding.Category GENERAL_CATEGORY = KeyBinding.Category + .create(Identifier.of("skybot", "general")); + private static final KeyBinding STOP_KEY = new KeyBinding( "key.skybot.stop", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_CAPS_LOCK, - KeyBinding.Category.create(Identifier.of("skybot", "general"))); + GENERAL_CATEGORY); public static boolean isBotEnabled() { return botEnabled; } + public static String botStatus() { + if (!botEnabled) { + return "§cIdle"; + } + + return "§aRunning"; + } + public static void stopBot() { activeFarmer = null; botEnabled = false; diff --git a/src/client/java/skybot/commands/CommandManager.java b/src/client/java/skybot/commands/CommandManager.java index 0d90c40..c98a87d 100644 --- a/src/client/java/skybot/commands/CommandManager.java +++ b/src/client/java/skybot/commands/CommandManager.java @@ -7,8 +7,10 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.command.CommandRegistryAccess; import skybot.SkybotClient; import skybot.farmers.CarrotFarmer; +import skybot.farmers.NetherwartFarmer; import skybot.farmers.PotatoFarmer; import skybot.farmers.TestFarmer; +import skybot.farmers.WheatFarmer; import skybot.utilities.ChatMenu; public class CommandManager { @@ -30,6 +32,18 @@ public class CommandManager { } return 1; })) + .then(literal("netherwart").executes(context -> { + if (SkybotClient.startBot(new NetherwartFarmer())) { + ChatMenu.send("§aStarting Netherwart Farmer...§r"); + } + return 1; + })) + .then(literal("wheat").executes(context -> { + if (SkybotClient.startBot(new WheatFarmer())) { + ChatMenu.send("§aStarting Wheat Farmer...§r"); + } + return 1; + })) .then(literal("potato").executes(context -> { if (SkybotClient.startBot(new PotatoFarmer())) { ChatMenu.send("§aStarting Potato Farmer...§r"); @@ -39,8 +53,7 @@ public class CommandManager { dispatcher.register(literal("skybot") .then(literal("status").executes(context -> { - String msg = SkybotClient.isBotEnabled() ? "§aRunning" : "§cIdle"; - ChatMenu.send("Status: " + msg); + ChatMenu.send("Status: " + SkybotClient.botStatus()); return 1; })) .then(literal("stop").executes(context -> { diff --git a/src/client/java/skybot/farmers/NetherwartFarmer.java b/src/client/java/skybot/farmers/NetherwartFarmer.java new file mode 100644 index 0000000..c662457 --- /dev/null +++ b/src/client/java/skybot/farmers/NetherwartFarmer.java @@ -0,0 +1,44 @@ +package skybot.farmers; + +import skybot.controller.Controller; +import skybot.task.HoldKeyTask; +import skybot.task.PressButtonTask; +import skybot.task.ReleaseButtonTask; +import skybot.task.RunCommandTask; +import skybot.task.TaskQueue; + +public class NetherwartFarmer implements Farmer { + + @Override + public void enqueue(TaskQueue queue) { + queue.clear(); + + queue.add(new RunCommandTask("warp garden"), 1998); + + int EPOCHS = 2; + + for (int i = 0; i < EPOCHS; i++) { + queue.add(new PressButtonTask(Controller::setLeftClick), 2021); + queue.add(new HoldKeyTask(Controller::setLeft, 119555)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 2015); + queue.add(new HoldKeyTask(Controller::setRight, 119402)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 1998); + queue.add(new HoldKeyTask(Controller::setLeft, 119223)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 2203); + queue.add(new HoldKeyTask(Controller::setRight, 119198)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 1998); + queue.add(new HoldKeyTask(Controller::setLeft, 120155)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new RunCommandTask("warp garden"), 2126); + } + } +} diff --git a/src/client/java/skybot/farmers/WheatFarmer.java b/src/client/java/skybot/farmers/WheatFarmer.java new file mode 100644 index 0000000..ea6a36d --- /dev/null +++ b/src/client/java/skybot/farmers/WheatFarmer.java @@ -0,0 +1,44 @@ +package skybot.farmers; + +import skybot.controller.Controller; +import skybot.task.HoldKeyTask; +import skybot.task.PressButtonTask; +import skybot.task.ReleaseButtonTask; +import skybot.task.RunCommandTask; +import skybot.task.TaskQueue; + +public class WheatFarmer implements Farmer { + + @Override + public void enqueue(TaskQueue queue) { + queue.clear(); + + queue.add(new RunCommandTask("warp garden"), 1998); + + int EPOCHS = 2; + + for (int i = 0; i < EPOCHS; i++) { + queue.add(new PressButtonTask(Controller::setLeftClick), 2021); + queue.add(new HoldKeyTask(Controller::setRight, 119555)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 2015); + queue.add(new HoldKeyTask(Controller::setLeft, 119402)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 1998); + queue.add(new HoldKeyTask(Controller::setRight, 119223)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 2203); + queue.add(new HoldKeyTask(Controller::setLeft, 119198)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new PressButtonTask(Controller::setLeftClick), 1998); + queue.add(new HoldKeyTask(Controller::setRight, 120155)); + queue.add(new ReleaseButtonTask(Controller::setLeftClick)); + + queue.add(new RunCommandTask("warp garden"), 2126); + } + } +}