geforkt von Mirrors/Paper
b8edb0e130
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender CraftBukkit Changes: db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender 4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties 8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block Spigot Changes: d2eba2c8 Rebuild patches
43 Zeilen
2.6 KiB
Diff
43 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 2 Nov 2018 23:11:51 -0400
|
|
Subject: [PATCH] Optimize World Time Updates
|
|
|
|
Splits time updates into incremental updates as well as does
|
|
the updates per world, so that we can re-use the same packet
|
|
object for every player unless they have per-player time enabled.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index e5ab15722fe640d4766b9a24fb82b1d60f15a241..1a74b7c252d16e5ab2c303e6e96c62e78ef9311c 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1386,12 +1386,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
|
|
// Send time updates to everyone, it will get the right time from the world the player is in.
|
|
- if (this.tickCount % 20 == 0) {
|
|
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
|
- ServerPlayer entityplayer = (ServerPlayer) this.getPlayerList().players.get(i);
|
|
- entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
|
+ // Paper start - optimize time updates
|
|
+ for (final ServerLevel level : this.getAllLevels()) {
|
|
+ final boolean doDaylight = level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT);
|
|
+ final long dayTime = level.getDayTime();
|
|
+ long worldTime = level.getGameTime();
|
|
+ final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
|
+ for (Player entityhuman : level.players()) {
|
|
+ if (!(entityhuman instanceof ServerPlayer) || (tickCount + entityhuman.getId()) % 20 != 0) {
|
|
+ continue;
|
|
+ }
|
|
+ ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
|
+ long playerTime = entityplayer.getPlayerTime();
|
|
+ ClientboundSetTimePacket packet = (playerTime == dayTime) ? worldPacket :
|
|
+ new ClientboundSetTimePacket(worldTime, playerTime, doDaylight);
|
|
+ entityplayer.connection.send(packet); // Add support for per player time
|
|
}
|
|
}
|
|
+ // Paper end
|
|
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
|
|
|
while (iterator.hasNext()) {
|