diff --git a/patches/unapplied/server/0407-Reduce-MutableInt-allocations-from-light-engine.patch b/patches/removed/1.20/0407-Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from patches/unapplied/server/0407-Reduce-MutableInt-allocations-from-light-engine.patch rename to patches/removed/1.20/0407-Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/patches/unapplied/server/0389-Villager-Restocks-API.patch b/patches/server/0376-Villager-Restocks-API.patch similarity index 92% rename from patches/unapplied/server/0389-Villager-Restocks-API.patch rename to patches/server/0376-Villager-Restocks-API.patch index 6aa68682f0..2629910b56 100644 --- a/patches/unapplied/server/0389-Villager-Restocks-API.patch +++ b/patches/server/0376-Villager-Restocks-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Villager Restocks API public net.minecraft.world.entity.npc.Villager numberOfRestocksToday diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 7479a68d9c1025c8f2cd784b2607b549d40f3638..ae8c32c3497125fa2d1959e3a44b7c3013646762 100644 +index 87d9cd989be932cf3eb9e777cbc2d2246ccf9d9a..350cfc1526894f4dac56832a6d1dfbbc9b25123c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -92,6 +92,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { diff --git a/patches/unapplied/server/0390-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0377-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 90% rename from patches/unapplied/server/0390-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to patches/server/0377-Validate-PickItem-Packet-and-kick-for-invalid.patch index 82f1ef7c08..dfef805203 100644 --- a/patches/unapplied/server/0390-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0377-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4ad848bd15a9bcb14a53e7f391938982a2f4c207..39dbdfe8c74b2bf3d57f59c073f882dd2eca79ab 100644 +index 093eaae15344b39e217978e4c0bdbc37b83f6799..3c0f15d294891143624ac7feadb09c3f8de3059e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -959,7 +959,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -960,7 +960,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handlePickItem(ServerboundPickItemPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - this.player.getInventory().pickSlot(packet.getSlot()); + // Paper start - validate pick item position + if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { diff --git a/patches/unapplied/server/0391-Expose-game-version.patch b/patches/server/0378-Expose-game-version.patch similarity index 89% rename from patches/unapplied/server/0391-Expose-game-version.patch rename to patches/server/0378-Expose-game-version.patch index 5f07821d47..eb37d6ee9b 100644 --- a/patches/unapplied/server/0391-Expose-game-version.patch +++ b/patches/server/0378-Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b7dc51e29aed83fe40cc4730a1b8448b432ebff8..0dbabab39dddfbc2a11c509e6e7e12814e60c6c2 100644 +index 7f4ee248bede39701365d200cdc4e39f7bdd8b26..db932976919ae8a2a258b61d386e6a5c54fe7be4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -577,6 +577,13 @@ public final class CraftServer implements Server { diff --git a/patches/unapplied/server/0392-Optimize-Voxel-Shape-Merging.patch b/patches/server/0379-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/unapplied/server/0392-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0379-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/unapplied/server/0393-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0380-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 93% rename from patches/unapplied/server/0393-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0380-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 2ac9053313..e21322dfbe 100644 --- a/patches/unapplied/server/0393-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0380-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 7f85bc8e8a666a32e392fa57418bf0d479e758d0..e7b088a6ffed52d2dc9d6528d827997d68fcc84c 100644 +index 203a25a2a8d843c33440d849a94b85e2c717d2a0..9f1b363e1a6fa4925dc4560654af8426e6908c9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -26,6 +26,7 @@ public class Main { diff --git a/patches/unapplied/server/0394-misc-debugging-dumps.patch b/patches/server/0381-misc-debugging-dumps.patch similarity index 92% rename from patches/unapplied/server/0394-misc-debugging-dumps.patch rename to patches/server/0381-misc-debugging-dumps.patch index 0f4aff6ccc..a16c86724c 100644 --- a/patches/unapplied/server/0394-misc-debugging-dumps.patch +++ b/patches/server/0381-misc-debugging-dumps.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ebc8446631a4c4abccd2292ec52b69a0b6685199..e189de6d2aa94e9bbb20f1477ee2e34431adb324 100644 +index d7428c963fc369e04926a5987653ea5bd325d51d..260fbcafbb4c2049372ea57451d22479e4a3addd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -892,6 +892,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop set) { // Paper diff --git a/patches/unapplied/server/0396-Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/0383-Deobfuscate-stacktraces-in-log-messages-crash-report.patch similarity index 96% rename from patches/unapplied/server/0396-Deobfuscate-stacktraces-in-log-messages-crash-report.patch rename to patches/server/0383-Deobfuscate-stacktraces-in-log-messages-crash-report.patch index 447763fd3a..54d52fb74a 100644 --- a/patches/unapplied/server/0396-Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/0383-Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and diff --git a/build.gradle.kts b/build.gradle.kts -index c04f733d053a52218893ef2b9ca050f911b50b0a..e63ad0e49818709cb292b9e43f5b52f5cb13002f 100644 +index d86a4eebb4fd4144d762407aaccc7de497d0a5c1..16739eb5fc89fce4a77ad84387c785a5d41a9df2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ dependencies { @@ -22,8 +22,8 @@ index c04f733d053a52218893ef2b9ca050f911b50b0a..e63ad0e49818709cb292b9e43f5b52f5 implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files implementation("commons-lang:commons-lang:2.6") + implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation - runtimeOnly("org.xerial:sqlite-jdbc:3.41.2.2") - runtimeOnly("com.mysql:mysql-connector-j:8.0.32") + runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0") + runtimeOnly("com.mysql:mysql-connector-j:8.0.33") runtimeOnly("com.lmax:disruptor:3.4.4") // Paper @@ -105,6 +107,18 @@ tasks.check { } @@ -474,7 +474,7 @@ index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890 } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd909c18a8b 100644 +index 7e11cf7d6871b6125ccccae2b765cd4dfcf38d3b..e857327b796455953e76ddf70913c37a3f1e2ee2 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -64,13 +64,13 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -494,7 +494,7 @@ index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd9 }); private final PacketFlow receiving; private final Queue queue = Queues.newConcurrentLinkedQueue(); -@@ -199,7 +199,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -172,7 +172,7 @@ public class Connection extends SimpleChannelInboundHandler> { } } @@ -504,7 +504,7 @@ index ca9a36e357e73b1b518ebb5c937314269655de32..59bb1d340e0be6f15a8c6ac21500cdd9 protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 549ea8e0fe702615eefcbfd1cd6a30e05b7b3fd5..771677c0e1cd7bfe089b9a5bb9095650216ff588 100644 +index eef9206a9d6a398eb1d44a36b6a1a342ed7bc878..9d2eb13130d3b68fd0ca07243a3a41735f89c7b2 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -516,10 +516,10 @@ index 549ea8e0fe702615eefcbfd1cd6a30e05b7b3fd5..771677c0e1cd7bfe089b9a5bb9095650 paperConfigurations.initializeWorldDefaultsConfiguration(); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813a40c1a11 100644 +index a25d46fc3e2a106ab94c6b2b49558dd7be11c5b9..8cdb2bdd404f2f091493bb7a93f62f764a8e511b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -218,7 +218,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -221,7 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel { public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper public static Throwable getAddToWorldStackTrace(Entity entity) { @@ -530,7 +530,7 @@ index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813 } @Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI -@@ -1326,7 +1328,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1235,7 +1237,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity.isRemoved()) { // Paper start if (DEBUG_ENTITIES) { @@ -540,7 +540,7 @@ index 4bf38f9006be9e838c54783dafd40cf84553d627..51e8070864ffc4a35377021a7ded9813 } // Paper end diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index fbf375534e2b8bd6ef052c4625764f4f8feb2ed6..bb9e65eee7e0ca0f715cd5791c47579a57b1b577 100644 +index 776528e50a5abc0e02d9de99231fb47352aa4f43..4017c15a62ce1048a61f55f46f915fd516496181 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -51,10 +51,10 @@ public class ServerConnectionListener { @@ -592,10 +592,10 @@ index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index ee1c9f2c8dd30b3f32a6d49aa1c43148f4e5ccac..73a3f9eae86df8e9afd08ee9da4c1b8e16dededd 100644 +index cb8166771b57bb4dd7e64150bd02e8944307783f..04d0e2db1bb38700a1bc210296d7f8bfdd3aead5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -633,7 +633,7 @@ public class LevelChunk extends ChunkAccess { +@@ -603,7 +603,7 @@ public class LevelChunk extends ChunkAccess { + " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" + "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) + "\nWorld: " + level.getLevel().dimension().location()); @@ -621,10 +621,10 @@ index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..9c1aff17aabd062640e3f451a2ef8c50 CraftAsyncScheduler() { diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 383c52c62f49b17db2fbf58009d6ea132d124bea..e0a71bfc1498a517456b21747ab6ef3f1067a3f3 100644 +index 29b315188e3deb994b45b2154b2ce4f17c4fde2d..571d80ca3e85fc108137b317ed1033ca4714718e 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -105,7 +105,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -105,7 +105,7 @@ public class WatchdogThread extends Thread log.log( Level.SEVERE, "During the run of the server, a plugin set an excessive velocity on an entity" ); log.log( Level.SEVERE, "This may be the cause of the issue, or it may be entirely unrelated" ); log.log( Level.SEVERE, org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getMessage()); @@ -633,7 +633,7 @@ index 383c52c62f49b17db2fbf58009d6ea132d124bea..e0a71bfc1498a517456b21747ab6ef3f { log.log( Level.SEVERE, "\t\t" + stack ); } -@@ -193,7 +193,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -192,7 +192,7 @@ public class WatchdogThread extends Thread } log.log( Level.SEVERE, "\tStack:" ); // diff --git a/patches/unapplied/server/0397-Implement-Mob-Goal-API.patch b/patches/server/0384-Implement-Mob-Goal-API.patch similarity index 99% rename from patches/unapplied/server/0397-Implement-Mob-Goal-API.patch rename to patches/server/0384-Implement-Mob-Goal-API.patch index 1237642b1b..9613c32f7f 100644 --- a/patches/unapplied/server/0397-Implement-Mob-Goal-API.patch +++ b/patches/server/0384-Implement-Mob-Goal-API.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index e63ad0e49818709cb292b9e43f5b52f5cb13002f..719f4b4bff2ab651156f17e27412ae8b0e9e5d02 100644 +index 16739eb5fc89fce4a77ad84387c785a5d41a9df2..bc71323234b69a07ac84703c04734711ca0dd113 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { - runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3") - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3") + runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.10") + runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.10") + testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test testImplementation("junit:junit:4.13.2") @@ -792,10 +792,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31 LOOK, JUMP, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9c50a908146b599b79176bd64f6773539db14996..ea1f82fd9369c75b1bfdc8f82c70f1bc132afdca 100644 +index 067457ff4f108a5725021cc2a9c501f5e9500307..b31657b4dd8ea2c8c3a4fb51ad37067118983d05 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2760,5 +2760,11 @@ public final class CraftServer implements Server { +@@ -2758,5 +2758,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/unapplied/server/0398-Add-villager-reputation-API.patch b/patches/server/0385-Add-villager-reputation-API.patch similarity index 98% rename from patches/unapplied/server/0398-Add-villager-reputation-API.patch rename to patches/server/0385-Add-villager-reputation-API.patch index a745be8032..a84e9e01ee 100644 --- a/patches/unapplied/server/0398-Add-villager-reputation-API.patch +++ b/patches/server/0385-Add-villager-reputation-API.patch @@ -57,7 +57,7 @@ index a28f359202e6502c6ea5e9c918ec0b3e9a3fca61..76dffb2705e5207db96895f82f1c7c56 static record GossipEntry(UUID target, GossipType type, int value) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index ae8c32c3497125fa2d1959e3a44b7c3013646762..a1705b0fae9574d4ce2bb815ea57a35f8551c3a6 100644 +index 350cfc1526894f4dac56832a6d1dfbbc9b25123c..e6fcdbabde66f4707627fc8c3012aa20de8e34e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -18,6 +18,13 @@ import org.bukkit.entity.Villager; diff --git a/patches/unapplied/server/0399-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0386-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 96% rename from patches/unapplied/server/0399-Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/0386-Option-for-maximum-exp-value-when-merging-orbs.patch index 466b49e0b3..bb103e920e 100644 --- a/patches/unapplied/server/0399-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0386-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 195f5ef5fcabcf021e429b2a51aa274e929c7322..52d4e6904601d680c89168d2b1e765868d57e798 100644 +index 4a1699b56f2111881653404b38f18c9e2e7473b4..3f6d9c6b88e14135917bdfe5e5df019213dde325 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -648,16 +648,30 @@ public class CraftEventFactory { diff --git a/patches/unapplied/server/0400-ExperienceOrbMergeEvent.patch b/patches/server/0387-ExperienceOrbMergeEvent.patch similarity index 94% rename from patches/unapplied/server/0400-ExperienceOrbMergeEvent.patch rename to patches/server/0387-ExperienceOrbMergeEvent.patch index 4a0c8ba371..d679d0f411 100644 --- a/patches/unapplied/server/0400-ExperienceOrbMergeEvent.patch +++ b/patches/server/0387-ExperienceOrbMergeEvent.patch @@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 52d4e6904601d680c89168d2b1e765868d57e798..0ad0d6e15f57c16fb71f988ac7d0d2e243493801 100644 +index 3f6d9c6b88e14135917bdfe5e5df019213dde325..7af0710c40c1453bd0bd8ecb4ea7606bbe76c20f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -658,7 +658,7 @@ public class CraftEventFactory { diff --git a/patches/unapplied/server/0401-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0388-Fix-PotionEffect-ignores-icon-flag.patch similarity index 100% rename from patches/unapplied/server/0401-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0388-Fix-PotionEffect-ignores-icon-flag.patch diff --git a/patches/unapplied/server/0402-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0389-Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/unapplied/server/0402-Optimize-brigadier-child-sorting-performance.patch rename to patches/server/0389-Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/unapplied/server/0403-Potential-bed-API.patch b/patches/server/0390-Potential-bed-API.patch similarity index 95% rename from patches/unapplied/server/0403-Potential-bed-API.patch rename to patches/server/0390-Potential-bed-API.patch index 2d479f5c15..f60a301ddb 100644 --- a/patches/unapplied/server/0403-Potential-bed-API.patch +++ b/patches/server/0390-Potential-bed-API.patch @@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 14984e791bd9309672b1fb404b8552849854d393..3f6e9214358c938b39106dd6c3eb652c8549c60b 100644 +index ed6d7743ab6513ee4f4c09eae1c7124197df4ed1..2d3a7bb9f68350df136ee3d2e3aed0bbbe1a91cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag; diff --git a/patches/unapplied/server/0404-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0391-Wait-for-Async-Tasks-during-shutdown.patch similarity index 90% rename from patches/unapplied/server/0404-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0391-Wait-for-Async-Tasks-during-shutdown.patch index 796b429362..244585da50 100644 --- a/patches/unapplied/server/0404-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0391-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e189de6d2aa94e9bbb20f1477ee2e34431adb324..4a58843f7ce2dd9e50f9daf3065d056a28910e5a 100644 +index 260fbcafbb4c2049372ea57451d22479e4a3addd..49283b13a88402ac5b54fd8c64e90a82499d09d7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -932,6 +932,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop stateDefinition; private BlockState defaultBlockState; // Paper start @@ -73,7 +73,7 @@ index f475926cfa6fc98f9f8f4fe8be6fd200cce39c7e..536a4e9f2bec3f44ca00edaf518c5d6c public co.aikar.timings.Timing getTiming() { if (timing == null) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9afd5d478 100644 +index 9e70f5ba6ff0935d245f357131b062c1cc7058fc..4f6b7ed4809086811f0460544ba2ec0606f0f5da 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -86,19 +86,19 @@ index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9 + return false; + } + // Paper end - prevent retracting when we're facing the wrong way + BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true); if (!world.isClientSide) { - boolean flag = this.getNeighborSignal(world, pos, enumdirection); -@@ -231,7 +237,7 @@ public class PistonBaseBlock extends DirectionalBlock { - BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); +@@ -232,7 +238,7 @@ public class PistonBaseBlock extends DirectionalBlock { + BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); - world.setBlock(pos, iblockdata1, 20); -- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); -+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change - world.blockUpdated(pos, iblockdata1.getBlock()); - iblockdata1.updateNeighbourShapes(world, pos, 2); + world.setBlock(pos, iblockdata2, 20); +- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); ++ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change + world.blockUpdated(pos, iblockdata2.getBlock()); + iblockdata2.updateNeighbourShapes(world, pos, 2); if (this.isSticky) { -@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -261,7 +267,14 @@ public class PistonBaseBlock extends DirectionalBlock { } } } else { @@ -115,20 +115,20 @@ index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 7cc6dcb128f2792fc32bb8f50e4c94d600255207..b245b3912a4e2f4e83872c29c5a9602743b5eccb 100644 +index 2451bb61e304fbe5cdfd6bbb248575e9e1135075..74f84bfcb1da6186c7a6783512c2fc7ba995215f 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -235,7 +235,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -229,7 +229,7 @@ public abstract class BlockBehaviour implements FeatureElement { /** @deprecated */ @Deprecated public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { -- return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())); -+ return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper +- return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())); ++ return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper; } /** @deprecated */ -@@ -800,6 +800,12 @@ public abstract class BlockBehaviour implements FeatureElement { - return ((Block) this.owner).builtInRegistryHolder(); +@@ -891,6 +891,12 @@ public abstract class BlockBehaviour implements FeatureElement { + return this.legacySolid; } + // Paper start @@ -137,20 +137,20 @@ index 7cc6dcb128f2792fc32bb8f50e4c94d600255207..b245b3912a4e2f4e83872c29c5a96027 + } + // Paper end + - public Material getMaterial() { - return this.material; + public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType type) { + return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type); } -@@ -897,7 +903,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -994,7 +1000,7 @@ public abstract class BlockBehaviour implements FeatureElement { } public PushReaction getPistonPushReaction() { -- return this.getBlock().getPistonPushReaction(this.asState()); -+ return !isDestroyable() ? PushReaction.BLOCK : this.getBlock().getPistonPushReaction(this.asState()); // Paper +- return this.pushReaction; ++ return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper } public boolean isSolidRender(BlockGetter world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index d1c7eba29c64a6dbf55d3062ced9769eecb548ed..faaf50cb9bce254aef554ed8b402b145532e12a4 100644 +index 389b63605d416678d35666bbd46e0fa05a02f898..33a6fda1e8f2df61b44f0e3ddda356ffa386f2df 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -221,6 +221,13 @@ public class PortalForcer { @@ -164,6 +164,6 @@ index d1c7eba29c64a6dbf55d3062ced9769eecb548ed..faaf50cb9bce254aef554ed8b402b145 + } + } + // Paper end - prevent destroying unbreakable blocks - if (k < 0 && !this.level.getBlockState(temp).getMaterial().isSolid()) { + if (k < 0 && !this.level.getBlockState(temp).isSolid()) { return false; } diff --git a/patches/unapplied/server/0408-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0394-Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 88% rename from patches/unapplied/server/0408-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to patches/server/0394-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 714b084af6..77d71fedb8 100644 --- a/patches/unapplied/server/0408-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0394-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -18,10 +18,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..5ca3ad7b3d7606accd0a58b3c708fadb @VisibleForTesting static long encode(double value) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f2bdb647f137a1334789dc56e517844b74d70bd9..1c638f65d33e5890a7a32bf7e89d484ae2afc093 100644 +index 3616f106b8bd5824700bfb67678599e6e1eca712..b312094bc88cd981fb424c244896c4c1d6454698 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1350,9 +1350,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1877,9 +1877,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { @@ -31,17 +31,17 @@ index f2bdb647f137a1334789dc56e517844b74d70bd9..1c638f65d33e5890a7a32bf7e89d484a + double vec3d_dx = player.getX() - this.entity.getX(); + double vec3d_dz = player.getZ() - this.entity.getZ(); + // Paper end - remove allocation of Vec3D here - double d0 = (double) Math.min(this.getEffectiveRange(), io.papermc.paper.chunk.PlayerChunkLoader.getSendViewDistance(player) * 16); // Paper - per player view distance + double d0 = (double) Math.min(this.getEffectiveRange(), ChunkMap.this.viewDistance * 16); - double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; + double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper double d2 = d0 * d0; boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index b3bc4af0b0be7223318e945c6eee4fe042523934..d4696783f5adaee5f4350dfe5da8d6b85cf07f7e 100644 +index 5ec480397fb043717c63961651f7c62440e57201..3f3c7ced3a43e2b0eb451930c09188e3706a1bee 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -165,7 +165,13 @@ public class ServerEntity { +@@ -161,7 +161,13 @@ public class ServerEntity { i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F); j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); Vec3 vec3d = this.entity.trackingPosition(); diff --git a/patches/unapplied/server/0409-Ensure-safe-gateway-teleport.patch b/patches/server/0395-Ensure-safe-gateway-teleport.patch similarity index 93% rename from patches/unapplied/server/0409-Ensure-safe-gateway-teleport.patch rename to patches/server/0395-Ensure-safe-gateway-teleport.patch index a77ce1d8bb..78a0eccaae 100644 --- a/patches/unapplied/server/0409-Ensure-safe-gateway-teleport.patch +++ b/patches/server/0395-Ensure-safe-gateway-teleport.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure safe gateway teleport diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index c7de74b7fcfb5f4d8adbe7e703087a03d9d9056d..c73024cc62490c336ffe26313580e88d25ca7078 100644 +index 11f9b40d0cfb77d69ecd2c7ef71dc409d1d79eba..d9baa85962236c42219cf09d4f3129be93ff069c 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java @@ -106,7 +106,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { diff --git a/patches/unapplied/server/0410-Add-option-for-console-having-all-permissions.patch b/patches/server/0396-Add-option-for-console-having-all-permissions.patch similarity index 100% rename from patches/unapplied/server/0410-Add-option-for-console-having-all-permissions.patch rename to patches/server/0396-Add-option-for-console-having-all-permissions.patch diff --git a/patches/unapplied/server/0413-Fix-villager-trading-demand-MC-163962.patch b/patches/server/0397-Fix-villager-trading-demand-MC-163962.patch similarity index 85% rename from patches/unapplied/server/0413-Fix-villager-trading-demand-MC-163962.patch rename to patches/server/0397-Fix-villager-trading-demand-MC-163962.patch index fa81bd70ac..e730577f1a 100644 --- a/patches/unapplied/server/0413-Fix-villager-trading-demand-MC-163962.patch +++ b/patches/server/0397-Fix-villager-trading-demand-MC-163962.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java -index f6fe6c39a8b11f4902e49e85db501808331392a2..8de9ea7928b272bbaf9c49940a8079f2499c8ee1 100644 +index 67f34a1670cb51a3d2aca3140800ad9b92533d84..dc5908374565dd3080679779cbfe7620a4810015 100644 --- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java +++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java -@@ -113,7 +113,7 @@ public class MerchantOffer { +@@ -115,7 +115,7 @@ public class MerchantOffer { } public void updateDemand() { diff --git a/patches/unapplied/server/0414-Maps-shouldn-t-load-chunks.patch b/patches/server/0398-Maps-shouldn-t-load-chunks.patch similarity index 90% rename from patches/unapplied/server/0414-Maps-shouldn-t-load-chunks.patch rename to patches/server/0398-Maps-shouldn-t-load-chunks.patch index 568d5b6e6c..233c73067b 100644 --- a/patches/unapplied/server/0414-Maps-shouldn-t-load-chunks.patch +++ b/patches/server/0398-Maps-shouldn-t-load-chunks.patch @@ -15,13 +15,13 @@ Previously maps would load all chunks in a certain radius depending on five ticks that movement occur in anyways. diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 0c4b4c8b770ea0adb1a8346ea2cda96570687bea..e58ba9c46e6de59b55c6471a44e1a5f158e70e07 100644 +index 9b55b04ab2769c6089d16a9c7bc61ca41683559f..7a5e5fa67ed5625cfbe74ba8ea8810095100e836 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java @@ -134,9 +134,9 @@ public class MapItem extends ComplexItem { int j2 = (j / i + k1 - 64) * i; int k2 = (k / i + l1 - 64) * i; - Multiset multiset = LinkedHashMultiset.create(); + Multiset multiset = LinkedHashMultiset.create(); - LevelChunk chunk = world.getChunk(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); + LevelChunk chunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); // Paper - Maps shouldn't load chunks diff --git a/patches/unapplied/server/0415-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0399-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 93% rename from patches/unapplied/server/0415-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to patches/server/0399-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index 5e2416fbfd..cb811d64aa 100644 --- a/patches/unapplied/server/0415-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/patches/server/0399-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index e58ba9c46e6de59b55c6471a44e1a5f158e70e07..f883e1bc4150bc074f1d8363a95b4eae16f3828e 100644 +index 7a5e5fa67ed5625cfbe74ba8ea8810095100e836..75b110c6fb685390306fe3b8504aeea9bd6deedd 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java @@ -250,14 +250,13 @@ public class MapItem extends ComplexItem {