2020-08-09 20:35:16 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: MrIvanPlays <ivan@mrivanplays.com>
|
2020-08-10 02:19:56 +02:00
|
|
|
Date: Sun, 9 Aug 2020 16:58:18 -0500
|
2020-08-09 20:35:16 +02:00
|
|
|
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
|
2020-08-10 02:19:56 +02:00
|
|
|
index 3782d329dc62a9e834f16a9009f4102b5b4aad6f..2a681afff2e8b9f7b7e106dcb780ecac27d14353 100644
|
2020-08-09 20:35:16 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2020-08-10 02:19:56 +02:00
|
|
|
@@ -833,12 +833,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
2020-08-09 20:35:16 +02:00
|
|
|
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
|
|
|
|
}
|
|
|
|
// */
|
|
|
|
- for (int idx = 0; idx < this.players.size(); ++idx) {
|
2020-08-10 02:19:56 +02:00
|
|
|
- if (((EntityPlayer) this.players.get(idx)).world == this) {
|
|
|
|
- ((EntityPlayer) this.players.get(idx)).tickWeather();
|
2020-08-09 20:35:16 +02:00
|
|
|
+ // 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);
|
2020-08-09 21:14:14 +02:00
|
|
|
+ // Yatopia end
|
2020-08-09 20:35:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* // Yatopia start - moved up
|
|
|
|
if (flag != this.isRaining()) {
|
|
|
|
// Only send weather packets to those affected
|
|
|
|
for (int idx = 0; idx < this.players.size(); ++idx) {
|
2020-08-10 02:19:56 +02:00
|
|
|
@@ -852,6 +857,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
|
|
((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
|
2020-08-09 20:35:16 +02:00
|
|
|
}
|
|
|
|
}
|
2020-08-10 02:19:56 +02:00
|
|
|
+ */ // Yatopia end
|
2020-08-09 20:35:16 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
if (this.everyoneSleeping) {
|