Skip to content

Commit e9e85fd

Browse files
committed
Update Paper
1 parent 6d795a8 commit e9e85fd

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

folia-server/minecraft-patches/features/0001-Region-Threading-Base.patch

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ index 1b8193587814225c2ef2c5d9e667436eb50ff6c5..0027a3896c0cfce2f46eca8a0a77a902
3030
}
3131
}
3232
diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java
33-
index 0b96f4790f7837cebca874e23c4dae7cc799c1ba..3152b791354327867629b42cd9453f022a27b246 100644
33+
index 31e34721f48a5d88379f50104abcf0fc63ebd194..faf62f8c9453f8e7a21b1e141577f1f4539cd2f9 100644
3434
--- a/ca/spottedleaf/moonrise/paper/PaperHooks.java
3535
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
3636
@@ -108,7 +108,7 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -350,7 +350,7 @@ index 7eafc5b7cba23d8dec92ecc1050afe3fd8c9e309..4bfcae47ed76346e6200514ebce5b04f
350350
\ No newline at end of file
351351
+}
352352
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
353-
index 467065e3b40df17f38716499259b46663c174fd0..01f24ac927661fa4b3895f66031c8b9d6c50742d 100644
353+
index 41b4c5a87b5153f845421a7df8df04c9231253a8..d866785adcd159ba5cf381a0fc532b7813246c74 100644
354354
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
355355
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
356356
@@ -61,6 +61,14 @@ import java.util.concurrent.atomic.AtomicReference;
@@ -701,7 +701,7 @@ index 467065e3b40df17f38716499259b46663c174fd0..01f24ac927661fa4b3895f66031c8b9d
701701
int unloadCountTentative = 0;
702702
for (final ChunkUnloadQueue.SectionToUnload sectionRef : unloadSectionsForRegion) {
703703
final ChunkUnloadQueue.UnloadSection section
704-
@@ -1458,22 +1602,17 @@ public final class ChunkHolderManager {
704+
@@ -1461,22 +1605,17 @@ public final class ChunkHolderManager {
705705
return CURRENT_TICKET_UPDATE_SCHEDULING.get();
706706
}
707707

@@ -732,7 +732,7 @@ index 467065e3b40df17f38716499259b46663c174fd0..01f24ac927661fa4b3895f66031c8b9d
732732

733733
boolean ret = false;
734734

735-
@@ -1489,9 +1628,7 @@ public final class ChunkHolderManager {
735+
@@ -1492,9 +1631,7 @@ public final class ChunkHolderManager {
736736
ret |= holder.handleFullStatusChange(changedFullStatus);
737737

738738
if (!changedFullStatus.isEmpty()) {
@@ -878,7 +878,7 @@ index 9a9a599ef178f851ee5c783631a724013a693586..fdb0bcdca1cd38f55f191d42e422c354
878878
try {
879879
consumer.accept(chunk);
880880
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
881-
index 817e4ffd597938697f0c4dca16068f8d20c088b3..e8bdc71a97c404f162e62ef777f47df8499c200c 100644
881+
index de764da80793d272ff597b4a0742ce785838799a..cc67d950846bdd45271024701f24dc8d7b79c889 100644
882882
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
883883
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
884884
@@ -1940,6 +1940,17 @@ public final class CollisionUtil {
@@ -7915,7 +7915,7 @@ index 19ec939529eb638bdc4d7fd9260f161fae118314..c26e81b07f1ea6d0820147da35cc8555
79157915

79167916
private static final class InnerUtil { // Attempt to hide these methods from ProtocolLib, so it doesn't accidently pick them up.
79177917
diff --git a/net/minecraft/network/PacketProcessor.java b/net/minecraft/network/PacketProcessor.java
7918-
index 3e4241976fdfe65bc0aae90a9097770745c0ddf1..f9300b9f8d15843dae8fd73ff066e4be99b60451 100644
7918+
index d501168e40f951ee37efcbc464c3ab1307051060..6923981fc317650f8a345faeea0756866ce31aba 100644
79197919
--- a/net/minecraft/network/PacketProcessor.java
79207920
+++ b/net/minecraft/network/PacketProcessor.java
79217921
@@ -19,6 +19,12 @@ public class PacketProcessor implements AutoCloseable {
@@ -7938,8 +7938,8 @@ index 3e4241976fdfe65bc0aae90a9097770745c0ddf1..f9300b9f8d15843dae8fd73ff066e4be
79387938
- public <T extends PacketListener> void scheduleIfPossible(T listener, Packet<T> packet) {
79397939
+ public <T extends PacketListener> boolean scheduleIfPossible(T listener, Packet<T> packet) { // Folia - region threading - return whether to notify
79407940
if (this.closed) {
7941-
- throw new RejectedExecutionException("Server already shutting down");
7942-
+ throw new RejectedExecutionException("Packet processor is shut down"); // Folia - region threading - change exception message
7941+
- throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Server already shutting down"); // Paper - do not prematurely disconnect players on stop
7942+
+ throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Packet processor is shut down"); // Paper - do not prematurely disconnect players on stop // Folia - region threading - change exception message
79437943
} else {
79447944
// Paper start - improve tick loop
79457945
// wake up main thread inbetween ticks to process packets
@@ -7988,7 +7988,7 @@ index 42d2f82b24ae48471bfc091667f8e84c5b0d62a8..ab80a66646a7ebe2862221ac342b06c1
79887988
}
79897989
}
79907990
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
7991-
index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c062ed67c 100644
7991+
index ca2caace6aab0dfcb0ab7a0fd28e66555c62fdc5..aea25454f88df40145934619856aded3682b59d6 100644
79927992
--- a/net/minecraft/server/MinecraftServer.java
79937993
+++ b/net/minecraft/server/MinecraftServer.java
79947994
@@ -196,7 +196,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -8280,15 +8280,15 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
82808280
this.resources.close();
82818281

82828282
try {
8283-
@@ -1117,6 +1193,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8283+
@@ -1112,6 +1188,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
82848284
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
82858285
// Paper end
82868286
this.running = false;
82878287
+ this.stopServer(); // Folia - region threading
82888288
if (waitForShutdown) {
82898289
try {
82908290
this.serverThread.join();
8291-
@@ -1265,6 +1342,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8291+
@@ -1260,6 +1337,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
82928292
this.status = this.buildServerStatus();
82938293

82948294
this.server.spark.enableBeforePlugins(); // Paper - spark
@@ -8307,7 +8307,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
83078307
// Spigot start
83088308
// Paper start
83098309
LOGGER.info("Running delayed init tasks");
8310-
@@ -1325,13 +1414,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8310+
@@ -1320,13 +1409,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
83118311
this.lastOverloadWarningNanos = this.nextTickTimeNanos;
83128312

83138313
this.currentTickStart = tickStart;
@@ -8323,7 +8323,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
83238323
}
83248324

83258325
// Paper - improve tick loop - done above
8326-
@@ -1485,28 +1574,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8326+
@@ -1480,28 +1569,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
83278327

83288328
@Override
83298329
public TickTask wrapRunnable(Runnable runnable) {
@@ -8356,15 +8356,15 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
83568356
if (super.pollTask()) {
83578357
this.moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
83588358
return true;
8359-
@@ -1526,6 +1611,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8359+
@@ -1521,6 +1606,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
83608360

83618361
@Override
83628362
public void doRunTask(TickTask task) {
83638363
+ if (true) throw new UnsupportedOperationException(); // Folia - region threading
83648364
Profiler.get().incrementCounter("runTask");
83658365
super.doRunTask(task);
83668366
}
8367-
@@ -1572,12 +1658,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8367+
@@ -1567,12 +1653,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
83688368
return false;
83698369
}
83708370

@@ -8383,7 +8383,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
83838383
if (this.playerList.getPlayerCount() == 0 && !this.tickRateManager.isSprinting() && this.pluginsBlockingSleep.isEmpty()) { // Paper - API to allow/disallow tick sleeping
83848384
this.emptyTicks++;
83858385
} else {
8386-
@@ -1602,24 +1691,51 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8386+
@@ -1597,24 +1686,51 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
83878387
level.getChunkSource().tick(() -> true, false);
83888388
}
83898389
// Paper end - avoid issues with certain tasks not processing during sleep
@@ -8442,7 +8442,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
84428442
// Paper start - Incremental chunk and player saving
84438443
final ProfilerFiller profiler = Profiler.get();
84448444
int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
8445-
@@ -1627,15 +1743,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8445+
@@ -1622,15 +1738,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
84468446
playerSaveInterval = autosavePeriod;
84478447
}
84488448
profiler.push("save");
@@ -8461,7 +8461,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
84618461
}
84628462
}
84638463
} finally {
8464-
@@ -1645,22 +1761,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8464+
@@ -1640,22 +1756,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
84658465
// Paper end - Incremental chunk and player saving
84668466

84678467
ProfilerFiller profilerFiller = Profiler.get();
@@ -8489,7 +8489,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
84898489
}
84908490

84918491
protected void processPacketsAndTick(boolean sprinting) {
8492-
@@ -1669,7 +1777,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8492+
@@ -1664,7 +1772,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
84938493
this.tickFrame.start();
84948494
// Paper - improve tick loop - moved into runAllTasksAtTickStart
84958495
this.runAllTasksAtTickStart(); // Paper - improve tick loop
@@ -8498,7 +8498,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
84988498
// Paper start - rewrite chunk system
84998499
final Throwable crash = this.chunkSystemCrash;
85008500
if (crash != null) {
8501-
@@ -1683,7 +1791,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8501+
@@ -1678,7 +1786,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
85028502
}
85038503

85048504
private void autoSave() {
@@ -8507,7 +8507,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
85078507
LOGGER.debug("Autosave started");
85088508
ProfilerFiller profilerFiller = Profiler.get();
85098509
profilerFiller.push("save");
8510-
@@ -1698,30 +1806,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8510+
@@ -1693,30 +1801,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
85118511
}
85128512
}
85138513

@@ -8546,7 +8546,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
85468546
private ServerStatus buildServerStatus() {
85478547
ServerStatus.Players players = this.buildPlayerStatus();
85488548
return new ServerStatus(
8549-
@@ -1734,7 +1834,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8549+
@@ -1729,7 +1829,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
85508550
}
85518551

85528552
private ServerStatus.Players buildPlayerStatus() {
@@ -8555,7 +8555,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
85558555
int maxPlayers = this.getMaxPlayers();
85568556
if (this.hidesOnlinePlayers()) {
85578557
return new ServerStatus.Players(maxPlayers, players.size(), List.of());
8558-
@@ -1753,44 +1853,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8558+
@@ -1748,44 +1848,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
85598559
}
85608560
}
85618561

@@ -8613,7 +8613,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86138613
continue;
86148614
}
86158615
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
8616-
@@ -1803,12 +1895,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8616+
@@ -1798,12 +1890,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86178617
}
86188618
}
86198619

@@ -8629,7 +8629,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86298629
profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().identifier());
86308630
/* Drop global time updates
86318631
if (this.tickCount % 20 == 0) {
8632-
@@ -1821,7 +1910,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8632+
@@ -1816,7 +1905,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86338633
profilerFiller.push("tick");
86348634

86358635
try {
@@ -8638,7 +8638,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86388638
} catch (Throwable var7) {
86398639
CrashReport crashReport = CrashReport.forThrowable(var7, "Exception ticking world");
86408640
serverLevel.fillReportDetails(crashReport);
8641-
@@ -1830,14 +1919,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8641+
@@ -1825,14 +1914,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86428642

86438643
profilerFiller.pop();
86448644
profilerFiller.pop();
@@ -8657,7 +8657,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86578657
profilerFiller.popPush("debugSubscribers");
86588658
this.debugSubscribers.tick();
86598659
if (this.tickRateManager.runsNormally()) {
8660-
@@ -1847,13 +1936,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8660+
@@ -1842,13 +1931,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86618661

86628662
profilerFiller.popPush("server gui refresh");
86638663

@@ -8673,7 +8673,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86738673
serverPlayer.connection.chunkSender.sendNextChunks(serverPlayer);
86748674
serverPlayer.connection.resumeFlushing();
86758675
}
8676-
@@ -2153,11 +2242,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8676+
@@ -2148,11 +2237,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86778677
int i = 0;
86788678

86798679
for (ServerPlayer serverPlayer : this.getPlayerList().getPlayers()) {
@@ -8689,7 +8689,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86898689
i++;
86908690
// Paper end - Expand PlayerGameModeChangeEvent
86918691
}
8692-
@@ -2179,7 +2270,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8692+
@@ -2174,7 +2265,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
86938693
}
86948694

86958695
public int getTickCount() {
@@ -8698,7 +8698,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
86988698
}
86998699

87008700
public boolean isUnderSpawnProtection(ServerLevel level, BlockPos pos, Player player) {
8701-
@@ -2215,6 +2306,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8701+
@@ -2210,6 +2301,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
87028702
}
87038703

87048704
public void invalidateStatus() {
@@ -8714,15 +8714,15 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
87148714
this.lastServerStatus = 0L;
87158715
}
87168716

8717-
@@ -2229,6 +2329,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8717+
@@ -2224,6 +2324,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
87188718

87198719
@Override
87208720
public void executeIfPossible(Runnable task) {
87218721
+ if (true) throw new UnsupportedOperationException(); // Folia - region threading
87228722
if (this.isStopped()) {
87238723
throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Server already shutting down"); // Paper - do not prematurely disconnect players on stop
87248724
} else {
8725-
@@ -2571,7 +2672,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8725+
@@ -2566,7 +2667,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
87268726
}
87278727

87288728
public long getAverageTickTimeNanos() {
@@ -8736,7 +8736,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
87368736
}
87378737

87388738
public long[] getTickTimesNanos() {
8739-
@@ -2815,13 +2921,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8739+
@@ -2810,13 +2916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
87408740
}
87418741

87428742
public ProfileResults stopTimeProfiler() {
@@ -8751,7 +8751,7 @@ index c2227d57ea2e2da537a313d4bfd2f8c7f776be64..78367d9620912b11473f582022422f7c
87518751
}
87528752

87538753
public int getMaxChainedNeighborUpdates() {
8754-
@@ -3073,24 +3173,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
8754+
@@ -3068,24 +3168,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
87558755

87568756
// Paper start - API to check if the server is sleeping
87578757
public boolean isTickPaused() {
@@ -13548,10 +13548,10 @@ index 6e135a4f622ef564c1a6562e171a0e05296e0022..be14531aa9d740ea3a2b3f61d4d6e303
1354813548
// Guess we don't have a date
1354913549
}
1355013550
diff --git a/net/minecraft/server/players/OldUsersConverter.java b/net/minecraft/server/players/OldUsersConverter.java
13551-
index 6838b8d5c0d046a7db8a88534edc430d79d6c628..62b33d404a20c42eac557eb39188ae07c1376add 100644
13551+
index 1e4f9aef0c98470b3297192bc282158e69d37230..c2d385bd06ca39f6477383352b2d589d905216d0 100644
1355213552
--- a/net/minecraft/server/players/OldUsersConverter.java
1355313553
+++ b/net/minecraft/server/players/OldUsersConverter.java
13554-
@@ -470,7 +470,7 @@ public class OldUsersConverter {
13554+
@@ -468,7 +468,7 @@ public class OldUsersConverter {
1355513555
static Date parseDate(String input, Date defaultValue) {
1355613556
Date date;
1355713557
try {

0 commit comments

Comments
 (0)