aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt
blob: 1216afe6a5c12d14c80a4afd350654848ecc4ac8 (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
package at.hannibal2.skyhanni.features

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.SpawnParticleEvent
import at.hannibal2.skyhanni.utils.EntityUtils.getEntitiesNearby
import at.hannibal2.skyhanni.utils.LorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.monster.EntityBlaze
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class HideBlazeParticles {

    @SubscribeEvent
    fun onSpawnParticle(event: SpawnParticleEvent) {
        val particleId = event.particleId
        if (!SkyHanniMod.feature.misc.hideBlazeParticles) return

        val particleType = EnumParticleTypes.values().find { it.particleID == particleId }
        if (particleType != EnumParticleTypes.SMOKE_LARGE) return

        val location = LorenzVec(event.x, event.y, event.z)
        val clazz = EntityBlaze::class.java
        if (Minecraft.getMinecraft().theWorld.getEntitiesNearby(clazz, location, 3.0).isNotEmpty()) {
            event.isCanceled = true
        }
    }
}