diff --git a/Spigot-Server-Patches/0393-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0393-Limit-lightning-strike-effect-distance.patch index 665f8f93e2..8d6f9fda29 100644 --- a/Spigot-Server-Patches/0393-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0393-Limit-lightning-strike-effect-distance.patch @@ -1,4 +1,4 @@ -From 9562e7d3f00411e9426c18af31edd06e519a1ed3 Mon Sep 17 00:00:00 2001 +From d723ec8024fb555d6ba49215319aafbf74c3a0ff Mon Sep 17 00:00:00 2001 From: Trigary Date: Fri, 14 Sep 2018 17:42:08 +0200 Subject: [PATCH] Limit lightning strike effect distance @@ -40,24 +40,25 @@ 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 -@@ -60,6 +60,13 @@ public class EntityLightning extends EntityWeather { +@@ -60,6 +60,14 @@ public class EntityLightning extends EntityWeather { double deltaX = this.locX - player.locX; 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); double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; -@@ -70,7 +77,7 @@ public class EntityLightning extends EntityWeather { +@@ -70,7 +78,7 @@ public class EntityLightning extends EntityWeather { } } // CraftBukkit end