Fix equals case in lightning sounds
This commit is contained in:
parent
20515a30ae
commit
6ec7d9f674
1 changed files with 7 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
From 9562e7d3f00411e9426c18af31edd06e519a1ed3 Mon Sep 17 00:00:00 2001
|
||||
From d723ec8024fb555d6ba49215319aafbf74c3a0ff Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue