Skip to content

Commit

Permalink
Update Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf committed Dec 8, 2024
1 parent d4bc338 commit 61aed65
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 131 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import io.papermc.paperweight.tasks.RebuildGitPatches
plugins {
java
`maven-publish`
id("io.papermc.paperweight.patcher") version "1.7.6"
id("io.papermc.paperweight.patcher") version "1.7.7"
}

val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group=dev.folia
version=1.21.4-R0.1-SNAPSHOT
mcVersion=1.21.4

paperRef=416a73304809d94c11a2bf22bbb2ad438a0dd68c
paperRef=71a367ec8489c8a61a4c009f6a3c536438707158

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0001-Build-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ index 2da91ed6363c0851e4c459188f5e8ef5475e0c97..8d2b5fec6fe27dca3ce01ba1ce505061
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 4b002e8b75d117b726b0de274a76d3596fce015b..cb60d58d4a7556dd896f31d0cd249f860bb3ef84 100644
index 8f62879582195d8ae4f64bd23f752fa133b1c973..f5ff71e31516327be71924926938f1c9f0e503df 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
@@ -592,7 +592,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
Expand All @@ -58,7 +58,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..cb60d58d4a7556dd896f31d0cd249f86

metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -607,11 +607,11 @@ public class Metrics {
@@ -606,11 +606,11 @@ public class Metrics {
final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion();
if (implVersion != null) {
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
Expand Down
217 changes: 108 additions & 109 deletions patches/server/0003-Threaded-Regions.patch

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ index 41bf71d116ffc5431586ce54abba7f8def6c1dcf..1cf9a7677449ab8f03fb23d835e3fadc
}

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 75929ae02677637500229b7b635479f92e3bd177..20fe53cc8e9edfc7b7d50f23379e0044e520c84d 100644
index faa1135996a3afccbf45c84059090248703b98ac..f86415bf2721835e6108408ebf05221fa17d854e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3244,6 +3244,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand Down Expand Up @@ -2288,10 +2288,10 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..074b2919be2b5544b0a46e6cd32f6c57
}

diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5ebcd6b8edc76572a3fffead4735fd5824a083f1..95047bf77be54af6968a6e77f13dd01aa989b4d8 100644
index 60053f73f1992f4a11edb6af89f31574bcc32fc7..e88f197dfc0e4ec06f0360ebe18914cf57d5bdf8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -674,7 +674,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -675,7 +675,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

@Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
Expand All @@ -2300,7 +2300,7 @@ index 5ebcd6b8edc76572a3fffead4735fd5824a083f1..95047bf77be54af6968a6e77f13dd01a
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2327,9 +2327,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2328,9 +2328,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs


diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7cc63a4a9759d3926f843cfedbc79986d1ece926..a8975cee866cf2c617b6d4976df71e5c20cf0e3d 100644
index 26e1584557c8ba7b6bdf4a5ca7fc801d2f33fbdf..567e12e24ece2cd823b73e7337b10eb89995da21 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1320,6 +1320,7 @@ public final class CraftServer implements Server {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ea3b3f624ab9f4fbdc6ff4e90076b5616728f6ca..759eb33a5b63cae7913907f06e67e0736f50dc13 100644
index 44c8d196b31c84ff6179d345808a10c0604206ad..93a341618bf53900d143f429b94ea295dd973f2c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -794,7 +794,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This allows the player to be re-positioned before logging into
the world without causing thread checks to trip on Folia.

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 759eb33a5b63cae7913907f06e67e0736f50dc13..b6f3078fa688ca61cfd45d856b95c160cfe7b2da 100644
index 93a341618bf53900d143f429b94ea295dd973f2c..b7fe3a1119f927bf4fb4d5855f758a16a76ec779 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -920,7 +920,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
Expand Down
20 changes: 10 additions & 10 deletions patches/server/0017-Region-profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1463,26 +1463,26 @@ index d6eb8f495688a1b65a4c419aa3ee655cd8eb322a..f338b273613840ed366ab13b528373e7
if (exception instanceof ReportedException) {
ReportedException reportedexception = (ReportedException) exception;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9fa5c1628f2df441de47a38e732e7b033c3e2448..be6dc4c066efd66279301f5796451105e323089a 100644
index 25b4b0d531f0698338ffeac686013a4631d60c00..1676c4abb3f6f71bb7b25351aa58b4e127786fca 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1714,6 +1714,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1713,6 +1713,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading
public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
// Folia end - region threading
org.spigotmc.WatchdogThread.tick(); // Spigot
long i = startTime; // Folia - region threading
@@ -1752,6 +1753,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1751,6 +1752,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}

+
// Folia start - region threading
if (region != null) {
region.world.getCurrentWorldData().updateTickData();
@@ -1775,10 +1777,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1774,10 +1776,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper - Server Tick Events // Folia - region threading
// Folia start - region threading
if (region != null) {
Expand All @@ -1499,7 +1499,7 @@ index 9fa5c1628f2df441de47a38e732e7b033c3e2448..be6dc4c066efd66279301f5796451105
for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) {
if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) {
continue;
@@ -1786,8 +1794,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1785,8 +1793,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
if (bukkit != null) {
bukkit.taskScheduler.executeTick();
Expand All @@ -1511,31 +1511,31 @@ index 9fa5c1628f2df441de47a38e732e7b033c3e2448..be6dc4c066efd66279301f5796451105
}
// Folia end - region threading
if (region == null) this.tickRateManager.tick(); // Folia - region threading
@@ -1806,6 +1817,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1805,6 +1816,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
+ foliaProfiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.AUTOSAVE); try { // Folia - profiler
try {
this.isSaving = true;
if (playerSaveInterval > 0) {
@@ -1819,6 +1831,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1818,6 +1830,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
+ } finally { foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.AUTOSAVE); } // Folia - profiler
profiler.pop();
// Paper end - Incremental chunk and player saving

@@ -1901,6 +1914,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1900,6 +1913,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

protected void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
+ final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking
ProfilerFiller gameprofilerfiller = Profiler.get();

@@ -1965,7 +1979,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1964,7 +1978,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
gameprofilerfiller.push("tick");

try {
Expand All @@ -1545,7 +1545,7 @@ index 9fa5c1628f2df441de47a38e732e7b033c3e2448..be6dc4c066efd66279301f5796451105
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");

@@ -1980,8 +1996,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1979,8 +1995,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (region == null) this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked // Folia - region threading

gameprofilerfiller.popPush("connection");
Expand Down

0 comments on commit 61aed65

Please sign in to comment.