blob: bddbc4e9113a2aee812d3cc956cf4657e0a82c3c (
plain)
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
|
package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.RenderMobColoredEvent
import at.hannibal2.skyhanni.events.ResetEntityHurtEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.entity.EntityLiving
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class HellionShieldHelper {
companion object {
val hellionShieldMobs = mutableMapOf<EntityLiving, HellionShield>()
}
@SubscribeEvent
fun onRenderMobColored(event: RenderMobColoredEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return
val shield = hellionShieldMobs.getOrDefault(event.entity, null) ?: return
event.color = shield.color.toColor().withAlpha(80)
}
@SubscribeEvent
fun onResetEntityHurtTime(event: ResetEntityHurtEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return
hellionShieldMobs.getOrDefault(event.entity, null) ?: return
event.shouldReset = true
}
}
fun EntityLiving.setHellionShield(shield: HellionShield?) {
if (shield != null) {
HellionShieldHelper.hellionShieldMobs[this] = shield
} else {
HellionShieldHelper.hellionShieldMobs.remove(this)
}
}
|