From cc4614854ae884f8c0585af1b6cfb9a0e99a22e0 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 23 Apr 2024 23:44:48 -0700 Subject: [PATCH] 405 --- .../0290-Entity-getEntitySpawnReason.patch | 4 +- .../0292-Add-PlayerPostRespawnEvent.patch | 2 +- ...move-existing-players-to-world-spawn.patch | 4 +- ...nEvent-when-Player-is-actually-ready.patch | 2 +- ...awn-point-if-spawn-in-unloaded-worl.patch} | 69 +++++++++---------- ...layerAttackEntityCooldownResetEvent.patch} | 4 +- ...-fire-BlockFade-on-worldgen-threads.patch} | 4 +- ...tom-creative-and-insomniac-controls.patch} | 8 +-- ...tem-duplication-and-teleport-issues.patch} | 30 ++++---- .../0360-Villager-Restocks-API.patch} | 0 ...ickItem-Packet-and-kick-for-invalid.patch} | 4 +- .../0362-Expose-game-version.patch} | 2 +- ...per-thread-native-byte-buffer-cache.patch} | 2 +- .../0364-misc-debugging-dumps.patch} | 22 +++--- ...5-Prevent-teleporting-dead-entities.patch} | 4 +- .../0366-Implement-Mob-Goal-API.patch} | 10 +-- .../0367-Add-villager-reputation-API.patch} | 0 ...maximum-exp-value-when-merging-orbs.patch} | 4 +- .../0369-ExperienceOrbMergeEvent.patch} | 4 +- ...-Fix-PotionEffect-ignores-icon-flag.patch} | 26 +++---- .../0371-Potential-bed-API.patch} | 4 +- ...ait-for-Async-Tasks-during-shutdown.patch} | 10 +-- ...er-respects-game-and-entity-rules-f.patch} | 6 +- .../0374-Ensure-safe-gateway-teleport.patch} | 4 +- ...-for-console-having-all-permissions.patch} | 0 ...x-villager-trading-demand-MC-163962.patch} | 4 +- .../0377-Maps-shouldn-t-load-chunks.patch} | 23 +++---- ...ookup-for-Treasure-Maps-Fixes-lag-fr.patch | 20 ++++++ ...r-runTaskTimerAsynchronously-Plugin.patch} | 0 ...ton-physics-inconsistency-MC-188840.patch} | 8 +-- ...sing-chunks-due-to-integer-overflow.patch} | 2 +- ...-position-desync-causing-tp-exploit.patch} | 4 +- ...older-method-without-block-snapshot.patch} | 0 ...0384-Add-PlayerRecipeBookClickEvent.patch} | 4 +- ...-Hide-sync-chunk-writes-behind-flag.patch} | 6 +- ...6-Add-permission-for-command-blocks.patch} | 20 +++--- ...position-and-AABB-are-never-invalid.patch} | 8 +-- ...d-Difficulty-Remembering-Difficulty.patch} | 28 ++++---- .../0389-Paper-dumpitem-command.patch} | 0 ...Legacy-Component-serialization-size.patch} | 8 +-- ...Plugin-Tickets-to-API-Chunk-Methods.patch} | 10 +-- ...-Add-BlockStateMeta-clearBlockState.patch} | 6 +- ...vert-legacy-attributes-in-Item-Meta.patch} | 6 +- ...-not-accept-invalid-client-settings.patch} | 4 +- ...e-fix-EntityTargetLivingEntityEvent.patch} | 0 .../0396-Add-entity-liquid-API.patch} | 4 +- .../0397-Add-PrepareResultEvent.patch} | 24 +++---- ...-for-portal-on-world-gen-entity-add.patch} | 4 +- ...x-arrows-never-despawning-MC-125757.patch} | 4 +- ...Vanilla-Command-permission-checking.patch} | 2 +- .../0401-Fix-SPIGOT-5989.patch} | 10 +-- ...-Bukkit-world-container-is-not-used.patch} | 4 +- ...5885-Unable-to-disable-advancements.patch} | 4 +- ...taPlayer-leak-due-from-quitting-ear.patch} | 2 +- ...e-NetworkManager-Exception-Handling.patch} | 12 ---- ...ookup-for-Treasure-Maps-Fixes-lag-fr.patch | 27 -------- ...0405-Support-old-UUID-format-for-NBT.patch | 0 ...pdate-itemstack-legacy-name-and-lore.patch | 0 58 files changed, 232 insertions(+), 255 deletions(-) rename patches/{unapplied/server/0366-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch => server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch} (67%) rename patches/{unapplied/server/0367-Add-PlayerAttackEntityCooldownResetEvent.patch => server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch} (92%) rename patches/{unapplied/server/0368-Don-t-fire-BlockFade-on-worldgen-threads.patch => server/0357-Don-t-fire-BlockFade-on-worldgen-threads.patch} (84%) rename patches/{unapplied/server/0369-Add-phantom-creative-and-insomniac-controls.patch => server/0358-Add-phantom-creative-and-insomniac-controls.patch} (90%) rename patches/{unapplied/server/0370-Fix-item-duplication-and-teleport-issues.patch => server/0359-Fix-item-duplication-and-teleport-issues.patch} (88%) rename patches/{unapplied/server/0371-Villager-Restocks-API.patch => server/0360-Villager-Restocks-API.patch} (100%) rename patches/{unapplied/server/0372-Validate-PickItem-Packet-and-kick-for-invalid.patch => server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch} (91%) rename patches/{unapplied/server/0373-Expose-game-version.patch => server/0362-Expose-game-version.patch} (89%) rename patches/{unapplied/server/0374-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch => server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch} (93%) rename patches/{unapplied/server/0375-misc-debugging-dumps.patch => server/0364-misc-debugging-dumps.patch} (86%) rename patches/{unapplied/server/0376-Prevent-teleporting-dead-entities.patch => server/0365-Prevent-teleporting-dead-entities.patch} (88%) rename patches/{unapplied/server/0378-Implement-Mob-Goal-API.patch => server/0366-Implement-Mob-Goal-API.patch} (98%) rename patches/{unapplied/server/0379-Add-villager-reputation-API.patch => server/0367-Add-villager-reputation-API.patch} (100%) rename patches/{unapplied/server/0380-Option-for-maximum-exp-value-when-merging-orbs.patch => server/0368-Option-for-maximum-exp-value-when-merging-orbs.patch} (94%) rename patches/{unapplied/server/0381-ExperienceOrbMergeEvent.patch => server/0369-ExperienceOrbMergeEvent.patch} (91%) rename patches/{unapplied/server/0382-Fix-PotionEffect-ignores-icon-flag.patch => server/0370-Fix-PotionEffect-ignores-icon-flag.patch} (70%) rename patches/{unapplied/server/0383-Potential-bed-API.patch => server/0371-Potential-bed-API.patch} (92%) rename patches/{unapplied/server/0384-Wait-for-Async-Tasks-during-shutdown.patch => server/0372-Wait-for-Async-Tasks-during-shutdown.patch} (84%) rename patches/{unapplied/server/0385-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch => server/0373-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch} (80%) rename patches/{unapplied/server/0386-Ensure-safe-gateway-teleport.patch => server/0374-Ensure-safe-gateway-teleport.patch} (87%) rename patches/{unapplied/server/0387-Add-option-for-console-having-all-permissions.patch => server/0375-Add-option-for-console-having-all-permissions.patch} (100%) rename patches/{unapplied/server/0388-Fix-villager-trading-demand-MC-163962.patch => server/0376-Fix-villager-trading-demand-MC-163962.patch} (85%) rename patches/{unapplied/server/0389-Maps-shouldn-t-load-chunks.patch => server/0377-Maps-shouldn-t-load-chunks.patch} (53%) create mode 100644 patches/server/0378-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename patches/{unapplied/server/0391-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch => server/0379-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch} (100%) rename patches/{unapplied/server/0392-Fix-piston-physics-inconsistency-MC-188840.patch => server/0380-Fix-piston-physics-inconsistency-MC-188840.patch} (94%) rename patches/{unapplied/server/0393-Fix-missing-chunks-due-to-integer-overflow.patch => server/0381-Fix-missing-chunks-due-to-integer-overflow.patch} (94%) rename patches/{unapplied/server/0394-Prevent-position-desync-causing-tp-exploit.patch => server/0382-Prevent-position-desync-causing-tp-exploit.patch} (91%) rename patches/{unapplied/server/0395-Inventory-getHolder-method-without-block-snapshot.patch => server/0383-Inventory-getHolder-method-without-block-snapshot.patch} (100%) rename patches/{unapplied/server/0396-Add-PlayerRecipeBookClickEvent.patch => server/0384-Add-PlayerRecipeBookClickEvent.patch} (95%) rename patches/{unapplied/server/0397-Hide-sync-chunk-writes-behind-flag.patch => server/0385-Hide-sync-chunk-writes-behind-flag.patch} (83%) rename patches/{unapplied/server/0398-Add-permission-for-command-blocks.patch => server/0386-Add-permission-for-command-blocks.patch} (88%) rename patches/{unapplied/server/0399-Ensure-Entity-position-and-AABB-are-never-invalid.patch => server/0387-Ensure-Entity-position-and-AABB-are-never-invalid.patch} (87%) rename patches/{unapplied/server/0400-Fix-Per-World-Difficulty-Remembering-Difficulty.patch => server/0388-Fix-Per-World-Difficulty-Remembering-Difficulty.patch} (87%) rename patches/{unapplied/server/0401-Paper-dumpitem-command.patch => server/0389-Paper-dumpitem-command.patch} (100%) rename patches/{unapplied/server/0402-Improve-Legacy-Component-serialization-size.patch => server/0390-Improve-Legacy-Component-serialization-size.patch} (92%) rename patches/{unapplied/server/0403-Add-Plugin-Tickets-to-API-Chunk-Methods.patch => server/0391-Add-Plugin-Tickets-to-API-Chunk-Methods.patch} (92%) rename patches/{unapplied/server/0404-Add-BlockStateMeta-clearBlockState.patch => server/0392-Add-BlockStateMeta-clearBlockState.patch} (71%) rename patches/{unapplied/server/0406-Convert-legacy-attributes-in-Item-Meta.patch => server/0393-Convert-legacy-attributes-in-Item-Meta.patch} (92%) rename patches/{unapplied/server/0407-Do-not-accept-invalid-client-settings.patch => server/0394-Do-not-accept-invalid-client-settings.patch} (90%) rename patches/{unapplied/server/0408-Improve-fix-EntityTargetLivingEntityEvent.patch => server/0395-Improve-fix-EntityTargetLivingEntityEvent.patch} (100%) rename patches/{unapplied/server/0409-Add-entity-liquid-API.patch => server/0396-Add-entity-liquid-API.patch} (89%) rename patches/{unapplied/server/0411-Add-PrepareResultEvent.patch => server/0397-Add-PrepareResultEvent.patch} (90%) rename patches/{unapplied/server/0412-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch => server/0398-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch} (85%) rename patches/{unapplied/server/0413-Fix-arrows-never-despawning-MC-125757.patch => server/0399-Fix-arrows-never-despawning-MC-125757.patch} (86%) rename patches/{unapplied/server/0414-Thread-Safe-Vanilla-Command-permission-checking.patch => server/0400-Thread-Safe-Vanilla-Command-permission-checking.patch} (97%) rename patches/{unapplied/server/0415-Fix-SPIGOT-5989.patch => server/0401-Fix-SPIGOT-5989.patch} (91%) rename patches/{unapplied/server/0416-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch => server/0402-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch} (96%) rename patches/{unapplied/server/0417-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch => server/0403-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch} (85%) rename patches/{unapplied/server/0418-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch => server/0404-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch} (97%) rename patches/{unapplied/server/0419-Optimize-NetworkManager-Exception-Handling.patch => server/0405-Optimize-NetworkManager-Exception-Handling.patch} (59%) delete mode 100644 patches/unapplied/server/0390-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename {patches/unapplied/server => removed-patches-1-20-5}/0405-Support-old-UUID-format-for-NBT.patch (100%) rename {patches/unapplied/server => removed-patches-1-20-5}/0410-Update-itemstack-legacy-name-and-lore.patch (100%) diff --git a/patches/server/0290-Entity-getEntitySpawnReason.patch b/patches/server/0290-Entity-getEntitySpawnReason.patch index 5d83fc3627..7565d226a7 100644 --- a/patches/server/0290-Entity-getEntitySpawnReason.patch +++ b/patches/server/0290-Entity-getEntitySpawnReason.patch @@ -34,7 +34,7 @@ index ce89f04b74e579dedae05cfdf681827a92626f9a..e008b0b1b04dd8da118be6ee0bdd05c1 // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..7d4b2c499dfe449e6f7116ae140535450b95e6d1 100644 +index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..24790ded773c8d041e7f43c9b8f8f8fe9fff3d74 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -223,6 +223,11 @@ public abstract class PlayerList { @@ -42,7 +42,7 @@ index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..7d4b2c499dfe449e6f7116ae14053545 } + // Paper start - Entity#getEntitySpawnReason -+ if (nbttagcompound == null) { ++ if (optional.isEmpty()) { + player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + } + // Paper end - Entity#getEntitySpawnReason diff --git a/patches/server/0292-Add-PlayerPostRespawnEvent.patch b/patches/server/0292-Add-PlayerPostRespawnEvent.patch index 47998f679c..c298077796 100644 --- a/patches/server/0292-Add-PlayerPostRespawnEvent.patch +++ b/patches/server/0292-Add-PlayerPostRespawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 7d4b2c499dfe449e6f7116ae140535450b95e6d1..03051e2252d7b871adc06dbbe48d2a90854c7adf 100644 +index 24790ded773c8d041e7f43c9b8f8f8fe9fff3d74..403a07e5db1ccb252a396cdb7eee5b42305cf7cc 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -751,9 +751,14 @@ public abstract class PlayerList { diff --git a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch index 39d7d103e4..e76141bd4c 100644 --- a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch @@ -35,12 +35,12 @@ index 74e8aef45702eef0dcabc7841a7c7125cc066cbe..618efe10752c968142fcc0f28a533d35 this.gameMode.setLevel((ServerLevel) world); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 03051e2252d7b871adc06dbbe48d2a90854c7adf..86d518f7c7b638802c08c896d758541ac6ab6176 100644 +index 403a07e5db1ccb252a396cdb7eee5b42305cf7cc..7ba8d31fe114f16c2fe558787bc3d033803f2cde 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -226,6 +226,7 @@ public abstract class PlayerList { // Paper start - Entity#getEntitySpawnReason - if (nbttagcompound == null) { + if (optional.isEmpty()) { player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn } diff --git a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch index a655bcfc24..c4200b1eba 100644 --- a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch +++ b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch @@ -55,7 +55,7 @@ index 62bdc3016120271da2ca3a1f6ac46757e2e1dab4..e3f73ccbc2d62eef386adc6c66428c60 // CraftBukkit end public boolean isRealPlayer; // Paper diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 86d518f7c7b638802c08c896d758541ac6ab6176..e2e1ed794e4601b93cffb4ff7cc7a538f2d56cc9 100644 +index 7ba8d31fe114f16c2fe558787bc3d033803f2cde..06926750f21fa9234bcc60b1e932a29a36831bdc 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -297,6 +297,12 @@ public abstract class PlayerList { diff --git a/patches/unapplied/server/0366-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 67% rename from patches/unapplied/server/0366-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 74931d2851..7c6a8fa042 100644 --- a/patches/unapplied/server/0366-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -10,31 +10,31 @@ Co-authored-by: Wyatt Childers Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029cd8680035 100644 +index 06926750f21fa9234bcc60b1e932a29a36831bdc..48f3e51d8904a51f146e9b8c8fe195ef012fecd8 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -195,7 +195,7 @@ public abstract class PlayerList { +@@ -197,6 +197,7 @@ public abstract class PlayerList { } - CompoundTag nbttagcompound = this.load(player); -- ResourceKey resourcekey; + Optional optional = this.load(player); // CraftBukkit - decompile error + ResourceKey resourcekey = null; // Paper // CraftBukkit start - Better rename detection - if (nbttagcompound != null && nbttagcompound.contains("bukkit")) { - CompoundTag bukkit = nbttagcompound.getCompound("bukkit"); -@@ -203,15 +203,42 @@ public abstract class PlayerList { + if (optional.isPresent()) { + CompoundTag nbttagcompound = optional.get(); +@@ -206,19 +207,47 @@ public abstract class PlayerList { + } } // CraftBukkit end - +- ResourceKey resourcekey = (ResourceKey) optional.flatMap((nbttagcompound) -> { + // Paper start - move logic in Entity to here, to use bukkit supplied world UUID & reset to main world spawn if no valid world is found -+ boolean invalidPlayerWorld = false; -+ bukkitData: if (nbttagcompound != null) { ++ boolean[] invalidPlayerWorld = {false}; ++ bukkitData: if (optional.isPresent()) { + // The main way for bukkit worlds to store the world is the world UUID despite mojang adding custom worlds + final org.bukkit.World bWorld; -+ if (nbttagcompound.contains("WorldUUIDMost") && nbttagcompound.contains("WorldUUIDLeast")) { -+ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"))); -+ } else if (nbttagcompound.contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name -+ bWorld = org.bukkit.Bukkit.getServer().getWorld(nbttagcompound.getString("world")); ++ if (optional.get().contains("WorldUUIDMost") && optional.get().contains("WorldUUIDLeast")) { ++ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(optional.get().getLong("WorldUUIDMost"), optional.get().getLong("WorldUUIDLeast"))); ++ } else if (optional.get().contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name ++ bWorld = org.bukkit.Bukkit.getServer().getWorld(optional.get().getString("world")); + } else { + break bukkitData; // if neither of the bukkit data points exist, proceed to the vanilla migration section + } @@ -42,55 +42,52 @@ index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029c + resourcekey = ((CraftWorld) bWorld).getHandle().dimension(); + } else { + resourcekey = Level.OVERWORLD; -+ invalidPlayerWorld = true; ++ invalidPlayerWorld[0] = true; + } + } + if (resourcekey == null) { // only run the vanilla logic if we haven't found a world from the bukkit data + // Below is the vanilla way of getting the dimension, this is for migration from vanilla servers -+ // Paper end - if (nbttagcompound != null) { ++ resourcekey = optional.flatMap((nbttagcompound) -> { ++ // Paper end DataResult> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error Logger logger = PlayerList.LOGGER; Objects.requireNonNull(logger); -- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD +- return dataresult.resultOrPartial(logger::error); +- }).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD + // Paper start - reset to main world spawn if no valid world is found + final Optional> result = dataresult.resultOrPartial(logger::error); -+ invalidPlayerWorld = result.isEmpty(); -+ resourcekey = result.orElse(Level.OVERWORLD); -+ // Paper end - } else { -- resourcekey = player.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD -+ resourcekey = Level.OVERWORLD; // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed - } -+ } // Paper ++ invalidPlayerWorld[0] = result.isEmpty(); ++ return result; ++ }).orElse(Level.OVERWORLD); // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed ++ } ++ // Paper end + ServerLevel worldserver = this.server.getLevel(resourcekey); + ServerLevel worldserver1; - ResourceKey resourcekey1 = resourcekey; - ServerLevel worldserver = this.server.getLevel(resourcekey1); -@@ -220,6 +247,7 @@ public abstract class PlayerList { if (worldserver == null) { - PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey1); + PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey); worldserver1 = this.server.overworld(); -+ invalidPlayerWorld = true; // Paper - reset to main world if no world with parsed value is found ++ invalidPlayerWorld[0] = true; // Paper - reset to main world if no world with parsed value is found } else { worldserver1 = worldserver; } -@@ -227,6 +255,10 @@ public abstract class PlayerList { +@@ -226,6 +255,10 @@ public abstract class PlayerList { // Paper start - Entity#getEntitySpawnReason - if (nbttagcompound == null) { + if (optional.isEmpty()) { player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + // Paper start - reset to main world spawn if first spawn or invalid world + } -+ if (nbttagcompound == null || invalidPlayerWorld) { ++ if (optional.isEmpty() || invalidPlayerWorld[0]) { + // Paper end - reset to main world spawn if first spawn or invalid world player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn } // Paper end - Entity#getEntitySpawnReason diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 537461e60366580bd18e3814113ef1f8b7009b39..5863d7118d9935735400cff4a09dd8546f67bac5 100644 +index f1b8e3f06db9bef44319c6d53574b1e7188c5931..04bd6d6bc6af0e423f56329dc3554b04170932f9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2289,27 +2289,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2317,27 +2317,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end diff --git a/patches/unapplied/server/0367-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 92% rename from patches/unapplied/server/0367-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch index e8b17654bf..617252a191 100644 --- a/patches/unapplied/server/0367-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e8410acb2f4be966177a0ec62fc93b8fe2cc0af3..1e5ffd48251c0727e662da4d9a59bc8c23eb95ff 100644 +index bca65fe3b38da83ce5f8fe67867b7cf19d02adbb..10e337fc1fb23d9eaab54f92021a7d95a14468f8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2211,7 +2211,16 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2258,7 +2258,16 @@ public abstract class LivingEntity extends Entity implements Attackable { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) { diff --git a/patches/unapplied/server/0368-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0357-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 84% rename from patches/unapplied/server/0368-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0357-Don-t-fire-BlockFade-on-worldgen-threads.patch index e5fdaf2d8f..8a262c1f35 100644 --- a/patches/unapplied/server/0368-Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/patches/server/0357-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index da9cd2da60186b94f3b8a259c13b20f20e50fccb..65b2873ca8032a64a4968b7587637644df1aeca5 100644 +index 886b8d2284e3ae85184c842b24869029b9ee4ebe..ceaa2a7048afc4955d3695af5291e83a79d83c5d 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java @@ -108,6 +108,7 @@ public class FireBlock extends BaseFireBlock { @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { // CraftBukkit start + if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation if (!this.canSurvive(state, world, pos)) { diff --git a/patches/unapplied/server/0369-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0358-Add-phantom-creative-and-insomniac-controls.patch similarity index 90% rename from patches/unapplied/server/0369-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0358-Add-phantom-creative-and-insomniac-controls.patch index 83892b75c4..8101fc3b6a 100644 --- a/patches/unapplied/server/0369-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0358-Add-phantom-creative-and-insomniac-controls.patch @@ -17,10 +17,10 @@ index 3207166061bf9c4d7bf3f38e5a9f7aff23ccd5c1..ee4495b67c46cf1282cdd6ad15b224b0 private EntitySelector() {} // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 658393f451e46a93c5665fe3c580aa395ace68d1..ea980c2fdf01988ba25bffc7f8963d775101bee1 100644 +index 4292a0fbab588a8cd58db36bc279f2991231aeec..ac119e2efff7ba3c32425783ffcf4b3c44156f27 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -568,6 +568,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -549,6 +549,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { @@ -29,10 +29,10 @@ index 658393f451e46a93c5665fe3c580aa395ace68d1..ea980c2fdf01988ba25bffc7f8963d77 return true; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -index 5d84bd022714f9726131d2e37d648c444052af9b..76982e0dbab0ecb6f7d4cd8a748af940492a31e7 100644 +index bb7f2d3ff7fc6f5cadb4ab24efb5a3a2f5bdc33f..f74d41e57570a40cd5ce4da3076f3210b6594a63 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -@@ -49,7 +49,7 @@ public class PhantomSpawner implements CustomSpawner { +@@ -48,7 +48,7 @@ public class PhantomSpawner implements CustomSpawner { while (iterator.hasNext()) { ServerPlayer entityplayer = (ServerPlayer) iterator.next(); diff --git a/patches/unapplied/server/0370-Fix-item-duplication-and-teleport-issues.patch b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch similarity index 88% rename from patches/unapplied/server/0370-Fix-item-duplication-and-teleport-issues.patch rename to patches/server/0359-Fix-item-duplication-and-teleport-issues.patch index 7e568e11ce..e8784b4e33 100644 --- a/patches/unapplied/server/0370-Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b214674e10 100644 +index 04bd6d6bc6af0e423f56329dc3554b04170932f9..af49ff55865b327c167efedcb7413c270824efe3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2419,11 +2419,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2447,11 +2447,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -3222,6 +3223,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3238,6 +3239,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public Entity teleportTo(ServerLevel worldserver, Vec3 location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 if (this.level() instanceof ServerLevel && !this.isRemoved()) { this.level().getProfiler().push("changeDimension"); // CraftBukkit start -@@ -3248,6 +3255,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3264,6 +3271,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end this.level().getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -3265,10 +3277,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3281,10 +3293,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 // CraftBukkit end } -@@ -3387,7 +3395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3405,7 +3413,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean canChangeDimensions() { @@ -80,10 +80,10 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08c97d86f2 100644 +index 10e337fc1fb23d9eaab54f92021a7d95a14468f8..8daaadbc524ee8d7c4a4ddd1d2a822f3b697abd0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1714,9 +1714,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1734,9 +1734,9 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper start org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource); if (deathEvent == null || !deathEvent.isCancelled()) { @@ -96,7 +96,7 @@ index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08 // Paper start - clear equipment if event is not cancelled if (this instanceof Mob) { for (EquipmentSlot slot : this.clearedEquipmentSlots) { -@@ -1817,8 +1817,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1837,8 +1837,13 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropCustomDeathLoot(source, i, flag); this.clearEquipmentSlots = prev; // Paper } @@ -113,10 +113,10 @@ index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08 this.drops = new ArrayList<>(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcbe21f5bbb 100644 +index cb3729509e50fed64b17f16797825c1d21f7bf5b..bf717b5bcd14291a99414eae5366c0b91ce68a68 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -625,7 +625,7 @@ public class ArmorStand extends LivingEntity { +@@ -628,7 +628,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -125,7 +125,7 @@ index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcb this.handItems.set(i, ItemStack.EMPTY); } } -@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity { +@@ -636,7 +636,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -135,10 +135,10 @@ index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcb } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 15c9150b7e48781268babe5915dc0e906645b341..8866f1d4f19c935edb7eb3c9265a2b65383e5595 100644 +index fae07957147ee22a91d5da925e834a0495021958..f39bfda4487114f5a0a720e328321485839dd790 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -895,6 +895,11 @@ public class CraftEventFactory { +@@ -894,6 +894,11 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List drops) { @@ -150,7 +150,7 @@ index 15c9150b7e48781268babe5915dc0e906645b341..8866f1d4f19c935edb7eb3c9265a2b65 CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); populateFields(victim, event); // Paper - make cancellable -@@ -908,11 +913,13 @@ public class CraftEventFactory { +@@ -907,11 +912,13 @@ public class CraftEventFactory { playDeathSound(victim, event); // Paper end victim.expToDrop = event.getDroppedExp(); diff --git a/patches/unapplied/server/0371-Villager-Restocks-API.patch b/patches/server/0360-Villager-Restocks-API.patch similarity index 100% rename from patches/unapplied/server/0371-Villager-Restocks-API.patch rename to patches/server/0360-Villager-Restocks-API.patch diff --git a/patches/unapplied/server/0372-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 91% rename from patches/unapplied/server/0372-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch index d64e44e188..890d9ce3df 100644 --- a/patches/unapplied/server/0372-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ 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 6d540917d0d4f4787e9abc8c80fd797b2ec1656f..f1f45ceed8454fc8c144a9abe96a431799d977a0 100644 +index eae6e3aeaca1b567698eaa05ed02c6c45717d7f6..6a490ba55e5af694b68bf6bf1677afc7f4f3679f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -867,7 +867,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -898,7 +898,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/unapplied/server/0373-Expose-game-version.patch b/patches/server/0362-Expose-game-version.patch similarity index 89% rename from patches/unapplied/server/0373-Expose-game-version.patch rename to patches/server/0362-Expose-game-version.patch index 3cbf0b5c30..e304bd9ae3 100644 --- a/patches/unapplied/server/0373-Expose-game-version.patch +++ b/patches/server/0362-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 ae424a5cbf8868aea9e11ffd565665c50aeb780e..356f737e4b224ed7d9692dcaf2a91617058e23ed 100644 +index e06b2821d29217aa6e043009cfc843da6e478a44..87414dc4b6fc759a8d2b13f32207280551a215f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -579,6 +579,13 @@ public final class CraftServer implements Server { diff --git a/patches/unapplied/server/0374-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 93% rename from patches/unapplied/server/0374-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 890d937ec1..a5ad213696 100644 --- a/patches/unapplied/server/0374-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0363-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 f21bff10aa56b418b1c3c3f1a40b88c4e992c26d..44f49cc8b7800eebda426a1a04a311979e4516b9 100644 +index cc4f7f5bdb6b930af4130dc775e4ed754be87783..90911cd3ba86e02baf8684099f0762fab563581c 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/0375-misc-debugging-dumps.patch b/patches/server/0364-misc-debugging-dumps.patch similarity index 86% rename from patches/unapplied/server/0375-misc-debugging-dumps.patch rename to patches/server/0364-misc-debugging-dumps.patch index 876590f71f..e5162afd5f 100644 --- a/patches/unapplied/server/0375-misc-debugging-dumps.patch +++ b/patches/server/0364-misc-debugging-dumps.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb1106f13601b 100644 +index 3b59f3d92d781c16825f6f67b725225256425d11..2fb4660147294de9e9dec70bc3527327f2d859ee 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -341,7 +341,7 @@ public class Commands { +@@ -344,7 +344,7 @@ public class Commands { } catch (Exception exception) { MutableComponent ichatmutablecomponent = Component.literal(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); @@ -42,10 +42,10 @@ index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb110 StackTraceElement[] astacktraceelement = exception.getStackTrace(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 746eeb22127d8633f1eeef1bb9c20edb7fd23e5a..4bb7f7ac1e05564ea36a7b0a4e89e6f0feb9c224 100644 +index a39753296a70a404b45dcb668ff42c1d88429e8e..1a8cfdd7c95460c359447dc69fadca077688c65b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -904,6 +904,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop set) { // Paper diff --git a/patches/unapplied/server/0378-Implement-Mob-Goal-API.patch b/patches/server/0366-Implement-Mob-Goal-API.patch similarity index 98% rename from patches/unapplied/server/0378-Implement-Mob-Goal-API.patch rename to patches/server/0366-Implement-Mob-Goal-API.patch index d09dc5505c..9551765728 100644 --- a/patches/unapplied/server/0378-Implement-Mob-Goal-API.patch +++ b/patches/server/0366-Implement-Mob-Goal-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09ab7a90d8 100644 +index a668438780c5b77d6b8bcbcc52d24bd92c59b85f..d104cf1064630698035025acbfbbf1f5e3da142a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -44,6 +44,7 @@ dependencies { +@@ -42,6 +42,7 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") @@ -18,7 +18,7 @@ index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09 testImplementation("org.mockito:mockito-core:5.11.0") diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..8117578ced94aa6bf01871f6526a388385c4adf2 +index 0000000000000000000000000000000000000000..e9683b5a76b2dd7fc90f1d2e4538b1abbbe27ef0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java @@ -0,0 +1,376 @@ @@ -768,10 +768,10 @@ index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7 LOOK, JUMP, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0a6b283aee63adb09cf1466fb18406f941466cd0..12b76fd9d3d5e8dcca31d7e82f6956e13447ff64 100644 +index 89749bd7f47afe9ddcb0f38d7d7a9fbd02077e30..3f29c1ba155ab3b145d241efb3f9274ef7a279e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2889,5 +2889,11 @@ public final class CraftServer implements Server { +@@ -2908,5 +2908,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/unapplied/server/0379-Add-villager-reputation-API.patch b/patches/server/0367-Add-villager-reputation-API.patch similarity index 100% rename from patches/unapplied/server/0379-Add-villager-reputation-API.patch rename to patches/server/0367-Add-villager-reputation-API.patch diff --git a/patches/unapplied/server/0380-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0368-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 94% rename from patches/unapplied/server/0380-Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/0368-Option-for-maximum-exp-value-when-merging-orbs.patch index 76f5165302..6b0e5e5279 100644 --- a/patches/unapplied/server/0380-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0368-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,10 +5,10 @@ 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 8866f1d4f19c935edb7eb3c9265a2b65383e5595..608829fa99a197a58505b1e7ca9898e8d6d19aa4 100644 +index f39bfda4487114f5a0a720e328321485839dd790..13147a658bc9c254538632bad12cdc4f0ba67bff 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -704,16 +704,30 @@ public class CraftEventFactory { +@@ -703,16 +703,30 @@ public class CraftEventFactory { if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) { double radius = world.spigotConfig.expMerge; if (radius > 0) { diff --git a/patches/unapplied/server/0381-ExperienceOrbMergeEvent.patch b/patches/server/0369-ExperienceOrbMergeEvent.patch similarity index 91% rename from patches/unapplied/server/0381-ExperienceOrbMergeEvent.patch rename to patches/server/0369-ExperienceOrbMergeEvent.patch index fbe377c669..2d56cb06bf 100644 --- a/patches/unapplied/server/0381-ExperienceOrbMergeEvent.patch +++ b/patches/server/0369-ExperienceOrbMergeEvent.patch @@ -9,10 +9,10 @@ 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 608829fa99a197a58505b1e7ca9898e8d6d19aa4..b38212ceb8c375c9604eac36bee6d143ffbf3837 100644 +index 13147a658bc9c254538632bad12cdc4f0ba67bff..36999a5c603aef1dc1e79adb2f2f6801899bfacc 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -713,7 +713,7 @@ public class CraftEventFactory { +@@ -712,7 +712,7 @@ public class CraftEventFactory { for (Entity e : entities) { if (e instanceof net.minecraft.world.entity.ExperienceOrb loopItem) { // Paper start diff --git a/patches/unapplied/server/0382-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0370-Fix-PotionEffect-ignores-icon-flag.patch similarity index 70% rename from patches/unapplied/server/0382-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0370-Fix-PotionEffect-ignores-icon-flag.patch index 11cb193b27..a401f6eca3 100644 --- a/patches/unapplied/server/0382-Fix-PotionEffect-ignores-icon-flag.patch +++ b/patches/server/0370-Fix-PotionEffect-ignores-icon-flag.patch @@ -6,50 +6,50 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 29fa2231cc5d9c3ac36d508f14408d6077b6594c..d84503ab329ebeb4c74f10f9897661ee6799e3d3 100644 +index 539280a0265a4746ebc9ede6667df3699dfb8125..a5026d470b8651ddf4b79fc29cbc598ac55217ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -484,7 +484,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -483,7 +483,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { -- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraft(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN); +- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN); + this.getHandle().addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(effect), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon return true; } -@@ -505,7 +505,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -504,7 +504,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public PotionEffect getPotionEffect(PotionEffectType type) { - MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraft(type)); -- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()); + MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type)); +- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()); + return (handle == null) ? null : org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle); // Paper } @Override -@@ -517,7 +517,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -516,7 +516,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public Collection getActivePotionEffects() { List effects = new ArrayList(); for (MobEffectInstance handle : this.getHandle().activeEffects.values()) { -- effects.add(new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible())); +- effects.add(new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible())); + effects.add(org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle)); // Paper } return effects; } diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java -index e29679a92da5ec05e122bb972a5ee469059a7a0a..844fb8c662a409670f631228f687d85c5436d3dd 100644 +index a91fd77d3a3aec302cb4a17e358d04bdf0cff6c3..068a9b2d7b6895f14077d9647a8c9fed3e3d3ade 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java -@@ -73,7 +73,7 @@ public class CraftPotionUtil { +@@ -10,7 +10,7 @@ public class CraftPotionUtil { public static MobEffectInstance fromBukkit(PotionEffect effect) { - MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType()); + Holder type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()); - return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()); + return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper } public static PotionEffect toBukkit(MobEffectInstance effect) { -@@ -82,7 +82,7 @@ public class CraftPotionUtil { +@@ -19,7 +19,7 @@ public class CraftPotionUtil { int duration = effect.getDuration(); boolean ambient = effect.isAmbient(); boolean particles = effect.isVisible(); @@ -57,4 +57,4 @@ index e29679a92da5ec05e122bb972a5ee469059a7a0a..844fb8c662a409670f631228f687d85c + return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper } - public static boolean equals(MobEffect mobEffect, PotionEffectType type) { + public static boolean equals(Holder mobEffect, PotionEffectType type) { diff --git a/patches/unapplied/server/0383-Potential-bed-API.patch b/patches/server/0371-Potential-bed-API.patch similarity index 92% rename from patches/unapplied/server/0383-Potential-bed-API.patch rename to patches/server/0371-Potential-bed-API.patch index c00100d03d..34470bcfc1 100644 --- a/patches/unapplied/server/0383-Potential-bed-API.patch +++ b/patches/server/0371-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 35f03bea2b1206b420ac46dfd77811fb485c5319..3898d583a65e82711fd4415aed32ecf08f42100f 100644 +index eb2d39d408e7f46a8f047a2b0d76981f24e1320a..bbd3f0981eb95348ef12c9af8fa1712c022ed869 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; @@ -19,7 +19,7 @@ index 35f03bea2b1206b420ac46dfd77811fb485c5319..3898d583a65e82711fd4415aed32ecf0 import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.MenuProvider; import net.minecraft.world.entity.Entity; -@@ -131,6 +132,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -129,6 +130,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return this.getHandle().sleepCounter; } diff --git a/patches/unapplied/server/0384-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0372-Wait-for-Async-Tasks-during-shutdown.patch similarity index 84% rename from patches/unapplied/server/0384-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0372-Wait-for-Async-Tasks-during-shutdown.patch index 732023775f..182e9f7422 100644 --- a/patches/unapplied/server/0384-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0372-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,22 +10,22 @@ 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 4bb7f7ac1e05564ea36a7b0a4e89e6f0feb9c224..8922598a66aa184c314595fe9c8ec62797caa052 100644 +index 1a8cfdd7c95460c359447dc69fadca077688c65b..777408fe6ad04abb32885e749ec6b7c39b81ca46 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 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 - -- if (!chunk.isEmpty()) { -+ if (chunk != null && !chunk.isEmpty()) { // Paper - Maps shouldn't load chunks - int l2 = 0; - double d1 = 0.0D; - int i3; +- LevelChunk levelChunk = world.getChunk(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s)); +- if (!levelChunk.isEmpty()) { ++ LevelChunk levelChunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s)); // Paper - Maps shouldn't load chunks ++ if (levelChunk != null && !levelChunk.isEmpty()) { // Paper - Maps shouldn't load chunks + int t = 0; + double e = 0.0; + if (world.dimensionType().hasCeiling()) { diff --git a/patches/server/0378-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0378-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch new file mode 100644 index 0000000000..27672e59d7 --- /dev/null +++ b/patches/server/0378-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 7 Jun 2020 19:25:13 -0400 +Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from + carto/sunken maps + + +diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java +index 36de7c63370c529579d31ba1d77ec12b754ef313..ce461b1a8d7fab87ae28e30205f6fab67f1808b6 100644 +--- a/src/main/java/net/minecraft/world/item/MapItem.java ++++ b/src/main/java/net/minecraft/world/item/MapItem.java +@@ -206,7 +206,7 @@ public class MapItem extends ComplexItem { + + for (int n = 0; n < 128; n++) { + for (int o = 0; o < 128; o++) { +- Holder holder = world.getBiome(mutableBlockPos.set((l + o) * i, 0, (m + n) * i)); ++ Holder holder = world.getUncachedNoiseBiome((l + o) * i, 0, (m + n) * i); // Paper - Perf: Use seed based lookup for treasure maps + bls[n * 128 + o] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES); + } + } diff --git a/patches/unapplied/server/0391-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/0379-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 100% rename from patches/unapplied/server/0391-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to patches/server/0379-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch diff --git a/patches/unapplied/server/0392-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0380-Fix-piston-physics-inconsistency-MC-188840.patch similarity index 94% rename from patches/unapplied/server/0392-Fix-piston-physics-inconsistency-MC-188840.patch rename to patches/server/0380-Fix-piston-physics-inconsistency-MC-188840.patch index 9aea09e883..44f85960c4 100644 --- a/patches/unapplied/server/0392-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0380-Fix-piston-physics-inconsistency-MC-188840.patch @@ -32,10 +32,10 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840 This patch also fixes rail duping and carpet duping. 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 b3732a6246a2b011e36c5c35fa2ac7749e75db16..3ae61e7b50bfc440c597f88843f92903f8a66801 100644 +index 530b6af1ca2e0ac81c0a8a55dbc7cf5c796c93ce..4aa34b7df734bb755906b228e0df9eb629569ea0 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 -@@ -413,14 +413,26 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -414,14 +414,26 @@ public class PistonBaseBlock extends DirectionalBlock { } for (j = list.size() - 1; j >= 0; --j) { @@ -66,10 +66,10 @@ index b3732a6246a2b011e36c5c35fa2ac7749e75db16..3ae61e7b50bfc440c597f88843f92903 } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 541f4ffd06509aa72cf26ea108f84160eac82bc3..0e15da7cae105196d444b924b8e0db190583ba30 100644 +index 8ea7d7da26e7d5644a8ee1a8d9e4c828c6b70a00..d7b963571c900f0f68005d6954bcd9ef1d9e0b7c 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -296,7 +296,7 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -297,7 +297,7 @@ public class PistonMovingBlockEntity extends BlockEntity { if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); if (blockState.isAir()) { diff --git a/patches/unapplied/server/0393-Fix-missing-chunks-due-to-integer-overflow.patch b/patches/server/0381-Fix-missing-chunks-due-to-integer-overflow.patch similarity index 94% rename from patches/unapplied/server/0393-Fix-missing-chunks-due-to-integer-overflow.patch rename to patches/server/0381-Fix-missing-chunks-due-to-integer-overflow.patch index 2c28da3a05..e7af97469b 100644 --- a/patches/unapplied/server/0393-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/patches/server/0381-Fix-missing-chunks-due-to-integer-overflow.patch @@ -15,7 +15,7 @@ allows the distance calculation to avoid overflow and work as intended. This issue is being tracked in Mojira ticket MC-159283 diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -index db1d0e5cec19059d14e1a7cd41f049d23600e3fe..92c2df6a6abd9c60e90b0b84ab66987557adb9c8 100644 +index 6171d57a0e5d1aecadfb2c23a72a92d897ca41ee..b09bc1dac649ce9f4826edc1923c843804226993 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java @@ -521,7 +521,7 @@ public final class DensityFunctions { diff --git a/patches/unapplied/server/0394-Prevent-position-desync-causing-tp-exploit.patch b/patches/server/0382-Prevent-position-desync-causing-tp-exploit.patch similarity index 91% rename from patches/unapplied/server/0394-Prevent-position-desync-causing-tp-exploit.patch rename to patches/server/0382-Prevent-position-desync-causing-tp-exploit.patch index 0f094614a6..71bb5d041e 100644 --- a/patches/unapplied/server/0394-Prevent-position-desync-causing-tp-exploit.patch +++ b/patches/server/0382-Prevent-position-desync-causing-tp-exploit.patch @@ -13,10 +13,10 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2f3f3dcfc08635435408d54b9ee89fb0584896d0..e59c54b6bc42d577b81bb1cefffa33c77dd27dbe 100644 +index fba8a57d96487f90ff6bc2f8090682d9dc163217..445d9c9a2c42c49388736a0b9b683a18fa5e9353 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1366,6 +1366,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1361,6 +1361,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move diff --git a/patches/unapplied/server/0395-Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/0383-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/unapplied/server/0395-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/0383-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/unapplied/server/0396-Add-PlayerRecipeBookClickEvent.patch b/patches/server/0384-Add-PlayerRecipeBookClickEvent.patch similarity index 95% rename from patches/unapplied/server/0396-Add-PlayerRecipeBookClickEvent.patch rename to patches/server/0384-Add-PlayerRecipeBookClickEvent.patch index 29ddcd8ca7..fb76b16567 100644 --- a/patches/unapplied/server/0396-Add-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0384-Add-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e59c54b6bc42d577b81bb1cefffa33c77dd27dbe..e40020e8fbfb2926c61c44f0a184bfc1868bdd0f 100644 +index 445d9c9a2c42c49388736a0b9b683a18fa5e9353..d90b073294df56617febb6eb3edc65bf488e7e23 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2966,16 +2966,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3051,16 +3051,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (!this.player.containerMenu.stillValid(this.player)) { ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); } else { diff --git a/patches/unapplied/server/0397-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0385-Hide-sync-chunk-writes-behind-flag.patch similarity index 83% rename from patches/unapplied/server/0397-Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/0385-Hide-sync-chunk-writes-behind-flag.patch index cf5c2534f0..030a5a1365 100644 --- a/patches/unapplied/server/0397-Hide-sync-chunk-writes-behind-flag.patch +++ b/patches/server/0385-Hide-sync-chunk-writes-behind-flag.patch @@ -9,15 +9,15 @@ on harddrives. -DPaper.enable-sync-chunk-writes=true to enable diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 90fe26a546eeebf90ccf7f899103346cdb3ae702..bab2471616404821671264ccefd729cab8d0bf58 100644 +index 502e5386ec4306de93148266f60810ec52ae5ab2..9d10cdacb3aed2c00dc60aeb6f2cbeb48905e21f 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -144,7 +144,7 @@ public class DedicatedServerProperties extends Settings { return Mth.clamp(integer, 1, 29999984); }, 29999984); - this.syncChunkWrites = this.get("sync-chunk-writes", true); + this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag + this.regionFileComression = this.get("region-file-compression", "deflate"); this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false); this.enableStatus = this.get("enable-status", true); - this.hideOnlinePlayers = this.get("hide-online-players", false); diff --git a/patches/unapplied/server/0398-Add-permission-for-command-blocks.patch b/patches/server/0386-Add-permission-for-command-blocks.patch similarity index 88% rename from patches/unapplied/server/0398-Add-permission-for-command-blocks.patch rename to patches/server/0386-Add-permission-for-command-blocks.patch index 8bf915e700..82700c8964 100644 --- a/patches/unapplied/server/0398-Add-permission-for-command-blocks.patch +++ b/patches/server/0386-Add-permission-for-command-blocks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index e8b12b27e5ec74afb940f575e5ce78e5905d55f4..c3eb4b6372eed0b7eb636f495ce494b676767b6e 100644 +index cd6f34ee326228036f8c025e4e6d04e0c15ba06f..2f0d56c78584abe27ef050258827103fb60d5785 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -397,7 +397,7 @@ public class ServerPlayerGameMode { +@@ -400,7 +400,7 @@ public class ServerPlayerGameMode { BlockEntity tileentity = this.level.getBlockEntity(pos); Block block = iblockdata.getBlock(); @@ -18,10 +18,10 @@ index e8b12b27e5ec74afb940f575e5ce78e5905d55f4..c3eb4b6372eed0b7eb636f495ce494b6 return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fcec36846e8 100644 +index d90b073294df56617febb6eb3edc65bf488e7e23..d8f1c46530f4fe52fa12fd9f876328aef39fc3eb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -778,7 +778,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -809,7 +809,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); @@ -30,7 +30,7 @@ index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fce this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = null; -@@ -845,7 +845,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -876,7 +876,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); @@ -40,10 +40,10 @@ index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fce } else { BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java -index ac0aeb53176069d0835b6b08c8d871edae846763..c56f5173fda6b38c2dcaea196217f2f5a7d7c641 100644 +index 2d0eac7a8aa94ed6c4ec024bc6024440cbeac702..e40069d937de5fd00741ae6873abeecc46b93732 100644 --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java -@@ -198,7 +198,7 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -203,7 +203,7 @@ public abstract class BaseCommandBlock implements CommandSource { } public InteractionResult usedBy(Player player) { @@ -53,11 +53,11 @@ index ac0aeb53176069d0835b6b08c8d871edae846763..c56f5173fda6b38c2dcaea196217f2f5 } else { if (player.getCommandSenderWorld().isClientSide) { diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java -index 840226771819024de2c6e84f08f6e354e96474ba..7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5 100644 +index 0530b2a6324ec3ac0b3929aab7c0fa89de8bd9b9..ec1a8c60ccac50e5131f937c4262128fd2768331 100644 --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java -@@ -143,7 +143,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { - public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { +@@ -141,7 +141,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { BlockEntity tileentity = world.getBlockEntity(pos); - if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) { diff --git a/patches/unapplied/server/0399-Ensure-Entity-position-and-AABB-are-never-invalid.patch b/patches/server/0387-Ensure-Entity-position-and-AABB-are-never-invalid.patch similarity index 87% rename from patches/unapplied/server/0399-Ensure-Entity-position-and-AABB-are-never-invalid.patch rename to patches/server/0387-Ensure-Entity-position-and-AABB-are-never-invalid.patch index ca8fc43bc6..db4f96e468 100644 --- a/patches/unapplied/server/0399-Ensure-Entity-position-and-AABB-are-never-invalid.patch +++ b/patches/server/0387-Ensure-Entity-position-and-AABB-are-never-invalid.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Ensure Entity position and AABB are never invalid Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e033719c0e1 100644 +index af49ff55865b327c167efedcb7413c270824efe3..e6422024dd4aa472156d9751dcdeb55b5e210f53 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -652,8 +652,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -665,8 +665,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setPos(double x, double y, double z) { @@ -20,7 +20,7 @@ index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e03 } protected AABB makeBoundingBox() { -@@ -4149,7 +4149,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4175,7 +4175,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); } @@ -50,7 +50,7 @@ index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e03 if (this.position.x != x || this.position.y != y || this.position.z != z) { this.position = new Vec3(x, y, z); int i = Mth.floor(x); -@@ -4167,6 +4189,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4193,6 +4215,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.levelCallback.onMove(); } diff --git a/patches/unapplied/server/0400-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0388-Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 87% rename from patches/unapplied/server/0400-Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/0388-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 360338e915..b7b64ae5b0 100644 --- a/patches/unapplied/server/0400-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0388-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,11 +8,11 @@ makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8922598a66aa184c314595fe9c8ec62797caa052..adc93e0e7a57907e824bdd8bb7b3012f28b515f4 100644 +index 777408fe6ad04abb32885e749ec6b7c39b81ca46..3ec35f0aff38e6cbd969ec3442b924bc51365f4a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -825,7 +825,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = new ArrayList(); -@@ -67,6 +68,7 @@ public final class CraftChatMessage { +@@ -68,6 +69,7 @@ public final class CraftChatMessage { Matcher matcher = (keepNewlines ? StringMessage.INCREMENTAL_PATTERN_KEEP_NEWLINES : StringMessage.INCREMENTAL_PATTERN).matcher(message); String match = null; boolean needsAdd = false; @@ -26,7 +26,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..753200057e74b8e2d5274894b982e6ee while (matcher.find()) { int groupId = 0; while ((match = matcher.group(++groupId)) == null) { -@@ -112,7 +114,26 @@ public final class CraftChatMessage { +@@ -113,7 +115,26 @@ public final class CraftChatMessage { throw new AssertionError("Unexpected message format"); } } else { // Color resets formatting diff --git a/patches/unapplied/server/0403-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/0391-Add-Plugin-Tickets-to-API-Chunk-Methods.patch similarity index 92% rename from patches/unapplied/server/0403-Add-Plugin-Tickets-to-API-Chunk-Methods.patch rename to patches/server/0391-Add-Plugin-Tickets-to-API-Chunk-Methods.patch index d3c6813046..cd41241a8f 100644 --- a/patches/unapplied/server/0403-Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ b/patches/server/0391-Add-Plugin-Tickets-to-API-Chunk-Methods.patch @@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab8c609a4e 100644 +index 946ad5418950daf13e449233eac94c1311f3d926..a22b146e2bfdeb66aca8abb5fb23ee5cd6306f4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -379,7 +379,7 @@ public final class CraftServer implements Server { @@ -31,7 +31,7 @@ index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); - TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks"); + TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second - this.minimumAPI = this.configuration.getString("settings.minimum-api"); + this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api")); this.loadIcon(); @@ -947,7 +947,7 @@ public final class CraftServer implements Server { @@ -40,11 +40,11 @@ index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); - TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks"); + TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second - this.minimumAPI = this.configuration.getString("settings.minimum-api"); + this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api")); this.printSaveWarning = false; this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e4f7cc59ea5a3c703ada8ad3d096a7bf09950ed7..b437f582c36ab9a5b06129ef1b36dd14432c0c31 100644 +index d5a9409ee45b6b0e0ec8380db041c1334aad994f..d4697f2f4c71001dba2cc3a69d54f27809766595 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -289,7 +289,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -93,7 +93,7 @@ index e4f7cc59ea5a3c703ada8ad3d096a7bf09950ed7..b437f582c36ab9a5b06129ef1b36dd14 return true; } -@@ -2241,6 +2253,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2239,6 +2251,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c; diff --git a/patches/unapplied/server/0404-Add-BlockStateMeta-clearBlockState.patch b/patches/server/0392-Add-BlockStateMeta-clearBlockState.patch similarity index 71% rename from patches/unapplied/server/0404-Add-BlockStateMeta-clearBlockState.patch rename to patches/server/0392-Add-BlockStateMeta-clearBlockState.patch index 86efcbf634..492ab3531b 100644 --- a/patches/unapplied/server/0404-Add-BlockStateMeta-clearBlockState.patch +++ b/patches/server/0392-Add-BlockStateMeta-clearBlockState.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockStateMeta#clearBlockState diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java -index 0cbca0c37b3e6a34157906d44357286126cfe112..671a9b92da04c22cd3e6c3fd291a343e57397e72 100644 +index 429f962fa16a6aedcd2a17d23b06de41c782417d..aef8708c38a0215241b110d4446a3c341a9912cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java -@@ -257,6 +257,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta +@@ -313,6 +313,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta return this.blockEntityTag != null; } @@ -21,4 +21,4 @@ index 0cbca0c37b3e6a34157906d44357286126cfe112..671a9b92da04c22cd3e6c3fd291a343e + @Override public BlockState getBlockState() { - Material stateMaterial = (this.material != Material.SHIELD) ? this.material : CraftMetaBlockState.shieldToBannerHack(this.blockEntityTag); // Only actually used for jigsaws + return (this.blockEntityTag != null) ? this.blockEntityTag.copy() : CraftMetaBlockState.getBlockState(this.material, null); diff --git a/patches/unapplied/server/0406-Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/0393-Convert-legacy-attributes-in-Item-Meta.patch similarity index 92% rename from patches/unapplied/server/0406-Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/0393-Convert-legacy-attributes-in-Item-Meta.patch index 382b69e42d..74fe418054 100644 --- a/patches/unapplied/server/0406-Convert-legacy-attributes-in-Item-Meta.patch +++ b/patches/server/0393-Convert-legacy-attributes-in-Item-Meta.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Convert legacy attributes in Item Meta diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -index d4dba8c733c7560e5108b8d239b52e593f8debec..ea48f1119a940056c37d1d203437bfbfdf13663b 100644 +index de40e522960469b98f987bd688489740446d9f85..a0a34f680e21007ebf2c2497d2e6505eedae6481 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java @@ -9,6 +9,20 @@ import org.bukkit.attribute.AttributeInstance; @@ -30,10 +30,10 @@ index d4dba8c733c7560e5108b8d239b52e593f8debec..ea48f1119a940056c37d1d203437bfbf public CraftAttributeMap(AttributeMap handle) { this.handle = handle; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 7cf1153ae532a9d53ee85b05f77ed74b94cf5fbc..27be5da67801be6fd99c91576064e4be0b3f0d6c 100644 +index 54e3059f405de2e6306cea16d045fb448bb5b099..b355663fe21510b8b15deefb28cdb0460c4d1baa 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -485,7 +485,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -607,7 +607,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); diff --git a/patches/unapplied/server/0407-Do-not-accept-invalid-client-settings.patch b/patches/server/0394-Do-not-accept-invalid-client-settings.patch similarity index 90% rename from patches/unapplied/server/0407-Do-not-accept-invalid-client-settings.patch rename to patches/server/0394-Do-not-accept-invalid-client-settings.patch index a698b1454c..9d306a4ea5 100644 --- a/patches/unapplied/server/0407-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0394-Do-not-accept-invalid-client-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 782ac9d9284bce9b91e03488756b31a255655edc..36ff9acf571d670fda225bce2f4ed16dc1d20fe3 100644 +index daa07712fe5e85612c30fc9b60f89fcf244a36bc..51e97ca80f25cd1e49033cfbc41b595f3fa54d66 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3161,6 +3161,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3246,6 +3246,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/unapplied/server/0408-Improve-fix-EntityTargetLivingEntityEvent.patch b/patches/server/0395-Improve-fix-EntityTargetLivingEntityEvent.patch similarity index 100% rename from patches/unapplied/server/0408-Improve-fix-EntityTargetLivingEntityEvent.patch rename to patches/server/0395-Improve-fix-EntityTargetLivingEntityEvent.patch diff --git a/patches/unapplied/server/0409-Add-entity-liquid-API.patch b/patches/server/0396-Add-entity-liquid-API.patch similarity index 89% rename from patches/unapplied/server/0409-Add-entity-liquid-API.patch rename to patches/server/0396-Add-entity-liquid-API.patch index bbfe602323..ab34d7ab7a 100644 --- a/patches/unapplied/server/0409-Add-entity-liquid-API.patch +++ b/patches/server/0396-Add-entity-liquid-API.patch @@ -8,10 +8,10 @@ public net.minecraft.world.entity.Entity isInRain()Z public net.minecraft.world.entity.Entity isInBubbleColumn()Z diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 9ed122efb2b380bb2c1b50fdfe75bf3e679c9c6e..326978aedbd9cc81db2bf1d5398c1cd2ce68a866 100644 +index 571b8352de4070622cdc47a50643beada0b16c36..40e4b8233e27b8ebd94a89bb43b5c14808edaa68 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -998,4 +998,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1008,4 +1008,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return getHandle().spawnReason; } // Paper end - entity spawn reason API diff --git a/patches/unapplied/server/0411-Add-PrepareResultEvent.patch b/patches/server/0397-Add-PrepareResultEvent.patch similarity index 90% rename from patches/unapplied/server/0411-Add-PrepareResultEvent.patch rename to patches/server/0397-Add-PrepareResultEvent.patch index bcd9713cd7..647dfc2399 100644 --- a/patches/unapplied/server/0411-Add-PrepareResultEvent.patch +++ b/patches/server/0397-Add-PrepareResultEvent.patch @@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item Anvil, Grindstone and Smithing now extend this event diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index 878d3c3089635a515fa7f54c956159a1bb6ce29b..cab3e0ba471c93764b5949ad68a0f2cce4d00099 100644 +index 4c766b879f935298ffa4249e9ce4045601cedb20..2bd91b48eaa06f85a5b9b1ae052c70e966ae8e4c 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -338,6 +338,7 @@ public class AnvilMenu extends ItemCombinerMenu { +@@ -327,6 +327,7 @@ public class AnvilMenu extends ItemCombinerMenu { } this.createResult(); @@ -20,10 +20,10 @@ index 878d3c3089635a515fa7f54c956159a1bb6ce29b..cab3e0ba471c93764b5949ad68a0f2cc } else { return false; diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java -index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..ca3c8b31967a6efd7b0caacb091ab2151e7c0bee 100644 +index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48c816aba6 100644 --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java -@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { +@@ -152,6 +152,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { this.setupResultSlot(itemstack, itemstack1, itemstack2); } @@ -32,7 +32,7 @@ index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..ca3c8b31967a6efd7b0caacb091ab215 private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) { diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..1783661f38a6f5fb655ea83953b9467bd91a1302 100644 +index d41197db6bbf9e17b67bb1faa5d370eea0212bd3..ecf3cdc16d1ea830c4d45b57f69204118af3218a 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -44,7 +44,7 @@ index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..1783661f38a6f5fb655ea83953b9467b } diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java -index 4087e381b2250be387b608d8742f6a6009a52879..eb36a69b8da492aec9609cc9ef80d7d68ff9af03 100644 +index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc9263349737f9a3 100644 --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java @@ -110,6 +110,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { @@ -56,10 +56,10 @@ index 4087e381b2250be387b608d8742f6a6009a52879..eb36a69b8da492aec9609cc9ef80d7d6 } diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index 5c209a3d81db5326f63c506077fa0bfd241b4b12..a98157f600837898dd8ef12671c4bb713e30f30c 100644 +index fb7027985c6442fc50573e96031a05a3c64f4426..4bd720a97da27c4fd97788d4c504c0174f0f6c25 100644 --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -@@ -248,7 +248,8 @@ public class LoomMenu extends AbstractContainerMenu { +@@ -249,7 +249,8 @@ public class LoomMenu extends AbstractContainerMenu { this.resultSlot.set(ItemStack.EMPTY); } @@ -94,10 +94,10 @@ index 9c2fe69ced7a46bbd8b0fbe10fa67d0a39b0f375..e40d9dbdbe5359c38af6d764d01c9be4 private void setupRecipeList(Container input, ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc30197c95 100644 +index 36999a5c603aef1dc1e79adb2f2f6801899bfacc..a5253dc7fc611e599ab83c08bf4ce71afc4ee3c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1653,6 +1653,12 @@ public class CraftEventFactory { +@@ -1648,6 +1648,12 @@ public class CraftEventFactory { } public static PrepareAnvilEvent callPrepareAnvilEvent(InventoryView view, ItemStack item) { @@ -110,7 +110,7 @@ index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1660,6 +1666,12 @@ public class CraftEventFactory { +@@ -1655,6 +1661,12 @@ public class CraftEventFactory { } public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { @@ -123,7 +123,7 @@ index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1667,12 +1679,39 @@ public class CraftEventFactory { +@@ -1662,12 +1674,39 @@ public class CraftEventFactory { } public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { diff --git a/patches/unapplied/server/0412-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0398-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 85% rename from patches/unapplied/server/0412-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0398-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 4f39c3bd5a..f671f9aab8 100644 --- a/patches/unapplied/server/0412-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0398-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 685c0028032b60c025f825c55e975b08c97d86f2..b98f82b619a1932e6d820a2c42120efdc03fc839 100644 +index 8daaadbc524ee8d7c4a4ddd1d2a822f3b697abd0..914c6499eb94665f0e3c4654dd05fc10d93f87d4 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3531,7 +3531,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3618,7 +3618,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation diff --git a/patches/unapplied/server/0413-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0399-Fix-arrows-never-despawning-MC-125757.patch similarity index 86% rename from patches/unapplied/server/0413-Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/0399-Fix-arrows-never-despawning-MC-125757.patch index d3111cf5b4..a08ff237f0 100644 --- a/patches/unapplied/server/0413-Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/0399-Fix-arrows-never-despawning-MC-125757.patch @@ -9,10 +9,10 @@ instead of getting stuck in a never despawn state (bubble columns, etc). diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index f1d7f202b99b8ae4c16d10956d68d74efae8445b..913f0eb1d9081cd224b54df401ff4a0af2989f1f 100644 +index 464ba41fd284e29374dbc81c984cf9486e51393e..047629405dc67e3bcb5e4b3d5afa0e821f8fde44 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -208,6 +208,7 @@ public abstract class AbstractArrow extends Projectile { +@@ -214,6 +214,7 @@ public abstract class AbstractArrow extends Projectile { ++this.inGroundTime; } else { diff --git a/patches/unapplied/server/0414-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0400-Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 97% rename from patches/unapplied/server/0414-Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/0400-Thread-Safe-Vanilla-Command-permission-checking.patch index d3ee9cbba1..ff5324aeb2 100644 --- a/patches/unapplied/server/0414-Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/patches/server/0400-Thread-Safe-Vanilla-Command-permission-checking.patch @@ -26,7 +26,7 @@ index d8142624f9f3a5909e7cc5665f1629a1a67dd302..b02fb15c98ab873fa78635d7a23706dd } // CraftBukkit end diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 0f98345f8adc6e9bf7fb2dc9ce4eba59a33ded61..907bc9d84dbc98427384cf529bfde4b09d8ce8ca 100644 +index 2a22827f44dd0d524c22264447959a6979e9f0de..f3c83bb20a73b489f1fb6bacb69388902b1b6fe7 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource> list = null; diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index c61789a2df774761feb79123d31eab75f9996bf2..6e0073a54f59621d8adb4e8a70e6c89c708eabba 100644 +index 6e8ccafe8966970d1665be21266f2ffe95e1d3ed..f46fa0fbfec19904d21729847788c6c624a3e97f 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -63,6 +63,7 @@ public class PlayerAdvancements { diff --git a/patches/unapplied/server/0419-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0405-Optimize-NetworkManager-Exception-Handling.patch similarity index 59% rename from patches/unapplied/server/0419-Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/0405-Optimize-NetworkManager-Exception-Handling.patch index 320fb48f53..8626e3b900 100644 --- a/patches/unapplied/server/0419-Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/0405-Optimize-NetworkManager-Exception-Handling.patch @@ -4,18 +4,6 @@ Date: Sun, 5 Jul 2020 22:38:18 -0400 Subject: [PATCH] Optimize NetworkManager Exception Handling -diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index 9d6dafb4855af9ccb7bc033ebf0fca5f75ceb9c6..347c4eff66ec1f3393494133ca59df2411dafa21 100644 ---- a/src/main/java/net/minecraft/network/ConnectionProtocol.java -+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -590,6 +590,7 @@ public enum ConnectionProtocol { - - @Nullable - public Packet createPacket(int id, FriendlyByteBuf buf) { -+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optimize exception handling - Function> function = this.idToDeserializer.get(id); - return (Packet)(function != null ? function.apply(buf) : null); - } diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java index 421dd76816063d56ea80339b77531729edd6aa55..1523d69b7b332f0085f40310a94d406da6513edc 100644 --- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java diff --git a/patches/unapplied/server/0390-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/unapplied/server/0390-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch deleted file mode 100644 index ff8699f85d..0000000000 --- a/patches/unapplied/server/0390-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 7 Jun 2020 19:25:13 -0400 -Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from - carto/sunken maps - - -diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index e46ceae916f6396d96226db6d8e90bd29088f765..f643d3c06bd8fc37f6c571a19d5691694b0ce8d3 100644 ---- a/src/main/java/net/minecraft/world/item/MapItem.java -+++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -242,14 +242,13 @@ public class MapItem extends ComplexItem { - boolean[] aboolean = new boolean[16384]; - int l = j / i - 64; - int i1 = k / i - 64; -- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); - - int j1; - int k1; - - for (j1 = 0; j1 < 128; ++j1) { - for (k1 = 0; k1 < 128; ++k1) { -- Holder holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i)); -+ Holder holder = world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i); // Paper - Perf: Use seed based lookup for treasure maps - - aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES); - } diff --git a/patches/unapplied/server/0405-Support-old-UUID-format-for-NBT.patch b/removed-patches-1-20-5/0405-Support-old-UUID-format-for-NBT.patch similarity index 100% rename from patches/unapplied/server/0405-Support-old-UUID-format-for-NBT.patch rename to removed-patches-1-20-5/0405-Support-old-UUID-format-for-NBT.patch diff --git a/patches/unapplied/server/0410-Update-itemstack-legacy-name-and-lore.patch b/removed-patches-1-20-5/0410-Update-itemstack-legacy-name-and-lore.patch similarity index 100% rename from patches/unapplied/server/0410-Update-itemstack-legacy-name-and-lore.patch rename to removed-patches-1-20-5/0410-Update-itemstack-legacy-name-and-lore.patch