Yatopia/patches/server/0028-Optimize-player-loops-around-weather.patch
Ivan Pekov f541b93c6a Updated Upstream and Sidestream(s) (Tuinity/Purpur/Rainforest)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
76777f0 Updated Upstream (Paper)
6465aba Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.3
ba4dbb6 Do not allow ticket level changes while unloading playerchunks
e0e7144 Aggressive state checking in region manager

Purpur Changes:
0743d38 PaperPR - Add hex color code support for console logging
081f5a7 Oopsie, lets fix these snowballs :3
4895a88 Improve output of plugins command
3424c40 Minor changes to projectile despawn rate patch
9d49a31 Updated Upstream (Paper)
09e0103 add snowball to despawn rate config

Rainforest Changes:
5a187d6 Update to 1.16.3.
2020-09-20 21:45:23 +03:00

40 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrIvanPlays <ivan@mrivanplays.com>
Date: Sun, 9 Aug 2020 16:58:18 -0500
Subject: [PATCH] Optimize player loops around weather
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 7ba007f44ffe062234e9277bc949f1d9cbea45fd..0dd86a72b538ff140d8a7268cf1fe4e18ede33b5 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -814,12 +814,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
}
// */
- for (int idx = 0; idx < this.players.size(); ++idx) {
- if (((EntityPlayer) this.players.get(idx)).world == this) {
- ((EntityPlayer) this.players.get(idx)).tickWeather();
+ // Yatopia start
+ for (EntityPlayer player : players) {
+ if (player.world == this) {
+ player.tickWeather();
+ player.updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
+ if (flag != this.isRaining()) player.setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
+ // Yatopia end
}
}
+ /* // Yatopia start - moved up
if (flag != this.isRaining()) {
// Only send weather packets to those affected
for (int idx = 0; idx < this.players.size(); ++idx) {
@@ -833,6 +838,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
}
}
+ */ // Yatopia end
// CraftBukkit end
if (this.everyoneSleeping) {