geforkt von Mirrors/Paper
789bc79280
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: c9a46ebf #653: Add World#spawn with randomizeData parameter e49c2e3a Damageable should extend ItemMeta 01ff04f4 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API ca5b4b1a SPIGOT-6697: Deprecate generateTree with BlockChangeDelegate as it does not handle tiles CraftBukkit Changes: 7c8bbcbe SPIGOT-6716: Preserve the order of stored enchantments of enchanted books. 18027d02 #914: Add World#spawn with randomizeData parameter 3cad0316 SPIGOT-6714: Don't fire PlayerBucketEvent when empty 8c6d60cf Fix server crash with BlockPopulator when entities are at a negative chunk border 4f6bcc84 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API 78d5b35b SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour 15792f0d Rebuild patch c949675e SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn a955f15c Fix issues with new ChunkGenerator API a0a37f41 SPIGOT-6630: Replacing an enchantment on an item creates a conflict error Spigot Changes: b166a49b Rebuild patches 3c1fc60a SPIGOT-6693: Composters only take in one item at custom hopper speeds
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 8b81f618598a4a95e4cb19c3e65b7e6d03459530..a5a48c0450cd3f15c2bc49f45487da9573a4dec3 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1404,12 +1404,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 world : this.getAllLevels()) {
|
|
+ final boolean doDaylight = world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT);
|
|
+ final long dayTime = world.getDayTime();
|
|
+ long worldTime = world.getGameTime();
|
|
+ final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
|
+ for (Player entityhuman : world.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()) {
|