aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCarsCupcake <84076092+CarsCupcake@users.noreply.github.com>2023-08-13 21:23:59 +0200
committerGitHub <noreply@github.com>2023-08-13 21:23:59 +0200
commiteadb0b8044d844216e598984eb654ca06338c826 (patch)
tree1cfce3bb521fe9bdd2e0dbf6e918e7daf7810952 /src/main/java
parent89b4748fe31d0d92a49c773bb314bad3f939ad23 (diff)
downloadskyhanni-eadb0b8044d844216e598984eb654ca06338c826.tar.gz
skyhanni-eadb0b8044d844216e598984eb654ca06338c826.tar.bz2
skyhanni-eadb0b8044d844216e598984eb654ca06338c826.zip
Merge pull request #384
* Fishing util additions
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt7
2 files changed, 24 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
index 61c435afb..1ec46fabf 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -2,15 +2,9 @@ package at.hannibal2.skyhanni.config.features;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.moulconfig.annotations.Accordion;
-import io.github.moulberry.moulconfig.annotations.ConfigAccordionId;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorColour;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider;
-import io.github.moulberry.moulconfig.annotations.ConfigOption;
+import io.github.moulberry.moulconfig.annotations.*;
import io.github.moulberry.moulconfig.observer.Property;
+import org.lwjgl.input.Keyboard;
public class FishingConfig {
@@ -122,6 +116,21 @@ public class FishingConfig {
public boolean barnTimerCrystalHollows = true;
@Expose
+ @ConfigOption(
+ name = "Worm Cap Alert",
+ desc = "Alerts you if you hit the Worm Sea Creature limit of 60."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean wormLimitAlert = true;
+
+ @Expose
+ @ConfigOption(name = "Reset Timer Hotkey", desc = "Press this key to reset the timer manualy")
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
+ @ConfigAccordionId(id = 2)
+ public int manualResetTimer = Keyboard.KEY_NONE;
+
+ @Expose
@ConfigOption(name = "Fishing Timer Alert", desc = "Change the amount of time in seconds until the timer dings.")
@ConfigEditorSlider(
minValue = 240,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
index 1c420af0c..5eff79532 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.lwjgl.input.Keyboard
class BarnFishingTimer {
private val config get() = SkyHanniMod.feature.fishing
@@ -32,6 +33,8 @@ class BarnFishingTimer {
if (event.isMod(5)) checkMobs()
if (event.isMod(7)) tryPlaySound()
+ val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey()
+ if (key == config.manualResetTimer) startTime = System.currentTimeMillis()
}
private fun tryPlaySound() {
@@ -55,6 +58,10 @@ class BarnFishingTimer {
if (newCount == 0) {
startTime = 0
}
+
+ if (inHollows && newCount >= 60 && config.wormLimitAlert) {
+ SoundUtils.playBeepSound()
+ }
}
private fun countHollowsMobs() = EntityUtils.getEntitiesNextToPlayer<EntityArmorStand>(10.0)