Fix thunder sounds not playing properly
This commit is contained in:
parent
e6d31d59dd
commit
e73ace252e
3 changed files with 26 additions and 25 deletions
|
@ -1,27 +1,25 @@
|
||||||
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
From aa465a00b42e0ce2a01128f6259dc8b5ae402186 Mon Sep 17 00:00:00 2001
|
||||||
From: Trigary <trigary0@gmail.com>
|
From: Trigary <trigary0@gmail.com>
|
||||||
Date: Fri, 14 Sep 2018 17:42:08 +0200
|
Date: Fri, 14 Sep 2018 17:42:08 +0200
|
||||||
Subject: [PATCH] Limit lightning strike effect distance
|
Subject: [PATCH] Limit lightning strike effect distance
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index 93bf8c6d..f94fa5df 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -237,6 +237,30 @@ public class PaperWorldConfig {
|
@@ -237,6 +237,28 @@ public class PaperWorldConfig {
|
||||||
skeleHorseSpawnChance = 0.01D; // Vanilla value
|
skeleHorseSpawnChance = 0.01D; // Vanilla value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public double sqrMaxLightningSoundDistance;
|
+ public double sqrMaxThunderDistance;
|
||||||
+ public double sqrMaxLightningImpactSoundDistance;
|
+ public double sqrMaxLightningImpactSoundDistance;
|
||||||
+ public double maxLightningFlashDistance;
|
+ public double maxLightningFlashDistance;
|
||||||
+ private void lightningStrikeDistanceLimit() {
|
+ private void lightningStrikeDistanceLimit() {
|
||||||
+ sqrMaxLightningSoundDistance = getInt("lightning-strike-distance-limit.sound", -1);
|
+ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1);
|
||||||
+ if (sqrMaxLightningSoundDistance < 0) {
|
+ if (sqrMaxThunderDistance > 0) {
|
||||||
+ sqrMaxLightningSoundDistance = Double.MAX_VALUE;
|
+ sqrMaxThunderDistance *= sqrMaxThunderDistance;
|
||||||
+ } else {
|
|
||||||
+ sqrMaxLightningSoundDistance *= sqrMaxLightningSoundDistance;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1);
|
+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1);
|
||||||
|
@ -40,10 +38,10 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||||
public boolean firePhysicsEventForRedstone = false;
|
public boolean firePhysicsEventForRedstone = false;
|
||||||
private void firePhysicsEventForRedstone() {
|
private void firePhysicsEventForRedstone() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index afbe43dd..d732be52 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||||
@@ -60,6 +60,14 @@ public class EntityLightning extends EntityWeather {
|
@@ -60,6 +60,17 @@ public class EntityLightning extends EntityWeather {
|
||||||
double deltaX = this.locX - player.locX;
|
double deltaX = this.locX - player.locX;
|
||||||
double deltaZ = this.locZ - player.locZ;
|
double deltaZ = this.locZ - player.locZ;
|
||||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||||
|
@ -51,14 +49,17 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||||
+ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) {
|
+ if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) {
|
||||||
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT,
|
+ 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));
|
+ SoundCategory.WEATHER, this.locX, this.locY, this.locZ, 2.0f, 0.5F + this.random.nextFloat() * 0.2F));
|
||||||
+ } else {
|
+ }
|
||||||
|
+
|
||||||
|
+ if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) {
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (distanceSquared > viewDistance * viewDistance) {
|
if (distanceSquared > viewDistance * viewDistance) {
|
||||||
double deltaLength = Math.sqrt(distanceSquared);
|
double deltaLength = Math.sqrt(distanceSquared);
|
||||||
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
||||||
@@ -70,7 +78,7 @@ public class EntityLightning extends EntityWeather {
|
@@ -70,7 +81,7 @@ public class EntityLightning extends EntityWeather {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -68,7 +69,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||||
|
|
||||||
--this.lifeTicks;
|
--this.lifeTicks;
|
||||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index a54ea5a6..818e4c37 100644
|
||||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
@@ -1087,7 +1087,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
@@ -1087,7 +1087,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
|
From b11f5d117ae187d77bf6ebab8612110d6c48ba17 Mon Sep 17 00:00:00 2001
|
||||||
From: Gabriele C <sgdc3.mail@gmail.com>
|
From: Gabriele C <sgdc3.mail@gmail.com>
|
||||||
Date: Mon, 22 Oct 2018 17:34:10 +0200
|
Date: Mon, 22 Oct 2018 17:34:10 +0200
|
||||||
Subject: [PATCH] Add option to prevent players from moving into unloaded
|
Subject: [PATCH] Add option to prevent players from moving into unloaded
|
||||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index f94fa5df..1a8a9026 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -564,4 +564,9 @@ public class PaperWorldConfig {
|
@@ -562,4 +562,9 @@ public class PaperWorldConfig {
|
||||||
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks"));
|
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks"));
|
||||||
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
index 7ac07ac07ac0..7ac07ac07ac0 100644
|
index 1e7f980e..4c1f17f8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
@@ -342,6 +342,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
@@ -342,6 +342,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From b49f9544a9d45081de36ca836fe839a8f84ce6c2 Mon Sep 17 00:00:00 2001
|
From d86c84eaf859b8946d009e18c515d55abbbaeee5 Mon Sep 17 00:00:00 2001
|
||||||
From: theosib <millerti@172.16.221.1>
|
From: theosib <millerti@172.16.221.1>
|
||||||
Date: Thu, 27 Sep 2018 01:43:35 -0600
|
Date: Thu, 27 Sep 2018 01:43:35 -0600
|
||||||
Subject: [PATCH] Optimize redstone algorithm
|
Subject: [PATCH] Optimize redstone algorithm
|
||||||
|
@ -19,10 +19,10 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
|
||||||
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index eabb2c1ba..5fb6e263a 100644
|
index 1a8a9026..69b42be4 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -569,4 +569,14 @@ public class PaperWorldConfig {
|
@@ -567,4 +567,14 @@ public class PaperWorldConfig {
|
||||||
private void preventMovingIntoUnloadedChunks() {
|
private void preventMovingIntoUnloadedChunks() {
|
||||||
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
|
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ index eabb2c1ba..5fb6e263a 100644
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
|
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..21d9d6d7e
|
index 00000000..21d9d6d7
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
|
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
|
||||||
@@ -0,0 +1,910 @@
|
@@ -0,0 +1,910 @@
|
||||||
|
@ -954,7 +954,7 @@ index 000000000..21d9d6d7e
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||||
index 80bad6755..3b45489a4 100644
|
index 80bad675..3b45489a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||||
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
|
||||||
@@ -1,5 +1,7 @@
|
@@ -1,5 +1,7 @@
|
||||||
|
@ -1140,7 +1140,7 @@ index 80bad6755..3b45489a4 100644
|
||||||
iblockdata.a(world, blockposition, 0);
|
iblockdata.a(world, blockposition, 0);
|
||||||
world.setAir(blockposition);
|
world.setAir(blockposition);
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index 7914f9b60..cdbb247da 100644
|
index 7914f9b6..cdbb247d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -646,6 +646,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
@@ -646,6 +646,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||||
|
@ -1160,5 +1160,5 @@ index 7914f9b60..cdbb247da 100644
|
||||||
int i = 0;
|
int i = 0;
|
||||||
EnumDirection[] aenumdirection = World.a;
|
EnumDirection[] aenumdirection = World.a;
|
||||||
--
|
--
|
||||||
2.19.1.windows.1
|
2.19.1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue