Skip to content

Commit

Permalink
Update Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 3, 2024
1 parent ec274f5 commit ffdcaa8
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=org.leavesmc.leaves
version=1.21-R0.1-SNAPSHOT
mcVersion=1.21
paperRef=0246a9da86a923e68d079eeceaeabdf750ee630d
paperRef=df3b6544f74be73c8882b97c43d39022340f2d74
preVersion=false
updatingMinecraft=false
org.gradle.jvmargs=-Xmx2G
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 @@ -184,10 +184,10 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..c060857cb0551fff8f5033553b887f3a
private static final String BUILD_DEV = "DEV";

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9325d6f95165a7cee00d7de736af723681cc16b4..b5a216dbf3f73c32ac4e930a694527dc13df0b5d 100644
index 23ddd26af762c1cd7fb3920669abb96b3213ab37..5be09db47028094ea52889f3c74b6a928278346f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1243,7 +1243,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1244,7 +1244,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("*************************************************************************************");
LOGGER.info("This is the first time you're starting this server.");
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
Expand All @@ -196,7 +196,7 @@ index 9325d6f95165a7cee00d7de736af723681cc16b4..b5a216dbf3f73c32ac4e930a694527dc
LOGGER.info("*************************************************************************************");
}
// Paper end - Add onboarding message for initial server start
@@ -1941,7 +1941,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1942,7 +1942,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

@DontObfuscate
public String getServerModName() {
Expand Down
50 changes: 25 additions & 25 deletions patches/server/0003-Delete-Timings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ index e2c24813f59c2fd075c740ac1842a38f20ed8554..1f7f68aad97ee73763c042837f239bdc
} catch (Exception exception) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d396a56e4 100644
index 5be09db47028094ea52889f3c74b6a928278346f..0d362b80044f05e3c6cae9d0f3ab9af6349b5fed 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,9 +3,6 @@ package net.minecraft.server;
Expand All @@ -837,15 +837,15 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer { // Paper - rewrite chunk system

private static MinecraftServer SERVER; // Paper
@@ -1038,7 +1033,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1039,7 +1034,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
- MinecraftTimings.stopServer(); // Paper
this.server.spark.disable(); // Paper - spark
// CraftBukkit start
if (this.server != null) {
@@ -1579,15 +1573,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1580,15 +1574,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

public void tickServer(BooleanSupplier shouldKeepTicking) {
Expand All @@ -863,7 +863,7 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
// Paper end
this.server.spark.tickStart(); // Paper - spark
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
@@ -1624,9 +1617,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1625,9 +1618,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop();
// Paper end - Incremental chunk and player saving
// Paper start - move executeAll() into full server tick timing
Expand All @@ -874,15 +874,15 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
// Paper end
// Paper start - Server Tick Events
long endTime = System.nanoTime();
@@ -1650,7 +1641,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1651,7 +1642,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.logTickMethodTime(i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}

private void logTickMethodTime(long tickStartTime) {
@@ -1721,9 +1711,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1722,9 +1712,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
Expand All @@ -892,7 +892,7 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
@@ -1740,21 +1728,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1741,21 +1729,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
this.profiler.push("commandFunctions");
Expand All @@ -914,15 +914,15 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - Perf: Optimize time updates
for (final ServerLevel level : this.getAllLevels()) {
@@ -1774,7 +1757,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1775,7 +1758,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end - Perf: Optimize time updates
- MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper

this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
@@ -1801,9 +1783,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1802,9 +1784,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.push("tick");

try {
Expand All @@ -932,7 +932,7 @@ index b5a216dbf3f73c32ac4e930a694527dc13df0b5d..e5dd0fdcf0e54b9d972880b336fea46d
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");

@@ -1818,24 +1798,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1819,24 +1799,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked

this.profiler.popPush("connection");
Expand Down Expand Up @@ -1136,7 +1136,7 @@ index dcb5651d1d9b10b40430fb2f713beedf68336704..68e445c21e0acbdf6bb74d50ddd32e0e
gameprofilerfiller.pop();
gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f89e239474 100644
index 2fe9d9b38c01d04416843fdd48d3e33899b7de63..af57e7aefc757be8ed9e2238e1e01973f57bf091 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,7 +1,6 @@
Expand All @@ -1147,15 +1147,15 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair;
@@ -709,7 +708,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -666,7 +665,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
}

gameprofilerfiller.popPush("tickPending");
- this.timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug() && flag) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -718,24 +716,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -675,24 +673,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks
gameprofilerfiller.pop();
}
Expand All @@ -1180,23 +1180,23 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
}

this.handlingTick = false;
@@ -748,7 +739,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -705,7 +696,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.

if (flag1 || this.emptyTime++ < 300) {
gameprofilerfiller.push("entities");
- this.timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null && flag) {
gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
@@ -756,7 +746,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -713,7 +703,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
}

org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- this.timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -783,8 +772,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -740,8 +729,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
}
}
});
Expand All @@ -1205,7 +1205,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
gameprofilerfiller.pop();
this.tickBlockEntities();
}
@@ -945,12 +932,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -902,12 +889,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
} // Paper - Option to disable ice and snow

