aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
index 1f4eda9a5..ad0a02453 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt
@@ -2,7 +2,9 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.utils.LocationUtils
+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
@@ -10,9 +12,9 @@ class ParticleHider {
@SubscribeEvent
fun onHypExplosions(event: ReceiveParticleEvent) {
- val distance = event.location.distance(LocationUtils.playerLocation())
+ val distanceToPlayer = event.distanceToPlayer
if (SkyHanniMod.feature.misc.hideFarParticles) {
- if (distance > 40) {
+ if (distanceToPlayer > 40) {
event.isCanceled = true
return
}
@@ -21,7 +23,7 @@ class ParticleHider {
val type = event.type
if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles) {
if (type == EnumParticleTypes.REDSTONE) {
- if (distance < 2) {
+ if (distanceToPlayer < 2) {
event.isCanceled = true
return
}
@@ -30,8 +32,14 @@ class ParticleHider {
if (SkyHanniMod.feature.misc.hideFireballParticles) {
if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) {
- event.isCanceled = true
- return
+ 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
+ }
+ }
}
}
}