Skip to content

Commit e112b00

Browse files
committed
Update Paper
1 parent 44f4aab commit e112b00

6 files changed

Lines changed: 335 additions & 268 deletions

File tree

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

Lines changed: 206 additions & 160 deletions
Large diffs are not rendered by default.

folia-server/minecraft-patches/features/0004-Prevent-block-updates-in-non-loaded-or-non-owned-chu.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ add explicit block update suppression techniques, it's better
99
than the server crashing.
1010

1111
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
12-
index 3cd535e108e797d4a0b3e776ad0c70d949335061..9f7fa145f7f6a765c668dc7754626a91bef4ce6a 100644
12+
index 18960e83871a0ec571f821ad50869604b2d3c543..8d02daa32b6888d9ac4581f05e89ef8fb5b94834 100644
1313
--- a/net/minecraft/world/level/Level.java
1414
+++ b/net/minecraft/world/level/Level.java
15-
@@ -2015,7 +2015,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
15+
@@ -2014,7 +2014,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
1616
public void updateNeighbourForOutputSignal(BlockPos pos, Block block) {
1717
for (Direction direction : Direction.Plane.HORIZONTAL) {
1818
BlockPos blockPos = pos.relative(direction);

folia-server/minecraft-patches/features/0007-Region-profiler.patch

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,26 +1461,26 @@ index f9300b9f8d15843dae8fd73ff066e4be99b60451..e07e5eced7e32d1c3a0ac14e8639c1f1
14611461
if (var3 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
14621462
throw PacketUtils.makeReportedException(var3, this.packet, this.listener);
14631463
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
1464-
index 7a6dab62a76b70183441c44b654109fb759e2e72..97842c57f5d2ec4b9ea002695fafd614a10b806a 100644
1464+
index 78367d9620912b11473f582022422f7c062ed67c..c01a09c616bf9981df445af363047906e13466b8 100644
14651465
--- a/net/minecraft/server/MinecraftServer.java
14661466
+++ b/net/minecraft/server/MinecraftServer.java
1467-
@@ -1658,6 +1658,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1467+
@@ -1661,6 +1661,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
14681468
// Folia start - region threading
14691469
public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
14701470
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
14711471
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
14721472
// Folia end - region threading
14731473
org.spigotmc.WatchdogThread.tick(); // Spigot
14741474
long nanos = startTime; // Folia - region threading
1475-
@@ -1695,6 +1696,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1475+
@@ -1698,6 +1699,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
14761476
}
14771477
}
14781478

14791479
+
14801480
// Folia start - region threading
14811481
region.world.getCurrentWorldData().updateTickData();
14821482
BooleanSupplier hasTimeLeft = () -> {
1483-
@@ -1706,22 +1708,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1483+
@@ -1709,22 +1711,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
14841484
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper - Server Tick Events // Folia - region threading
14851485
// Folia start - region threading
14861486
if (region != null) {
@@ -1514,31 +1514,31 @@ index 7a6dab62a76b70183441c44b654109fb759e2e72..97842c57f5d2ec4b9ea002695fafd614
15141514
}
15151515
// Folia end - region threading
15161516
//this.tickCount++; // Folia - region threading
1517-
@@ -1741,6 +1754,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1517+
@@ -1744,6 +1757,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
15181518
}
15191519
profiler.push("save");
15201520
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
15211521
+ foliaProfiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.AUTOSAVE); try { // Folia - profiler
15221522
try {
15231523
this.isSaving = true;
15241524
if (playerSaveInterval > 0) {
1525-
@@ -1754,6 +1768,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1525+
@@ -1757,6 +1771,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
15261526
} finally {
15271527
this.isSaving = false;
15281528
}
15291529
+ } finally { foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.AUTOSAVE); } // Folia - profiler
15301530
profiler.pop();
15311531
// Paper end - Incremental chunk and player saving
15321532

1533-
@@ -1853,6 +1868,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1533+
@@ -1856,6 +1871,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
15341534
// Folia - region threading - moved to regionised data
15351535

15361536
protected void tickChildren(BooleanSupplier hasTimeLeft, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
15371537
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
15381538
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking
15391539
ProfilerFiller profilerFiller = Profiler.get();
15401540
//this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing()); // Folia - region threading
1541-
@@ -1907,7 +1923,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1541+
@@ -1910,7 +1926,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
15421542
profilerFiller.push("tick");
15431543

15441544
try {
@@ -1548,7 +1548,7 @@ index 7a6dab62a76b70183441c44b654109fb759e2e72..97842c57f5d2ec4b9ea002695fafd614
15481548
} catch (Throwable var7) {
15491549
CrashReport crashReport = CrashReport.forThrowable(var7, "Exception ticking world");
15501550
serverLevel.fillReportDetails(crashReport);
1551-
@@ -1921,7 +1939,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
1551+
@@ -1924,7 +1942,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
15521552
//this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked // Folia - region threading
15531553

15541554
profilerFiller.popPush("connection");
@@ -1737,7 +1737,7 @@ index 79bc7b4f112f390592694e2d5c358f1c98e6c310..7400be75c5dae2b24cc327d23b703bf6
17371737

17381738
profiler.pop();
17391739
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
1740-
index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46f6010181 100644
1740+
index efd303538bdc38c5497703d8d0bdeb2ccf0e0fd0..3471200d54b938ef82f142efc2fcb096d72ec7b4 100644
17411741
--- a/net/minecraft/server/level/ServerLevel.java
17421742
+++ b/net/minecraft/server/level/ServerLevel.java
17431743
@@ -763,6 +763,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -1748,7 +1748,7 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
17481748
ProfilerFiller profilerFiller = Profiler.get();
17491749
regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking
17501750
TickRateManager tickRateManager = this.tickRateManager();
1751-
@@ -786,22 +787,32 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1751+
@@ -800,22 +801,32 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
17521752
if (!this.isDebug() && runsNormally) {
17531753
long l = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading
17541754
profilerFiller.push("blockTicks");
@@ -1781,15 +1781,15 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
17811781
}
17821782

17831783
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking
1784-
@@ -818,6 +829,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1784+
@@ -832,6 +843,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
17851785
if (this.emptyTime < 300) {
17861786
profilerFiller.push("entities");
17871787
if (this.dragonFight != null && runsNormally) {
17881788
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.DRAGON_FIGHT_TICK); try { // Folia - profiler
17891789
if (ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading
17901790
profilerFiller.push("dragonFight");
17911791
this.dragonFight.tick();
1792-
@@ -830,9 +842,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1792+
@@ -844,9 +856,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
17931793
null
17941794
);
17951795
} // Folia end - region threading
@@ -1803,7 +1803,7 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
18031803
regionizedWorldData // Folia - regionised ticking
18041804
.forEachTickingEntity( // Folia - regionised ticking
18051805
entity -> {
1806-
@@ -860,8 +876,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1806+
@@ -874,8 +890,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18071807
}
18081808
}
18091809
);
@@ -1815,7 +1815,7 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
18151815
profilerFiller.pop();
18161816
}
18171817

1818-
@@ -942,8 +961,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1818+
@@ -956,8 +975,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18191819
}
18201820

