This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 -> {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user