1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-03 13:27:23 +01:00

Fix equals case in lightning sounds

This commit is contained in:
Zach Brown 2018-10-16 21:40:32 -04:00
parent cdbdd636e7
commit 4a6e5b036f

View file

@ -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);