From 7821cf311e817e010af64d14aa545b9ff804f34c Mon Sep 17 00:00:00 2001 From: c0de Date: Tue, 21 Mar 2023 20:50:48 -0500 Subject: [PATCH] Add a toggleKey method --- src/main/java/dev/c0de/minecraft/client/Module.java | 8 ++++++++ .../dev/c0de/minecraft/client/modules/Fullbright.java | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/c0de/minecraft/client/Module.java b/src/main/java/dev/c0de/minecraft/client/Module.java index 0d212c2..6c0a6ca 100644 --- a/src/main/java/dev/c0de/minecraft/client/Module.java +++ b/src/main/java/dev/c0de/minecraft/client/Module.java @@ -34,6 +34,14 @@ public abstract class Module { return key; } + public void toggleKey() { + if (key != null) { + if (key.wasPressed()) { + this.setState(!this.isState()); + } + } + } + public boolean isState() { return state; } diff --git a/src/main/java/dev/c0de/minecraft/client/modules/Fullbright.java b/src/main/java/dev/c0de/minecraft/client/modules/Fullbright.java index ba8feb1..d143383 100644 --- a/src/main/java/dev/c0de/minecraft/client/modules/Fullbright.java +++ b/src/main/java/dev/c0de/minecraft/client/modules/Fullbright.java @@ -17,9 +17,7 @@ public class Fullbright extends Module { @Override public void onTick(MinecraftClient client) { - if (key.wasPressed()) { - this.setState(!this.isState()); - } + this.toggleKey(); if (this.isState()) { c0deFoxModClient.LOGGER.warn("Active State");