blob: ad0a02453a0e080bfa5fec8226eead891a917630 (
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
|
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.entity.projectile.EntitySmallFireball
import net.minecraft.util.EnumParticleTypes
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ParticleHider {
@SubscribeEvent
fun onHypExplosions(event: ReceiveParticleEvent) {
val distanceToPlayer = event.distanceToPlayer
if (SkyHanniMod.feature.misc.hideFarParticles) {
if (distanceToPlayer > 40) {
event.isCanceled = true
return
}
}
val type = event.type
if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles) {
if (type == EnumParticleTypes.REDSTONE) {
if (distanceToPlayer < 2) {
event.isCanceled = true
return
}
}
}
if (SkyHanniMod.feature.misc.hideFireballParticles) {
if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) {
for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList.toMutableList()) {
if (entity !is EntitySmallFireball) continue
val distance = entity.getLorenzVec().distance(event.location)
if (distance < 5) {
event.isCanceled = true
return
}
}
}
}
}
}
|