18211821
public void tickCustomSpawners(boolean spawnEnemies) {
@@ -1827,7 +1827,7 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
18271827
}
18281828
}
18291829

1830-
@@ -1398,6 +1420,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1830+
@@ -1412,6 +1434,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18311831
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
18321832
profilerFiller.incrementCounter("tickNonPassenger");
18331833
final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
@@ -1840,15 +1840,15 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
18401840
if (isActive) { // Paper - EAR 2
18411841
entity.tick();
18421842
// Folia start - region threading
1843-
@@ -1412,6 +1440,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1843+
@@ -1426,6 +1454,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18441844
// Folia end - region threading
18451845
} else {entity.inactiveTick();} // Paper - EAR 2
18461846
profilerFiller.pop();
18471847
+ } finally { profiler.stopTimer(timerId); } // Folia - profiler
18481848

18491849
for (Entity entity1 : entity.getPassengers()) {
18501850
this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
1851-
@@ -1427,6 +1456,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1851+
@@ -1441,6 +1470,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18521852
if (passengerEntity.isRemoved() || passengerEntity.getVehicle() != ridingEntity) {
18531853
passengerEntity.stopRiding();
18541854
} else if (passengerEntity instanceof Player || this.getCurrentWorldData().hasEntityTickingEntity(passengerEntity)) { // Folia - region threading
@@ -1861,7 +1861,7 @@ index 1f23ca975a870b45b600e782d4779ab4bfb3af49..833e004937871e5a9ba2a5a41f4c7f46
18611861
passengerEntity.setOldPosAndRot();
18621862
passengerEntity.tickCount++;
18631863
passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities
1864-
@@ -1458,6 +1493,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
1864+
@@ -1472,6 +1507,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
18651865
for (Entity entity : passengerEntity.getPassengers()) {
18661866
this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2
18671867
}
@@ -1936,10 +1936,10 @@ index abccad13c2bb3a33e98ad8eb6d7f08c0ef021811..0590d5723854a03a59fe9471710802f4
19361936
}
19371937
}
19381938
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
1939-
index 1a815a6e89fd2924f59c0fcad061d61cae29aca1..937f7f51e047d6f71ce89db0c8697ea558334bbc 100644
1939+
index 8d02daa32b6888d9ac4581f05e89ef8fb5b94834..2c3d36a9d4bf361c516fe1fe6e29d225002b303c 100644
19401940
--- a/net/minecraft/world/level/Level.java
19411941
+++ b/net/minecraft/world/level/Level.java
1942-
@@ -194,6 +194,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
1942+
@@ -193,6 +193,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
19431943
public final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup moonrise$getEntityLookup() {
19441944
return this.entityLookup;
19451945
}
@@ -1949,7 +1949,7 @@ index 1a815a6e89fd2924f59c0fcad061d61cae29aca1..937f7f51e047d6f71ce89db0c8697ea5
19491949

19501950
@Override
19511951
public final void moonrise$setEntityLookup(final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup) {
1952-
@@ -884,6 +887,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
1952+
@@ -883,6 +886,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
19531953
this.damageSources = new DamageSources(registryAccess);
19541954
this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system
19551955
this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new io.papermc.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : io.papermc.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
@@ -1959,7 +1959,7 @@ index 1a815a6e89fd2924f59c0fcad061d61cae29aca1..937f7f51e047d6f71ce89db0c8697ea5
19591959
}
19601960

19611961
// Paper start - Cancel hit for vanished players
1962-
@@ -1433,11 +1439,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
1962+
@@ -1432,11 +1438,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
19631963
}
19641964

19651965
public void tickBlockEntities() {
@@ -1975,7 +1975,7 @@ index 1a815a6e89fd2924f59c0fcad061d61cae29aca1..937f7f51e047d6f71ce89db0c8697ea5
19751975
// Spigot start
19761976
boolean runsNormally = this.tickRateManager().runsNormally();
19771977

1978-
@@ -1459,6 +1469,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
1978+
@@ -1458,6 +1468,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
19791979
}
19801980
}
19811981
blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 // Folia - regionised ticking

0 commit comments

Comments
 (0)