Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

Commit 7f16525

Browse files
Merge pull request #184 from Hammer86gn/fix-auto-rc-bug
Fixed Auto RC bug
2 parents 9db709d + bc0997b commit 7f16525

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

src/main/java/io/github/codeutilities/mod/mixin/inventory/MItemSlotUpdate.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
public class MItemSlotUpdate {
2828
final MinecraftClient mc = MinecraftClient.getInstance();
2929
private long lobbyTime = System.currentTimeMillis() - 1000;
30-
private long lastDevCheck = 0;
3130

3231
@Inject(method = "onScreenHandlerSlotUpdate", at = @At("HEAD"))
3332
public void onScreenHandlerSlotUpdate(ScreenHandlerSlotUpdateS2CPacket packet, CallbackInfo ci) {
@@ -81,31 +80,8 @@ public void onScreenHandlerSlotUpdate(ScreenHandlerSlotUpdateS2CPacket packet, C
8180
// fs toggle
8281
FlightspeedToggle.fs_is_normal = true;
8382

84-
long time = System.currentTimeMillis() / 1000L;
85-
if (time - lastDevCheck > 1) {
8683

87-
new Thread(() -> {
88-
try {
89-
Thread.sleep(10);
90-
if (Config.getBoolean("autoRC")) {
91-
mc.player.sendChatMessage("/rc");
92-
}
93-
if (Config.getBoolean("autotime")) {
94-
ChatUtil.executeCommandSilently("time " + Config.getLong("autotimeval"));
95-
}
96-
if (Config.getBoolean("autonightvis")) {
97-
ChatUtil.executeCommandSilently("nightvis");
98-
}
99-
} catch (Exception e) {
100-
CodeUtilities.log(Level.ERROR, "Error while executing the task!");
101-
e.printStackTrace();
102-
}
103-
}).start();
104-
105-
lastDevCheck = time;
10684
}
10785
}
10886
}
10987
}
110-
111-
}

src/main/java/io/github/codeutilities/mod/mixin/message/MMessageListener.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,25 @@ private void updateState(Text component) {
222222
if (minecraftClient.player.isCreative() && text.matches("^» You are now in dev mode\\.$")) {
223223
// fs toggle
224224
FlightspeedToggle.fs_is_normal = true;
225+
226+
new Thread(() -> {
227+
try {
228+
Thread.sleep(10);
229+
if (Config.getBoolean("autoRC")) {
230+
CodeUtilities.MC.player.sendChatMessage("/rc");
231+
}
232+
if (Config.getBoolean("autotime")) {
233+
ChatUtil.executeCommandSilently("time " + Config.getLong("autotimeval"));
234+
}
235+
if (Config.getBoolean("autonightvis")) {
236+
ChatUtil.executeCommandSilently("nightvis");
237+
}
238+
} catch (Exception e) {
239+
CodeUtilities.log(Level.ERROR, "Error while executing the task!");
240+
e.printStackTrace();
241+
}
242+
}).start();
243+
225244
}
226245
}
227246
}

0 commit comments

Comments
 (0)