Skip to content
Open
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
9 changes: 8 additions & 1 deletion src/main/java/troy/autofish/Autofish.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void catchFish() {
//queue actions
queueRodSwitch();
queueRecast();
modAutofish.getScheduler().scheduleAction(ActionType.REEL_IN, modAutofish.getConfig().getReelInDelay(), this::useRod);
modAutofish.getScheduler().scheduleAction(ActionType.REEL_IN, getRandomDelayReelIn(), this::useRod);
}
}

Expand Down Expand Up @@ -332,6 +332,13 @@ private long getRandomDelay(){
return (long) (recastDelay * (1 + randomOffset));
}

private long getRandomDelayReelIn(){
long reelInDelay = modAutofish.getConfig().getReelInDelay();
double randomDelayRatio = modAutofish.getConfig().getRandomDelay() * 0.01;
double randomOffset = (Math.random() * 2 - 1) * randomDelayRatio;
return (long) (reelInDelay * (1 + randomOffset));
}

private boolean shouldPreventBreak(){
if(!modAutofish.getConfig().isNoBreak()) return false;
ItemStack item = getHeldItem();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/troy/autofish/config/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private static final class ConfigSpec {
this.recastDelay = builder.comment("Delay before recasting after a catch, in milliseconds.")
.translation("options.autofish.recast_delay.title")
.defineInRange("recastDelay", 1500L, 500L, 5000L);
this.randomPercent = builder.comment("Randomize recast delay by up to this percentage.")
this.randomPercent = builder.comment("Randomize recast & reel-in delay by up to this percentage.")
.translation("options.autofish.random_delay.title")
.defineInRange("randomDelayPercent", 50L, 0L, 75L);
this.reelInDelay = builder.comment("Delay before reeling in after a bite, in milliseconds.")
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"options.autofish.advanced.title": "Advanced Options",
"options.autofish.open_water_detection.title": "Enable Open Water detection",
"options.autofish.open_water_detection.title.tooltip": "In game versions above 20w12a(1.16), You can only get treasure loot at open water.\nThis will alert you when you are not fishing at open water.",
"options.autofish.random_delay.title": "Random Recast Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.title": "Random Recast/Reel-in/Reel-in Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast/Reel-in Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.value": "%d percent",
"info.autofish.open_water_detection.fail": "§c[Autofish] The area you're fishing in is not open water!§0",
"info.autofish.open_water_detection.success": "§2[Autofish] You're fishing in open water!§0"
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"options.autofish.advanced.title": "suoᴉʇdO pǝɔuɐʌp∀",
"options.autofish.open_water_detection.title": "Enable Open Water detection",
"options.autofish.open_water_detection.title.tooltip": "In game versions above 20w12a(1.16), You can only get treasure loot at open water.\nThis will alert you when you are not fishing at open water.",
"options.autofish.random_delay.title": "Random Recast Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.title": "Random Recast/Reel-in Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast/Reel-in Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.value": "%d percent",
"info.autofish.open_water_detection.fail": "§c[Autofish] The area you're fishing in is not open water!§0",
"info.autofish.open_water_detection.success": "§2[Autofish] You're fishing in open water!§0"
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"options.autofish.recast_delay.title": "Recast Delay (ms)",
"options.autofish.recast_delay.title.tooltip": "Adjusts the delay between catching a fish and recasting the rod.",
"options.autofish.recast_delay.value": "%d ms",
"options.autofish.random_delay.title": "Random Recast Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.title": "Random Recast/Reel-in Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast/Reel-in Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.value": "%d percent",
"options.autofish.reel_in_delay.title": "Reel in delay",
"options.autofish.reel_in_delay.title.tooltip": "Add a delay for the reel-in when a fish bites the float.\nSet this option to 1 to disable this function.",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/ko_kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"options.autofish.advanced.title": "고급 옵션",
"options.autofish.open_water_detection.title": "Enable Open Water detection",
"options.autofish.open_water_detection.title.tooltip": "In game versions above 20w12a(1.16), You can only get treasure loot at open water.\nThis will alert you when you are not fishing at open water.",
"options.autofish.random_delay.title": "Random Recast Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.title": "Random Recast/Reel-in Delay Field",
"options.autofish.random_delay.title.tooltip": "Add ±% randomness to the Recast/Reel-in Delay For example: Set this to 20% will make a 1500ms delay fall in 1200-1800ms (1500ms ±20%).\nSet this to 0 to disable this function.",
"options.autofish.random_delay.value": "%d percent",
"info.autofish.open_water_detection.fail": "§c[Autofish] The area you're fishing in is not open water!§0",
"info.autofish.open_water_detection.success": "§2[Autofish] You're fishing in open water!§0"
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/lzh.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"options.autofish.recast_delay.title": "再投延逾(毫秒)",
"options.autofish.recast_delay.title.tooltip": "調釣魚之間隔 毫秒以為計",
"options.autofish.recast_delay.value": "%d 毫秒",
"options.autofish.random_delay.title": "隨機再投延逾",
"options.autofish.random_delay.title.tooltip": "為投竿延逾增減百分之變數 譬如:定此為增減百分之二十,將使一千五百毫秒之延逾, 範圍將落於一千二百至一千八百毫秒間(正負二十之偏差) 設為零以解此功用",
"options.autofish.random_delay.title": "隨機再投/捲線延逾",
"options.autofish.random_delay.title.tooltip": "為再投/捲線延逾增減百分之變數 譬如:定此為增減百分之二十,將使一千五百毫秒之延逾,範圍落於一千二百至一千八百毫秒間(正負二十之偏差)。設為零以停用此功能。",
"options.autofish.random_delay.value": "百分數:%d 分",
"options.autofish.clear_regex.title": "論板重投規式",
"options.autofish.clear_regex.title.tooltip": "以論板之規則表達式 以觸發再投竿 §6可置設 §a規則表達式§6",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"options.autofish.recast_delay.title": "Задержка перезаброса (мс)",
"options.autofish.recast_delay.title.tooltip": "Настройка задержки между пойманными рыбами и перезабросом удочки.",
"options.autofish.recast_delay.value": "%d мс",
"options.autofish.random_delay.title": "Поле случайной задержки перезаброса",
"options.autofish.random_delay.title.tooltip": "Добавляет ±% случайности к задержке перезаброса Например: установка на 20% приведет к задержке 1500 мс будет в пределах 1200-1800 мс (1500 ±20%).\nУстановите на 0, чтобы отключить эту функцию.",
"options.autofish.random_delay.title": "Поле случайной задержки перезаброса/подтягивания",
"options.autofish.random_delay.title.tooltip": "Добавляет ±% случайности к задержке перезаброса/подтягивания. Например: установка на 20% превратит задержку 1500 мс в диапазон 12001800 мс (1500 мс ±20%).\nУстановите на 0, чтобы отключить эту функцию.",
"options.autofish.random_delay.value": "%d процентов",
"options.autofish.reel_in_delay.title": "Задержка подтягивания",
"options.autofish.reel_in_delay.title.tooltip": "Добавьте задержку для подтягивания, когда рыба клюнет.\nУстановите эту опцию на 1, чтобы отключить данную функцию.",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"options.autofish.recast_delay.title": "重新投掷延迟",
"options.autofish.recast_delay.title.tooltip": "调整收杆和重新投掷钓鱼竿之间的延迟 以毫秒 (ms) 为单位.",
"options.autofish.recast_delay.value": "%d 毫秒(ms)",
"options.autofish.random_delay.title": "随机重新投掷延迟",
"options.autofish.random_delay.title.tooltip": "为投掷钓鱼竿的延迟添加 ±% 的变化量 例如: 当默认延迟为1500ms时将该选项设置为20%, 会使重新投掷延迟落在1200-1800ms区间内 (1500ms ±20%).\n将该选项设置为0以禁用此功能",
"options.autofish.random_delay.title": "随机重新投掷/收杆延迟",
"options.autofish.random_delay.title.tooltip": "为重新投掷/收杆延迟添加 ±% 的变化量 例如: 当默认延迟为1500ms时将该选项设置为20%,会使延迟落在1200-1800ms区间内 (1500ms ±20%).\n将该选项设置为0以禁用此功能",
"options.autofish.random_delay.value": "百分之 %d",
"options.autofish.clear_regex.title": "聊天重抛正则",
"options.autofish.clear_regex.title.tooltip": "使用聊天栏正则表达式 来触发重新投掷钓鱼竿.\n§6可设置 §a正则表达式§6.",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/autofish/lang/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"options.autofish.recast_delay.title": "重新拋竿延遲(毫秒)",
"options.autofish.recast_delay.title.tooltip": "調整釣到魚和 重新拋竿之間的延遲。",
"options.autofish.recast_delay.value": "%d 毫秒",
"options.autofish.random_delay.title": "隨機拋竿延遲範圍",
"options.autofish.random_delay.title.tooltip": "為重新拋竿延遲增加 ±% 的隨機性 例如:將此設定為 20% 會使 1500 毫秒的延遲落在 1200-1800 毫秒(1500 毫秒 ±20%)。\n將此設定為 0 可停用此功能。",
"options.autofish.random_delay.title": "隨機拋竿/捲線延遲範圍",
"options.autofish.random_delay.title.tooltip": "為重新拋竿/捲線延遲增加 ±% 的隨機性 例如:將此設定為 20% 會使 1500 毫秒的延遲落在 1200-1800 毫秒(1500 毫秒 ±20%)。\n將此設定為 0 可停用此功能。",
"options.autofish.random_delay.value": "百分之 %d",
"options.autofish.reel_in_delay.title": "捲線延遲",
"options.autofish.reel_in_delay.title.tooltip": "在魚咬鉤時,增加捲線延遲。\n將此選項設定為 1 可停用此功能。",
Expand Down