Skip to content

Commit dbecfbc

Browse files
committed
added option to hide damage splashes around ashfang
1 parent 1e2d4f8 commit dbecfbc

File tree

7 files changed

+73
-25
lines changed

7 files changed

+73
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Added highlight for the different ashfang blazes in their respective color
1313
- Added option to hide all the particles around the ashfang boss
1414
- Added option to hide the name of full health blazes around ashfang (only useful when highlight blazes is enabled)
15+
- Added option to hide damage splashes around ashfang
1516

1617
### Minor Changes
1718
- Optimizing the highlight block size for minions, blazing souls and gravity orbs

FEATURES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
- Highlight the different ashfang blazes in their respective color
4545
- Option to hide all the particles around the ashfang boss
4646
- Option to hide the name of full health blazes around ashfang (only useful when highlight blazes is enabled)
47+
- Option to hide damage splashes around ashfang
4748

4849

4950
## Minion

src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public void preInit(FMLPreInitializationEvent event) {
9090
registerEvent(new AshfangBlazingSouls());
9191
registerEvent(new AshfangBlazes());
9292
registerEvent(new AshfangHideParticles());
93+
registerEvent(new AshfangHideDamageIndicator());
9394
registerEvent(new ItemStars());
9495
registerEvent(new MinionFeatures());
9596
registerEvent(new RealTime());

src/main/java/at/hannibal2/skyhanni/config/features/Ashfang.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,9 @@ public class Ashfang {
6969
@ConfigOption(name = "Ashfang Hide Names", desc = "Hide the name of full health blazes around ashfang (only useful when highlight blazes is enabled)")
7070
@ConfigEditorBoolean
7171
public boolean hideNames = false;
72+
73+
@Expose
74+
@ConfigOption(name = "Ashfang Hide Damage", desc = "Hide damage splashes around ashfang")
75+
@ConfigEditorBoolean
76+
public boolean hideDamageSplash = false;
7277
}

src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ class DamageIndicatorManager {
4040

4141
companion object {
4242
private var data = mutableMapOf<UUID, EntityData>()
43-
val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)")
43+
private val damagePattern: Pattern = Pattern.compile("✧?(\\d+[⚔+✧❤♞☄✷ﬗ]*)")
44+
45+
fun isDamageSplash(entity: EntityLivingBase): Boolean {
46+
if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return false
47+
if (!entity.hasCustomName()) return false
48+
if (entity.isDead) return false
49+
val name = entity.customNameTag.removeColor().replace(",", "")
50+
51+
return damagePattern.matcher(name).matches()
52+
}
4453

4554
fun isBossSpawned(type: BossType): Boolean {
4655
return data.entries.find { it.value.bossType == type } != null
@@ -176,8 +185,10 @@ class DamageIndicatorManager {
176185
}
177186

178187
if (now > damageCounter.firstTick + 1_000) {
179-
damageCounter.oldDamages.add(0,
180-
OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing))
188+
damageCounter.oldDamages.add(
189+
0,
190+
OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing)
191+
)
181192
damageCounter.firstTick = 0L
182193
damageCounter.currentDamage = 0
183194
damageCounter.currentHealing = 0
@@ -389,6 +400,7 @@ class DamageIndicatorManager {
389400
"§a3/3 "
390401
}
391402
}
403+
392404
BossType.SLAYER_ENDERMAN_4 -> {
393405
val step = maxHealth / 6
394406
calcMaxHealth = step
@@ -412,6 +424,7 @@ class DamageIndicatorManager {
412424
"§a6/6 "
413425
}
414426
}
427+
415428
else -> return null
416429
}
417430
val result =
@@ -461,10 +474,15 @@ class DamageIndicatorManager {
461474
66_000, 132_000 -> 1
462475
0 -> 0
463476
else -> {
464-
LorenzUtils.error("Unexpected health of thorn in f4! (${
465-
LorenzUtils.formatDouble(LorenzUtils.formatDouble(
466-
realHealth.toDouble()).toDouble())
467-
})")
477+
LorenzUtils.error(
478+
"Unexpected health of thorn in f4! (${
479+
LorenzUtils.formatDouble(
480+
LorenzUtils.formatDouble(
481+
realHealth.toDouble()
482+
).toDouble()
483+
)
484+
})"
485+
)
468486
return null
469487
}
470488
}
@@ -481,10 +499,15 @@ class DamageIndicatorManager {
481499
0 -> 0
482500
else -> {
483501
LorenzTest.text = "thorn has ${LorenzUtils.formatDouble(realHealth.toDouble())} hp!"
484-
LorenzUtils.error("Unexpected health of thorn in m4! (${
485-
LorenzUtils.formatDouble(LorenzUtils.formatDouble(
486-
realHealth.toDouble()).toDouble())
487-
})")
502+
LorenzUtils.error(
503+
"Unexpected health of thorn in m4! (${
504+
LorenzUtils.formatDouble(
505+
LorenzUtils.formatDouble(
506+
realHealth.toDouble()
507+
).toDouble()
508+
)
509+
})"
510+
)
488511
return null
489512
}
490513
}
@@ -551,11 +574,8 @@ class DamageIndicatorManager {
551574
@SubscribeEvent(priority = EventPriority.HIGH)
552575
fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
553576
val entity = event.entity
554-
if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return
555-
if (!entity.hasCustomName()) return
556-
if (entity.isDead) return
577+
if (!isDamageSplash(entity)) return
557578
val name = entity.customNameTag.removeColor().replace(",", "")
558-
if (!damagePattern.matcher(name).matches()) return
559579

560580
if (SkyHanniMod.feature.misc.fixSkytilsDamageSplash) {
561581
entity.customNameTag = entity.customNameTag.replace(",", "")

src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonBossHideDamageSplash.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package at.hannibal2.skyhanni.features.dungeon
22

33
import at.hannibal2.skyhanni.SkyHanniMod
44
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
5-
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
65
import net.minecraft.entity.EntityLivingBase
7-
import net.minecraft.entity.item.EntityArmorStand
86
import net.minecraftforge.client.event.RenderLivingEvent
97
import net.minecraftforge.fml.common.eventhandler.EventPriority
108
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -16,13 +14,8 @@ class DungeonBossHideDamageSplash {
1614
if (!SkyHanniMod.feature.dungeon.damageSplashBoss) return
1715
if (!DungeonData.inBossRoom) return
1816

19-
val entity = event.entity
20-
if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return
21-
if (!entity.hasCustomName()) return
22-
if (entity.isDead) return
23-
val name = entity.customNameTag.removeColor().replace(",", "")
24-
if (!DamageIndicatorManager.damagePattern.matcher(name).matches()) return
25-
26-
event.isCanceled = true
17+
if (DamageIndicatorManager.isDamageSplash(event.entity)) {
18+
event.isCanceled = true
19+
}
2720
}
2821
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package at.hannibal2.skyhanni.features.nether.ashfang
2+
3+
import at.hannibal2.skyhanni.SkyHanniMod
4+
import at.hannibal2.skyhanni.features.damageindicator.BossType
5+
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
6+
import at.hannibal2.skyhanni.utils.LorenzUtils
7+
import net.minecraft.entity.EntityLivingBase
8+
import net.minecraftforge.client.event.RenderLivingEvent
9+
import net.minecraftforge.fml.common.eventhandler.EventPriority
10+
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
11+
12+
class AshfangHideDamageIndicator {
13+
14+
@SubscribeEvent(priority = EventPriority.HIGH)
15+
fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
16+
if (!isEnabled()) return
17+
18+
if (DamageIndicatorManager.isDamageSplash(event.entity)) {
19+
event.isCanceled = true
20+
}
21+
}
22+
23+
private fun isEnabled(): Boolean {
24+
return LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideDamageSplash &&
25+
DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
26+
}
27+
}

0 commit comments

Comments
 (0)