diff options
author | Spottedleaf <[email protected]> | 2022-09-26 01:02:51 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-26 01:02:51 -0700 |
commit | 01a13871deefa50e186a10b63f71c5e0459e7d30 (patch) | |
tree | caf7056fa3ad155645b2dec6046b13841eb5d4a2 /patches/server/0009-Adventure.patch | |
parent | abe53a7eb477664aba5f32ff22d81f11ed48a44d (diff) | |
download | Paper-01a13871deefa50e186a10b63f71c5e0459e7d30.tar.gz Paper-01a13871deefa50e186a10b63f71c5e0459e7d30.zip |
Rewrite chunk system (#8177)
Patch documentation to come
Issues with the old system that are fixed now:
- World generation does not scale with cpu cores effectively.
- Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps.
- Unreliable prioritisation of chunk gen/load calls that block the main thread.
- Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved.
- Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal.
- Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles.
The above list is not complete. The patch documentation will complete it.
New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil.
Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft.
The old legacy chunk system patches have been moved to the removed folder in case we need them again.
Diffstat (limited to 'patches/server/0009-Adventure.patch')
-rw-r--r-- | patches/server/0009-Adventure.patch | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/patches/server/0009-Adventure.patch b/patches/server/0009-Adventure.patch index 5e5641e209..35a7393050 100644 --- a/patches/server/0009-Adventure.patch +++ b/patches/server/0009-Adventure.patch @@ -1959,7 +1959,7 @@ index 805a1773d55e2551911e5b8e69052e23f630359b..e4220f14a5ebf43dd3491fc8649c2be5 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400ff6ea97bd 100644 +index bdad7b404067ab65d85d1628db9009896a43a052..5aad3da061d391d1003bdcca95dd4f7e5c0e5ea8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -154,6 +154,7 @@ import net.minecraft.world.scores.Score; @@ -1978,7 +1978,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f public Component listName; public org.bukkit.Location compassTarget; public int newExp = 0; -@@ -312,6 +314,7 @@ public class ServerPlayer extends Player { +@@ -313,6 +315,7 @@ public class ServerPlayer extends Player { // CraftBukkit start this.displayName = this.getScoreboardName(); @@ -1986,7 +1986,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f this.bukkitPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); } -@@ -788,22 +791,17 @@ public class ServerPlayer extends Player { +@@ -789,22 +792,17 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel @@ -2013,7 +2013,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { boolean flag1 = true; -@@ -1729,8 +1727,13 @@ public class ServerPlayer extends Player { +@@ -1730,8 +1728,13 @@ public class ServerPlayer extends Player { } public void sendChatMessage(OutgoingPlayerChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) { @@ -2028,7 +2028,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f } } -@@ -1751,6 +1754,7 @@ public class ServerPlayer extends Player { +@@ -1752,6 +1755,7 @@ public class ServerPlayer extends Player { } public String locale = "en_us"; // CraftBukkit - add, lowercase @@ -2036,7 +2036,7 @@ index 84564ca128d2dfc79c0b5a13b699cf6fc80bdea7..9ab4588e4e512176b881ad4c252e400f public void updateOptions(ServerboundClientInformationPacket packet) { // CraftBukkit start if (getMainArm() != packet.mainHand()) { -@@ -1762,6 +1766,10 @@ public class ServerPlayer extends Player { +@@ -1763,6 +1767,10 @@ public class ServerPlayer extends Player { this.server.server.getPluginManager().callEvent(event); } this.locale = packet.language; @@ -2278,7 +2278,7 @@ index 3a587073dbe5e8a599d342c5f758d842b7b6cddb..a426adfba3fccf1815177e0b8065684c @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e311706a10 100644 +index 474843e57028ade5ef36ac5cda4924dbd95f6fe4..3710f544a491a837b973daedc2dfa51357b70b56 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; @@ -2289,7 +2289,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 import java.io.File; import java.net.SocketAddress; import java.nio.file.Path; -@@ -264,7 +265,7 @@ public abstract class PlayerList { +@@ -265,7 +266,7 @@ public abstract class PlayerList { } // CraftBukkit start ichatmutablecomponent.withStyle(ChatFormatting.YELLOW); @@ -2298,7 +2298,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); this.players.add(player); -@@ -278,19 +279,18 @@ public abstract class PlayerList { +@@ -279,19 +280,18 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); @@ -2323,7 +2323,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 } // CraftBukkit end -@@ -487,7 +487,7 @@ public abstract class PlayerList { +@@ -488,7 +488,7 @@ public abstract class PlayerList { } @@ -2332,7 +2332,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 ServerLevel worldserver = entityplayer.getLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -498,7 +498,7 @@ public abstract class PlayerList { +@@ -499,7 +499,7 @@ public abstract class PlayerList { entityplayer.closeContainer(); } @@ -2341,7 +2341,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -551,7 +551,7 @@ public abstract class PlayerList { +@@ -552,7 +552,7 @@ public abstract class PlayerList { this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -2350,7 +2350,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -597,10 +597,10 @@ public abstract class PlayerList { +@@ -598,10 +598,10 @@ public abstract class PlayerList { } // return chatmessage; @@ -2363,7 +2363,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -610,17 +610,17 @@ public abstract class PlayerList { +@@ -611,17 +611,17 @@ public abstract class PlayerList { } // return chatmessage; @@ -2384,7 +2384,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 return null; } return entity; -@@ -1128,7 +1128,7 @@ public abstract class PlayerList { +@@ -1129,7 +1129,7 @@ public abstract class PlayerList { public void removeAll() { // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -2393,7 +2393,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 } // CraftBukkit end -@@ -1169,14 +1169,25 @@ public abstract class PlayerList { +@@ -1170,14 +1170,25 @@ public abstract class PlayerList { } public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) { @@ -2421,7 +2421,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(message); boolean flag1 = message.isFullyFiltered(); boolean flag2 = false; -@@ -1186,7 +1197,7 @@ public abstract class PlayerList { +@@ -1187,7 +1198,7 @@ public abstract class PlayerList { ServerPlayer entityplayer1 = (ServerPlayer) iterator.next(); boolean flag3 = shouldSendFiltered.test(entityplayer1); @@ -2430,7 +2430,7 @@ index 6987bee4bf2c1f3d47ffdd5329f6c0c63a2962a5..521f485366c65527ac3289dd27d8f2e3 if (sender != entityplayer1) { flag2 |= flag1 && flag3; } -@@ -1213,7 +1224,7 @@ public abstract class PlayerList { +@@ -1214,7 +1225,7 @@ public abstract class PlayerList { } |