blob: 03211eb5bbbf1983212e472f67d89e901cc6a77b (
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
|
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
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
import net.minecraftforge.fml.common.gameevent.TickEvent
class AshfangHideParticles {
var tick = 0
private var nearAshfang = false
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (!LorenzUtils.inSkyBlock) return
if (tick++ % 60 == 0) {
nearAshfang = DamageIndicatorManager.getDistanceTo(BossType.NETHER_ASHFANG) < 40
}
}
@SubscribeEvent
fun onReceivePacket(event: ReceiveParticleEvent) {
if (isEnabled()) {
event.isCanceled = true
}
}
@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 ?: continue
if (name == "§aFairy Souls") continue
if (name == "Glowstone") {
event.isCanceled = true
}
}
}
}
private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideParticles && nearAshfang
}
|