From bc0997b0127d026ad59fa19e4c89a29d011515c0 Mon Sep 17 00:00:00 2001 From: Chloe <56194759+Hammer86gn@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:20:23 -0400 Subject: [PATCH] Fixed Auto RC bug --- .../mod/mixin/inventory/MItemSlotUpdate.java | 24 ------------------- .../mod/mixin/message/MMessageListener.java | 19 +++++++++++++++ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/main/java/io/github/codeutilities/mod/mixin/inventory/MItemSlotUpdate.java b/src/main/java/io/github/codeutilities/mod/mixin/inventory/MItemSlotUpdate.java index 562d0cd6..28555b55 100644 --- a/src/main/java/io/github/codeutilities/mod/mixin/inventory/MItemSlotUpdate.java +++ b/src/main/java/io/github/codeutilities/mod/mixin/inventory/MItemSlotUpdate.java @@ -27,7 +27,6 @@ public class MItemSlotUpdate { final MinecraftClient mc = MinecraftClient.getInstance(); private long lobbyTime = System.currentTimeMillis() - 1000; - private long lastDevCheck = 0; @Inject(method = "onScreenHandlerSlotUpdate", at = @At("HEAD")) public void onScreenHandlerSlotUpdate(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) { @@ -81,31 +80,8 @@ public void onScreenHandlerSlotUpdate(ScreenHandlerSlotUpdateS2CPacket packet, C // fs toggle FlightspeedToggle.fs_is_normal = true; - long time = System.currentTimeMillis() / 1000L; - if (time - lastDevCheck > 1) { - new Thread(() -> { - try { - Thread.sleep(10); - if (Config.getBoolean("autoRC")) { - mc.player.sendChatMessage("/rc"); - } - if (Config.getBoolean("autotime")) { - ChatUtil.executeCommandSilently("time " + Config.getLong("autotimeval")); - } - if (Config.getBoolean("autonightvis")) { - ChatUtil.executeCommandSilently("nightvis"); - } - } catch (Exception e) { - CodeUtilities.log(Level.ERROR, "Error while executing the task!"); - e.printStackTrace(); - } - }).start(); - - lastDevCheck = time; } } } } - -} diff --git a/src/main/java/io/github/codeutilities/mod/mixin/message/MMessageListener.java b/src/main/java/io/github/codeutilities/mod/mixin/message/MMessageListener.java index 288e0d11..33928cf4 100644 --- a/src/main/java/io/github/codeutilities/mod/mixin/message/MMessageListener.java +++ b/src/main/java/io/github/codeutilities/mod/mixin/message/MMessageListener.java @@ -222,6 +222,25 @@ private void updateState(Text component) { if (minecraftClient.player.isCreative() && text.matches("^ยป You are now in dev mode\\.$")) { // fs toggle FlightspeedToggle.fs_is_normal = true; + + new Thread(() -> { + try { + Thread.sleep(10); + if (Config.getBoolean("autoRC")) { + CodeUtilities.MC.player.sendChatMessage("/rc"); + } + if (Config.getBoolean("autotime")) { + ChatUtil.executeCommandSilently("time " + Config.getLong("autotimeval")); + } + if (Config.getBoolean("autonightvis")) { + ChatUtil.executeCommandSilently("nightvis"); + } + } catch (Exception e) { + CodeUtilities.log(Level.ERROR, "Error while executing the task!"); + e.printStackTrace(); + } + }).start(); + } } } \ No newline at end of file