Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 19 additions & 9 deletions src/client/java/com/example/ExampleModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(() -> {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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
Expand All @@ -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");
Expand Down