Skip to content

Commit

Permalink
fixing custom damage splash form skytils, fixing 'hide damage splash …
Browse files Browse the repository at this point in the history
…next to damage indicator'
  • Loading branch information
hannibal002 committed Aug 19, 2022
1 parent daefac6 commit bd6a39b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public class Misc {
@ConfigEditorBoolean
public boolean summonSoulDisplay = false;

@Expose
@ConfigOption(name = "Skytils Damage Splash", desc = "Fixing the custom damage splash feature from skytils.")
@ConfigEditorBoolean
public boolean fixSkytilsDamageSplash = true;

@Expose
@ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.")
@ConfigEditorBoolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,25 +543,27 @@ class DamageIndicatorManager {
bossFinder?.handleNewEntity(event.entity)
}

@SubscribeEvent(priority = EventPriority.HIGHEST)
@SubscribeEvent(priority = EventPriority.HIGH)
fun onRenderLiving(e: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
if (!SkyHanniMod.feature.damageIndicator.hideDamageSplash) return

val entity = e.entity
if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return
if (!entity.hasCustomName()) return
if (entity.isDead) return
val strippedName = entity.customNameTag.removeColor()
val strippedName = entity.customNameTag.removeColor().replace(",", "")
val damageMatcher = damagePattern.matcher(strippedName)
if (damageMatcher.matches()) {
if (!damageMatcher.matches()) return

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

if (SkyHanniMod.feature.damageIndicator.hideDamageSplash) {
if (data.values.any {
val distance = it.entity.getLorenzVec().distance(entity.getLorenzVec())
val found = distance < 4.5
found
distance < 4.5
}) {
e.isCanceled = true
}
}
}

}

0 comments on commit bd6a39b

Please sign in to comment.