blob: 421ffb7253d949bf847f091a0d4e8b6f54bd4a3b (
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
|
package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
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.LorenzUtils
import net.minecraft.entity.EntityLiving
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object HellionShieldHelper {
val hellionShieldMobs = mutableMapOf<EntityLiving, HellionShield>()
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(3, "slayer.blazeColoredMobs", "slayer.blazes.hellion.coloredMobs")
}
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
hellionShieldMobs.clear()
}
fun EntityLiving.setHellionShield(shield: HellionShield?) {
if (shield != null) {
hellionShieldMobs[this] = shield
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
this,
shield.color.toColor().withAlpha(80)
) { LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazes.hellion.coloredMobs }
} else {
hellionShieldMobs.remove(this)
RenderLivingEntityHelper.removeCustomRender(this)
}
}
}
|