Add a toggleKey method

This commit is contained in:
c0de 2023-03-21 20:50:48 -05:00
parent 86bc75991a
commit 7821cf311e
2 changed files with 9 additions and 3 deletions

View File

@ -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;
}

View File

@ -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");