diff options
author | Aikar <[email protected]> | 2020-05-23 17:15:40 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2020-05-23 17:17:14 -0400 |
commit | 64cfcf3e4b16148cdc352d58a29e3428715b1157 (patch) | |
tree | 0c8779b782d0a3e3d3c62c96ac5d6a98e693c945 /Spigot-Server-Patches/0004-MC-Utils.patch | |
parent | cf82dad399cf3bfb6b4cdd54f264d4563633940e (diff) | |
download | Paper-64cfcf3e4b16148cdc352d58a29e3428715b1157.tar.gz Paper-64cfcf3e4b16148cdc352d58a29e3428715b1157.zip |
Optimize sending packets to nearby locations (sounds/effects)
Instead of using the entire world or player list, use the distance
maps to only iterate players who are even seeing the chunk the packet
is originating from.
This will drastically cut down on packet sending cost for worlds with
lots of players in them.
Closes #3437
Diffstat (limited to 'Spigot-Server-Patches/0004-MC-Utils.patch')
-rw-r--r-- | Spigot-Server-Patches/0004-MC-Utils.patch | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 60e3b62952..7e5e65e5f0 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -3004,6 +3004,20 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a public void b(PacketDataSerializer packetdataserializer) { this.a(); packetdataserializer.writeByte(this.i); +diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java +index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..951db04bca7ee9021a5d4707f1907b2c8f734a92 100644 +--- a/src/main/java/net/minecraft/server/DimensionManager.java ++++ b/src/main/java/net/minecraft/server/DimensionManager.java +@@ -55,7 +55,9 @@ public class DimensionManager implements MinecraftSerializable { + return this.folder.isEmpty() ? file : new File(file, this.folder); + } + ++ public WorldServer world; // Paper - store ref to world this manager is for + public WorldProvider getWorldProvider(World world) { ++ if (this.world == null) this.world = (WorldServer) world; // Paper + return (WorldProvider) this.providerFactory.apply(world, this); + } + diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626d8786a9a 100644 --- a/src/main/java/net/minecraft/server/Entity.java |