Yatopia/patches/server/0028-Optimize-player-loops-around-weather.patch
Ivan Pekov 37ee772342
Updated Upstream and Sidestream(s) (Tuinity/Origami/Purpur)
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:
d39cda0 Updated Upstream (Paper)

Origami Changes:
6c89f23 Update Paper

Purpur Changes:
242deee Merge pull request #63 from jmanpenilla/patch-1
700b42f Update README.md
2020-09-17 14:42:54 +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 41e218f31d5d384d836fe03c474121e7a8e70e82..4a31b93fcfefb44904fde0720953dcf995f6e5fb 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) {