aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
blob: 1f4eda9a5aafb8876340ef98e02cb8b7cd139625 (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
package at.hannibal2.skyhanni.features.misc

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.LocationUtils
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class ParticleHider {

    @SubscribeEvent
    fun onHypExplosions(event: ReceiveParticleEvent) {
        val distance = event.location.distance(LocationUtils.playerLocation())
        if (SkyHanniMod.feature.misc.hideFarParticles) {
            if (distance > 40) {
                event.isCanceled = true
                return
            }
        }

        val type = event.type
        if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles) {
            if (type == EnumParticleTypes.REDSTONE) {
                if (distance < 2) {
                    event.isCanceled = true
                    return
                }
            }
        }

        if (SkyHanniMod.feature.misc.hideFireballParticles) {
            if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) {
                event.isCanceled = true
                return
            }
        }
    }
}