aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-16 17:09:13 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-16 17:09:13 +0100
commit04cc6b44e2e433f25dd38bc709a2e652b2a693c9 (patch)
treeb6926c001b552c273bb22db264080786e379ff22 /src/main/java/at/hannibal2/skyhanni/features/misc
parentcb4fa47b4120dd8c18cbef01d673c051dd883ce8 (diff)
downloadskyhanni-04cc6b44e2e433f25dd38bc709a2e652b2a693c9.tar.gz
skyhanni-04cc6b44e2e433f25dd38bc709a2e652b2a693c9.tar.bz2
skyhanni-04cc6b44e2e433f25dd38bc709a2e652b2a693c9.zip
Fixed bug with particles that blocks NotEnoughUpdates' Fishing features.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-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
+ }
+ }
}
}
}