diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-11 01:27:52 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-02-11 01:27:52 +0100 |
commit | 36f1f795ac569c712d86d02192082e233a5f17d8 (patch) | |
tree | f2cc86e4103db866271584280b8da868dc709199 /src/main/java/at/hannibal2/skyhanni/mixins | |
parent | 9034699b2f0cd35691b41b43ebca67ea4febb17f (diff) | |
download | skyhanni-36f1f795ac569c712d86d02192082e233a5f17d8.tar.gz skyhanni-36f1f795ac569c712d86d02192082e233a5f17d8.tar.bz2 skyhanni-36f1f795ac569c712d86d02192082e233a5f17d8.zip |
Reworked entity highlight config for area mini bosses, slayer mini bosses, corrupted mobs and arachne keepers.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt index 371f97a68..036c75627 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt @@ -11,53 +11,55 @@ class RenderLivingEntityHelper { @SubscribeEvent fun onWorldChange(event: WorldEvent.Load) { entityColorMap.clear() + entityColorCondition.clear() + entityNoHurTime.clear() + entityNoHurTimeCondition.clear() } companion object { private val entityColorMap = mutableMapOf<EntityLivingBase, Int>() + private val entityColorCondition = mutableMapOf<EntityLivingBase, () -> Boolean>() + private val entityNoHurTime = mutableListOf<EntityLivingBase>() + private val entityNoHurTimeCondition = mutableMapOf<EntityLivingBase, () -> Boolean>() - fun <T : EntityLivingBase> setEntityColor(entity: T, color: Int) { + fun <T : EntityLivingBase> setEntityColor(entity: T, color: Int, condition: () -> Boolean) { entityColorMap[entity] = color + entityColorCondition[entity] = condition } - fun <T : EntityLivingBase> setNoHurtTime(entity: T) { + fun <T : EntityLivingBase> setNoHurtTime(entity: T, condition: () -> Boolean) { entityNoHurTime.add(entity) + entityNoHurTimeCondition[entity] = condition } - fun <T : EntityLivingBase> setColorMultiplier(entity: T, ): Int { + fun <T : EntityLivingBase> setColorMultiplier(entity: T): Int { if (entityColorMap.containsKey(entity)) { - return entityColorMap[entity]!! + val condition = entityColorCondition[entity]!! + if (condition.invoke()) { + return entityColorMap[entity]!! + } } //TODO remove event val event = RenderMobColoredEvent(entity, 0) event.postAndCatch() - val color = event.color - if (color != 0) { - //TODO remove? - entityColorMap[entity] = color - } - - return color + return event.color } fun <T : EntityLivingBase> changeHurtTime(entity: T): Int { if (entityNoHurTime.contains(entity)) { - return 0 + val condition = entityNoHurTimeCondition[entity]!! + if (condition.invoke()) { + return 0 + } } //TODO remove event val event = ResetEntityHurtEvent(entity, false) event.postAndCatch() - val shouldReset = event.shouldReset - - if (shouldReset) { - //TODO remove? - entityNoHurTime.add(entity) - } - return if (shouldReset) 0 else entity.hurtTime + return if (event.shouldReset) 0 else entity.hurtTime } } }
\ No newline at end of file |