From 8f67d293a26a790439e63e006948e821e2b8f821 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 24 Nov 2021 12:38:00 +0100 Subject: [PATCH] More more more more more more more more more more more work --- ...layerAttackEntityCooldownResetEvent.patch} | 0 ...Stack-swapping-the-extended-and-upg.patch} | 0 ...9-Add-item-slot-convenience-methods.patch} | 0 .../0200-Villager-Restocks-API.patch} | 0 .../0201-Expose-game-version.patch} | 8 ++-- .../api/0202-Add-Mob-Goal-API.patch | 13 +++--- .../0203-Add-villager-reputation-API.patch} | 0 .../0204-Spawn-Reason-API.patch} | 0 .../0205-Potential-bed-API.patch} | 0 ...Levels-chunk-level-checking-methods.patch} | 44 +++++++++---------- ...tance-map-to-optimise-entity-tracker.patch | 0 ...n-Full-Status-Chunk-NBT-Memory-Leak.patch} | 4 +- ...-isOutsideRange-to-use-distance-maps.patch | 0 ...nk-Unloads-based-on-Player-Movement.patch} | 10 ++--- ...packets-to-nearby-locations-sounds-.patch} | 4 +- ...Chunk-Post-Processing-deadlock-risk.patch} | 12 ++--- ...-Broken-behavior-of-PlayerJoinEvent.patch} | 24 +++++----- ...oad-Chunks-for-Login-Asynchronously.patch} | 38 ++++++++-------- ...awn-point-if-spawn-in-unloaded-worl.patch} | 4 +- ...layerAttackEntityCooldownResetEvent.patch} | 4 +- ...-fire-BlockFade-on-worldgen-threads.patch} | 6 +-- ...tom-creative-and-insomniac-controls.patch} | 32 +++++++------- ...-duplication-issues-and-teleport-is.patch} | 22 +++++----- .../0410-Villager-Restocks-API.patch} | 2 +- ...ickItem-Packet-and-kick-for-invalid.patch} | 4 +- .../0412-Expose-game-version.patch} | 4 +- .../0413-Optimize-Voxel-Shape-Merging.patch} | 6 +-- ...per-thread-native-byte-buffer-cache.patch} | 2 +- .../0415-misc-debugging-dumps.patch} | 18 ++++---- ...traces-in-log-messages-crash-report.patch} | 32 +++++++------- .../0417-Implement-Mob-Goal-API.patch} | 30 +++++++------ .../0418-Add-villager-reputation-API.patch} | 4 +- ...maximum-exp-value-when-merging-orbs.patch} | 16 +++---- .../0420-ExperienceOrbMergeEvent.patch} | 2 +- ...-Fix-PotionEffect-ignores-icon-flag.patch} | 2 +- ...brigadier-child-sorting-performance.patch} | 0 .../0423-Potential-bed-API.patch} | 2 +- ...ait-for-Async-Tasks-during-shutdown.patch} | 8 ++-- ...er-respects-game-and-entity-rules-f.patch} | 4 +- ...nd-End-Portal-Frames-from-being-des.patch} | 40 ++++++++--------- ...leInt-allocations-from-light-engine.patch} | 0 ...location-of-Vec3D-by-entity-tracker.patch} | 23 +++++----- .../0429-Ensure-safe-gateway-teleport.patch} | 4 +- ...-for-console-having-all-permissions.patch} | 4 +- ...x-villager-trading-demand-MC-163962.patch} | 2 +- .../0432-Maps-shouldn-t-load-chunks.patch} | 4 +- ...ookup-for-Treasure-Maps-Fixes-lag-fr.patch | 20 +++++++++ ...ookup-for-Treasure-Maps-Fixes-lag-fr.patch | 20 --------- 48 files changed, 238 insertions(+), 240 deletions(-) rename patches/{unapplied/api/0198-Add-PlayerAttackEntityCooldownResetEvent.patch => api/0197-Add-PlayerAttackEntityCooldownResetEvent.patch} (100%) rename patches/{unapplied/api/0199-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch => api/0198-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch} (100%) rename patches/{unapplied/api/0200-Add-item-slot-convenience-methods.patch => api/0199-Add-item-slot-convenience-methods.patch} (100%) rename patches/{unapplied/api/0201-Villager-Restocks-API.patch => api/0200-Villager-Restocks-API.patch} (100%) rename patches/{unapplied/api/0203-Expose-game-version.patch => api/0201-Expose-game-version.patch} (81%) rename patches/{unapplied => }/api/0202-Add-Mob-Goal-API.patch (98%) rename patches/{unapplied/api/0204-Add-villager-reputation-API.patch => api/0203-Add-villager-reputation-API.patch} (100%) rename patches/{unapplied/api/0205-Spawn-Reason-API.patch => api/0204-Spawn-Reason-API.patch} (100%) rename patches/{unapplied/api/0206-Potential-bed-API.patch => api/0205-Potential-bed-API.patch} (100%) rename patches/{unapplied/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch => removed/1.18/0431-Optimize-ServerLevels-chunk-level-checking-methods.patch} (57%) rename patches/{unapplied/server => removed/1.18}/0431-Use-distance-map-to-optimise-entity-tracker.patch (100%) rename patches/{unapplied/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch => removed/1.18/0432-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch} (99%) rename patches/{unapplied/server => removed/1.18}/0432-Optimize-isOutsideRange-to-use-distance-maps.patch (100%) rename patches/{unapplied/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch => removed/1.18/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch} (93%) rename patches/{unapplied/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch => removed/1.18/0436-Optimize-sending-packets-to-nearby-locations-sounds-.patch} (95%) rename patches/{unapplied/server/0412-Fix-Chunk-Post-Processing-deadlock-risk.patch => server/0402-Fix-Chunk-Post-Processing-deadlock-risk.patch} (86%) rename patches/{unapplied/server/0415-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch => server/0403-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch} (85%) rename patches/{unapplied/server/0416-Load-Chunks-for-Login-Asynchronously.patch => server/0404-Load-Chunks-for-Login-Asynchronously.patch} (90%) rename patches/{unapplied/server/0417-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch => server/0405-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch} (86%) rename patches/{unapplied/server/0418-Add-PlayerAttackEntityCooldownResetEvent.patch => server/0406-Add-PlayerAttackEntityCooldownResetEvent.patch} (92%) rename patches/{unapplied/server/0419-Don-t-fire-BlockFade-on-worldgen-threads.patch => server/0407-Don-t-fire-BlockFade-on-worldgen-threads.patch} (86%) rename patches/{unapplied/server/0420-Add-phantom-creative-and-insomniac-controls.patch => server/0408-Add-phantom-creative-and-insomniac-controls.patch} (71%) rename patches/{unapplied/server/0421-Fix-numerous-item-duplication-issues-and-teleport-is.patch => server/0409-Fix-numerous-item-duplication-issues-and-teleport-is.patch} (85%) rename patches/{unapplied/server/0423-Villager-Restocks-API.patch => server/0410-Villager-Restocks-API.patch} (91%) rename patches/{unapplied/server/0424-Validate-PickItem-Packet-and-kick-for-invalid.patch => server/0411-Validate-PickItem-Packet-and-kick-for-invalid.patch} (91%) rename patches/{unapplied/server/0425-Expose-game-version.patch => server/0412-Expose-game-version.patch} (82%) rename patches/{unapplied/server/0426-Optimize-Voxel-Shape-Merging.patch => server/0413-Optimize-Voxel-Shape-Merging.patch} (96%) rename patches/{unapplied/server/0427-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch => server/0414-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch} (93%) rename patches/{unapplied/server/0428-misc-debugging-dumps.patch => server/0415-misc-debugging-dumps.patch} (85%) rename patches/{unapplied/server/0429-Deobfuscate-stacktraces-in-log-messages-crash-report.patch => server/0416-Deobfuscate-stacktraces-in-log-messages-crash-report.patch} (96%) rename patches/{unapplied/server/0430-Implement-Mob-Goal-API.patch => server/0417-Implement-Mob-Goal-API.patch} (97%) rename patches/{unapplied/server/0433-Add-villager-reputation-API.patch => server/0418-Add-villager-reputation-API.patch} (97%) rename patches/{unapplied/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch => server/0419-Option-for-maximum-exp-value-when-merging-orbs.patch} (86%) rename patches/{unapplied/server/0435-ExperienceOrbMergeEvent.patch => server/0420-ExperienceOrbMergeEvent.patch} (94%) rename patches/{unapplied/server/0436-Fix-PotionEffect-ignores-icon-flag.patch => server/0421-Fix-PotionEffect-ignores-icon-flag.patch} (92%) rename patches/{unapplied/server/0437-Optimize-brigadier-child-sorting-performance.patch => server/0422-Optimize-brigadier-child-sorting-performance.patch} (100%) rename patches/{unapplied/server/0438-Potential-bed-API.patch => server/0423-Potential-bed-API.patch} (95%) rename patches/{unapplied/server/0439-Wait-for-Async-Tasks-during-shutdown.patch => server/0424-Wait-for-Async-Tasks-during-shutdown.patch} (88%) rename patches/{unapplied/server/0440-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch => server/0425-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch} (86%) rename patches/{unapplied/server/0441-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch => server/0426-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch} (86%) rename patches/{unapplied/server/0442-Reduce-MutableInt-allocations-from-light-engine.patch => server/0427-Reduce-MutableInt-allocations-from-light-engine.patch} (100%) rename patches/{unapplied/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch => server/0428-Reduce-allocation-of-Vec3D-by-entity-tracker.patch} (73%) rename patches/{unapplied/server/0444-Ensure-safe-gateway-teleport.patch => server/0429-Ensure-safe-gateway-teleport.patch} (89%) rename patches/{unapplied/server/0445-Add-option-for-console-having-all-permissions.patch => server/0430-Add-option-for-console-having-all-permissions.patch} (96%) rename patches/{unapplied/server/0449-Fix-villager-trading-demand-MC-163962.patch => server/0431-Fix-villager-trading-demand-MC-163962.patch} (90%) rename patches/{unapplied/server/0450-Maps-shouldn-t-load-chunks.patch => server/0432-Maps-shouldn-t-load-chunks.patch} (91%) create mode 100644 patches/server/0433-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch delete mode 100644 patches/unapplied/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch diff --git a/patches/unapplied/api/0198-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/api/0197-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 100% rename from patches/unapplied/api/0198-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/api/0197-Add-PlayerAttackEntityCooldownResetEvent.patch diff --git a/patches/unapplied/api/0199-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch b/patches/api/0198-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch similarity index 100% rename from patches/unapplied/api/0199-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch rename to patches/api/0198-Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch diff --git a/patches/unapplied/api/0200-Add-item-slot-convenience-methods.patch b/patches/api/0199-Add-item-slot-convenience-methods.patch similarity index 100% rename from patches/unapplied/api/0200-Add-item-slot-convenience-methods.patch rename to patches/api/0199-Add-item-slot-convenience-methods.patch diff --git a/patches/unapplied/api/0201-Villager-Restocks-API.patch b/patches/api/0200-Villager-Restocks-API.patch similarity index 100% rename from patches/unapplied/api/0201-Villager-Restocks-API.patch rename to patches/api/0200-Villager-Restocks-API.patch diff --git a/patches/unapplied/api/0203-Expose-game-version.patch b/patches/api/0201-Expose-game-version.patch similarity index 81% rename from patches/unapplied/api/0203-Expose-game-version.patch rename to patches/api/0201-Expose-game-version.patch index 91ea56bc7..74762b0fe 100644 --- a/patches/unapplied/api/0203-Expose-game-version.patch +++ b/patches/api/0201-Expose-game-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ea67d9e95f0c9ca0b0ae3afba67563e43743abec..396e3e32e71a310702cb5d8138e1ee378656d10e 100644 +index ddaee386c6039eabb349481c2a66ec1292d0bfde..93f6168f2748f127d94a13a3c92e257135bfc534 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -119,6 +119,18 @@ public final class Bukkit { +@@ -133,6 +133,18 @@ public final class Bukkit { return server.getBukkitVersion(); } @@ -28,10 +28,10 @@ index ea67d9e95f0c9ca0b0ae3afba67563e43743abec..396e3e32e71a310702cb5d8138e1ee37 * Gets a view of all currently logged in players. This {@linkplain * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 451a75c2716b23ca61ff53927d594034493da359..f9fe3c20b749acf89c7ea78e73a11a96448940d7 100644 +index dd263faad52612a076847c717582e8fc09dc3345..3b370b0cefe2debacb187d74e8c47ae56c7397e1 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -98,6 +98,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -110,6 +110,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @NotNull public String getBukkitVersion(); diff --git a/patches/unapplied/api/0202-Add-Mob-Goal-API.patch b/patches/api/0202-Add-Mob-Goal-API.patch similarity index 98% rename from patches/unapplied/api/0202-Add-Mob-Goal-API.patch rename to patches/api/0202-Add-Mob-Goal-API.patch index 079bdd13b..02b4660fd 100644 --- a/patches/unapplied/api/0202-Add-Mob-Goal-API.patch +++ b/patches/api/0202-Add-Mob-Goal-API.patch @@ -227,10 +227,10 @@ index 0000000000000000000000000000000000000000..e21f7574763dd4f13794f91bbef192ef +} diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java new file mode 100644 -index 0000000000000000000000000000000000000000..fb0c77c66ca117eaff9487a41f1e280afe6253c6 +index 0000000000000000000000000000000000000000..2405254739a83b2fb517da7fa4ea0721c68f9f6d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java -@@ -0,0 +1,288 @@ +@@ -0,0 +1,289 @@ +package com.destroystokyo.paper.entity.ai; + +import com.destroystokyo.paper.entity.RangedEntity; @@ -428,6 +428,7 @@ index 0000000000000000000000000000000000000000..fb0c77c66ca117eaff9487a41f1e280a + GoalKey OBTAIN_RAID_LEADER_BANNER = GoalKey.of(Raider.class, NamespacedKey.minecraft("obtain_raid_leader_banner")); + GoalKey RAIDER_CELEBRATION = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_celebration")); + GoalKey RAIDER_MOVE_THROUGH_VILLAGE = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_move_through_village")); ++ GoalKey PARROT_WANDER = GoalKey.of(Creature.class, NamespacedKey.minecraft("parrot_wander")); + + /** + * @deprecated removed in 1.16 @@ -520,10 +521,10 @@ index 0000000000000000000000000000000000000000..fb0c77c66ca117eaff9487a41f1e280a + @Deprecated GoalKey UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset")); +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 796f72b1026371fff09e8ce60536d30609987449..84dc57bc02d1496afc3fe3df0b94417079c2ee6b 100644 +index 93f6168f2748f127d94a13a3c92e257135bfc534..338f0938fbae7eec6cecaf3f1cd30d3e27ad40d6 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2007,6 +2007,16 @@ public final class Bukkit { +@@ -2033,6 +2033,16 @@ public final class Bukkit { public static boolean isStopping() { return server.isStopping(); } @@ -541,10 +542,10 @@ index 796f72b1026371fff09e8ce60536d30609987449..84dc57bc02d1496afc3fe3df0b944170 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 552b56995ffb0898ffd459e0175af57341f39f46..3633fcb9155e35479005bfa0c13661b1c9fa726a 100644 +index 3b370b0cefe2debacb187d74e8c47ae56c7397e1..5a98eaeafafc11a7f925701187fc96eb5c675efe 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1761,5 +1761,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1783,5 +1783,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @return true if server is in the process of being shutdown */ boolean isStopping(); diff --git a/patches/unapplied/api/0204-Add-villager-reputation-API.patch b/patches/api/0203-Add-villager-reputation-API.patch similarity index 100% rename from patches/unapplied/api/0204-Add-villager-reputation-API.patch rename to patches/api/0203-Add-villager-reputation-API.patch diff --git a/patches/unapplied/api/0205-Spawn-Reason-API.patch b/patches/api/0204-Spawn-Reason-API.patch similarity index 100% rename from patches/unapplied/api/0205-Spawn-Reason-API.patch rename to patches/api/0204-Spawn-Reason-API.patch diff --git a/patches/unapplied/api/0206-Potential-bed-API.patch b/patches/api/0205-Potential-bed-API.patch similarity index 100% rename from patches/unapplied/api/0206-Potential-bed-API.patch rename to patches/api/0205-Potential-bed-API.patch diff --git a/patches/unapplied/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/removed/1.18/0431-Optimize-ServerLevels-chunk-level-checking-methods.patch similarity index 57% rename from patches/unapplied/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch rename to patches/removed/1.18/0431-Optimize-ServerLevels-chunk-level-checking-methods.patch index 252fada60..e1e6497e2 100644 --- a/patches/unapplied/server/0446-Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/removed/1.18/0431-Optimize-ServerLevels-chunk-level-checking-methods.patch @@ -8,49 +8,49 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 89e88a1de65a5724d05e926cd41733c9cd6cd740..09d06ffb0d3c9920f80843c65e2d0831b9d94f95 100644 +index cdacb26699a54659d1e43ec0f73640556a743700..32bfde94533fcba205e0de3bc55baa8359f8fae6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2118,15 +2118,18 @@ public class ServerLevel extends Level implements WorldGenLevel { - public boolean isPositionTickingWithEntitiesLoaded(BlockPos blockposition) { - long i = ChunkPos.asLong(blockposition); +@@ -2136,15 +2136,18 @@ public class ServerLevel extends Level implements WorldGenLevel { + } -- return this.chunkSource.isPositionTicking(i) && this.areEntitiesLoaded(i); + private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { +- return this.areEntitiesLoaded(chunkPos) && this.chunkSource.isPositionTicking(chunkPos); + // Paper start - optimize is ticking ready type functions -+ ChunkHolder chunkHolder = this.chunkSource.chunkMap.getVisibleChunkIfPresent(i); -+ return chunkHolder != null && chunkHolder.isTickingReady() && this.areEntitiesLoaded(i); ++ ChunkHolder chunkHolder = this.chunkSource.chunkMap.getVisibleChunkIfPresent(chunkPos); ++ return chunkHolder != null && chunkHolder.isTickingReady() && this.areEntitiesLoaded(chunkPos); + // Paper end } - public boolean isPositionEntityTicking(BlockPos blockposition) { -- return this.entityManager.isPositionTicking(blockposition); -+ return this.entityManager.isPositionTicking(ChunkPos.asLong(blockposition)); // Paper + public boolean isPositionEntityTicking(BlockPos pos) { +- return this.entityManager.isPositionTicking(pos); ++ return this.entityManager.isPositionTicking(ChunkPos.asLong(pos)); // Paper } - public boolean isPositionEntityTicking(ChunkPos chunkcoordintpair) { -- return this.entityManager.isPositionTicking(chunkcoordintpair); -+ return this.entityManager.isPositionTicking(chunkcoordintpair.toLong()); // Paper + public boolean isPositionEntityTicking(ChunkPos pos) { +- return this.entityManager.isPositionTicking(pos); ++ return this.entityManager.isPositionTicking(pos.toLong()); // Paper } private final class EntityCallbacks implements LevelCallback { diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 439f82a48e6f6ce7b4773505ced32324cacb302d..2a99aa989ac5c19d99bb3cbc0934425e46573cd7 100644 +index 18c8988dcb5b475c8738a313f1775b73c9d961f4..32037377737cd45fa55ecbe19c201f424a127714 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java -@@ -48,7 +48,7 @@ public class ChunkPos { +@@ -49,7 +49,7 @@ public class ChunkPos { } - public static long asLong(BlockPos blockPos) { -- return asLong(SectionPos.blockToSectionCoord(blockPos.getX()), SectionPos.blockToSectionCoord(blockPos.getZ())); -+ return (((long)blockPos.getX() >> 4) & 4294967295L) | ((((long)blockPos.getZ() >> 4) & 4294967295L) << 32); // Paper - inline + public static long asLong(BlockPos pos) { +- return asLong(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())); ++ return (((long)pos.getX() >> 4) & 4294967295L) | ((((long)pos.getZ() >> 4) & 4294967295L) << 32); // Paper - inline } public static int getX(long pos) { diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -index be65a8a5a853d4e014d44730a48ccf247acf08d2..573e5ba276d270b8f67727dc1fbe6bfd7f2a28b1 100644 +index e19f5b2c8f485d596a64d5d96e75fa1f4a8255b5..ccafd28e3dc9a03f310eb5bdde85fcb277ef5116 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java -@@ -389,6 +389,11 @@ public class PersistentEntitySectionManager implements A +@@ -383,6 +383,11 @@ public class PersistentEntitySectionManager implements A public LevelEntityGetter getEntityGetter() { return this.entityGetter; } @@ -60,5 +60,5 @@ index be65a8a5a853d4e014d44730a48ccf247acf08d2..573e5ba276d270b8f67727dc1fbe6bfd + } + // Paper end - public boolean isPositionTicking(BlockPos blockposition) { - return ((Visibility) this.chunkVisibility.get(ChunkPos.asLong(blockposition))).isTicking(); + public boolean isPositionTicking(BlockPos pos) { + return ((Visibility) this.chunkVisibility.get(ChunkPos.asLong(pos))).isTicking(); diff --git a/patches/unapplied/server/0431-Use-distance-map-to-optimise-entity-tracker.patch b/patches/removed/1.18/0431-Use-distance-map-to-optimise-entity-tracker.patch similarity index 100% rename from patches/unapplied/server/0431-Use-distance-map-to-optimise-entity-tracker.patch rename to patches/removed/1.18/0431-Use-distance-map-to-optimise-entity-tracker.patch diff --git a/patches/unapplied/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/patches/removed/1.18/0432-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch similarity index 99% rename from patches/unapplied/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch rename to patches/removed/1.18/0432-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index 3d7732420..ac69b7883 100644 --- a/patches/unapplied/server/0447-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/patches/removed/1.18/0432-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -30,7 +30,7 @@ index 79f2b3942a3ccccd8fe8719db12de458212e8659..d113b4835e86a789c0ba124eb839e1c5 @@ -205,15 +206,9 @@ public class ChunkSerializer { object2 = protochunkticklist1; } - + - object = new LevelChunk(world.getLevel(), pos, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, k, achunksection, (chunk) -> { - ChunkSerializer.postLoadChunk(world, nbttagcompound1, chunk); - // CraftBukkit start - load chunk persistent data from nbt @@ -45,7 +45,7 @@ index 79f2b3942a3ccccd8fe8719db12de458212e8659..d113b4835e86a789c0ba124eb839e1c5 + );// Paper end } else { ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, world); // Paper - add level - + @@ -319,6 +314,50 @@ public class ChunkSerializer { return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading } diff --git a/patches/unapplied/server/0432-Optimize-isOutsideRange-to-use-distance-maps.patch b/patches/removed/1.18/0432-Optimize-isOutsideRange-to-use-distance-maps.patch similarity index 100% rename from patches/unapplied/server/0432-Optimize-isOutsideRange-to-use-distance-maps.patch rename to patches/removed/1.18/0432-Optimize-isOutsideRange-to-use-distance-maps.patch diff --git a/patches/unapplied/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/patches/removed/1.18/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 93% rename from patches/unapplied/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to patches/removed/1.18/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch index 7cfe4b244..8529a202e 100644 --- a/patches/unapplied/server/0452-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/patches/removed/1.18/0435-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -17,11 +17,11 @@ This allows servers with smaller worlds who do less long distance exploring to s wasting cpu cycles on saving/unloading/reloading chunks repeatedly. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c0805c5bafbe3ae9da00969796c7ee4cc791249d..c0bb172aeaabcaa05aa4b05353f345d6d8501769 100644 +index a5361e1dba7c025667c7627b8851655bba2c9c6a..ef50517fa00fd219e05c4a725350a78635604b2f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -575,6 +575,15 @@ public class PaperWorldConfig { - this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); +@@ -545,6 +545,15 @@ public class PaperWorldConfig { + lightQueueSize = getInt("light-queue-size", lightQueueSize); } + public long delayChunkUnloadsBy; @@ -37,10 +37,10 @@ index c0805c5bafbe3ae9da00969796c7ee4cc791249d..c0bb172aeaabcaa05aa4b05353f345d6 public java.util.Map altItemDespawnRateMap; private void altItemDespawnRate() { diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 577b391dcba1db712c1e2c83296e1c87b3e34ab2..d94241bcca4f2fd5e464a860bd356af504dc68b7 100644 +index 1a6c75a33c6dfec63eabef0b8a0a5d8812aeeb4c..fb570511f2e12cb3794d32fa72b6fb886e6f1199 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -181,6 +181,27 @@ public abstract class DistanceManager { +@@ -195,6 +195,27 @@ public abstract class DistanceManager { boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { removed = true; // CraftBukkit diff --git a/patches/unapplied/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/patches/removed/1.18/0436-Optimize-sending-packets-to-nearby-locations-sounds-.patch similarity index 95% rename from patches/unapplied/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch rename to patches/removed/1.18/0436-Optimize-sending-packets-to-nearby-locations-sounds-.patch index 87d789feb..9d47f45f0 100644 --- a/patches/unapplied/server/0448-Optimize-sending-packets-to-nearby-locations-sounds-.patch +++ b/patches/removed/1.18/0436-Optimize-sending-packets-to-nearby-locations-sounds-.patch @@ -11,10 +11,10 @@ This will drastically cut down on packet sending cost for worlds with lots of players in them. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 004381c9a7366b6caabc14160ec6ff58874c75af..60abb3e64c083a6867c242a473d0d7049c1eb1cd 100644 +index c2cc59f476a67224774503009439fec2ad1ec62d..54cbcea8e3eb4d2fdeced2ebc3c4819af429da9d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1138,16 +1138,40 @@ public abstract class PlayerList { +@@ -1134,16 +1134,40 @@ public abstract class PlayerList { } public void broadcast(@Nullable net.minecraft.world.entity.player.Player player, double x, double y, double z, double distance, ResourceKey worldKey, Packet packet) { diff --git a/patches/unapplied/server/0412-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0402-Fix-Chunk-Post-Processing-deadlock-risk.patch similarity index 86% rename from patches/unapplied/server/0412-Fix-Chunk-Post-Processing-deadlock-risk.patch rename to patches/server/0402-Fix-Chunk-Post-Processing-deadlock-risk.patch index 36601a92d..17e5fa711 100644 --- a/patches/unapplied/server/0412-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0402-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,18 +25,18 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 41f8afe938ea4fc9ceb4e57867bde5ae9aa6530e..291b7bd1c7951293d76b8bab399450628cd51d39 100644 +index 0758f0983c17e7e4b5b5aea64ea12e990f7a22e4..f3021f34a73c11ad2e181deda8a43d026280bef0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -168,6 +168,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -172,6 +172,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end + final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); - // Paper start - no-tick view distance -@@ -1056,7 +1057,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + +@@ -976,7 +977,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return Either.left(chunk); }); }, (runnable) -> { @@ -46,10 +46,10 @@ index 41f8afe938ea4fc9ceb4e57867bde5ae9aa6530e..291b7bd1c7951293d76b8bab39945062 completablefuture1.thenAcceptAsync((either) -> { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ec0d8e58a518a20634b902769251d6d04750433e..fe9711daa67151187906128c9d07ad967b72e677 100644 +index 2f31cae237b74e8281142c5ccf9ac4272607b8eb..d56eb5071ed3ae2b9d5636cafb3aca9b2cd71d15 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1136,6 +1136,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1137,6 +1137,7 @@ public class ServerChunkCache extends ChunkSource { return super.pollTask() || execChunkTask; // Paper } } finally { diff --git a/patches/unapplied/server/0415-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0403-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch similarity index 85% rename from patches/unapplied/server/0415-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch rename to patches/server/0403-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 07a151d23..98c94c646 100644 --- a/patches/unapplied/server/0415-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0403-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 291b7bd1c7951293d76b8bab399450628cd51d39..3a546b879d093702e36118231020cf41fe972410 100644 +index f3021f34a73c11ad2e181deda8a43d026280bef0..5592f879ef2c1b8f15bc63b38edb57f19e9d589d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1566,6 +1566,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1555,6 +1555,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider .printStackTrace(); return; } @@ -40,10 +40,10 @@ index 291b7bd1c7951293d76b8bab399450628cd51d39..3a546b879d093702e36118231020cf41 if (!(entity instanceof EnderDragonPart)) { EntityType entitytypes = entity.getType(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 2f102c6160a01177820c3b82dce138c71a492526..4433734f070cecbec058648a619b10567e44eeab 100644 +index cdb0eb8e21299ca70ed7ed5c1195d07f44e47838..6d59a813aa752b4233dbe1894cfc8273473c24e9 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -243,6 +243,7 @@ public class ServerPlayer extends Player { +@@ -246,6 +246,7 @@ public class ServerPlayer extends Player { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; @@ -52,12 +52,12 @@ index 2f102c6160a01177820c3b82dce138c71a492526..4433734f070cecbec058648a619b1056 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c6d7d546ca79f71aadafe92d5d91f7ace8a07a0d..9609579e6d61c3975740d07a394680aeef952516 100644 +index ccf03feb976d22f8c4ca4f60b6bc1d1d773c485f..492fc4e450b961e4d3421da88fcf8c1737bc3ded 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -277,6 +277,12 @@ public abstract class PlayerList { +@@ -276,6 +276,12 @@ public abstract class PlayerList { this.playersByUUID.put(player.getUUID(), player); - // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below + // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below + // Paper start - correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks + player.supressTrackerForLogin = true; @@ -68,8 +68,8 @@ index c6d7d546ca79f71aadafe92d5d91f7ace8a07a0d..9609579e6d61c3975740d07a394680ae // CraftBukkit start CraftPlayer bukkitPlayer = player.getBukkitEntity(); -@@ -317,6 +323,8 @@ public abstract class PlayerList { - player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[] { entityplayer1})); +@@ -316,6 +322,8 @@ public abstract class PlayerList { + player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{entityplayer1})); } player.sentListPacket = true; + player.supressTrackerForLogin = false; // Paper @@ -77,7 +77,7 @@ index c6d7d546ca79f71aadafe92d5d91f7ace8a07a0d..9609579e6d61c3975740d07a394680ae // CraftBukkit end player.connection.send(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -342,6 +350,11 @@ public abstract class PlayerList { +@@ -341,6 +349,11 @@ public abstract class PlayerList { playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect)); } @@ -89,7 +89,7 @@ index c6d7d546ca79f71aadafe92d5d91f7ace8a07a0d..9609579e6d61c3975740d07a394680ae if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); // CraftBukkit start -@@ -390,6 +403,10 @@ public abstract class PlayerList { +@@ -389,6 +402,10 @@ public abstract class PlayerList { } } @@ -100,7 +100,7 @@ index c6d7d546ca79f71aadafe92d5d91f7ace8a07a0d..9609579e6d61c3975740d07a394680ae player.initInventoryMenu(); // CraftBukkit - Moved from above, added world // Paper start - Add to collideRule team if needed -@@ -399,6 +416,7 @@ public abstract class PlayerList { +@@ -398,6 +415,7 @@ public abstract class PlayerList { scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); } // Paper end diff --git a/patches/unapplied/server/0416-Load-Chunks-for-Login-Asynchronously.patch b/patches/server/0404-Load-Chunks-for-Login-Asynchronously.patch similarity index 90% rename from patches/unapplied/server/0416-Load-Chunks-for-Login-Asynchronously.patch rename to patches/server/0404-Load-Chunks-for-Login-Asynchronously.patch index 524bed692..69b6ebec1 100644 --- a/patches/unapplied/server/0416-Load-Chunks-for-Login-Asynchronously.patch +++ b/patches/server/0404-Load-Chunks-for-Login-Asynchronously.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 4433734f070cecbec058648a619b10567e44eeab..40692f3559eec910a653e89d3bc199fb9f17db27 100644 +index 6d59a813aa752b4233dbe1894cfc8273473c24e9..beebb7a0e6b8b1fa4e7d2f9fdf1962357cc2ebc3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -178,6 +178,7 @@ public class ServerPlayer extends Player { +@@ -174,6 +174,7 @@ public class ServerPlayer extends Player { private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; @@ -16,7 +16,7 @@ index 4433734f070cecbec058648a619b10567e44eeab..40692f3559eec910a653e89d3bc199fb public final MinecraftServer server; public final ServerPlayerGameMode gameMode; private final PlayerAdvancements advancements; -@@ -244,6 +245,7 @@ public class ServerPlayer extends Player { +@@ -247,6 +248,7 @@ public class ServerPlayer extends Player { public boolean joining = true; public boolean sentListPacket = false; public boolean supressTrackerForLogin = false; // Paper @@ -37,10 +37,10 @@ index be677d437d17b74c6188ce1bd5fc6fdc228fd92f..78fbb4c3e52e900956ae0811aaf934c8 public static final TicketType UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); public static final TicketType PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d4fac789cebd17e7b244002a7382d94cf0d80bb2..f585cd4f4682a9d2a6ebc2367a32995d8660d591 100644 +index 97c67fe091b2042a3aa98cc53d5e1ea1163a0966..f2960cc42295833a788a22becfa28cca76e15930 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -220,6 +220,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -219,6 +219,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final int LATENCY_CHECK_INTERVAL = 15000; public final Connection connection; private final MinecraftServer server; @@ -48,7 +48,7 @@ index d4fac789cebd17e7b244002a7382d94cf0d80bb2..f585cd4f4682a9d2a6ebc2367a32995d public ServerPlayer player; private int tickCount; private long keepAliveTime = Util.getMillis(); -@@ -294,6 +295,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -293,6 +294,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // CraftBukkit end public void tick() { @@ -64,7 +64,7 @@ index d4fac789cebd17e7b244002a7382d94cf0d80bb2..f585cd4f4682a9d2a6ebc2367a32995d this.resetPosition(); this.player.xo = this.player.getX(); this.player.yo = this.player.getY(); -@@ -335,7 +345,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -334,7 +344,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.lastVehicle = null; this.clientVehicleIsFloating = false; this.aboveGroundVehicleTickCount = 0; @@ -74,7 +74,7 @@ index d4fac789cebd17e7b244002a7382d94cf0d80bb2..f585cd4f4682a9d2a6ebc2367a32995d this.server.getProfiler().push("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index b5d8987d2903086d69bbd6ba8092e568c94be63f..bd1203a5b58bac7cccf1f81337fa2967a0e9eb40 100644 +index bb767f5b626225e70a8af273384bb74dbd21430d..301042e7a0d372a914f27ec0988dd938cf2a8262 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -88,7 +88,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -94,12 +94,12 @@ index b5d8987d2903086d69bbd6ba8092e568c94be63f..bd1203a5b58bac7cccf1f81337fa2967 + ServerPlayer entityplayer = this.server.getPlayerList().getActivePlayer(this.gameProfile.getId()); // Paper try { - ServerPlayer entityplayer1 = this.server.getPlayerList().processLogin(this.gameProfile, s); // CraftBukkit - add player reference + ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a097670be5 100644 +index 492fc4e450b961e4d3421da88fcf8c1737bc3ded..c2cc59f476a67224774503009439fec2ad1ec62d 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -40,6 +40,7 @@ import net.minecraft.network.protocol.Packet; +@@ -39,6 +39,7 @@ import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundChatPacket; import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; @@ -107,7 +107,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; import net.minecraft.network.protocol.game.ClientboundGameEventPacket; import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket; -@@ -135,6 +136,7 @@ public abstract class PlayerList { +@@ -134,6 +135,7 @@ public abstract class PlayerList { private final IpBanList ipBans; private final ServerOpList ops; private final UserWhiteList whitelist; @@ -136,7 +136,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 // CraftBukkit end if (nbttagcompound != null) { -@@ -260,6 +267,52 @@ public abstract class PlayerList { +@@ -259,6 +266,52 @@ public abstract class PlayerList { player.getRecipeBook().sendInitialRecipeBook(player); this.updateEntireScoreboard(worldserver1.getScoreboard(), player); this.server.invalidateStatus(); @@ -189,7 +189,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 TranslatableComponent chatmessage; if (player.getGameProfile().getName().equalsIgnoreCase(s)) { -@@ -503,6 +556,7 @@ public abstract class PlayerList { +@@ -502,6 +555,7 @@ public abstract class PlayerList { protected void save(ServerPlayer player) { if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit @@ -197,7 +197,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -530,7 +584,7 @@ public abstract class PlayerList { +@@ -529,7 +583,7 @@ public abstract class PlayerList { } PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); @@ -206,7 +206,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); if (server.isSameThread()) entityplayer.doTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) -@@ -575,6 +629,13 @@ public abstract class PlayerList { +@@ -574,6 +628,13 @@ public abstract class PlayerList { // this.advancements.remove(uuid); // CraftBukkit end } @@ -219,8 +219,8 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 + // Paper end // CraftBukkit start - // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); -@@ -592,7 +653,7 @@ public abstract class PlayerList { + // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); +@@ -591,7 +652,7 @@ public abstract class PlayerList { this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -229,7 +229,7 @@ index 9609579e6d61c3975740d07a394680aeef952516..6b23b9389ff92ae8016d4adb289ac2a0 } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -611,6 +672,13 @@ public abstract class PlayerList { +@@ -610,6 +671,13 @@ public abstract class PlayerList { list.add(entityplayer); } } diff --git a/patches/unapplied/server/0417-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0405-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 86% rename from patches/unapplied/server/0417-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to patches/server/0405-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 59e186206..60ee483dd 100644 --- a/patches/unapplied/server/0417-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0405-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1164fc5915f0121b697ea10fac73919597902026..5802b1721a0d8e1c40d87be099d4f1b1c8a921d7 100644 +index c7581c1b306d9c6498e18456d67f5acd067357e6..5a26fe2b8c468063618dd02056da43f001173812 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2010,9 +2010,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2038,9 +2038,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i bworld = server.getWorld(worldName); } diff --git a/patches/unapplied/server/0418-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0406-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 92% rename from patches/unapplied/server/0418-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/server/0406-Add-PlayerAttackEntityCooldownResetEvent.patch index 343e379a5..9a5fb8020 100644 --- a/patches/unapplied/server/0418-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0406-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 478204aa91d33232f33708816fcc7ea2fe1b55d4..fab8098ce72feb9b08960e55ab1a4aebaae22276 100644 +index ba3aae873c2bd23a1bb35bb7746907d0bcfd0dd3..6c4fd054a06830947dbb4728e62dc320a51f43f0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2040,7 +2040,16 @@ public abstract class LivingEntity extends Entity { +@@ -2039,7 +2039,16 @@ public abstract class LivingEntity extends Entity { 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/0419-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0407-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 86% rename from patches/unapplied/server/0419-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0407-Don-t-fire-BlockFade-on-worldgen-threads.patch index 53781b7ce..8a5268c81 100644 --- a/patches/unapplied/server/0419-Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/patches/server/0407-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads Caused a deadlock 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 8ce3dea66a1f45bb3f416bca1765c563394ad8ed..4156f212461201e8f8001f3fbcd7fb683e86ed6b 100644 +index 33752432af861a708e0dbb1afafcd5968d795931..08bc35b40720ca001d3f6c1185bdd11c61ec9ee1 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java -@@ -101,6 +101,7 @@ public class FireBlock extends BaseFireBlock { +@@ -100,6 +100,7 @@ public class FireBlock extends BaseFireBlock { @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { // CraftBukkit start @@ -17,7 +17,7 @@ index 8ce3dea66a1f45bb3f416bca1765c563394ad8ed..4156f212461201e8f8001f3fbcd7fb68 if (!this.canSurvive(state, world, pos)) { // Suppress during worldgen if (!(world instanceof Level)) { -@@ -116,7 +117,7 @@ public class FireBlock extends BaseFireBlock { +@@ -115,7 +116,7 @@ public class FireBlock extends BaseFireBlock { return blockState.getHandle(); } } diff --git a/patches/unapplied/server/0420-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0408-Add-phantom-creative-and-insomniac-controls.patch similarity index 71% rename from patches/unapplied/server/0420-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0408-Add-phantom-creative-and-insomniac-controls.patch index 465bec7a6..25bd1fe36 100644 --- a/patches/unapplied/server/0420-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0408-Add-phantom-creative-and-insomniac-controls.patch @@ -5,52 +5,50 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6bda3fc058045d637564fde569b6c44aabdfd099..4e43d4fbd5f69d278f94b69c0704d2bc3569296e 100644 +index ab37621a4955b122415ceace9c9eb135b71099cd..d59d8bc43ade0843a3eef62f7c7954e8225783a3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -557,6 +557,13 @@ public class PaperWorldConfig { - lightQueueSize = getInt("light-queue-size", lightQueueSize); +@@ -600,4 +600,11 @@ public class PaperWorldConfig { + } + perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true); } - ++ + public boolean phantomIgnoreCreative = true; + public boolean phantomOnlyAttackInsomniacs = true; + private void phantomSettings() { + phantomIgnoreCreative = getBoolean("phantoms-do-not-spawn-on-creative-players", phantomIgnoreCreative); + phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); + } -+ - public int noTickViewDistance; - private void viewDistance() { - this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); + } diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index d17b75ad13bbc8a38cdc2f2d77ee5d88438cec31..8fb89326395a7e70982c0d757b506565e98b12a4 100644 +index b91a61be7c4829fce0ff8da290eab580e20bb78d..22f36cd3df49160f1b6668befdd05c2268edaa49 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java -@@ -26,6 +26,7 @@ public final class EntitySelector { - public static final Predicate NO_SPECTATORS = (entity) -> { +@@ -27,6 +27,7 @@ public final class EntitySelector { return !entity.isSpectator(); }; + public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); + public static Predicate isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper private EntitySelector() {} // Paper start 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 080f6d12838faf47ead0958d6bc08f26f78c4671..53cb932d5af963c51b026440da49bdc402cae9fd 100644 +index 451be9232eaa513ed66ff0d2b93c932317ad6729..7344301e1cdeccd95375b77f6955edb508362a7b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -547,6 +547,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -548,6 +548,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); - if (Phantom.this.canAttack((LivingEntity) entityhuman, TargetingConditions.DEFAULT)) { + if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { + if (!level.paperConfig.phantomOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper - Phantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason + Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason 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 42effcbd3ca7c38a4e8b1aa835543ad243112a33..79504dc3448402e73b09c4232b1fd0488872cf68 100644 +index 891c12b8cfcdc7a2915955bdd08e50b5b9465e02..1e21d6cf2f03219fb2b7217c9a72bdd83c2146f7 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -@@ -53,7 +53,7 @@ public class PhantomSpawner implements CustomSpawner { +@@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner { while (iterator.hasNext()) { Player entityhuman = (Player) iterator.next(); diff --git a/patches/unapplied/server/0421-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0409-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 85% rename from patches/unapplied/server/0421-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to patches/server/0409-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 9dd3452ca..81837f2c2 100644 --- a/patches/unapplied/server/0421-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0409-Fix-numerous-item-duplication-issues-and-teleport-is.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 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe1631fe78 100644 +index 5a26fe2b8c468063618dd02056da43f001173812..640ea4522419fe90a0a390c2cf0379aab8d060b2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2159,11 +2159,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2188,11 +2188,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } 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 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2905,6 +2906,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2943,6 +2944,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -2925,6 +2932,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2963,6 +2970,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -56,10 +56,10 @@ index 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe + ((Mob) this).dropLeash(true, true); // Paper drop lead + } + // Paper end - Entity entity = this.getType().create((Level) worldserver); + Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -2938,10 +2950,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2976,10 +2988,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe // CraftBukkit end } -@@ -3066,7 +3074,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3100,7 +3108,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public boolean canChangeDimensions() { @@ -80,10 +80,10 @@ index 5802b1721a0d8e1c40d87be099d4f1b1c8a921d7..fbcbe0443f843d04738938f10b433bfe 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/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index b41e6fb0b7e02b50e5ad05555ed911d09055d694..c5e9273055ff7302941b7475d8175be53eaece1f 100644 +index a3a900d10440ed5ebe24370a77ccb6cad911cfc9..0d468631b9c260091e732925da43c177ebda892f 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -611,7 +611,7 @@ public class ArmorStand extends LivingEntity { +@@ -610,7 +610,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -92,7 +92,7 @@ index b41e6fb0b7e02b50e5ad05555ed911d09055d694..c5e9273055ff7302941b7475d8175be5 this.handItems.set(i, ItemStack.EMPTY); } } -@@ -619,7 +619,7 @@ public class ArmorStand extends LivingEntity { +@@ -618,7 +618,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -102,7 +102,7 @@ index b41e6fb0b7e02b50e5ad05555ed911d09055d694..c5e9273055ff7302941b7475d8175be5 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 4c2ebb2eb93c1f8a805dbe0919f9726ccb4fff1f..54aa3a95118176e7f91f4d669253790167fcd958 100644 +index bf7c61c767bdfe8ddb63367f1b38dbbeba17ba02..4cdac8044d3a14861dab5b018479c735d094adcf 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -827,7 +827,8 @@ public class CraftEventFactory { diff --git a/patches/unapplied/server/0423-Villager-Restocks-API.patch b/patches/server/0410-Villager-Restocks-API.patch similarity index 91% rename from patches/unapplied/server/0423-Villager-Restocks-API.patch rename to patches/server/0410-Villager-Restocks-API.patch index 405b36f5d..17ee27bb6 100644 --- a/patches/unapplied/server/0423-Villager-Restocks-API.patch +++ b/patches/server/0410-Villager-Restocks-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Villager Restocks API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 18fbf866fd7a6de2ed037b8d9c53e25d180be98b..83b7b136794ad855eb0faf839edfcf4a024b2c2a 100644 +index 503c547451b8754342197d8b6f9bb0f1298f83c2..e9a51b5b387ff91b5840bbd13ed6c5b776283ed9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -83,6 +83,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { diff --git a/patches/unapplied/server/0424-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0411-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 91% rename from patches/unapplied/server/0424-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to patches/server/0411-Validate-PickItem-Packet-and-kick-for-invalid.patch index 7647f7465..be3a22b04 100644 --- a/patches/unapplied/server/0424-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0411-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 11d9e22c9ef64db62528da73066de8c118565054..fa291673ab392af499c38d0a3b31bbdb664a3a68 100644 +index f2960cc42295833a788a22becfa28cca76e15930..bb1244d895c6e5fd668b5a01f507624fdac847f0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -876,7 +876,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -875,7 +875,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); diff --git a/patches/unapplied/server/0425-Expose-game-version.patch b/patches/server/0412-Expose-game-version.patch similarity index 82% rename from patches/unapplied/server/0425-Expose-game-version.patch rename to patches/server/0412-Expose-game-version.patch index 3edddb010..e2501256c 100644 --- a/patches/unapplied/server/0425-Expose-game-version.patch +++ b/patches/server/0412-Expose-game-version.patch @@ -5,10 +5,10 @@ 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 6b1bc025d0072aa5d0c7609d1da355b9eae7df2d..9a6d9f2a4bb1efad247f70e7639da9540409a327 100644 +index c7e2ce7d2fa80c6c97ebe94ec5c36c9eb7356f45..6b9fedc5abeab73a74ca86ee7c3893e0bdc24dd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -541,6 +541,13 @@ public final class CraftServer implements Server { +@@ -579,6 +579,13 @@ public final class CraftServer implements Server { return this.bukkitVersion; } diff --git a/patches/unapplied/server/0426-Optimize-Voxel-Shape-Merging.patch b/patches/server/0413-Optimize-Voxel-Shape-Merging.patch similarity index 96% rename from patches/unapplied/server/0426-Optimize-Voxel-Shape-Merging.patch rename to patches/server/0413-Optimize-Voxel-Shape-Merging.patch index 2ef4cbd94..25915ad4d 100644 --- a/patches/unapplied/server/0426-Optimize-Voxel-Shape-Merging.patch +++ b/patches/server/0413-Optimize-Voxel-Shape-Merging.patch @@ -68,10 +68,10 @@ index 9e0afab2329e560c4b2512548dd4b02dd1a2e69f..06662dbff8180751a8684841aa35f709 this.firstIndices = new int[k]; this.secondIndices = new int[k]; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index ee5fa14d2232b145806aefcaffb5c6348a08058a..18eeb49a4859a8ab9cbef97caf63c0639bc63233 100644 +index 48812329969b7192acd948db974bb77bb546f979..f7708920c62ea3040ba5c931d2141fa1d6ff613d 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -336,9 +336,21 @@ public final class Shapes { +@@ -337,9 +337,21 @@ public final class Shapes { } @VisibleForTesting @@ -94,7 +94,7 @@ index ee5fa14d2232b145806aefcaffb5c6348a08058a..18eeb49a4859a8ab9cbef97caf63c063 if (first instanceof CubePointRange && second instanceof CubePointRange) { long l = lcm(i, j); if ((long)size * l <= 256L) { -@@ -346,13 +358,22 @@ public final class Shapes { +@@ -347,13 +359,22 @@ public final class Shapes { } } diff --git a/patches/unapplied/server/0427-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0414-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 93% rename from patches/unapplied/server/0427-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to patches/server/0414-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index e0a1bf15f..499c804b4 100644 --- a/patches/unapplied/server/0427-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0414-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 1d63b1da588ef8930133d4cf7ca541fe4d753a4b..c687df04b3543df763a4d5225342357355fab7ec 100644 +index 1ade239c9aacf2334c6dee773e0b37f3969723da..450518903c0a10301b177d8dd7fe05aca3b8b37e 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -28,6 +28,7 @@ public class Main { diff --git a/patches/unapplied/server/0428-misc-debugging-dumps.patch b/patches/server/0415-misc-debugging-dumps.patch similarity index 85% rename from patches/unapplied/server/0428-misc-debugging-dumps.patch rename to patches/server/0415-misc-debugging-dumps.patch index becb2a035..9bb15646d 100644 --- a/patches/unapplied/server/0428-misc-debugging-dumps.patch +++ b/patches/server/0415-misc-debugging-dumps.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 42642e923b68e1074ee322d290983370cdf8881f..d986d03ee40866880ff7a4f39e83b06e1bcc7b6e 100644 +index 77820cd4d464f2582b57f60d34bc0c2f3622e4ae..7ca3752aa6f4e626c4437857821000101162b2bc 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -937,6 +937,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop("generatePomFileForMavenPublication") +@@ -111,6 +121,45 @@ tasks.shadowJar { transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java) } @@ -95,10 +95,10 @@ index a482ad74b9a5d06a982ac2a6d9b6c5dc9f664f46..974f0bbbd3d271d28ce884490dc68b68 exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") } diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 4bdc154ce5b91c3d5c4b5dc63ff32a7fe094bd37..e1d91a95c306e71ac77b3658de77ec9d18c4f8e6 100644 +index a074df5708624bd4b0bc2ad3dcbd4bc4ff737595..68dc68238adc8d288052132e9f70663e8bba1e80 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -436,4 +436,9 @@ public class PaperConfig { +@@ -429,4 +429,9 @@ public class PaperConfig { log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag."); } } @@ -523,10 +523,10 @@ index 3941e14d1c3e6e688e28904948039c8b2200de5f..a4fda4a3bae9ce600e778b44cd3ef432 } } diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index a335d48467d1730bfed25eb5fd9046e115f23ed0..8098875a5c4146dec81f5daed0e34ddfe17a26c6 100644 +index 0716aaf29f9d76240a0de4ca02daba442b36ec7d..2b7ba5d8dda0297c8b35a0cea68c3ae10188e3f2 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -214,6 +214,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -212,6 +212,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now diff --git a/patches/unapplied/server/0430-Implement-Mob-Goal-API.patch b/patches/server/0417-Implement-Mob-Goal-API.patch similarity index 97% rename from patches/unapplied/server/0430-Implement-Mob-Goal-API.patch rename to patches/server/0417-Implement-Mob-Goal-API.patch index 9c72336d8..d2822a775 100644 --- a/patches/unapplied/server/0430-Implement-Mob-Goal-API.patch +++ b/patches/server/0417-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 f802d9e803b406cb9b5b4bce7de6858eba0fae7e..27f8a99f35a22f334e8023c1c9048e3a88a63d6f 100644 +index 8f65d5d3a5fa58394b0e398bed80044aec3fcc7c..eaeed610e3f1a622b2ece220d595fbca9c750d20 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -55,6 +55,7 @@ dependencies { +@@ -52,6 +52,7 @@ dependencies { implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation @@ -735,23 +735,25 @@ index 0000000000000000000000000000000000000000..0d30e0b21b9024df939a9d070bd4a99b + } +} diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java -index 9df0006c1a283f77c4d01d9fce9062fc1c9bbb1f..b3329c6fcd6758a781a51f5ba8f5052ac1c77b49 100644 +index 66f6423d2732d23809fe86418537e35d40d24373..964f68fc3cbdb658c13d5d0213abf2ee3ce9557d 100644 --- a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java +++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java -@@ -64,4 +64,8 @@ public final class OptimizedSmallEnumSet> { - public boolean hasCommonElements(final OptimizedSmallEnumSet other) { +@@ -67,6 +67,10 @@ public final class OptimizedSmallEnumSet> { return (other.backingSet & this.backingSet) != 0; } -+ + + public boolean hasElement(final E element) { + return (this.backingSet & (1L << element.ordinal())) != 0; + } - } ++ + public void forEach(final E[] values, final Consumer action) { + long iterator = this.getBackingSet(); + int wrappedGoalSize = this.size(); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -index fabd20265863751ad980ee4a697f3f0d47df101f..3a4da2bb86a742985d309eb325dc843ae405cd8b 100644 +index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc313c28e7cb 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -@@ -6,6 +6,14 @@ public abstract class Goal { +@@ -7,6 +7,14 @@ public abstract class Goal { private final EnumSet flags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector @@ -766,7 +768,7 @@ index fabd20265863751ad980ee4a697f3f0d47df101f..3a4da2bb86a742985d309eb325dc843a public abstract boolean canUse(); public boolean canContinueToUse() { -@@ -29,6 +37,10 @@ public abstract class Goal { +@@ -34,6 +42,10 @@ public abstract class Goal { // Paper start - remove streams from pathfindergoalselector this.goalTypes.clear(); this.goalTypes.addAllUnchecked(controls); @@ -777,8 +779,8 @@ index fabd20265863751ad980ee4a697f3f0d47df101f..3a4da2bb86a742985d309eb325dc843a // Paper end - remove streams from pathfindergoalselector } -@@ -43,7 +55,19 @@ public abstract class Goal { - // Paper end - remove streams from pathfindergoalselector +@@ -56,7 +68,19 @@ public abstract class Goal { + return Mth.positiveCeilDiv(serverTicks, 2); } + // Paper start - mob goal api @@ -798,10 +800,10 @@ index fabd20265863751ad980ee4a697f3f0d47df101f..3a4da2bb86a742985d309eb325dc843a LOOK, JUMP, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1e34f8d2c3b14ed6a42930099d3130c4d589d48c..df5a9d6b1b8117080ede57f443dc79b875145461 100644 +index 194de00bdff499ac5159f266f17f95c8e4e2f0b2..7a44029f6ab3372bfd246ec3d61aa81541b7b968 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2570,5 +2570,11 @@ public final class CraftServer implements Server { +@@ -2616,5 +2616,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } diff --git a/patches/unapplied/server/0433-Add-villager-reputation-API.patch b/patches/server/0418-Add-villager-reputation-API.patch similarity index 97% rename from patches/unapplied/server/0433-Add-villager-reputation-API.patch rename to patches/server/0418-Add-villager-reputation-API.patch index 22bcc3614..8718589cd 100644 --- a/patches/unapplied/server/0433-Add-villager-reputation-API.patch +++ b/patches/server/0418-Add-villager-reputation-API.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084 + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index 3eb1d640f53e0b8be53fa78aaa7bca6a7963d912..01df536b3b61281828ca2be03ac1bbb6a1096423 100644 +index 23dda5721fe6b706428075cd868ae0d68f986382..5498ec7049318dc2d10bb2ef7fbfefcf1e6e1e72 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java @@ -29,7 +29,7 @@ import net.minecraft.util.VisibleForDebug; @@ -62,7 +62,7 @@ index 3eb1d640f53e0b8be53fa78aaa7bca6a7963d912..01df536b3b61281828ca2be03ac1bbb6 static class GossipEntry { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 83b7b136794ad855eb0faf839edfcf4a024b2c2a..1c2a086445b1dd59299eef89056990bc3d1152f8 100644 +index e9a51b5b387ff91b5840bbd13ed6c5b776283ed9..67cf86dfad91ee5afea3b4b48f89224af3ea2354 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -16,6 +16,13 @@ import org.bukkit.entity.Villager; diff --git a/patches/unapplied/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch b/patches/server/0419-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 86% rename from patches/unapplied/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch rename to patches/server/0419-Option-for-maximum-exp-value-when-merging-orbs.patch index 11f4b43a2..1db1996cc 100644 --- a/patches/unapplied/server/0434-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/patches/server/0419-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,24 +5,22 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f036c3179f4e7633eac4e1889c029383c291da92..16b4711496ce4cc7b8e53de4614836d2590a5704 100644 +index d59d8bc43ade0843a3eef62f7c7954e8225783a3..a5361e1dba7c025667c7627b8851655bba2c9c6a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -397,6 +397,12 @@ public class PaperWorldConfig { - log("Creeper lingering effect: " + disableCreeperLingeringEffect); +@@ -607,4 +607,10 @@ public class PaperWorldConfig { + phantomIgnoreCreative = getBoolean("phantoms-do-not-spawn-on-creative-players", phantomIgnoreCreative); + phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); } - ++ + public int expMergeMaxValue; + private void expMergeMaxValue() { + expMergeMaxValue = getInt("experience-merge-max-value", -1); + log("Experience Merge Max Value: " + expMergeMaxValue); + } -+ - public double squidMaxSpawnHeight; - private void squidMaxSpawnHeight() { - squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); + } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 54aa3a95118176e7f91f4d669253790167fcd958..b07247dda5f7be1186c47ce5cb490ca0a46cc56c 100644 +index 4cdac8044d3a14861dab5b018479c735d094adcf..147839ff49ad5ac20dfd1cfdb09a25dafc6ae03c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -630,16 +630,30 @@ public class CraftEventFactory { diff --git a/patches/unapplied/server/0435-ExperienceOrbMergeEvent.patch b/patches/server/0420-ExperienceOrbMergeEvent.patch similarity index 94% rename from patches/unapplied/server/0435-ExperienceOrbMergeEvent.patch rename to patches/server/0420-ExperienceOrbMergeEvent.patch index 254b5ba23..9ca6a034e 100644 --- a/patches/unapplied/server/0435-ExperienceOrbMergeEvent.patch +++ b/patches/server/0420-ExperienceOrbMergeEvent.patch @@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b07247dda5f7be1186c47ce5cb490ca0a46cc56c..ff2149572a82d6605a0b28f2fdd0dadb86af25a1 100644 +index 147839ff49ad5ac20dfd1cfdb09a25dafc6ae03c..5fea023590fd1456a4d43c1ebc5b8c243e185631 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -640,7 +640,7 @@ public class CraftEventFactory { diff --git a/patches/unapplied/server/0436-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0421-Fix-PotionEffect-ignores-icon-flag.patch similarity index 92% rename from patches/unapplied/server/0436-Fix-PotionEffect-ignores-icon-flag.patch rename to patches/server/0421-Fix-PotionEffect-ignores-icon-flag.patch index b9e0ada09..e542865e6 100644 --- a/patches/unapplied/server/0436-Fix-PotionEffect-ignores-icon-flag.patch +++ b/patches/server/0421-Fix-PotionEffect-ignores-icon-flag.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index e617e4ecd3763dea795d524b92f8a979fd7d3c48..0d64e930f0a30e15b180cd845a692d3ff61c8927 100644 +index be1540b0a5f95f8a85f91d5fe398cd2cf8832ec4..639d376bf382409410e26385134d36fd6e3b5f0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -412,7 +412,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/unapplied/server/0437-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0422-Optimize-brigadier-child-sorting-performance.patch similarity index 100% rename from patches/unapplied/server/0437-Optimize-brigadier-child-sorting-performance.patch rename to patches/server/0422-Optimize-brigadier-child-sorting-performance.patch diff --git a/patches/unapplied/server/0438-Potential-bed-API.patch b/patches/server/0423-Potential-bed-API.patch similarity index 95% rename from patches/unapplied/server/0438-Potential-bed-API.patch rename to patches/server/0423-Potential-bed-API.patch index c6e55d9ea..8b5848a99 100644 --- a/patches/unapplied/server/0438-Potential-bed-API.patch +++ b/patches/server/0423-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 8836e8cf912948199f0233c3ec22b079268db79d..2be54303ad01fd2b464a8962ec1afe81d045b098 100644 +index 9ad94aea2959082dfd44edd63c0a5aa1cec1e655..a0af465056786f0c8e177a3f48bbf51c0f79b949 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag; diff --git a/patches/unapplied/server/0439-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0424-Wait-for-Async-Tasks-during-shutdown.patch similarity index 88% rename from patches/unapplied/server/0439-Wait-for-Async-Tasks-during-shutdown.patch rename to patches/server/0424-Wait-for-Async-Tasks-during-shutdown.patch index a40d5605b..d32c75585 100644 --- a/patches/unapplied/server/0439-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0424-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d986d03ee40866880ff7a4f39e83b06e1bcc7b6e..62b17026df08cc4d8c1dd98f451fc606c92c57f1 100644 +index 7ca3752aa6f4e626c4437857821000101162b2bc..22885b3d7931f2e439769cad39a37e8af3b3de54 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -972,6 +972,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.0F; f -= 0.22500001F) { BlockPos blockposition = new BlockPos(d4, d5, d6); BlockState iblockdata = this.level.getBlockState(blockposition); @@ -44,7 +44,7 @@ index a861b4b55862b1c5583101fe7f28a3a43c547468..1575fb0bbad6e11f25fb9ce51fd1f15a FluidState fluid = iblockdata.getFluidState(); // Paper if (!this.level.isInWorldBounds(blockposition)) { -@@ -332,7 +333,7 @@ public class Explosion { +@@ -330,7 +331,7 @@ public class Explosion { BlockState iblockdata = this.level.getBlockState(blockposition); Block block = iblockdata.getBlock(); @@ -54,10 +54,10 @@ index a861b4b55862b1c5583101fe7f28a3a43c547468..1575fb0bbad6e11f25fb9ce51fd1f15a this.level.getProfiler().push("explosion_blocks"); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c1f545f48cea7afea53342e3053c669d295851f0..d01687250a9a022000b4e57b839b8c0751caef29 100644 +index 46adef4de2f9e5888dce1e669619dd0386b90470..9d628996437959e79348679e2c85e07bc138475e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -416,6 +416,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -413,6 +413,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -69,10 +69,10 @@ index c1f545f48cea7afea53342e3053c669d295851f0..d01687250a9a022000b4e57b839b8c07 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 6a31e3a3466369ede28e28bc3b9fda8dcb77e136..d6a3f3a2edae806b0ebf5bf5ac445116c0d64535 100644 +index b77eda6af8b430311e502465a2590d83555ff6cf..a37213bce34f45898f56a22196b0d5ef1470e812 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -91,6 +91,19 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -89,6 +89,19 @@ public class Block extends BlockBehaviour implements ItemLike { protected final StateDefinition stateDefinition; private BlockState defaultBlockState; // Paper start @@ -93,10 +93,10 @@ index 6a31e3a3466369ede28e28bc3b9fda8dcb77e136..d6a3f3a2edae806b0ebf5bf5ac445116 public co.aikar.timings.Timing getTiming() { if (timing == null) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index c345bd7542f3ffa09719864887e1516f1182e7e3..4eac07022a7d896ee8921afa6d35cba7f0c89941 100644 +index 2f1345d3c3671953a806cb243a152e080fbb9108..e9b315fb5a7b466e2ac65ae4ae69e893dd992739 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 -@@ -200,6 +200,12 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock { @Override public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) { Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING); @@ -109,7 +109,7 @@ index c345bd7542f3ffa09719864887e1516f1182e7e3..4eac07022a7d896ee8921afa6d35cba7 if (!world.isClientSide) { boolean flag = this.getNeighborSignal(world, pos, enumdirection); -@@ -232,7 +238,7 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -231,7 +237,7 @@ public class PistonBaseBlock extends DirectionalBlock { BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); world.setBlock(pos, iblockdata1, 20); @@ -118,7 +118,7 @@ index c345bd7542f3ffa09719864887e1516f1182e7e3..4eac07022a7d896ee8921afa6d35cba7 world.blockUpdated(pos, iblockdata1.getBlock()); iblockdata1.updateNeighbourShapes(world, pos, 2); if (this.isSticky) { -@@ -261,7 +267,14 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock { } } } else { @@ -135,10 +135,10 @@ index c345bd7542f3ffa09719864887e1516f1182e7e3..4eac07022a7d896ee8921afa6d35cba7 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 6e34d0fb002e61460ab21edcbd23a6d00ac2730c..e218e4f1dfc399cff4131cc5210184af85855d57 100644 +index 987a4180a1eb902c512c2e6a36d692cbdd9b1563..e1beb18dfb5529f48c312bf7ff85be18f6c935b5 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -206,7 +206,7 @@ public abstract class BlockBehaviour { +@@ -205,7 +205,7 @@ public abstract class BlockBehaviour { @Deprecated public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { @@ -147,7 +147,7 @@ index 6e34d0fb002e61460ab21edcbd23a6d00ac2730c..e218e4f1dfc399cff4131cc5210184af } @Deprecated -@@ -664,7 +664,11 @@ public abstract class BlockBehaviour { +@@ -663,7 +663,11 @@ public abstract class BlockBehaviour { public Block getBlock() { return (Block) this.owner; } @@ -160,7 +160,7 @@ index 6e34d0fb002e61460ab21edcbd23a6d00ac2730c..e218e4f1dfc399cff4131cc5210184af public Material getMaterial() { return this.material; } -@@ -762,7 +766,7 @@ public abstract class BlockBehaviour { +@@ -761,7 +765,7 @@ public abstract class BlockBehaviour { } public PushReaction getPistonPushReaction() { @@ -170,13 +170,13 @@ index 6e34d0fb002e61460ab21edcbd23a6d00ac2730c..e218e4f1dfc399cff4131cc5210184af public boolean isSolidRender(BlockGetter world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index d5ba2e679ed1858ea18e18feffce50544ae036c2..ca3e143e641933fa6b9499bbaaa1836877d90c52 100644 +index 80811386c1006d56824ff4d43830f2a140aaee30..2aa59b14b171ff4efbb113816c04675da0954d0e 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -@@ -209,6 +209,13 @@ public class PortalForcer { +@@ -210,6 +210,13 @@ public class PortalForcer { for (int j = -1; j < 3; ++j) { for (int k = -1; k < 4; ++k) { - temp.setWithOffset((Vec3i) pos, portalDirection.getStepX() * j + enumdirection1.getStepX() * distanceOrthogonalToPortal, k, portalDirection.getStepZ() * j + enumdirection1.getStepZ() * distanceOrthogonalToPortal); + temp.setWithOffset(pos, portalDirection.getStepX() * j + enumdirection1.getStepX() * distanceOrthogonalToPortal, k, portalDirection.getStepZ() * j + enumdirection1.getStepZ() * distanceOrthogonalToPortal); + // Paper start - prevent destroying unbreakable blocks + if (!com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits) { + if (!this.level.getBlockState(temp).isDestroyable()) { diff --git a/patches/unapplied/server/0442-Reduce-MutableInt-allocations-from-light-engine.patch b/patches/server/0427-Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from patches/unapplied/server/0442-Reduce-MutableInt-allocations-from-light-engine.patch rename to patches/server/0427-Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/patches/unapplied/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0428-Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 73% rename from patches/unapplied/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to patches/server/0428-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 760558e61..72e968dd9 100644 --- a/patches/unapplied/server/0443-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0428-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,31 +5,30 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 790761848d0ea0934b07c852675e8f746edac211..cec1906adc4d2953b50d262abb1c2cb61cb3ba41 100644 +index 5592f879ef2c1b8f15bc63b38edb57f19e9d589d..2e127a2eb9b00eabe1f5c9c966e405e280c38756 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -2102,9 +2102,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially +@@ -1828,9 +1828,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { - Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 + // Paper start - remove allocation of Vec3D here -+ //Vec3D vec3d = entityplayer.getPositionVector().d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113 ++ //Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113 + double vec3d_dx = player.getX() - this.entity.getX(); -+ double vec3d_dy = player.getY() - this.entity.getY(); + double vec3d_dz = player.getZ() - this.entity.getZ(); + // Paper end - remove allocation of Vec3D here - int i = Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); -- boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.entity.broadcastToPlayer(player); -+ boolean flag = vec3d_dx >= (double) (-i) && vec3d_dx <= (double) i && vec3d_dz >= (double) (-i) && vec3d_dz <= (double) i && this.entity.broadcastToPlayer(player); // Paper - remove allocation of Vec3D here + double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16); +- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z; ++ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper + double d2 = d0 * d0; + boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); - // CraftBukkit start - respect vanish API - if (this.entity instanceof ServerPlayer) { diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 58cae4202e61cded7d5dfa9652bbfb9735927f7e..2f3e69ad809199ffc2661d524bb627ec8dbc2e80 100644 +index ceba19ea3bb9664899b83f82f28af06476b7ff56..f6b6ac1ab31c364646151866c54c9e46dee12516 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -144,8 +144,12 @@ public class ServerEntity { +@@ -143,8 +143,12 @@ public class ServerEntity { ++this.teleportDelay; i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F); j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F); @@ -44,7 +43,7 @@ index 58cae4202e61cded7d5dfa9652bbfb9735927f7e..2f3e69ad809199ffc2661d524bb627ec Packet packet1 = null; boolean flag2 = flag1 || this.tickCount % 60 == 0; boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1; -@@ -162,9 +166,11 @@ public class ServerEntity { +@@ -161,9 +165,11 @@ public class ServerEntity { // CraftBukkit end if (this.tickCount > 0 || this.entity instanceof AbstractArrow) { diff --git a/patches/unapplied/server/0444-Ensure-safe-gateway-teleport.patch b/patches/server/0429-Ensure-safe-gateway-teleport.patch similarity index 89% rename from patches/unapplied/server/0444-Ensure-safe-gateway-teleport.patch rename to patches/server/0429-Ensure-safe-gateway-teleport.patch index 1b95afaf3..c81dcd407 100644 --- a/patches/unapplied/server/0444-Ensure-safe-gateway-teleport.patch +++ b/patches/server/0429-Ensure-safe-gateway-teleport.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure safe gateway teleport diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index f41dfe8bff59d17000f3eb17670c524102adb276..0b238666a506816b8948d1db7397c26ca50b89d3 100644 +index 1d8af8475d0aac71a4ed8a2fed9861dd89d8319b..bc028de0ac71e69e8d714db5f65286f306544bf1 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -105,7 +105,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -104,7 +104,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { List list = world.getEntitiesOfClass(Entity.class, new AABB(pos), TheEndGatewayBlockEntity::canEntityTeleport); if (!list.isEmpty()) { diff --git a/patches/unapplied/server/0445-Add-option-for-console-having-all-permissions.patch b/patches/server/0430-Add-option-for-console-having-all-permissions.patch similarity index 96% rename from patches/unapplied/server/0445-Add-option-for-console-having-all-permissions.patch rename to patches/server/0430-Add-option-for-console-having-all-permissions.patch index 9c144c5e8..3c76e7d30 100644 --- a/patches/unapplied/server/0445-Add-option-for-console-having-all-permissions.patch +++ b/patches/server/0430-Add-option-for-console-having-all-permissions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option for console having all permissions diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index c9bf57298c7023b2d609d5271609a4070bb1c773..31e127151d2a046bf1652a909bc3ea64f95f2d1f 100644 +index bfaaa80a5b144bd46ff3ea6a782aa87e5c51e8ea..374cb5a2fb8c44b7d914beff5688cf36fc08640c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -452,4 +452,9 @@ public class PaperConfig { +@@ -445,4 +445,9 @@ public class PaperConfig { config.set("settings.unsupported-settings.allow-permanent-block-break-exploits-readme", "This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks."); allowBlockPermanentBreakingExploits = getBoolean("settings.unsupported-settings.allow-permanent-block-break-exploits", allowBlockPermanentBreakingExploits); } diff --git a/patches/unapplied/server/0449-Fix-villager-trading-demand-MC-163962.patch b/patches/server/0431-Fix-villager-trading-demand-MC-163962.patch similarity index 90% rename from patches/unapplied/server/0449-Fix-villager-trading-demand-MC-163962.patch rename to patches/server/0431-Fix-villager-trading-demand-MC-163962.patch index 6e2a6230a..7c1bab118 100644 --- a/patches/unapplied/server/0449-Fix-villager-trading-demand-MC-163962.patch +++ b/patches/server/0431-Fix-villager-trading-demand-MC-163962.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java -index 3a59f610145504a096ccf4793ea4140120b00f48..75827fcad36a551d832f4be094167936092b6caf 100644 +index a9970cd2cdca15d6ea2d3acd3c361dd99f64061b..29b65a80e890e7e513336cb78d052c9d2c535a35 100644 --- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java +++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java @@ -109,7 +109,7 @@ public class MerchantOffer { diff --git a/patches/unapplied/server/0450-Maps-shouldn-t-load-chunks.patch b/patches/server/0432-Maps-shouldn-t-load-chunks.patch similarity index 91% rename from patches/unapplied/server/0450-Maps-shouldn-t-load-chunks.patch rename to patches/server/0432-Maps-shouldn-t-load-chunks.patch index a0db1e61c..c1f48bd1b 100644 --- a/patches/unapplied/server/0450-Maps-shouldn-t-load-chunks.patch +++ b/patches/server/0432-Maps-shouldn-t-load-chunks.patch @@ -15,10 +15,10 @@ Previously maps would load all chunks in a certain radius depending on five ticks that movement occur in anyways. diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 2ac84599cd9c71c1a32d70e447b014dc6711cda7..d44cbcfc9e59365149823b594e3b313ed48ec511 100644 +index 65fbc22b3b03d1e95cf76da37babd052d8ae4445..27862f85307e2de5f3fe2195b62a1a9bd3f496de 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -132,9 +132,9 @@ public class MapItem extends ComplexItem { +@@ -131,9 +131,9 @@ public class MapItem extends ComplexItem { int k2 = (j / i + k1 - 64) * i; int l2 = (k / i + l1 - 64) * i; Multiset multiset = LinkedHashMultiset.create(); diff --git a/patches/server/0433-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0433-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch new file mode 100644 index 000000000..7361ae68f --- /dev/null +++ b/patches/server/0433-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 27862f85307e2de5f3fe2195b62a1a9bd3f496de..602e6bc05c053baf821c11c30b24538320b9ac61 100644 +--- a/src/main/java/net/minecraft/world/item/MapItem.java ++++ b/src/main/java/net/minecraft/world/item/MapItem.java +@@ -256,7 +256,7 @@ public class MapItem extends ComplexItem { + + for (l = 0; l < 128 * i; ++l) { + for (i1 = 0; i1 < 128 * i; ++i1) { +- Biome.BiomeCategory biomebase_geography = world.getBiome(new BlockPos((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)).getBiomeCategory(); ++ Biome.BiomeCategory biomebase_geography = world.getUncachedNoiseBiome((j / i - 64) * i + i1, 0, (k / i - 64) * i + l).getBiomeCategory(); // Paper + + aboolean[l * 128 * i + i1] = biomebase_geography == Biome.BiomeCategory.OCEAN || biomebase_geography == Biome.BiomeCategory.RIVER || biomebase_geography == Biome.BiomeCategory.SWAMP; + } diff --git a/patches/unapplied/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/unapplied/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch deleted file mode 100644 index 4ef1fa7db..000000000 --- a/patches/unapplied/server/0451-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ /dev/null @@ -1,20 +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 d44cbcfc9e59365149823b594e3b313ed48ec511..24700c7e6a32cc30c97dccc21c5f3e3e6b6438e5 100644 ---- a/src/main/java/net/minecraft/world/item/MapItem.java -+++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -258,7 +258,7 @@ public class MapItem extends ComplexItem { - - for (l = 0; l < 128 * i; ++l) { - for (i1 = 0; i1 < 128 * i; ++i1) { -- abiomebase[l * 128 * i + i1] = world.getBiome(new BlockPos((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)); -+ abiomebase[l * 128 * i + i1] = world.getUncachedNoiseBiome((j / i - 64) * i + i1, 0, (k / i - 64) * i + l); // Paper - } - } -