blob: 4c228a436f6608446ac0b031798c8d7aeb87392b (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.combat.damageindicator.BossType
import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object AshfangHideParticles {
private var nearAshfang = false
@SubscribeEvent
fun onSecondPassed(event: SecondPassedEvent) {
if (!LorenzUtils.inSkyBlock) return
nearAshfang = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) < 40
}
@SubscribeEvent
fun onReceiveParticle(event: ReceiveParticleEvent) {
if (isEnabled()) {
event.cancel()
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!isEnabled()) return
val entity = event.entity
if (entity is EntityArmorStand) {
for (stack in entity.inventory) {
if (stack == null) continue
val name = stack.name
if (name == "§aFairy Souls") continue
if (name == "Glowstone") {
event.cancel()
}
}
}
}
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(2, "ashfang.hideParticles", "crimsonIsle.ashfang.hide.particles")
}
private fun isEnabled() =
LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.particles && nearAshfang
}
|