aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-04 22:38:28 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-04 22:38:28 +0200
commita4db6ba2104c7e59364c75e06edd5fd291b72406 (patch)
treedc2b66f596e074f3dac357ec27d9d05eb261aadf /src
parent22f7ac624784bc70721022699bc430bcca2f6357 (diff)
downloadskyhanni-a4db6ba2104c7e59364c75e06edd5fd291b72406.tar.gz
skyhanni-a4db6ba2104c7e59364c75e06edd5fd291b72406.tar.bz2
skyhanni-a4db6ba2104c7e59364c75e06edd5fd291b72406.zip
added option to hide damage splashes around ashfang
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt27
5 files changed, 71 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index fdcefcea9..e7ca8c882 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -90,6 +90,7 @@ public class SkyHanniMod {
registerEvent(new AshfangBlazingSouls());
registerEvent(new AshfangBlazes());
registerEvent(new AshfangHideParticles());
+ registerEvent(new AshfangHideDamageIndicator());
registerEvent(new ItemStars());
registerEvent(new MinionFeatures());
registerEvent(new RealTime());
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java b/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
index 92d3b3bf4..909649633 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java
@@ -69,4 +69,9 @@ public class Ashfang {
@ConfigOption(name = "Ashfang Hide Names", desc = "Hide the name of full health blazes around ashfang (only useful when highlight blazes is enabled)")
@ConfigEditorBoolean
public boolean hideNames = false;
+
+ @Expose
+ @ConfigOption(name = "Ashfang Hide Damage", desc = "Hide damage splashes around ashfang")
+ @ConfigEditorBoolean
+ public boolean hideDamageSplash = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index de53ecfb2..3f9c88dac 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -40,7 +40,16 @@ class DamageIndicatorManager {
companion object {
private var data = mutableMapOf<UUID, EntityData>()
- val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)")
+ private val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)")
+
+ fun isDamageSplash(entity: EntityLivingBase): Boolean {
+ if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return false
+ if (!entity.hasCustomName()) return false
+ if (entity.isDead) return false
+ val name = entity.customNameTag.removeColor().replace(",", "")
+
+ return damagePattern.matcher(name).matches()
+ }
fun isBossSpawned(type: BossType): Boolean {
return data.entries.find { it.value.bossType == type } != null
@@ -176,8 +185,10 @@ class DamageIndicatorManager {
}
if (now > damageCounter.firstTick + 1_000) {
- damageCounter.oldDamages.add(0,
- OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing))
+ damageCounter.oldDamages.add(
+ 0,
+ OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing)
+ )
damageCounter.firstTick = 0L
damageCounter.currentDamage = 0
damageCounter.currentHealing = 0
@@ -389,6 +400,7 @@ class DamageIndicatorManager {
"§a3/3 "
}
}
+
BossType.SLAYER_ENDERMAN_4 -> {
val step = maxHealth / 6
calcMaxHealth = step
@@ -412,6 +424,7 @@ class DamageIndicatorManager {
"§a6/6 "
}
}
+
else -> return null
}
val result =
@@ -461,10 +474,15 @@ class DamageIndicatorManager {
66_000, 132_000 -> 1
0 -> 0
else -> {
- LorenzUtils.error("Unexpected health of thorn in f4! (${
- LorenzUtils.formatDouble(LorenzUtils.formatDouble(
- realHealth.toDouble()).toDouble())
- })")
+ LorenzUtils.error(
+ "Unexpected health of thorn in f4! (${
+ LorenzUtils.formatDouble(
+ LorenzUtils.formatDouble(
+ realHealth.toDouble()
+ ).toDouble()
+ )
+ })"
+ )
return null
}
}
@@ -481,10 +499,15 @@ class DamageIndicatorManager {
0 -> 0
else -> {
LorenzTest.text = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
- LorenzUtils.error("Unexpected health of thorn in m4! (${
- LorenzUtils.formatDouble(LorenzUtils.formatDouble(
- realHealth.toDouble()).toDouble())
- })")
+ LorenzUtils.error(
+ "Unexpected health of thorn in m4! (${
+ LorenzUtils.formatDouble(
+ LorenzUtils.formatDouble(
+ realHealth.toDouble()
+ ).toDouble()
+ )
+ })"
+ )
return null
}
}
@@ -551,11 +574,8 @@ class DamageIndicatorManager {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
val entity = event.entity
- if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return
- if (!entity.hasCustomName()) return
- if (entity.isDead) return
+ if (!isDamageSplash(entity)) return
val name = entity.customNameTag.removeColor().replace(",", "")
- if (!damagePattern.matcher(name).matches()) return
if (SkyHanniMod.feature.misc.fixSkytilsDamageSplash) {
entity.customNameTag = entity.customNameTag.replace(",", "")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt
index 397038401..62d28d3cb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt
@@ -2,9 +2,7 @@ package at.hannibal2.skyhanni.features.dungeon
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.entity.EntityLivingBase
-import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -16,13 +14,8 @@ class DungeonBossHideDamageSplash {
if (!SkyHanniMod.feature.dungeon.damageSplashBoss) return
if (!DungeonData.inBossRoom) return
- val entity = event.entity
- if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return
- if (!entity.hasCustomName()) return
- if (entity.isDead) return
- val name = entity.customNameTag.removeColor().replace(",", "")
- if (!DamageIndicatorManager.damagePattern.matcher(name).matches()) return
-
- event.isCanceled = true
+ if (DamageIndicatorManager.isDamageSplash(event.entity)) {
+ event.isCanceled = true
+ }
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt
new file mode 100644
index 000000000..3785a3f76
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt
@@ -0,0 +1,27 @@
+package at.hannibal2.skyhanni.features.nether.ashfang
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.features.damageindicator.BossType
+import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.entity.EntityLivingBase
+import net.minecraftforge.client.event.RenderLivingEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class AshfangHideDamageIndicator {
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
+ if (!isEnabled()) return
+
+ if (DamageIndicatorManager.isDamageSplash(event.entity)) {
+ event.isCanceled = true
+ }
+ }
+
+ private fun isEnabled(): Boolean {
+ return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideDamageSplash &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
+ }
+} \ No newline at end of file