From 5a735a63ed912a281b567e6de20f46feaf8d66df Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 17 May 2024 18:23:14 -0700 Subject: [PATCH] Update Paper --- gradle.properties | 2 +- ...king-ownership-of-region-by-position.patch | 4 +- patches/server/0001-Build-changes.patch | 108 ++++++----- patches/server/0003-Threaded-Regions.patch | 168 +++++++++--------- ...-getHandle-and-overrides-perform-thr.patch | 30 ++-- ...0007-Disable-mid-tick-task-execution.patch | 4 +- ...edOperationException-for-broken-APIs.patch | 6 +- ...access-when-waking-players-up-during.patch | 4 +- patches/server/0018-Region-profiler.patch | 18 +- 9 files changed, 168 insertions(+), 176 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1dd871afb..5ac4d33e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=dev.folia version=1.20.6-R0.1-SNAPSHOT mcVersion=1.20.6 -paperRef=4fd58a1b8fcb4e044b87a4d4af2f20da53fdb3b3 +paperRef=d8d59e0cdeda3f7e9da337b6d489f306fc5e76c9 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch b/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch index 385b564c0..a8baaee28 100644 --- a/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch +++ b/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch @@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership check. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 5d1b55fdbcbe63f6b42b694d05211a3cc691a09d..b4327a55c422380ca6b3a1dc47c3adbe76de4655 100644 +index 71f1c361ebccbe83193c37ec3a90faa4085001c3..67c021f6d5d2afed92c7ceb4f511e3a43bbe2417 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2905,6 +2905,14 @@ public final class Bukkit { +@@ -2902,6 +2902,14 @@ public final class Bukkit { return server.isOwnedByCurrentRegion(entity); } // Paper end - Folia region threading API diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index 74742353d..1a5591c1f 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -5,34 +5,38 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index 079bf6878538a1c223ac912f29f6df79a1167218..b1d621ed91c74790fd5b66339c044ec444de62ef 100644 +index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..eb2f9941b24af591f1e56339b97f5284a765cf81 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -12,8 +12,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { +@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { val alsoShade: Configuration by configurations.creating dependencies { - implementation(project(":paper-api")) -- implementation(project(":paper-mojangapi")) -+ // Folia start -+ implementation(project(":folia-api")) -+ implementation("io.papermc.paper:paper-mojangapi:${project.version}") { -+ exclude("io.papermc.paper", "paper-api") -+ } -+ // Folia end ++ implementation(project(":folia-api")) // Folia // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -79,7 +83,7 @@ tasks.jar { +@@ -80,14 +80,14 @@ tasks.jar { + val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", - "Implementation-Title" to "CraftBukkit", -- "Implementation-Version" to "git-Paper-$implementationVersion", -+ "Implementation-Version" to "git-Folia-$implementationVersion", // Folia +- "Implementation-Title" to "Paper", ++ "Implementation-Title" to "Folia", // Folia + "Implementation-Version" to implementationVersion, "Implementation-Vendor" to date, // Paper - "Specification-Title" to "Bukkit", +- "Specification-Title" to "Paper", ++ "Specification-Title" to "Folia", // Folia "Specification-Version" to project.version, -@@ -138,7 +142,7 @@ fun TaskContainer.registerRunTask( + "Specification-Vendor" to "Paper Team", +- "Brand-Id" to "papermc:paper", +- "Brand-Name" to "Paper", ++ "Brand-Id" to "papermc:folia", // Folia ++ "Brand-Name" to "Folia", // Folia + "Build-Number" to (build ?: ""), + "Build-Time" to Instant.now().toString(), + "Git-Branch" to gitBranch, // Paper +@@ -144,7 +144,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -69,55 +73,43 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..cb60d58d4a7556dd896f31d0cd249f86 metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { Map> map = new HashMap<>(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f1100c89c17 100644 +index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..29bd788ae8bc61c1e62a4f84b9e259931a7041ce 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher { - @Nonnull - @Override - public Component getVersionMessage(@Nonnull String serverVersion) { -- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]"); -- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]); -+ String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia -+ final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia - final Component history = getHistory(); +@@ -49,7 +49,7 @@ public class PaperVersionFetcher implements VersionFetcher { + if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) { + updateMessage = text("You are running a development version without access to version information", color(0xFF5300)); + } else { +- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build); ++ updateMessage = getUpdateStatusMessage("PaperMC/Folia", build); // Folia + } + final @Nullable Component history = this.getHistory(); - return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage; -@@ -85,7 +85,7 @@ public class PaperVersionFetcher implements VersionFetcher { - if (siteApiVersion == null) { return -1; } +@@ -86,7 +86,7 @@ public class PaperVersionFetcher implements VersionFetcher { + private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) { try { - try (BufferedReader reader = Resources.asCharSource( -- new URL("https://api.papermc.io/v2/projects/paper/versions/" + siteApiVersion), -+ new URL("https://api.papermc.io/v2/projects/folia/versions/" + siteApiVersion), // Folia + try (final BufferedReader reader = Resources.asCharSource( +- URI.create("https://api.papermc.io/v2/projects/paper/versions/" + build.minecraftVersionId()).toURL(), ++ URI.create("https://api.papermc.io/v2/projects/folia/versions/" + build.minecraftVersionId()).toURL(), // Folia Charsets.UTF_8 ).openBufferedStream()) { - JsonObject json = new Gson().fromJson(reader, JsonObject.class); -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8dc2f9df367c849ca333bf1a1fd92ff91617b548..5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1924,7 +1924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API @@ -10070,10 +10070,10 @@ index 57e76b53e5e314c3e6b8856010f7a84188121582..9f07a1a5e2c082d16de068de6f47bf8f } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b403c2cb1ca 100644 +index dbc86b8d4d2af6e5f7e678f2bb77fd39b85c04c5..cd63ccf69ce701079d780afaff0d784ec0e4f535 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -207,7 +207,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; - public Commands vanillaCommandDispatcher; -@@ -313,13 +312,41 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system -@@ -355,7 +382,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 ? Mth.square(ChunkProgressListener.calculateDiameter(i)) : 0; @@ -10218,7 +10218,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40 // Iterator iterator = this.levels.values().iterator(); if (true) { -@@ -845,7 +884,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { String s = String.valueOf(worldserver); -@@ -1780,7 +1857,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop command = new java.util.concurrent.atomic.AtomicReference<>(s); // Paper @@ -12185,7 +12185,7 @@ index eb4fc900164d1fb3a78653ae8bc42ea30323f5b7..05bc06fcf508e74c717a7f71a2c7ed7c CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack(); RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s); this.server.getPluginManager().callEvent(event); -@@ -812,7 +812,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -811,7 +811,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper); this.server.dispatchServerCommand(event.getSender(), serverCommand); } // Paper @@ -14293,7 +14293,7 @@ index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..559b6d0e3611b506ff10e5ae7c42b35f for (ServerPlayer player : ServerLevel.this.players) { player.getBukkitEntity().onEntityRemove(entity); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8437316888c6056060a2780652147590b6fe7443..ea396c3b2a7d738ec4331d332b5cff550c9d9ffb 100644 +index c10401e587a710d49c4af481c1e531b4bf51f755..080c0128e4fab68bcf9739737a44c736e1f87bc0 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -199,7 +199,7 @@ import org.bukkit.inventory.MainHand; @@ -15039,7 +15039,7 @@ index 1351423a12c19a01f602a202832372a399e6a867..888cf5257fba032b9edd95a89e71ca8b } diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 8ac5d8ccf731100a1be690cb2ed1be82cadba8ed..e25918c403ddcca87dd64d36b06f7466e2c99bd8 100644 +index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..f907dbb55369395058091dd75ae435d2025d94dd 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -107,6 +107,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -15221,7 +15221,7 @@ index 8aff5129f85ab5729b3da2e465871be62d15bdf2..8044271ff01dfc6808f5a3b60be74f6d Collections.shuffle( this.connections ); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f6476848664b046221 100644 +index b9b3277c8ed94e0cd30b20b9c00a33eaad48e5ac..b4c4e72ddd09231747f82962a9d2883c6415ce30 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -300,7 +300,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -15553,7 +15553,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 // Evil plugins still listening to deprecated event final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients()); queueEvent.setCancelled(event.isCancelled()); -@@ -2506,6 +2558,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2493,6 +2545,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (s.isEmpty()) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message"); } else if (this.getCraftPlayer().isConversing()) { @@ -15561,7 +15561,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 final String conversationInput = s; this.server.processQueue.add(new Runnable() { @Override -@@ -2741,8 +2794,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2724,8 +2777,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot End public void switchToConfig() { @@ -15588,7 +15588,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 this.send(ClientboundStartConfigurationPacket.INSTANCE); this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND); } -@@ -2768,7 +2838,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2751,7 +2821,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); this.player.setShiftKeyDown(packet.isUsingSecondaryAction()); @@ -15597,7 +15597,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 if (!worldserver.getWorldBorder().isWithinBounds(entity.blockPosition())) { return; } -@@ -2912,6 +2982,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2895,6 +2965,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl switch (packetplayinclientcommand_enumclientcommand) { case PERFORM_RESPAWN: if (this.player.wonGame) { @@ -15610,7 +15610,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 this.player.wonGame = false; this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, RespawnReason.END_PORTAL, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - Expand PlayerRespawnEvent CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD); -@@ -2920,6 +2996,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2903,6 +2979,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } @@ -15629,7 +15629,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent -@@ -3291,7 +3379,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3274,7 +3362,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -15638,7 +15638,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866 return; } } -@@ -3460,7 +3548,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3443,7 +3531,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.filterTextPacket(list).thenAcceptAsync((list1) -> { this.updateSignText(packet, list1); @@ -16397,10 +16397,10 @@ index 99a7e9eb75231c15bd8bb24fbb4e296bc9fdedff..695f5b452d0abc4e474e8e55134a122d public Component getDeathMessage() { diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -index 359a2f0492a9b938a4f015c546e100e0092ae1d4..6f13f96bcc401673be45c8ed62e62ca2b43ce36c 100644 +index dd9638bdb228a53e72820e0e7cf6fe6fcc08fe4b..0fa04cab50f885f0e03215859c4919c843521d59 100644 --- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java +++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -@@ -157,13 +157,13 @@ public class DamageSource { +@@ -173,13 +173,13 @@ public class DamageSource { LivingEntity entityliving1 = killed.getKillCredit(); String s1 = s + ".player"; @@ -17437,7 +17437,7 @@ index 2bc85351e6e52f90da5fdb29d8d042a06132d742..8d3737dc1381cb0c179912c7cb215e15 /** * Invoked only when the entity is truly removed from the server, never to be added to any world. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..ed1aa10948897780aefa9a2b4034abb4c7efbb17 100644 +index 517e10c3d8b1549cd30fd0e7cf2bcb35e88eb8ed..533ecd7e2666c2735483953e5a0426939e928ec5 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -256,7 +256,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -18634,10 +18634,10 @@ index 5b32364f1452e1b395b91921d045060fd94881b8..51f2ec6dd466c12282a68d07b46b8478 boolean flag = false; diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a34497216f 100644 +index 519755b7f8bc7e8bb9fab135fc5bf7de3a9419f9..b3b7c61db5e640acdc9f4aa70ebf1d8b8e3ec272 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -46,6 +46,78 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -45,6 +45,78 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F); } @@ -18716,7 +18716,7 @@ index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a3 @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); -@@ -55,6 +127,20 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -54,6 +126,20 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { } if (!this.level().isClientSide && !this.isRemoved()) { @@ -18737,7 +18737,7 @@ index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a3 Entity entity = this.getOwner(); if (entity instanceof ServerPlayer) { -@@ -113,6 +199,14 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -112,6 +198,14 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { } @@ -19327,7 +19327,7 @@ index ea0aee88c7d901034427db201c1b2430f8a1d522..2a147a839e78b1d7bfb5eea869754025 return player; } diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index dc88014c4d9f172cc54e5d77b488128f9ffbc73d..1234203335675df14aadc029792ce56ba61dbc51 100644 +index 082b804f4793f72e76361f5427f0358273454b3d..f079fc7ada73dbf5cf21ae78ec4aaebdaa116b1a 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -878,17 +878,18 @@ public class Explosion { @@ -19904,7 +19904,7 @@ index 54972cce2314eff774250101df43a9b7074e9604..0c4942895a83ce1392dd1e71a00ab6d0 } diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java -index 4459685d1fb655f93a523ae50b62d6b97785ed90..318e4939591cc51c0a72f82d51084d140b9d12c4 100644 +index 85d598c3354ee62f0fd1b26e485e0084967c0380..8492c8fd3ff448d559b33f27b549180918aedeea 100644 --- a/src/main/java/net/minecraft/world/level/block/BedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java @@ -365,7 +365,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @@ -21823,10 +21823,10 @@ index 7a69564572357a7acc043e35b9c113beeb738951..f71661ef4250d3b668fffeea7cd74a28 LevelChunkTicks levelChunkTicks = this.allContainers.get(l); if (levelChunkTicks == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5b5cb713e 100644 +index 2fa5507aa2153a05208077f9547c165a1099b5bb..08e374191b474a1300a70096f2b0138b309e4b80 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -311,7 +311,7 @@ public final class CraftServer implements Server { +@@ -307,7 +307,7 @@ public final class CraftServer implements Server { private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes // Paper start - Folia region threading API @@ -21835,7 +21835,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5 private final io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler asyncScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler(); private final io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler globalRegionScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler(); -@@ -379,6 +379,12 @@ public final class CraftServer implements Server { +@@ -375,6 +375,12 @@ public final class CraftServer implements Server { return io.papermc.paper.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandleRaw()); } // Paper end - Folia reagion threading API @@ -21848,7 +21848,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5 static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); -@@ -971,6 +977,9 @@ public final class CraftServer implements Server { +@@ -936,6 +942,9 @@ public final class CraftServer implements Server { // NOTE: Should only be called from DedicatedServer.ah() public boolean dispatchServerCommand(CommandSender sender, ConsoleInput serverCommand) { @@ -21858,7 +21858,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5 if (sender instanceof Conversable) { Conversable conversable = (Conversable) sender; -@@ -990,12 +999,46 @@ public final class CraftServer implements Server { +@@ -955,12 +964,46 @@ public final class CraftServer implements Server { } } @@ -21905,7 +21905,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5 if (this.commandMap.dispatch(sender, commandLine)) { return true; } -@@ -3254,7 +3297,7 @@ public final class CraftServer implements Server { +@@ -3240,7 +3283,7 @@ public final class CraftServer implements Server { @Override public int getCurrentTick() { @@ -22706,7 +22706,7 @@ index a2d336ceb52b63db5c03432ee7bc94dc6a742b82..cf9282a46534319308e9ccf69f332a5c // Paper end - more teleport API / async chunk API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5f896948d158651cd9837364759dbfbcce6b7d21..81f442d23582049757353d9aba02d612e6058299 100644 +index 7e6116963d835d4606ef3d93b69d3e44b61288e1..c03015738313ba802436ed8a047623c02e94a06e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -647,7 +647,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -22749,7 +22749,7 @@ index 5f896948d158651cd9837364759dbfbcce6b7d21..81f442d23582049757353d9aba02d612 entry.updatePlayer(this.getHandle()); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 547ab158cd0cbf51da06ea97740cfce34bca651b..570fb9e4c6750666c8a498e896520bd4bdb3610e 100644 +index 34b91eff3190848bae38b20e1d956ece497b1473..9aa832a851b78197759c6d8d5c5159f33e3870f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -942,7 +942,7 @@ public class CraftEventFactory { @@ -22770,7 +22770,7 @@ index 547ab158cd0cbf51da06ea97740cfce34bca651b..570fb9e4c6750666c8a498e896520bd4 Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { -@@ -2143,7 +2143,7 @@ public class CraftEventFactory { +@@ -2140,7 +2140,7 @@ public class CraftEventFactory { CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1)); org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to)); @@ -22792,10 +22792,10 @@ index e85b9bb3f9c225d289a4959921970b9963881199..b00e3b9b628f3d2a2fdbf1d2c7790496 if (!this.isAsyncScheduler && !task.isSync()) { this.asyncScheduler.handle(task, delay); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a1c9989df460d7ae3666fffe7968750832a30b85..521b9c19e3d50a0ecc59cdcce0a7d7d79544085b 100644 +index 5a382907285a288f2a223189e690d3dbdf45594c..8248cd6c908c82b6b7a18df7410a9a4a46a91959 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -383,6 +383,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -387,6 +387,12 @@ public final class CraftMagicNumbers implements UnsafeValues { throw new InvalidPluginException("Unsupported API version " + pdf.getAPIVersion()); } diff --git a/patches/server/0006-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch b/patches/server/0006-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch index 65f60ddef..86e1a0769 100644 --- a/patches/server/0006-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch +++ b/patches/server/0006-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch @@ -270,10 +270,10 @@ index ab42bc721d5b6c17c2ca6c7153b757571aea05e8..2887699c16b9452ce948f8b945c595ca } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java -index af35ff560a02daca7a130322fccbb52160e2db98..e6422dd9175e1e87580c9f3930ce486d1cfe730d 100644 +index 81f5e1d866128af8fb2acc13aca715580fdf9886..a1485f913ee824620083f9726fdf5812f9d2dc5f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java -@@ -27,8 +27,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud +@@ -28,8 +28,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud super(server, entity); } @@ -324,10 +324,10 @@ index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223f3e8e340 100644 +index 5232fbef0d014edd32a5d18d4a1500ab215313f5..461419d42cc7fe47311d798a637cf2f2c0025364 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -@@ -25,6 +25,7 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow { +@@ -26,6 +26,7 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow { @Override public net.minecraft.world.entity.projectile.Arrow getHandle() { @@ -335,7 +335,7 @@ index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223 return (net.minecraft.world.entity.projectile.Arrow) this.entity; } -@@ -89,6 +90,13 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow { +@@ -90,6 +91,13 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow { return true; } @@ -347,8 +347,8 @@ index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223 + // Folia end - region threading + @Override - public void setBasePotionType(PotionType potionType) { - if (potionType != null) { + public void setBasePotionData(PotionData data) { + this.setBasePotionType(CraftPotionUtil.fromBukkit(data)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java index cbfca242f820d238b112f8ce64e9de8398c48a1c..c5f0cd5e69a20f1fffcd017385bf9fab59630ffc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java @@ -1079,10 +1079,10 @@ index 1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69..0be7f84a50b7568d0c639f5906b5ca76 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java -index 939a0713c74dd92273190017d3976d894f002d95..51c96a085ca8b164435bafdc4f269f43e8f8fe6d 100644 +index 2124b31ca4d994ad159556d47a315004b7246265..17773f2629f372b671898640ac87021593452407 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java -@@ -60,8 +60,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball { +@@ -75,8 +75,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball { } // Paper end - Expose power on fireball projectiles @@ -1415,7 +1415,7 @@ index 37007775d27598e319c0c78929c6a808b697724a..17265ad2eaa38259f3c311c1c73576a7 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java -index 8746f80d08df5501b32958eb123aa7d814573ddf..c6c6eb55f4649e18beef9832c2ea7b9d1515666f 100644 +index 9b6ff0f64966c78a3233860bb0840182b52f01bc..a9b9bebee183992d0abd4de78efae078f41fe4ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java @@ -13,8 +13,16 @@ public class CraftHorse extends CraftAbstractHorse implements Horse { @@ -1693,7 +1693,7 @@ index aa351df679f300018367244c7ccb3e5a59e9276f..9a24e70d574c854fa48510603bee7b0e } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java -index 0ad16ee7b33582d214dab41eeee378d52c8e38ed..874c6690ec46d482757093296bbcf1864382e13b 100644 +index 351f42842b780d053cd2e5bad9ae299449141b10..6329f0b069fc03eef14e2c85525c93b47b8d3945 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -14,8 +14,16 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys @@ -2224,7 +2224,7 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292140545d7 100644 +index c03015738313ba802436ed8a047623c02e94a06e..96201b5b458d8e0cbebf586062fac1ec2d81fdd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -667,7 +667,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2236,7 +2236,7 @@ index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292 final ServerGamePacketListenerImpl connection = this.getHandle().connection; if (connection != null) { connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); -@@ -2294,9 +2294,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2291,9 +2291,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this; } @@ -2254,7 +2254,7 @@ index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292 } public void setHandle(final ServerPlayer entity) { -@@ -3332,7 +3339,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3329,7 +3336,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { { if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() ) { @@ -2895,7 +2895,7 @@ index 5e7fef664c56d6087502e56a0eb4fc07d34ade9f..7538d449e24a8d680628f31b22924e7d } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java -index 93b42b970b174b800cf89cb0d12cf3d2574323bd..e21207d107be5dcae30add4d4e68e33979020b89 100644 +index 42462fac097aeb1cfd367f8c240da63f513ec5a8..bee84fee81eb8fca431d982ea88df71b3136c182 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java @@ -61,8 +61,17 @@ public class CraftThrownPotion extends CraftThrowableProjectile implements Throw diff --git a/patches/server/0007-Disable-mid-tick-task-execution.patch b/patches/server/0007-Disable-mid-tick-task-execution.patch index 753354ae1..0334aff29 100644 --- a/patches/server/0007-Disable-mid-tick-task-execution.patch +++ b/patches/server/0007-Disable-mid-tick-task-execution.patch @@ -10,10 +10,10 @@ the impact from scaling the region threads, but is not a fix to the underlying issue. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 240ab19712f35b6860b8a4a963a85b403c2cb1ca..d260b41ae96eb6da429853ac115c155829a04c62 100644 +index cd63ccf69ce701079d780afaff0d784ec0e4f535..b28c82e4a49ae5ae58bdb43e012afd5ef4a839f3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1522,6 +1522,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading @@ -1424,7 +1424,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8 try { this.isSaving = true; if (playerSaveInterval > 0) { -@@ -1717,6 +1728,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { // Folia - region threading entityplayer.connection.suspendFlushing(); -@@ -1858,12 +1871,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop