From 4a6e5b036f7de1e34e8c2cb2a81a7477d5688f73 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Tue, 16 Oct 2018 21:40:32 -0400 Subject: [PATCH] Fix equals case in lightning sounds --- .../Limit-lightning-strike-effect-distance.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch index aa92bd9b4..c81b312e2 100644 --- a/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch @@ -40,7 +40,7 @@ index 93bf8c6d3..25246eac5 100644 public boolean firePhysicsEventForRedstone = false; private void firePhysicsEventForRedstone() { diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index afbe43dd3..b7e88d346 100644 +index afbe43dd3..f64e6e864 100644 --- a/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java @@ -0,0 +0,0 @@ public class EntityLightning extends EntityWeather { @@ -48,11 +48,12 @@ index afbe43dd3..b7e88d346 100644 double deltaZ = this.locZ - player.locZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + // Paper start - Limit lightning strike effect distance -+ if (distanceSquared < this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { ++ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { + player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, + SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); ++ } else { ++ continue; + } -+ if (distanceSquared > this.world.paperConfig.sqrMaxLightningSoundDistance) continue; + // Paper end if (distanceSquared > viewDistance * viewDistance) { double deltaLength = Math.sqrt(distanceSquared);