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: Golden Fish Timer #1941

Merged
merged 23 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
597ac25
golden fish timer
ItsEmpa May 30, 2024
b29864a
fix
ItsEmpa May 30, 2024
72456e6
option to not show head in display
ItsEmpa May 30, 2024
de23f3e
%
ItsEmpa May 30, 2024
a893162
timer reset when catch fish
ItsEmpa May 30, 2024
95e17ca
patternGroup
ItsEmpa May 31, 2024
95fccdf
add debug message
ItsEmpa May 31, 2024
7369a87
fix head location
ItsEmpa May 31, 2024
ebe3fcf
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
CalMWolfs Jun 2, 2024
4b6bb0f
add annotation
CalMWolfs Jun 2, 2024
5658a34
oops wrong module
CalMWolfs Jun 2, 2024
256f55b
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
CalMWolfs Jun 5, 2024
d014911
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
CalMWolfs Jun 5, 2024
5e8fcd9
fix merge
CalMWolfs Jun 5, 2024
3f468ec
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
CalMWolfs Jun 6, 2024
0b77987
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
CalMWolfs Jun 8, 2024
ba9e304
fix merge
CalMWolfs Jun 8, 2024
a5f0e3a
Merge branch 'refs/heads/beta' into feature/golden-fish-timer
ItsEmpa Jun 26, 2024
5130fc2
Merge branch 'refs/heads/beta' into fork/ItsEmpa/feature/golden-fish-…
hannibal002 Aug 26, 2024
68774c7
added checks to only show the golden fish timer while lava rod in inv…
hannibal002 Aug 26, 2024
b918efa
Merge branch 'refs/heads/beta' into feature/golden-fish-timer
ItsEmpa Sep 10, 2024
711c763
fix golden fish timer and duration formatting
ItsEmpa Sep 10, 2024
f12ee5b
Merge branch 'beta' into fork/ItsEmpa/feature/golden-fish-timer
hannibal002 Sep 10, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package at.hannibal2.skyhanni.config.features.fishing.trophyfishing;

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class GoldenFishTimerConfig {

@Expose
@ConfigOption(name = "Enabled", desc = "Enable the Golden Fish Timer.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = true;

@Expose
@ConfigOption(name = "Nametag", desc = "Show a nametag on the Golden Fish showing how weak it is and when it will despawn.")
@ConfigEditorBoolean
public boolean nametag = true;

@Expose
@ConfigOption(name = "Highlight when ready", desc = "Highlight the Golden Fish when it is ready to be caught.")
@ConfigEditorBoolean
public boolean highlight = true;

@Expose
@ConfigOption(name = "Throw Rod Warning", desc = "Show a warning when you are close to the time limit of throwing your rod.")
@ConfigEditorBoolean
public boolean throwRodWarning = false;

@Expose
@ConfigOption(name = "Show Head", desc = "Show the Golden Fish head in the Golden Fish Timer GUI.")
@ConfigEditorBoolean
public boolean showHead = true;

@Expose
@ConfigOption(name = "Throw Rod Warning Time", desc = "The time in seconds before the throw rod warning appears.")
@ConfigEditorSlider(minValue = 1, maxValue = 60, minStep = 1)
public int throwRodWarningTime = 20;

@Expose
@ConfigLink(owner = GoldenFishTimerConfig.class, field = "enabled")
public Position position = new Position(50, 80);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public class TrophyFishingConfig {
@Expose
public SulphurSkitterBoxConfig sulphurSkitterBox = new SulphurSkitterBoxConfig();

@Expose
@ConfigOption(name = "Golden Fish Timer", desc = "")
@Accordion
public GoldenFishTimerConfig goldenFishTimer = new GoldenFishTimerConfig();

@Expose
@ConfigOption(name = "Fillet Tooltip", desc = "Show fillet value of Trophy Fish in tooltip.")
@ConfigEditorBoolean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package at.hannibal2.skyhanni.events

import net.minecraft.entity.projectile.EntityFishHook

class FishingBobberInLiquidEvent(val bobber: EntityFishHook, val onWater: Boolean) : LorenzEvent()

This file was deleted.

24 changes: 13 additions & 11 deletions src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.fishing
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson
import at.hannibal2.skyhanni.events.FishingBobberCastEvent
import at.hannibal2.skyhanni.events.FishingBobberInWaterEvent
import at.hannibal2.skyhanni.events.FishingBobberInLiquidEvent
import at.hannibal2.skyhanni.events.ItemInHandChangeEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
Expand All @@ -13,16 +13,15 @@ import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemCategory
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.getLorenzVec
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.Minecraft
Expand Down Expand Up @@ -52,7 +51,7 @@ object FishingAPI {
private var waterRods = listOf<NEUInternalName>()

var bobber: EntityFishHook? = null
var bobberHasTouchedWater = false
var bobberHasTouchedLiquid = false

var wearingTrophyArmor = false

Expand All @@ -63,13 +62,13 @@ object FishingAPI {

lastCastTime = SimpleTimeMark.now()
bobber = event.entity
bobberHasTouchedWater = false
bobberHasTouchedLiquid = false
FishingBobberCastEvent(event.entity).postAndCatch()
}

private fun resetBobber() {
bobber = null
bobberHasTouchedWater = false
bobberHasTouchedLiquid = false
}

@SubscribeEvent
Expand All @@ -89,12 +88,15 @@ object FishingAPI {
if (bobber.isDead) {
resetBobber()
} else {
if (!bobberHasTouchedWater) {
val block = bobber.getLorenzVec().getBlockAt()
if (block in getAllowedBlocks()) {
bobberHasTouchedWater = true
FishingBobberInWaterEvent().postAndCatch()
if (!bobberHasTouchedLiquid) {
val isWater = when {
bobber.isInLava && holdingLavaRod -> false
bobber.isInWater && holdingWaterRod -> true
else -> return
}

bobberHasTouchedLiquid = true
FishingBobberInLiquidEvent(bobber, isWater).postAndCatch()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.fishing

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.FishingBobberInWaterEvent
import at.hannibal2.skyhanni.events.FishingBobberInLiquidEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI.isBait
Expand Down Expand Up @@ -48,7 +48,7 @@ object FishingBaitWarnings {
}

@SubscribeEvent
fun onBobberInWater(event: FishingBobberInWaterEvent) {
fun onBobber(event: FishingBobberInLiquidEvent) {
if (!isEnabled()) return
DelayedRun.runDelayed(500.milliseconds) {
checkBait()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.features.fishing

import at.hannibal2.skyhanni.events.FishingBobberInWaterEvent
import at.hannibal2.skyhanni.events.FishingBobberInLiquidEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.EntityUtils
Expand All @@ -26,7 +26,7 @@ object IsFishingDetection {
private var lastSeaCreatureKillAreaTime = SimpleTimeMark.farPast()

@SubscribeEvent
fun onBobberInWater(event: FishingBobberInWaterEvent) {
fun onBobber(event: FishingBobberInLiquidEvent) {
lastRodCastLocation = LocationUtils.playerLocation()
lastRodCastTime = SimpleTimeMark.now()
}
Expand Down
Loading
Loading