diff --git a/gradle.properties b/gradle.properties index f6308a7..0271fd0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,6 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true -org.gradle.java.home=C:/Users/Aneesh/.gradle/jdks/eclipse_adoptium-25-amd64-windows.2 # Fabric Properties # check these on https://fabricmc.net/develop diff --git a/src/client/java/com/example/ExampleModClient.java b/src/client/java/com/example/ExampleModClient.java index 1c60cc7..61075ce 100644 --- a/src/client/java/com/example/ExampleModClient.java +++ b/src/client/java/com/example/ExampleModClient.java @@ -25,7 +25,8 @@ public class ExampleModClient implements ClientModInitializer { private static final String FISHING_HOLOGRAM_NAME = "!!!"; private long lastDetectionTime = 0; - private static final long DETECTION_COOLDOWN_MS = 1000; // 1 second cooldown for detection + private boolean temp = false; + private static final long DETECTION_COOLDOWN_MS = 2000; // 1 second cooldown for detection private static long lastFireveilTime = 0; private final Random random = new Random(); private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); @@ -181,12 +182,21 @@ public void onInitializeClient() { client.player.sendSystemMessage(Component.literal("Fishing hologram detected! Simulating right click...")); } lastDetectionTime = currentTime; + if (AutoFisherConfig.slugfish) { + if (temp){ + temp = false; + break; + } + else { + temp = true; + } + } // Simulate human-like delay before right-clicking (complex randomization: 56-129ms) - int baseDelay = 56; - int randomOffset1 = random.nextInt(37); // 0-36ms - int randomOffset2 = random.nextInt(38); // 0-37ms - int initialClickDelay = baseDelay + randomOffset1 + randomOffset2; // Total delay will be between 56ms and 129ms + //int baseDelay = 56; + //int randomOffset1 = random.nextInt(37); // 0-36ms + //int randomOffset2 = random.nextInt(38); // 0-37ms + int initialClickDelay = AutoFisherConfig.baseDelay + AutoFisherConfig.randomDelay1 + AutoFisherConfig.randomDelay2; // Total delay will be between 56ms and 129ms scheduler.schedule(() -> { Minecraft.getInstance().execute(() -> { @@ -200,10 +210,10 @@ public void onInitializeClient() { // Handle recast logic based on user's refined requirements if (AutoFisherConfig.enableRecast) { // Generate a random recast delay between 390ms and 980ms - int randomDelay1 = random.nextInt(200); // 0-199 - int randomDelay2 = random.nextInt(200); // 0-199 - int randomDelay3 = random.nextInt(200); // 0-199 - int finalRecastDelay = 390 + (randomDelay1 + randomDelay2 + randomDelay3) % (980 - 390 + 1); // Scale to 390-980 + //int randomDelay1 = random.nextInt(200); // 0-199 + //int randomDelay2 = random.nextInt(200); // 0-199 + //int randomDelay3 = random.nextInt(200); // 0-199 + int finalRecastDelay = AutoFisherConfig.baseRecastDelay + (AutoFisherConfig.randomDelay1 + AutoFisherConfig.randomDelay2 + AutoFisherConfig.randomDelay3) % (AutoFisherConfig.maxRecastDelay - AutoFisherConfig.minRecastDelay + 1); // Scale to 390-980 // Always schedule a recast if enableRecast is true. // This will be the default recast if Fireveil is disabled, diff --git a/src/client/java/com/example/autofisher/config/AutoFisherConfig.java b/src/client/java/com/example/autofisher/config/AutoFisherConfig.java index f6a7923..0a96eb4 100644 --- a/src/client/java/com/example/autofisher/config/AutoFisherConfig.java +++ b/src/client/java/com/example/autofisher/config/AutoFisherConfig.java @@ -24,6 +24,14 @@ public class AutoFisherConfig { public static int fireveilDelayToRightClick_random = 70; public static int fireveilDelayToOriginalSlot_base = 90; public static int fireveilDelayToOriginalSlot_random = 80; + public static int baseDelay = 56; + public static int baseRecastDelay = 390; + public static int minRecastDelay = 390; + public static int maxRecastDelay = 980; + public static int randomDelay1 = 37; + public static int randomDelay2 = 38; + public static int randomDelay3 = 200; + public static boolean slugfish = false; public static void load() { if (!Files.exists(CONFIG_FILE)) { @@ -43,6 +51,15 @@ public static void load() { fireveilDelayToRightClick_random = Integer.parseInt(properties.getProperty("fireveilDelayToRightClick_random", "70")); fireveilDelayToOriginalSlot_base = Integer.parseInt(properties.getProperty("fireveilDelayToOriginalSlot_base", "90")); fireveilDelayToOriginalSlot_random = Integer.parseInt(properties.getProperty("fireveilDelayToOriginalSlot_random", "80")); + baseDelay = Integer.parseInt(properties.getProperty("baseDelay", "56")); + baseRecastDelay = Integer.parseInt(properties.getProperty("baseRecastDelay", "390")); + minRecastDelay = Integer.parseInt(properties.getProperty("minRecastDelay", "390")); + maxRecastDelay = Integer.parseInt(properties.getProperty("maxRecastDelay", "980")); + randomDelay1 = Integer.parseInt(properties.getProperty("randomDelay1", "37")); + randomDelay2 = Integer.parseInt(properties.getProperty("randomDelay2", "38")); + randomDelay3 = Integer.parseInt(properties.getProperty("randomDelay3", "100")); + slugfish = Boolean.parseBoolean(properties.getProperty("slugfish", "false")); + } catch (IOException | NumberFormatException e) { System.err.println("Failed to load AutoFisher config: " + e.getMessage()); // Reset to default values on error @@ -67,6 +84,14 @@ public static void save() { properties.setProperty("fireveilDelayToRightClick_random", String.valueOf(fireveilDelayToRightClick_random)); properties.setProperty("fireveilDelayToOriginalSlot_base", String.valueOf(fireveilDelayToOriginalSlot_base)); properties.setProperty("fireveilDelayToOriginalSlot_random", String.valueOf(fireveilDelayToOriginalSlot_random)); + properties.setProperty("baseDelay", String.valueOf(baseDelay)); + properties.setProperty("baseRecastDelay", String.valueOf(baseRecastDelay)); + properties.setProperty("minRecastDelay", String.valueOf(minRecastDelay)); + properties.setProperty("maxRecastDelay", String.valueOf(maxRecastDelay)); + properties.setProperty("randomDelay1", String.valueOf(randomDelay1)); + properties.setProperty("randomDelay2", String.valueOf(randomDelay2)); + properties.setProperty("randomDelay3", String.valueOf(randomDelay3)); + properties.setProperty("slugfish", String.valueOf(slugfish)); try (var writer = Files.newBufferedWriter(CONFIG_FILE)) { properties.store(writer, "AutoFisher Configuration");