1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
package at.hannibal2.skyhanni.features.combat.mobs
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent
import at.hannibal2.skyhanni.events.EntityMaxHealthUpdateEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.withAlpha
import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.ignoreDerpy
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.monster.EntityCaveSpider
import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.entity.monster.EntitySpider
import net.minecraft.init.Blocks
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object MobHighlight {
private val config get() = SkyHanniMod.feature.combat.mobs
private var arachne: EntityLivingBase? = null
@SubscribeEvent
fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return
val entity = event.entity
val baseMaxHealth = entity.baseMaxHealth
if (config.corruptedMobHighlight && event.health == baseMaxHealth * 3) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_PURPLE.toColor().withAlpha(127)
)
{ config.corruptedMobHighlight }
}
}
@SubscribeEvent
fun onEntityHealthUpdate(event: EntityMaxHealthUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return
val entity = event.entity
val maxHealth = event.maxHealth
if (config.arachneKeeperHighlight && (maxHealth == 3_000 || maxHealth == 12_000) && entity is EntityCaveSpider) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_BLUE.toColor().withAlpha(127)
)
{ config.arachneKeeperHighlight }
}
if (config.corleoneHighlighter && maxHealth == 1_000_000 && entity is EntityOtherPlayerMP && entity.name == "Team Treasurite") {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_PURPLE.toColor().withAlpha(127)
)
{ config.corleoneHighlighter }
}
if (entity is EntityEnderman) {
val isZealot = maxHealth == 13_000 || maxHealth == 13_000 * 4 // runic
val isBruiser = maxHealth == 65_000 || maxHealth == 65_000 * 4 // runic
if (config.zealotBruiserHighlighter) {
if (isZealot || isBruiser) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_AQUA.toColor().withAlpha(127)
)
{ config.zealotBruiserHighlighter }
}
}
if (config.chestZealotHighlighter) {
val isHoldingChest = (entity as? EntityEnderman)?.getBlockInHand()?.block == Blocks.ender_chest
if ((isZealot || isBruiser) && isHoldingChest) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.GREEN.toColor().withAlpha(127)
)
{ config.chestZealotHighlighter }
}
}
// Special Zealots are not impacted by derpy
if (config.specialZealotHighlighter && maxHealth.ignoreDerpy() == 2_000) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
entity,
LorenzColor.DARK_RED.toColor().withAlpha(50)
)
{ config.specialZealotHighlighter }
}
}
if (entity is EntitySpider) {
checkArachne(entity)
}
}
@SubscribeEvent
fun onWorldRender(event: LorenzRenderWorldEvent) {
if (!LorenzUtils.inSkyBlock || !config.lineToArachne) return
val arachne = arachne ?: return
if (arachne.isDead || arachne.health <= 0) {
this.arachne = null
return
}
if (arachne.distanceToPlayer() > 10) return
event.draw3DLine(
event.exactPlayerEyeLocation(),
arachne.getLorenzVec().add(y = 1),
LorenzColor.RED.toColor(),
config.lineToArachneWidth,
true
)
}
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
arachne = null
}
private fun checkArachne(entity: EntitySpider) {
if (!config.arachneBossHighlighter && !config.lineToArachne) return
if (!entity.hasNameTagWith(1, "[§7Lv300§8] §cArachne") &&
!entity.hasNameTagWith(1, "[§7Lv300§8] §lArachne") &&
!entity.hasNameTagWith(1, "[§7Lv500§8] §cArachne") &&
!entity.hasNameTagWith(1, "[§7Lv500§8] §lArachne")
) return
if (entity is EntityCaveSpider) {
markArachneMinis(entity)
} else if (entity.baseMaxHealth == 20_000 || entity.baseMaxHealth == 100_000) {
this.arachne = entity
markArachne(entity)
}
}
private fun markArachneMinis(entity: EntityLivingBase) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.GOLD.toColor().withAlpha(50))
{ config.arachneBossHighlighter }
}
private fun markArachne(entity: EntityLivingBase) {
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(entity, LorenzColor.RED.toColor().withAlpha(50))
{ config.arachneBossHighlighter }
}
}
|