geforkt von Mirrors/Paper
aba4969668
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e970fd72 Remove incorrect javadoc from TargetReason 84df6df1 SPIGOT-5282: Improve bucket event API CraftBukkit Changes:b2bcde89
SPIGOT-5258: TNT Not Moving Players in Creative Mode44d675ad
SPIGOT-5263: Chests stay open after InventoryOpenEvent cancelled.2439178e
SPIGOT-5278: EntityDrowned memory leak7055c931
SPIGOT-5264: Call event for experience orbs losing their target49141172
SPIGOT-5282: Improve bucket event API6bbb3b04
SPIGOT-5281: Clearer error messages for ChunkSnapshot misuse
87 Zeilen
4.7 KiB
Diff
87 Zeilen
4.7 KiB
Diff
From e67da0dbb682fc754406f55ee184f670219f84c8 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
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 7e031d18e..63f313a92 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -234,6 +234,28 @@ public class PaperWorldConfig {
|
|
skeleHorseSpawnChance = 0.01D; // Vanilla value
|
|
}
|
|
}
|
|
+
|
|
+ public double sqrMaxThunderDistance;
|
|
+ public double sqrMaxLightningImpactSoundDistance;
|
|
+ public double maxLightningFlashDistance;
|
|
+ private void lightningStrikeDistanceLimit() {
|
|
+ sqrMaxThunderDistance = getInt("lightning-strike-distance-limit.sound", -1);
|
|
+ if (sqrMaxThunderDistance > 0) {
|
|
+ sqrMaxThunderDistance *= sqrMaxThunderDistance;
|
|
+ }
|
|
+
|
|
+ sqrMaxLightningImpactSoundDistance = getInt("lightning-strike-distance-limit.impact-sound", -1);
|
|
+ if (sqrMaxLightningImpactSoundDistance < 0) {
|
|
+ sqrMaxLightningImpactSoundDistance = 32 * 32; //Vanilla value
|
|
+ } else {
|
|
+ sqrMaxLightningImpactSoundDistance *= sqrMaxLightningImpactSoundDistance;
|
|
+ }
|
|
+
|
|
+ maxLightningFlashDistance = getInt("lightning-strike-distance-limit.flash", -1);
|
|
+ if (maxLightningFlashDistance < 0) {
|
|
+ maxLightningFlashDistance = 512; // Vanilla value
|
|
+ }
|
|
+ }
|
|
|
|
public int fixedInhabitedTime;
|
|
private void fixedInhabitedTime() {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
|
index 2ceee79cf..27bf271bb 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
|
@@ -64,6 +64,17 @@ public class EntityLightning extends Entity {
|
|
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) {
|
|
+ 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));
|
|
+ }
|
|
+
|
|
+ if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ // Paper end
|
|
if (distanceSquared > viewDistance * viewDistance) {
|
|
double deltaLength = Math.sqrt(distanceSquared);
|
|
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
|
@@ -74,7 +85,7 @@ public class EntityLightning extends Entity {
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
- this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
|
+ //this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop)
|
|
}
|
|
|
|
--this.lifeTicks;
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 55d469e37..62f9a068f 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1217,7 +1217,7 @@ public class WorldServer extends World {
|
|
}
|
|
// CraftBukkit end
|
|
this.globalEntityList.add(entitylightning);
|
|
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension
|
|
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance
|
|
}
|
|
|
|
@Override
|
|
--
|
|
2.23.0
|
|
|