gameprofilerfiller.popPush("tickBlocks");
Expand All @@ -1218,7 +1218,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
gameprofilerfiller.pop();
}

@@ -1262,9 +1247,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1219,9 +1204,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
currentlyTickingEntity.lazySet(entity);
}
// Paper end - log detailed entity tick information
Expand All @@ -1228,7 +1228,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
/*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below
entity.tickCount++;
timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings
@@ -1273,11 +1256,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1230,11 +1213,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return;
}*/ // Paper - comment out EAR 2
// Spigot end
Expand All @@ -1240,7 +1240,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler();

@@ -1287,12 +1266,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1244,12 +1223,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
if (isActive) { // Paper - EAR 2
Expand All @@ -1253,7 +1253,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
Iterator iterator = entity.getPassengers().iterator();

while (iterator.hasNext()) {
@@ -1315,8 +1292,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1272,8 +1249,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
Expand All @@ -1262,7 +1262,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
@@ -1345,8 +1320,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1302,8 +1277,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.

this.tickPassenger(passenger, entity2);
}
Expand All @@ -1271,7 +1271,7 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
}
} else {
passenger.stopRiding();
@@ -1366,24 +1339,23 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1323,24 +1296,23 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
}

Expand Down Expand Up @@ -1309,15 +1309,15 @@ index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..6944c6af9bee702be8a1b52e251a18f8
}
// Paper end - Incremental chunk and player saving

@@ -1397,7 +1369,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1354,7 +1326,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.

if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
- try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1407,12 +1378,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1364,12 +1335,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0007-Leaves-Protocol-Core.patch
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ index 1967c43ee3a12e63365cc40ee6565307e2fd73cf..6e376d0db5321d8e9b6e0b54617ffd17

assert isValidPath(path);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e5dd0fdcf0e54b9d972880b336fea46d396a56e4..bac0a69424c0370055c2a0ebfbf711c5e8a3db4c 100644
index 0d362b80044f05e3c6cae9d0f3ab9af6349b5fed..7ce0fb36690e12f3f36c9a43e45ac71814be8e69 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1807,6 +1807,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1808,6 +1808,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

this.profiler.popPush("server gui refresh");

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0008-Fix-trading-with-the-void.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Fix trading with the void


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6944c6af9bee702be8a1b52e251a18f89e239474..71f1b5eb1d2b3d9fb0436c842b479c30976be3f6 100644
index af57e7aefc757be8ed9e2238e1e01973f57bf091..b835b259d9e371ff18b1704249b290d1ecbe06e1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2606,11 +2606,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2563,11 +2563,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
Expand Down
Loading

0 comments on commit ffdcaa8

Please sign in to comment.