Skip to content

Commit

Permalink
remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher committed May 10, 2024
1 parent d9ce54e commit 990c1d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
20 changes: 9 additions & 11 deletions src/client/java/dev/clatza/mcautofight/KeyBindingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@
import org.lwjgl.glfw.GLFW;

public class KeyBindingHelper {
// Die Variable toggleVariableKeybind ist jetzt als static öffentlich verfügbar
public static KeyBinding toggleVariableKeybind;
public static long keyPressTimeout = 0;

public static void registerGameEvents() {
toggleVariableKeybind = net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Toogle Autoklicker", // Übersetzungsschlüssel für die Beschreibung
InputUtil.Type.KEYSYM, // Typ der Eingabe (KEYSYM für Tastatur)
GLFW.GLFW_KEY_F6, // Standardtaste ist F6
"Autoklicker" // Übersetzungsschlüssel für die Kategorie
"Toggle Auto klicker",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_F6,
"Auto klicker"
));

ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (KeyBindingHelper.toggleVariableKeybind.wasPressed()) {
setGlobalAttackMode(!GlobalData.isAttacking);
if(keyPressTimeout + 200 < System.currentTimeMillis()){
keyPressTimeout = System.currentTimeMillis();
setGlobalAttackMode(!GlobalData.isAttacking);
}
}
});
}
Expand All @@ -47,9 +50,4 @@ public static void setGlobalAttackMode(boolean newStatus){
public static void setKeyBindingPressed(KeyBinding keyBinding, boolean pressed) {
keyBinding.setPressed(pressed);
}

public static void oneTimePress(KeyBinding keyBinding) {
setKeyBindingPressed(keyBinding, true);
setKeyBindingPressed(keyBinding, false);
}
}
10 changes: 2 additions & 8 deletions src/client/java/dev/clatza/mcautofight/TeleportMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
Expand All @@ -19,7 +17,7 @@ public class TeleportMonitor {

private static final int SEARCH_RADIUS = 50;
private static final int BUFFER_ZONE = 15;
private static List<Box> portalSafeZones = new ArrayList<>();
private static final List<Box> portalSafeZones = new ArrayList<>();

private static boolean lastState = false;

Expand All @@ -44,11 +42,7 @@ public static void registerGameEvents(){
lastPosition = MinecraftClient.getInstance().player.getPos();
});

ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> {
MinecraftClient.getInstance().execute(() -> {
KeyBindingHelper.setGlobalAttackMode(false);
});
});
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> MinecraftClient.getInstance().execute(() -> KeyBindingHelper.setGlobalAttackMode(false)));
}

public static void detectPortals(World world, Vec3d playerPos) {
Expand Down

0 comments on commit 990c1d0

Please sign in to comment.