Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Shadow Assassin Jump Notification #852

Merged
merged 14 commits into from
Apr 5, 2024
Merged
Next Next commit
Fishing util aditions
  • Loading branch information
CarsCupcake committed Aug 12, 2023
commit 520654cc4b840ecc58d21190f3ae109e53cd8c58
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@

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 {

Expand Down Expand Up @@ -121,6 +115,21 @@ public class FishingConfig {
@ConfigAccordionId(id = 2)
public boolean barnTimerCrystalHollows = true;

@Expose
@ConfigOption(
name = "Worm Fishing Sea Creature 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 and Sea Creature amount 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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)
Expand Down