aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/dungeon
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-06 17:56:02 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-06 17:56:02 +0200
commit84b9b27da573a33d845642547a50510bf8a8a234 (patch)
treebb9baadd6324890e5cda1b01aac39a73d717116a /src/main/java/at/hannibal2/skyhanni/dungeon
parentc9b4b56db48e935f7c671d0fe0c9c4a0e3edcfdf (diff)
downloadskyhanni-84b9b27da573a33d845642547a50510bf8a8a234.tar.gz
skyhanni-84b9b27da573a33d845642547a50510bf8a8a234.tar.bz2
skyhanni-84b9b27da573a33d845642547a50510bf8a8a234.zip
adding support for damage indicator outside dungeon
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/dungeon')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt (renamed from src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossDamageIndicator.kt)19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt (renamed from src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossFinder.kt)165
2 files changed, 93 insertions, 91 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt
index d9e149b7b..fe69dbd61 100644
--- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossDamageIndicator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossDamageIndicator.kt
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.dungeon.damageindicator
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.dungeon.DungeonData
import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent
-import at.hannibal2.skyhanni.events.DungeonEnterEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -17,33 +16,31 @@ import net.minecraft.util.Vec3
import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.event.entity.EntityJoinWorldEvent
+import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.text.DecimalFormat
import java.util.*
import kotlin.math.max
-class DungeonBossDamageIndicator {
+class BossDamageIndicator {
var data = mutableMapOf<EntityLivingBase, EntityData>()
- private var bossFinder: DungeonBossFinder? = null
+ private var bossFinder: BossFinder? = null
private val decimalFormat = DecimalFormat("0.0")
private val maxHealth = mutableMapOf<UUID, Int>()
@SubscribeEvent
- fun onDungeonStart(event: DungeonEnterEvent) {
- bossFinder = DungeonBossFinder()
+ fun onDungeonStart(event: WorldEvent.Load) {
+ bossFinder = BossFinder()
}
@SubscribeEvent(receiveCanceled = true)
fun onChatMessage(event: LorenzChatEvent) {
- if (!LorenzUtils.inDungeons) return
-
bossFinder?.handleChat(event.message)
}
@SubscribeEvent
fun onWorldRender(event: RenderWorldLastEvent) {
- if (!LorenzUtils.inDungeons) return
if (!SkyHanniMod.feature.dungeon.bossDamageIndicator) return
GlStateManager.disableDepth()
@@ -99,12 +96,12 @@ class DungeonBossDamageIndicator {
@SubscribeEvent
fun onRenderLivingPost(event: RenderLivingEvent.Post<*>) {
- if (!LorenzUtils.inDungeons) return
-
try {
val entity = event.entity
val result = bossFinder?.shouldShow(entity) ?: return
- checkLastBossDead(result.finalBoss, entity.entityId)
+ if (LorenzUtils.inDungeons) {
+ checkLastBossDead(result.finalBoss, entity.entityId)
+ }
val ignoreBlocks = result.ignoreBlocks
val delayedStart = result.delayedStart
diff --git a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossFinder.kt b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt
index 02538673f..9dab49492 100644
--- a/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/DungeonBossFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/dungeon/damageindicator/BossFinder.kt
@@ -11,12 +11,13 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.monster.EntityBlaze
import net.minecraft.entity.monster.EntityGhast
import net.minecraft.entity.monster.EntityGiantZombie
import net.minecraft.entity.monster.EntityGuardian
import java.util.*
-class DungeonBossFinder {
+class BossFinder {
//F1
private var floor1bonzo1 = false
@@ -225,110 +226,114 @@ class DungeonBossFinder {
}
fun handleChat(message: String) {
- when (message) {
- //F1
- "§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable." -> {
- floor1bonzo1 = true
- floor1bonzo1SpawnTime = System.currentTimeMillis() + 11_250
- }
+ if (LorenzUtils.inDungeons) {
+ when (message) {
+ //F1
+ "§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable." -> {
+ floor1bonzo1 = true
+ floor1bonzo1SpawnTime = System.currentTimeMillis() + 11_250
+ }
- "§c[BOSS] Bonzo§r§f: Oh noes, you got me.. what ever will I do?!" -> {
- floor1bonzo1 = false
- }
+ "§c[BOSS] Bonzo§r§f: Oh noes, you got me.. what ever will I do?!" -> {
+ floor1bonzo1 = false
+ }
- "§c[BOSS] Bonzo§r§f: Oh I'm dead!" -> {
- floor1bonzo2 = true
- floor1bonzo2SpawnTime = System.currentTimeMillis() + 4_200
- }
+ "§c[BOSS] Bonzo§r§f: Oh I'm dead!" -> {
+ floor1bonzo2 = true
+ floor1bonzo2SpawnTime = System.currentTimeMillis() + 4_200
+ }
- "§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all.." -> {
- floor1bonzo2 = false
- }
+ "§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all.." -> {
+ floor1bonzo2 = false
+ }
- //F2
- "§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!" -> {
- floor2summons1 = true
- floor2summons1SpawnTime = System.currentTimeMillis() + 3_500
- }
+ //F2
+ "§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!" -> {
+ floor2summons1 = true
+ floor2summons1SpawnTime = System.currentTimeMillis() + 3_500
+ }
- "§c[BOSS] Scarf§r§f: Those toys are not strong enough I see." -> {
- floor2summons1 = false
- }
+ "§c[BOSS] Scarf§r§f: Those toys are not strong enough I see." -> {
+ floor2summons1 = false
+ }
- "§c[BOSS] Scarf§r§f: Don't get too excited though." -> {
- floor2secondPhase = true
- floor2secondPhaseSpawnTime = System.currentTimeMillis() + 6_300
- }
+ "§c[BOSS] Scarf§r§f: Don't get too excited though." -> {
+ floor2secondPhase = true
+ floor2secondPhaseSpawnTime = System.currentTimeMillis() + 6_300
+ }
- "§c[BOSS] Scarf§r§f: Whatever..." -> {
- floor2secondPhase = false
- }
+ "§c[BOSS] Scarf§r§f: Whatever..." -> {
+ floor2secondPhase = false
+ }
- //F3
- "§c[BOSS] The Professor§r§f: I was burdened with terrible news recently..." -> {
- floor3GuardianShield = true
- floor3GuardianShieldSpawnTime = System.currentTimeMillis() + 16_400
- }
+ //F3
+ "§c[BOSS] The Professor§r§f: I was burdened with terrible news recently..." -> {
+ floor3GuardianShield = true
+ floor3GuardianShieldSpawnTime = System.currentTimeMillis() + 16_400
+ }
- "§c[BOSS] The Professor§r§f: Even if you took my barrier down, I can still fight." -> {
- floor3GuardianShield = false
- }
+ "§c[BOSS] The Professor§r§f: Even if you took my barrier down, I can still fight." -> {
+ floor3GuardianShield = false
+ }
- "§c[BOSS] The Professor§r§f: Oh? You found my Guardians one weakness?" -> {
- floor3Professor = true
- floor3ProfessorSpawnTime = System.currentTimeMillis() + 10_300
- }
+ "§c[BOSS] The Professor§r§f: Oh? You found my Guardians one weakness?" -> {
+ floor3Professor = true
+ floor3ProfessorSpawnTime = System.currentTimeMillis() + 10_300
+ }
- "§c[BOSS] The Professor§r§f: I see. You have forced me to use my ultimate technique." -> {
- floor3Professor = false
+ "§c[BOSS] The Professor§r§f: I see. You have forced me to use my ultimate technique." -> {
+ floor3Professor = false
- floor3ProfessorGuardianPrepare = true
- floor3ProfessorGuardianPrepareSpawnTime = System.currentTimeMillis() + 10_500
- }
+ floor3ProfessorGuardianPrepare = true
+ floor3ProfessorGuardianPrepareSpawnTime = System.currentTimeMillis() + 10_500
+ }
- "§c[BOSS] The Professor§r§f: The process is irreversible, but I'll be stronger than a Wither now!" -> {
- floor3ProfessorGuardian = true
- }
+ "§c[BOSS] The Professor§r§f: The process is irreversible, but I'll be stronger than a Wither now!" -> {
+ floor3ProfessorGuardian = true
+ }
- "§c[BOSS] The Professor§r§f: What?! My Guardian power is unbeatable!" -> {
- floor3ProfessorGuardian = false
- }
+ "§c[BOSS] The Professor§r§f: What?! My Guardian power is unbeatable!" -> {
+ floor3ProfessorGuardian = false
+ }
- //F5
- "§c[BOSS] Livid§r§f: This Orb you see, is Thorn, or what is left of him." -> {
- floor5lividEntity = findLivid()
- floor5lividEntitySpawnTime = System.currentTimeMillis() + 13_000
- }
+ //F5
+ "§c[BOSS] Livid§r§f: This Orb you see, is Thorn, or what is left of him." -> {
+ floor5lividEntity = findLivid()
+ floor5lividEntitySpawnTime = System.currentTimeMillis() + 13_000
+ }
- //F6
- "§c[BOSS] Sadan§r§f: ENOUGH!" -> {
- floor6Giants = true
- floor6GiantsSpawnTime = System.currentTimeMillis() + 7_400
- }
+ //F6
+ "§c[BOSS] Sadan§r§f: ENOUGH!" -> {
+ floor6Giants = true
+ floor6GiantsSpawnTime = System.currentTimeMillis() + 7_400
+ }
- "§c[BOSS] Sadan§r§f: You did it. I understand now, you have earned my respect." -> {
- floor6Giants = false
- floor6Sadan = true
- floor6SadanSpawnTime = System.currentTimeMillis() + 32_500
- }
+ "§c[BOSS] Sadan§r§f: You did it. I understand now, you have earned my respect." -> {
+ floor6Giants = false
+ floor6Sadan = true
+ floor6SadanSpawnTime = System.currentTimeMillis() + 32_500
+ }
- "§c[BOSS] Sadan§r§f: NOOOOOOOOO!!! THIS IS IMPOSSIBLE!!" -> {
- floor6Sadan = false
+ "§c[BOSS] Sadan§r§f: NOOOOOOOOO!!! THIS IS IMPOSSIBLE!!" -> {
+ floor6Sadan = false
+ }
}
- }
- if (message.matchRegex("§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!")) {
- floor5lividEntity = null
+ if (message.matchRegex("§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!")) {
+ floor5lividEntity = null
+ }
}
}
fun handleNewEntity(entity: Entity) {
- if (floor3ProfessorGuardian) {
- if (entity is EntityGuardian) {
- if (floor3ProfessorGuardianEntity == null) {
- floor3ProfessorGuardianEntity = entity
- floor3ProfessorGuardianPrepare = false
+ if (LorenzUtils.inDungeons) {
+ if (floor3ProfessorGuardian) {
+ if (entity is EntityGuardian) {
+ if (floor3ProfessorGuardianEntity == null) {
+ floor3ProfessorGuardianEntity = entity
+ floor3ProfessorGuardianPrepare = false
+ }
}
}
}