mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-02 07:33:39 +01:00
15bf6a2103
* Updated Upstream and Sidestream(s) (Paper) 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. Paper Changes: 808bd9198 Add fast alternative constructor for Vector3f (#5339) e849c51da fix #5336 0b25bacfc fix patch 'Remove streams from SensorNearest' (fixes #5330) 4d287e31c Use Adventure for `/version` command feedback, add copy to clipboard click event (#5333) * Updated Upstream and Sidestream(s) (Tuinity) 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: 19ac660 Move region chunk unload & poi unload hook up 38ad5a1 Do not run close logic for inventories on chunk unload fb75a6f Do not allow the server to unload chunks at request of plugins
83 lines
4.2 KiB
Diff
83 lines
4.2 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 some stuff in WorldServer ticking
|
|
|
|
Replaced some streams and some array lists with glue lists
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index fe6611e480c18e97061268690d067a811b13bb1b..68fda6e73db23cc8fb10501b2d84f229ea5afc7f 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -885,12 +885,21 @@ 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
|
|
+ boolean sleepyMatch = true;
|
|
+ for (EntityPlayer player : players) {
|
|
+ if (player.world == this) {
|
|
+ player.tickWeather();
|
|
+ if (flag != this.isRaining()) player.setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
|
|
+ player.updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
|
|
+ }
|
|
+ if (sleepyMatch && !player.isSpectator() && !player.isDeeplySleeping() && !player.fauxSleeping) {
|
|
+ sleepyMatch = 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) {
|
|
@@ -905,11 +914,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
+ */ // Yatopia end
|
|
|
|
- if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
|
|
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping && !(purpurConfig.idleTimeoutCountAsSleeping && entityplayer.isAfk()); // CraftBukkit // Purpur
|
|
- })) {
|
|
- // CraftBukkit start
|
|
+ if (this.everyoneSleeping && sleepyMatch) { // Yatopia
|
|
long l = this.worldData.getDayTime() + 24000L;
|
|
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
|
|
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
|
@@ -1114,9 +1121,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
|
|
private void wakeupPlayers() {
|
|
- (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
|
|
+ for (EntityPlayer entityplayer : players) { if (entityplayer.isSleeping()) { // Yatopia
|
|
entityplayer.wakeup(false, false);
|
|
- });
|
|
+ }} // Yatopia
|
|
}
|
|
|
|
// Paper start - optimise random block ticking
|
|
@@ -1908,8 +1915,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
// Spigot start
|
|
if ( entity instanceof EntityHuman )
|
|
{
|
|
- this.getMinecraftServer().worldServer.values().stream().map( WorldServer::getWorldPersistentData ).forEach( (worldData) ->
|
|
+ for ( WorldServer worldServer : getMinecraftServer().worldServer.values() ) // Yatopia
|
|
{
|
|
+ WorldPersistentData worldData = worldServer.getWorldPersistentData(); // Yatopia
|
|
for (Object o : worldData.data.values() )
|
|
{
|
|
if ( o instanceof WorldMap )
|
|
@@ -1926,7 +1934,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
}
|
|
- } );
|
|
+ } // Yatopia
|
|
}
|
|
// Spigot end
|
|
// Spigot Start
|