geforkt von Mirrors/Paper
48b6bfe2a6
Upstream has released updates that appears 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: c987938a SPIGOT-5180: Add Villager#sleep() and #wakeup() methods CraftBukkit Changes:7f33c6a2
SPIGOT-5196: Restore previous version behaviour regarding cancelled BlockBreakEvent6a5fc902
Improve diff in EntityHangingc98d61bf
SPIGOT-4712: Allow spawning of upwards or downwards facing item framesdb971477
SPIGOT-5199: Fix NPE if setting the book of the ItemMeta of a lecternb0ef3996
SPIGOT-4679 Fix black lines after book paragraphs1215188f
SPIGOT-5180: Add Villager#sleep() and #wakeup() methodsc03b2bef
SPIGOT-4975: NPE on WorldGenStronghold When Using Multiple Worlds65ea162c
Ensure Bukkit data pack is always up to date0b107b8d
MC-157395, SPIGOT-5193: Small armor stands do not drop loot6da0abca
SPIGOT-5195: Player loot table does not drop when keepInventory is on8b09d983
SPIGOT-5190: Superfluous EntityCombustEvent called when using fire aspect sword Spigot Changes: 1981d553 SPIGOT-5198: Catch more bad async operations 6a14ca46 Rebuild patches
46 Zeilen
2.6 KiB
Diff
46 Zeilen
2.6 KiB
Diff
From 00ff72f7dcdf3fa0d12681e7491bd52c59798c9d 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 f6a979a5b..c92586ccd 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1124,12 +1124,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
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.ticks % 20 == 0) {
|
|
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
|
- EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
|
- entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
|
|
+ // Paper start - optimize time updates
|
|
+ for (final WorldServer world : this.getWorlds()) {
|
|
+ final boolean doDaylight = world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE);
|
|
+ final long dayTime = world.getDayTime();
|
|
+ long worldTime = world.getTime();
|
|
+ final PacketPlayOutUpdateTime worldPacket = new PacketPlayOutUpdateTime(worldTime, dayTime, doDaylight);
|
|
+ for (EntityHuman entityhuman : world.getPlayers()) {
|
|
+ if (!(entityhuman instanceof EntityPlayer) || (ticks + entityhuman.getId()) % 20 != 0) {
|
|
+ continue;
|
|
+ }
|
|
+ EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
|
+ long playerTime = entityplayer.getPlayerTime();
|
|
+ PacketPlayOutUpdateTime packet = (playerTime == dayTime) ? worldPacket :
|
|
+ new PacketPlayOutUpdateTime(worldTime, playerTime, doDaylight);
|
|
+ entityplayer.playerConnection.sendPacket(packet); // Add support for per player time
|
|
}
|
|
}
|
|
+ // Paper end
|
|
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
|
|
|
while (iterator.hasNext()) {
|
|
--
|
|
2.22.0
|
|
|