aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt66
7 files changed, 108 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index b0574d046..7a4420407 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -21,10 +21,7 @@ import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper;
import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper;
import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder;
import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow;
-import at.hannibal2.skyhanni.features.fishing.BarnFishingTimer;
-import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager;
-import at.hannibal2.skyhanni.features.fishing.SeaCreatureMessageShortener;
-import at.hannibal2.skyhanni.features.fishing.TrophyFishMessages;
+import at.hannibal2.skyhanni.features.fishing.*;
import at.hannibal2.skyhanni.features.inventory.*;
import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles;
import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown;
@@ -174,8 +171,8 @@ public class SkyHanniMod {
loadModule(new BrewingStandOverlay());
loadModule(new BazaarUpdateTimer());
loadModule(new BarnFishingTimer());
-
loadModule(new CrimsonIsleReputationHelper(this));
+ loadModule(new SharkFishCounter());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 64bfe9541..ac9cd154b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -121,6 +121,11 @@ public class Features extends Config {
editOverlay(activeConfigCategory, 200, 16, fishing.barnTimerPos);
return;
}
+
+ if (runnableId.equals("sharkFishCounter")) {
+ editOverlay(activeConfigCategory, 200, 16, fishing.sharkFishCounterPos);
+ return;
+ }
}
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
index 958fe0b2e..52065e37b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java
@@ -67,4 +67,17 @@ public class Fishing {
minStep = 10
)
public int barnTimerAlertTime = 330;
+
+ @Expose
+ @ConfigOption(
+ name = "Shark Fish Counter",
+ desc = "Counts how many sharks have been caught."
+ )
+ @ConfigEditorBoolean
+ public boolean sharkFishCounter = false;
+
+ @Expose
+ @ConfigOption(name = "Shark Location", desc = "")
+ @ConfigEditorButton(runnableId = "sharkFishCounter", buttonText = "Edit")
+ public Position sharkFishCounterPos = new Position(10, 10, false, true);
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
index 95d9aff04..95572c213 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt
@@ -3,6 +3,8 @@ package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.LorenzActionBarEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
+import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.network.play.server.S02PacketChat
@@ -63,4 +65,12 @@ class ChatManager {
loggerModified.log("[modified] " + modified.formattedText)
}
}
+
+ @SubscribeEvent
+ fun onChatMessage(chatEvent: LorenzChatEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+
+ val seaCreature = SeaCreatureManager.getSeaCreature(chatEvent.message) ?: return
+ SeaCreatureFishEvent(seaCreature, chatEvent).postAndCatch()
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt
new file mode 100644
index 000000000..86c69549b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/SeaCreatureFishEvent.kt
@@ -0,0 +1,5 @@
+package at.hannibal2.skyhanni.events
+
+import at.hannibal2.skyhanni.features.fishing.SeaCreature
+
+class SeaCreatureFishEvent(val seaCreature: SeaCreature, val chatEvent: LorenzChatEvent): LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
index 6670a4a3e..2c310a7bd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
@@ -1,24 +1,21 @@
package at.hannibal2.skyhanni.features.fishing
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SeaCreatureMessageShortener {
@SubscribeEvent
- fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.inSkyBlock) return
+ fun onSeaCreatureFish(event: SeaCreatureFishEvent) {
if (!SkyHanniMod.feature.fishing.shortenFishingMessage) return
- val seaCreature = SeaCreatureManager.getSeaCreature(event.message)
- if (seaCreature != null) {
- event.blockedReason = "sea_create_caught"
- LorenzUtils.chat("§9You caught a $seaCreature§9!")
- if (seaCreature.fishingExperience == 0) {
- LorenzUtils.debug("no fishing exp set for " + seaCreature.displayName)
- }
+ val seaCreature = event.seaCreature
+ event.chatEvent.blockedReason = "sea_creature_caught"
+ LorenzUtils.chat("§9You caught a $seaCreature§9!")
+ if (seaCreature.fishingExperience == 0) {
+ LorenzUtils.debug("no fishing exp set for " + seaCreature.displayName)
}
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
new file mode 100644
index 000000000..a6253c25b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
@@ -0,0 +1,66 @@
+package at.hannibal2.skyhanni.features.fishing
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import net.minecraft.client.Minecraft
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+class SharkFishCounter {
+
+ private var counter = 0
+ private var display = "$counter sharks caught"
+ private var tick = 0
+ private var hasWaterRodInHand = false
+
+ @SubscribeEvent
+ fun onSeaCreatureFish(event: SeaCreatureFishEvent) {
+ if (!SkyHanniMod.feature.fishing.sharkFishCounter) return
+
+ val displayName = event.seaCreature.displayName
+ if (displayName.contains("Shark")) {
+ counter++
+ display = "$counter sharks caught"
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START) return
+
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.fishing.sharkFishCounter) return
+
+ tick++
+
+ if (tick % 10 == 0) {
+ hasWaterRodInHand = isWaterFishingRod()
+ }
+ }
+
+ private fun isWaterFishingRod(): Boolean {
+ val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return false
+ val isRod = heldItem.name?.contains("Rod") ?: return false
+ if (!isRod) return false
+
+ val isLavaRod = heldItem.getLore().any { it.contains("Lava Rod") }
+ if (isLavaRod) return false
+
+ return true
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: RenderGameOverlayEvent.Post) {
+ if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.fishing.sharkFishCounter) return
+ if (!hasWaterRodInHand) return
+
+ SkyHanniMod.feature.fishing.sharkFishCounterPos.renderString(display)
+ }
+} \ No newline at end of file