This commit is contained in:
@@ -24,16 +24,27 @@ public class SkybotClient implements ClientModInitializer {
|
|||||||
private static volatile Farmer activeFarmer = null;
|
private static volatile Farmer activeFarmer = null;
|
||||||
private static volatile boolean botEnabled = false;
|
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(
|
private static final KeyBinding STOP_KEY = new KeyBinding(
|
||||||
"key.skybot.stop",
|
"key.skybot.stop",
|
||||||
InputUtil.Type.KEYSYM,
|
InputUtil.Type.KEYSYM,
|
||||||
GLFW.GLFW_KEY_CAPS_LOCK,
|
GLFW.GLFW_KEY_CAPS_LOCK,
|
||||||
KeyBinding.Category.create(Identifier.of("skybot", "general")));
|
GENERAL_CATEGORY);
|
||||||
|
|
||||||
public static boolean isBotEnabled() {
|
public static boolean isBotEnabled() {
|
||||||
return botEnabled;
|
return botEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String botStatus() {
|
||||||
|
if (!botEnabled) {
|
||||||
|
return "§cIdle";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "§aRunning";
|
||||||
|
}
|
||||||
|
|
||||||
public static void stopBot() {
|
public static void stopBot() {
|
||||||
activeFarmer = null;
|
activeFarmer = null;
|
||||||
botEnabled = false;
|
botEnabled = false;
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
|||||||
import net.minecraft.command.CommandRegistryAccess;
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
import skybot.SkybotClient;
|
import skybot.SkybotClient;
|
||||||
import skybot.farmers.CarrotFarmer;
|
import skybot.farmers.CarrotFarmer;
|
||||||
|
import skybot.farmers.NetherwartFarmer;
|
||||||
import skybot.farmers.PotatoFarmer;
|
import skybot.farmers.PotatoFarmer;
|
||||||
import skybot.farmers.TestFarmer;
|
import skybot.farmers.TestFarmer;
|
||||||
|
import skybot.farmers.WheatFarmer;
|
||||||
import skybot.utilities.ChatMenu;
|
import skybot.utilities.ChatMenu;
|
||||||
|
|
||||||
public class CommandManager {
|
public class CommandManager {
|
||||||
@@ -30,6 +32,18 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
return 1;
|
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 -> {
|
.then(literal("potato").executes(context -> {
|
||||||
if (SkybotClient.startBot(new PotatoFarmer())) {
|
if (SkybotClient.startBot(new PotatoFarmer())) {
|
||||||
ChatMenu.send("§aStarting Potato Farmer...§r");
|
ChatMenu.send("§aStarting Potato Farmer...§r");
|
||||||
@@ -39,8 +53,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
dispatcher.register(literal("skybot")
|
dispatcher.register(literal("skybot")
|
||||||
.then(literal("status").executes(context -> {
|
.then(literal("status").executes(context -> {
|
||||||
String msg = SkybotClient.isBotEnabled() ? "§aRunning" : "§cIdle";
|
ChatMenu.send("Status: " + SkybotClient.botStatus());
|
||||||
ChatMenu.send("Status: " + msg);
|
|
||||||
return 1;
|
return 1;
|
||||||
}))
|
}))
|
||||||
.then(literal("stop").executes(context -> {
|
.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