diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/CoreCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/CoreCommand.java index d901d8a..c0c52cf 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/CoreCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/CoreCommand.java @@ -3,6 +3,9 @@ package land.chipmunk.chipmunkmod.commands; import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; + +import static com.mojang.brigadier.arguments.BoolArgumentType.bool; +import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; import static land.chipmunk.chipmunkmod.command.CommandManager.literal; import static land.chipmunk.chipmunkmod.command.CommandManager.argument; import static com.mojang.brigadier.arguments.StringArgumentType.greedyString; @@ -35,6 +38,14 @@ public class CoreCommand { .then(literal("refill").executes(c -> refill(c))) .then(literal("move").executes(c -> move(c))) + + .then( + literal("runFillCommand") + .then( + argument("enabled", bool()) + .executes(c -> runFillCommand(c)) + ) + ) ); } @@ -76,4 +87,16 @@ public class CoreCommand { return Command.SINGLE_SUCCESS; } + + public static int runFillCommand(CommandContext context) { + final FabricClientCommandSource source = context.getSource(); + + final boolean bool = getBool(context, "enabled"); + + CommandCore.INSTANCE.runFillCommand = bool; + + source.sendFeedback(Text.literal("Running fill commands are now " + (bool ? "enabled" : "disabled"))); + + return Command.SINGLE_SUCCESS; + } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java index 31209e5..d0c8ff4 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java @@ -26,6 +26,8 @@ public class CommandCore { private Timer timer; + public boolean runFillCommand = true; + public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance(), ChipmunkMod.CONFIG.core.relativeArea); public CommandCore (MinecraftClient client, BlockArea relativeArea) { @@ -79,6 +81,8 @@ public class CommandCore { } public void refill () { + if (!runFillCommand) return; + // final PositionManager position = client.position(); final BlockPos relStart = relativeArea.start; final BlockPos relEnd = relativeArea.end;