diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-08-26 10:27:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 10:27:32 +0200 |
commit | d13954de4de5d9a04380bb4105c13d7ae564255e (patch) | |
tree | b9ad05a6de3523231ed6ea5ff0259a7cc66497c3 /src/main/java/at/hannibal2/skyhanni/data | |
parent | 57224a6c4c4dac2eba2892f29ab4f41cee435995 (diff) | |
download | skyhanni-d13954de4de5d9a04380bb4105c13d7ae564255e.tar.gz skyhanni-d13954de4de5d9a04380bb4105c13d7ae564255e.tar.bz2 skyhanni-d13954de4de5d9a04380bb4105c13d7ae564255e.zip |
Feature: Starred Mob Highlight + Fels Highlight/Line (#1558)
Co-authored-by: Cal <cwolfson58@gmail.com>
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/mob/Mob.kt | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt index 1d5827490..7e7e9f96c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt @@ -115,10 +115,17 @@ class Mob( private var highlightColor: Color? = null - /** If no alpha is set or alpha is set to 255 it will set the alpha to 127 */ - fun highlight(color: Color) { - highlightColor = color.takeIf { it.alpha == 255 }?.addAlpha(127) ?: color - internalHighlight() + /** If [color] has no alpha or alpha is set to 255 it will set the alpha to 127 + * If [color] is set to null it removes a highlight*/ + fun highlight(color: Color?) { + if (color == highlightColor) return + if (color == null) { + internalRemoveColor() + highlightColor = null + } else { + highlightColor = color.takeIf { it.alpha == 255 }?.addAlpha(127) ?: color + internalHighlight() + } } private fun internalHighlight() { @@ -162,8 +169,10 @@ class Mob( } private fun makeRelativeBoundingBox() = - (baseEntity.entityBoundingBox.union(extraEntities.filter { it !is EntityArmorStand } - .mapNotNull { it.entityBoundingBox }))?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ) + (baseEntity.entityBoundingBox.union( + extraEntities.filter { it !is EntityArmorStand } + .mapNotNull { it.entityBoundingBox }, + ))?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ) fun fullEntityList() = baseEntity.toSingletonListOrEmpty() + |