aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-09-21 13:03:18 +0200
committerGitHub <noreply@github.com>2024-09-21 13:03:18 +0200
commit1052203d26f8ded5d7a1b1eb25a32e0ce2e6c784 (patch)
treebc9c0b23aa5ed85562da4c6f8c30721f5a3d444d /src/main/java/at/hannibal2/skyhanni/data
parent1739a5f13194bc136e169a7870a14c2704174be8 (diff)
downloadskyhanni-1052203d26f8ded5d7a1b1eb25a32e0ce2e6c784.tar.gz
skyhanni-1052203d26f8ded5d7a1b1eb25a32e0ce2e6c784.tar.bz2
skyhanni-1052203d26f8ded5d7a1b1eb25a32e0ce2e6c784.zip
Feature: Carry Tracker (#2185)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OtherPlayersSlayerAPI.kt36
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CarryTrackerJson.kt8
2 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OtherPlayersSlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/OtherPlayersSlayerAPI.kt
new file mode 100644
index 000000000..0401746c4
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/OtherPlayersSlayerAPI.kt
@@ -0,0 +1,36 @@
+package at.hannibal2.skyhanni.data
+
+import at.hannibal2.skyhanni.data.mob.Mob
+import at.hannibal2.skyhanni.events.MobEvent
+import at.hannibal2.skyhanni.events.entity.slayer.SlayerDeathEvent
+import at.hannibal2.skyhanni.features.slayer.SlayerType
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import at.hannibal2.skyhanni.test.command.ErrorManager
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@SkyHanniModule
+object OtherPlayersSlayerAPI {
+
+ @SubscribeEvent
+ fun onMobDespawn(event: MobEvent.DeSpawn.SkyblockMob) {
+ val mob = event.mob
+
+ // no death, rather despawn because too far away
+ if (mob.baseEntity.health != 0f) return
+
+ if (mob.mobType != Mob.Type.SLAYER) return
+
+ val owner = mob.owner?.ownerName
+ val tier = mob.levelOrTier
+ val name = mob.name
+ val slayerType = SlayerType.getByName(name) ?: run {
+ ErrorManager.logErrorStateWithData(
+ "Unknown slayer type found", "unknown slayer",
+ "name" to name,
+ )
+ return
+ }
+
+ SlayerDeathEvent(slayerType, tier, owner).post()
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CarryTrackerJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CarryTrackerJson.kt
new file mode 100644
index 000000000..1819b36b9
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/CarryTrackerJson.kt
@@ -0,0 +1,8 @@
+package at.hannibal2.skyhanni.data.jsonobjects.repo
+
+import com.google.gson.annotations.Expose
+import com.google.gson.annotations.SerializedName
+
+data class CarryTrackerJson(
+ @Expose @SerializedName("slayer_names") val slayerNames: Map<String, List<String>>,
+)