aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCarsCupcake <84076092+CarsCupcake@users.noreply.github.com>2024-04-06 01:20:46 +0200
committerGitHub <noreply@github.com>2024-04-06 01:20:46 +0200
commit202609cde2f74b7e6b789e2e5caa781a49ca7cdc (patch)
tree1883d2fe4c0c8f2ebf2d1607d0870285b11448d2 /src/main/java
parent4a76d31e9c1bef01b2d6617777f808ea03f117c2 (diff)
downloadskyhanni-202609cde2f74b7e6b789e2e5caa781a49ca7cdc.tar.gz
skyhanni-202609cde2f74b7e6b789e2e5caa781a49ca7cdc.tar.bz2
skyhanni-202609cde2f74b7e6b789e2e5caa781a49ca7cdc.zip
Feature: Shadow Assassin Jump Notification (#852)
Co-authored-by: Linnea Gräf <nea@nea.moe> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt32
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorWorldBoarderPacket.java14
4 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index f9f1ef742..904f47c29 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -116,6 +116,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonHighlightClickedBlocks
import at.hannibal2.skyhanni.features.dungeon.DungeonLividFinder
import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay
import at.hannibal2.skyhanni.features.dungeon.DungeonRankTabListColor
+import at.hannibal2.skyhanni.features.dungeon.DungeonShadowAssassinNotification
import at.hannibal2.skyhanni.features.dungeon.DungeonTeammateOutlines
import at.hannibal2.skyhanni.features.dungeon.HighlightDungeonDeathmite
import at.hannibal2.skyhanni.features.dungeon.TerracottaPhase
@@ -821,6 +822,7 @@ class SkyHanniMod {
loadModule(LimboPlaytime())
loadModule(RareDropMessages())
loadModule(CraftMaterialsFromBazaar())
+ loadModule(DungeonShadowAssassinNotification())
loadModule(PestProfitTracker)
loadModule(NoBitsWarning())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
index 516346d33..675e86ca7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
@@ -110,4 +110,11 @@ public class DungeonConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean croesusUnopenedChestTracker = true;
+
+ @Expose
+ @ConfigOption(name = "SA Jump Notification", desc = "Notifies you when a Shadow Assassin is about " +
+ "to jump on you.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean shadowAssassinJumpNotifier = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt
new file mode 100644
index 000000000..26144f940
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonShadowAssassinNotification.kt
@@ -0,0 +1,32 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.TitleManager
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.mixins.transformers.AccessorWorldBoarderPacket
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.SoundUtils
+import net.minecraft.network.play.server.S44PacketWorldBorder
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
+
+class DungeonShadowAssassinNotification {
+ private val config get() = SkyHanniMod.feature.dungeon
+
+ @SubscribeEvent
+ fun onWorldBoarderChange(event: PacketEvent.ReceiveEvent) {
+ if (!isEnabled()) return
+ if (DungeonAPI.dungeonFloor?.contains("3") == true && DungeonAPI.inBossRoom) return
+
+ val packet = event.packet as? AccessorWorldBoarderPacket ?: return
+ val action = packet.action
+ val warningTime = packet.warningTime
+
+ if (action == S44PacketWorldBorder.Action.INITIALIZE && warningTime == 10000) {
+ TitleManager.sendTitle("§cShadow Assassin Jumping!", 2.seconds, 3.6, 7.0f)
+ SoundUtils.playBeepSound()
+ }
+ }
+
+ private fun isEnabled() = LorenzUtils.inDungeons && config.shadowAssassinJumpNotifier
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorWorldBoarderPacket.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorWorldBoarderPacket.java
new file mode 100644
index 000000000..b65841521
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorWorldBoarderPacket.java
@@ -0,0 +1,14 @@
+package at.hannibal2.skyhanni.mixins.transformers;
+
+import net.minecraft.network.play.server.S44PacketWorldBorder;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(S44PacketWorldBorder.class)
+public interface AccessorWorldBoarderPacket {
+ @Accessor("action")
+ S44PacketWorldBorder.Action getAction();
+
+ @Accessor("warningTime")
+ int getWarningTime();
+}