From 8ca5a642eff3a60b9cce8e991d8bfdfca4ed7b9d Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 14 Jun 2021 12:42:08 +0200 Subject: [PATCH] more work work work --- ...-Support-hex-colors-in-getLastColors.patch | 0 .../0217-Add-setMaxPlayers-API.patch | 4 +- .../0218-Add-moon-phase-API.patch | 2 +- ...yPickupItemAnimation-to-LivingEntity.patch | 0 .../0220-Add-BellRingEvent.patch | 0 .../0221-Brand-support.patch | 4 +- ...der-Remove-Streams-Optimized-collect.patch | 2 +- .../1.17}/0541-Import-fastutil-classes.patch | 2 +- ...ove-armour-stand-double-add-to-world.patch | 2 +- ...her-Boss-Bar-doesn-t-update-until-in.patch | 1 + .../1.17}/0549-Fix-MC-197271.patch | 2 +- .../0550-MC-197883-Bandaid-decode-issue.patch | 2 +- ...ataPlayer-leak-due-from-quitting-ear.patch | 94 ------------------- ...-Fix-MC-187716-Use-configured-height.patch | 45 --------- .../0483-Fix-SPIGOT-5989.patch} | 14 +-- ...-Bukkit-world-container-is-not-used.patch} | 6 +- ...5885-Unable-to-disable-advancements.patch} | 4 +- ...ataPlayer-leak-due-from-quitting-ear.patch | 82 ++++++++++++++++ ...eLighting-call-to-World-spigot-stri.patch} | 4 +- ...ix-some-rails-connecting-improperly.patch} | 41 ++++---- .../0489-Incremental-player-saving.patch} | 63 +++++++------ ...ll-chunk-sections-for-block-updates.patch} | 8 +- ...-Fix-MC-187716-Use-configured-height.patch | 51 ++++++++++ ...stake-in-CB-NBT-int-deserialization.patch} | 2 +- ...rver-load-chunks-from-newer-version.patch} | 21 +++-- .../0494-Brand-support.patch} | 27 +++--- .../0495-Add-setMaxPlayers-API.patch} | 12 +-- ...PickupItemAnimation-to-LivingEntity.patch} | 2 +- .../0497-Don-t-require-FACING-data.patch} | 2 +- ...eEvent-not-firing-for-all-use-cases.patch} | 14 +-- .../0499-Add-moon-phase-API.patch} | 6 +- ...headless-pistons-from-being-created.patch} | 12 +-- 32 files changed, 267 insertions(+), 264 deletions(-) rename patches/{api-unmapped => api}/0216-Support-hex-colors-in-getLastColors.patch (100%) rename patches/{api-unmapped => api}/0217-Add-setMaxPlayers-API.patch (88%) rename patches/{api-unmapped => api}/0218-Add-moon-phase-API.patch (94%) rename patches/{api-unmapped => api}/0219-Add-playPickupItemAnimation-to-LivingEntity.patch (100%) rename patches/{api-unmapped => api}/0220-Add-BellRingEvent.patch (100%) rename patches/{api-unmapped => api}/0221-Brand-support.patch (85%) rename patches/{server-remapped => removed/1.17}/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch (99%) rename patches/{server-remapped => removed/1.17}/0541-Import-fastutil-classes.patch (99%) rename patches/{server-remapped => removed/1.17}/0543-Remove-armour-stand-double-add-to-world.patch (98%) rename patches/{server-remapped => removed/1.17}/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch (95%) rename patches/{server-remapped => removed/1.17}/0549-Fix-MC-197271.patch (98%) rename patches/{server-remapped => removed/1.17}/0550-MC-197883-Bandaid-decode-issue.patch (96%) delete mode 100644 patches/server-remapped/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch delete mode 100644 patches/server-remapped/0544-Fix-MC-187716-Use-configured-height.patch rename patches/{server-remapped/0533-Fix-SPIGOT-5989.patch => server/0483-Fix-SPIGOT-5989.patch} (87%) rename patches/{server-remapped/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch => server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch} (87%) rename patches/{server-remapped/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch => server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch} (85%) create mode 100644 patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch rename patches/{server-remapped/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch => server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch} (82%) rename patches/{server-remapped/0538-Fix-some-rails-connecting-improperly.patch => server/0488-Fix-some-rails-connecting-improperly.patch} (71%) rename patches/{server-remapped/0540-Incremental-player-saving.patch => server/0489-Incremental-player-saving.patch} (63%) rename patches/{server-remapped/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch => server/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch} (79%) create mode 100644 patches/server/0491-Fix-MC-187716-Use-configured-height.patch rename patches/{server-remapped/0545-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch => server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch} (94%) rename patches/{server-remapped/0546-Do-not-let-the-server-load-chunks-from-newer-version.patch => server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch} (68%) rename patches/{server-remapped/0547-Brand-support.patch => server/0494-Brand-support.patch} (77%) rename patches/{server-remapped/0551-Add-setMaxPlayers-API.patch => server/0495-Add-setMaxPlayers-API.patch} (77%) rename patches/{server-remapped/0552-Add-playPickupItemAnimation-to-LivingEntity.patch => server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch} (90%) rename patches/{server-remapped/0553-Don-t-require-FACING-data.patch => server/0497-Don-t-require-FACING-data.patch} (94%) rename patches/{server-remapped/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch => server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch} (81%) rename patches/{server-remapped/0555-Add-moon-phase-API.patch => server/0499-Add-moon-phase-API.patch} (78%) rename patches/{server-remapped/0556-Prevent-headless-pistons-from-being-created.patch => server/0500-Prevent-headless-pistons-from-being-created.patch} (87%) diff --git a/patches/api-unmapped/0216-Support-hex-colors-in-getLastColors.patch b/patches/api/0216-Support-hex-colors-in-getLastColors.patch similarity index 100% rename from patches/api-unmapped/0216-Support-hex-colors-in-getLastColors.patch rename to patches/api/0216-Support-hex-colors-in-getLastColors.patch diff --git a/patches/api-unmapped/0217-Add-setMaxPlayers-API.patch b/patches/api/0217-Add-setMaxPlayers-API.patch similarity index 88% rename from patches/api-unmapped/0217-Add-setMaxPlayers-API.patch rename to patches/api/0217-Add-setMaxPlayers-API.patch index 17b9d923f..41c695495 100644 --- a/patches/api-unmapped/0217-Add-setMaxPlayers-API.patch +++ b/patches/api/0217-Add-setMaxPlayers-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 1eaf6aae1e13c48a7f911e523015cb9b8cca8638..6228d7eca85fba52296c8d63d32804f32af1b421 100644 +index 26099f95d68540d4e6c54c32fd9699ff01660236..af0cf1fe3db1efd39bc06a89216413fc4415b007 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -171,6 +171,17 @@ public final class Bukkit { @@ -27,7 +27,7 @@ index 1eaf6aae1e13c48a7f911e523015cb9b8cca8638..6228d7eca85fba52296c8d63d32804f3 * Get the game port that the server runs on. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 8ee02c3d6cc8751704e5993fecd05293714e492f..6237578b373002c009efde4fb4c1864f0bf4f19e 100644 +index 864211431ebfe9bb333943c31892dfcbdeb33037..64316a3bcba881f9366d9bf9e16b205e2b817707 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -144,6 +144,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api-unmapped/0218-Add-moon-phase-API.patch b/patches/api/0218-Add-moon-phase-API.patch similarity index 94% rename from patches/api-unmapped/0218-Add-moon-phase-API.patch rename to patches/api/0218-Add-moon-phase-API.patch index c9e982795..364b9c106 100644 --- a/patches/api-unmapped/0218-Add-moon-phase-API.patch +++ b/patches/api/0218-Add-moon-phase-API.patch @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e + } +} diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 6441d4e45e5d5f008f95233cdc34048b8be38592..e20d863d1308b470a294cb7ab022aac4b9a91f71 100644 +index 10c22809535b6151b45aa18a02b80b8f2e3e6dff..27d97cde0fb5f6d727656c291e34dc468200f0c0 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -70,6 +70,12 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad diff --git a/patches/api-unmapped/0219-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/0219-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/api-unmapped/0219-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/api/0219-Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/api-unmapped/0220-Add-BellRingEvent.patch b/patches/api/0220-Add-BellRingEvent.patch similarity index 100% rename from patches/api-unmapped/0220-Add-BellRingEvent.patch rename to patches/api/0220-Add-BellRingEvent.patch diff --git a/patches/api-unmapped/0221-Brand-support.patch b/patches/api/0221-Brand-support.patch similarity index 85% rename from patches/api-unmapped/0221-Brand-support.patch rename to patches/api/0221-Brand-support.patch index 2c6d0a6ab..4e255c4f7 100644 --- a/patches/api-unmapped/0221-Brand-support.patch +++ b/patches/api/0221-Brand-support.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 2530c811f52f51d6338900221b4681c952c1c752..828b2b0538d4f936bee57d9fca55774723e13970 100644 +index e53f641e11dc74c99e656e985caa7c5943fb53a4..6bc4f12e4ef35979c9d99273d14d7b31833d3f75 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2044,6 +2044,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2071,6 +2071,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM // Paper end } diff --git a/patches/server-remapped/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/removed/1.17/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch similarity index 99% rename from patches/server-remapped/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch rename to patches/removed/1.17/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch index 7f15a7705..4d8b1d035 100644 --- a/patches/server-remapped/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch +++ b/patches/removed/1.17/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch @@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 4 Aug 2020 22:24:15 +0200 Subject: [PATCH] Optimize Pathfinder - Remove Streams / Optimized collections - +1.17 Update: Please do this k thx bb I utilized the IDE to convert streams to non streams code, so shouldn't be any risk of behavior change. Only did minor optimization of the generated code set to remove unnecessary things. diff --git a/patches/server-remapped/0541-Import-fastutil-classes.patch b/patches/removed/1.17/0541-Import-fastutil-classes.patch similarity index 99% rename from patches/server-remapped/0541-Import-fastutil-classes.patch rename to patches/removed/1.17/0541-Import-fastutil-classes.patch index 706c8236e..0fd44a3e6 100644 --- a/patches/server-remapped/0541-Import-fastutil-classes.patch +++ b/patches/removed/1.17/0541-Import-fastutil-classes.patch @@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Wed, 12 Aug 2020 11:33:04 +0200 Subject: [PATCH] Import fastutil classes - +1.17: YEET diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java index 95e166aa63f42c675df645a56e313bdffc2e8663..05f7d4a3835536f26f741d54a0884bd43fc82967 100644 diff --git a/patches/server-remapped/0543-Remove-armour-stand-double-add-to-world.patch b/patches/removed/1.17/0543-Remove-armour-stand-double-add-to-world.patch similarity index 98% rename from patches/server-remapped/0543-Remove-armour-stand-double-add-to-world.patch rename to patches/removed/1.17/0543-Remove-armour-stand-double-add-to-world.patch index 8e11c0592..12731c058 100644 --- a/patches/server-remapped/0543-Remove-armour-stand-double-add-to-world.patch +++ b/patches/removed/1.17/0543-Remove-armour-stand-double-add-to-world.patch @@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Fri, 14 Aug 2020 23:59:26 +0200 Subject: [PATCH] Remove armour stand double add to world - +1.17 Update: YEET (?) diff --git a/src/main/java/net/minecraft/world/item/ArmorStandItem.java b/src/main/java/net/minecraft/world/item/ArmorStandItem.java index a2dfcaac8a2a4a69e703de43be76d4fe369fd647..bed063497bb593683ea384605ae1a71a68f4fc1b 100644 diff --git a/patches/server-remapped/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch b/patches/removed/1.17/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch similarity index 95% rename from patches/server-remapped/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch rename to patches/removed/1.17/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch index d3257fe8b..aed77697a 100644 --- a/patches/server-remapped/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch +++ b/patches/removed/1.17/0548-Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch @@ -2,6 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: jmp Date: Thu, 20 Aug 2020 19:24:13 -0700 Subject: [PATCH] Fix MC-99259 Wither Boss Bar doesn't update until +1.17 Update: This issue is marked as fixed on 1.17 - yeet! invulnerability period is over diff --git a/patches/server-remapped/0549-Fix-MC-197271.patch b/patches/removed/1.17/0549-Fix-MC-197271.patch similarity index 98% rename from patches/server-remapped/0549-Fix-MC-197271.patch rename to patches/removed/1.17/0549-Fix-MC-197271.patch index 14ad3b04d..65a6ccce8 100644 --- a/patches/server-remapped/0549-Fix-MC-197271.patch +++ b/patches/removed/1.17/0549-Fix-MC-197271.patch @@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: ishland Date: Sun, 23 Aug 2020 10:57:44 +0200 Subject: [PATCH] Fix MC-197271 - +Update 1.17: Fixed in openj9-0.23.0-m2 release This patch only fixes an issue for servers running OpenJ9. diff --git a/src/main/java/net/minecraft/data/BuiltinRegistries.java b/src/main/java/net/minecraft/data/BuiltinRegistries.java diff --git a/patches/server-remapped/0550-MC-197883-Bandaid-decode-issue.patch b/patches/removed/1.17/0550-MC-197883-Bandaid-decode-issue.patch similarity index 96% rename from patches/server-remapped/0550-MC-197883-Bandaid-decode-issue.patch rename to patches/removed/1.17/0550-MC-197883-Bandaid-decode-issue.patch index fd35ea34e..b05b52883 100644 --- a/patches/server-remapped/0550-MC-197883-Bandaid-decode-issue.patch +++ b/patches/removed/1.17/0550-MC-197883-Bandaid-decode-issue.patch @@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 21 Aug 2020 21:05:28 -0400 Subject: [PATCH] MC-197883: Bandaid decode issue - +1.17 Update: Marked as fixed in 1.17 on mojira, yeet Mojang has a mix of type and name in the data sets, but you can only use one. diff --git a/patches/server-remapped/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server-remapped/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch deleted file mode 100644 index 8ec38751c..000000000 --- a/patches/server-remapped/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Mon, 13 Jul 2020 06:22:54 -0700 -Subject: [PATCH] Fix AdvancementDataPlayer leak due from quitting early in - login - -Move the criterion storage to the AdvancementDataPlayer object -itself, so the criterion object stores no references - and thus -needs no cleanup. - -diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -index 31650e41b37e322d2e8a4d4a3deec95851e72675..a645c79af856d2484a4ce7aa2885a32358b9a480 100644 ---- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -@@ -16,25 +16,25 @@ import net.minecraft.world.level.storage.loot.LootContext; - - public abstract class SimpleCriterionTrigger implements CriterionTrigger { - -- private final Map>> a = Maps.newIdentityHashMap(); -+ //private final Map>> a = Maps.newIdentityHashMap(); // Paper - moved into AdvancementDataPlayer to fix memory leak - - public SimpleCriterionTrigger() {} - - @Override - public final void a(PlayerAdvancements advancementdataplayer, CriterionTrigger.Listener criteriontrigger_a) { -- ((Set) this.a.computeIfAbsent(advancementdataplayer, (advancementdataplayer1) -> { -+ (advancementdataplayer.criterionData.computeIfAbsent(this, (advancementdataplayer1) -> { // Paper - fix AdvancementDataPlayer leak - return Sets.newHashSet(); - })).add(criteriontrigger_a); - } - - @Override - public final void b(PlayerAdvancements advancementdataplayer, CriterionTrigger.Listener criteriontrigger_a) { -- Set> set = (Set) this.a.get(advancementdataplayer); -+ Set> set = (Set) advancementdataplayer.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak - - if (set != null) { - set.remove(criteriontrigger_a); - if (set.isEmpty()) { -- this.a.remove(advancementdataplayer); -+ advancementdataplayer.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak - } - } - -@@ -42,7 +42,7 @@ public abstract class SimpleCriterionTrigger tester) { - PlayerAdvancements advancementdataplayer = player.getAdvancements(); -- Set> set = (Set) this.a.get(advancementdataplayer); -+ Set> set = (Set) advancementdataplayer.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak - - if (set != null && !set.isEmpty()) { - LootContext loottableinfo = EntityPredicate.createContext(player, player); -@@ -67,7 +67,7 @@ public abstract class SimpleCriterionTrigger> criterionData = Maps.newIdentityHashMap(); -+ // Paper end - fix advancement data player leakage -+ - public PlayerAdvancements(DataFixer datafixer, PlayerList playerlist, ServerAdvancementManager advancementdataworld, File file, ServerPlayer entityplayer) { - this.dataFixer = datafixer; - this.playerList = playerlist; diff --git a/patches/server-remapped/0544-Fix-MC-187716-Use-configured-height.patch b/patches/server-remapped/0544-Fix-MC-187716-Use-configured-height.patch deleted file mode 100644 index 1e2cd52d5..000000000 --- a/patches/server-remapped/0544-Fix-MC-187716-Use-configured-height.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 15 Aug 2020 08:04:49 -0500 -Subject: [PATCH] Fix MC-187716 Use configured height - - -diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java -index 3f297ef7bde4159c77681574966446a0eba03f25..ff17c76f341028dd6d17f4c1f13f442c2e404532 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java -@@ -44,7 +44,7 @@ public abstract class NetherCappedSurfaceBuilder extends SurfaceBuilder= 0; --k2) { -+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height - blockposition_mutableblockposition.set(k1, k2, l1); - BlockState iblockdata5 = chunk.getBlockState(blockposition_mutableblockposition); - int l2; -diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java -index 4d6c03048022442dea467e1d9d018f150adc62c7..f64671b7359fb71e8af578d48d0a3c211e315057 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java -@@ -34,7 +34,7 @@ public class NetherForestSurfaceBuilder extends SurfaceBuilder= 0; --k2) { -+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height - blockposition_mutableblockposition.set(k1, k2, l1); - BlockState iblockdata3 = surfaceBlocks.getTopMaterial(); - BlockState iblockdata4 = chunk.getBlockState(blockposition_mutableblockposition); -diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java -index c1e0fd7813786bf1cc03b08b204007711575f144..b222890e7bdff2c1470841677a99d4423f9c9d7f 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java -@@ -36,7 +36,7 @@ public class NetherSurfaceBuilder extends SurfaceBuilder= 0; --k2) { -+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height - blockposition_mutableblockposition.set(k1, k2, l1); - BlockState iblockdata4 = chunk.getBlockState(blockposition_mutableblockposition); - diff --git a/patches/server-remapped/0533-Fix-SPIGOT-5989.patch b/patches/server/0483-Fix-SPIGOT-5989.patch similarity index 87% rename from patches/server-remapped/0533-Fix-SPIGOT-5989.patch rename to patches/server/0483-Fix-SPIGOT-5989.patch index 84a6a9da9..a31cd6ebb 100644 --- a/patches/server-remapped/0533-Fix-SPIGOT-5989.patch +++ b/patches/server/0483-Fix-SPIGOT-5989.patch @@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa62846922ab531f 100644 +index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3f7468ba9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -84,6 +84,7 @@ import net.minecraft.world.level.GameType; +@@ -77,6 +77,7 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.block.Blocks; @@ -21,7 +21,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469 import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.BorderChangeListener; import net.minecraft.world.level.border.WorldBorder; -@@ -846,6 +847,7 @@ public abstract class PlayerList { +@@ -821,6 +822,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; boolean isRespawn = false; @@ -29,7 +29,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469 // Paper end // CraftBukkit start - fire PlayerRespawnEvent -@@ -856,7 +858,7 @@ public abstract class PlayerList { +@@ -831,7 +833,7 @@ public abstract class PlayerList { Optional optional; if (blockposition != null) { @@ -38,7 +38,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469 } else { optional = Optional.empty(); } -@@ -899,7 +901,12 @@ public abstract class PlayerList { +@@ -874,7 +876,12 @@ public abstract class PlayerList { } // Spigot End @@ -52,7 +52,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469 if (!flag) entityplayer.reset(); // SPIGOT-4785 isRespawn = true; // Paper } else { -@@ -937,8 +944,12 @@ public abstract class PlayerList { +@@ -911,8 +918,12 @@ public abstract class PlayerList { } // entityplayer1.syncInventory(); entityplayer1.setHealth(entityplayer1.getHealth()); @@ -66,4 +66,4 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469 + // Paper end } // Added from changeDimension - sendAllPlayerInfo(entityplayer); // Update health, etc... + this.sendAllPlayerInfo(entityplayer); // Update health, etc... diff --git a/patches/server-remapped/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch similarity index 87% rename from patches/server-remapped/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch rename to patches/server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 52bb1345a..057ecc45b 100644 --- a/patches/server-remapped/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 855b3b4c90d84d4efa8395a76010b4b194591cbc..4e353432281a6dbbb49eaa4a6cb4eb051d1a08c5 100644 +index 7ce854edba32ffcafaa5268d4bb2822a5233e40b..3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -124,11 +124,20 @@ public class Main { +@@ -129,11 +129,20 @@ public class Main { return; } @@ -29,5 +29,5 @@ index 855b3b4c90d84d4efa8395a76010b4b194591cbc..4e353432281a6dbbb49eaa4a6cb4eb05 - GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName())); + GameProfileCache usercache = new GameProfileCache(gameprofilerepository, userCacheFile); // Paper - only move usercache.json into folder if --universe is used, not world-container // CraftBukkit start - String s = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); + String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/patches/server-remapped/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch similarity index 85% rename from patches/server-remapped/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch rename to patches/server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch index fb2e14a9d..6de50899f 100644 --- a/patches/server-remapped/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch +++ b/patches/server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 4e353432281a6dbbb49eaa4a6cb4eb051d1a08c5..9dc9a5e6ad7f23c8bf3553c765ceeecd67a49ac1 100644 +index 3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67..ea136b9ad3a2a07076e12b8656c68f63aa4718c8 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -124,6 +124,7 @@ public class Main { +@@ -129,6 +129,7 @@ public class Main { return; } diff --git a/patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch new file mode 100644 index 000000000..0711bd7fa --- /dev/null +++ b/patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 13 Jul 2020 06:22:54 -0700 +Subject: [PATCH] Fix AdvancementDataPlayer leak due from quitting early in + login + +Move the criterion storage to the AdvancementDataPlayer object +itself, so the criterion object stores no references - and thus +needs no cleanup. + +diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +index 584f48aba7bfec07a75b5a37da4ba7439610543c..c25c1cfca010ed625b6faf310be2edeccd6667bc 100644 +--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java ++++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +@@ -14,22 +14,24 @@ import net.minecraft.server.level.ServerPlayer; + import net.minecraft.world.level.storage.loot.LootContext; + + public abstract class SimpleCriterionTrigger implements CriterionTrigger { +- private final Map>> players = Maps.newIdentityHashMap(); ++ //private final Map>> players = Maps.newIdentityHashMap(); // Paper - moved into AdvancementDataPlayer to fix memory leak ++ ++ public SimpleCriterionTrigger() {} + + @Override + public final void addPlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener conditions) { +- this.players.computeIfAbsent(manager, (managerx) -> { ++ manager.criterionData.computeIfAbsent(this, (managerx) -> { // Paper - fix AdvancementDataPlayer leak + return Sets.newHashSet(); + }).add(conditions); + } + + @Override + public final void removePlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener conditions) { +- Set> set = this.players.get(manager); ++ Set> set = (Set) manager.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak + if (set != null) { + set.remove(conditions); + if (set.isEmpty()) { +- this.players.remove(manager); ++ manager.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak + } + } + +@@ -37,7 +39,7 @@ public abstract class SimpleCriterionTrigger tester) { + PlayerAdvancements playerAdvancements = player.getAdvancements(); +- Set> set = this.players.get(playerAdvancements); ++ Set> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak + if (set != null && !set.isEmpty()) { + LootContext lootContext = EntityPredicate.createContext(player, player); + List> list = null; +diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java +index ce02a467c1c3434f2cdb112ceb9794196069a820..e05e5710c81b7dbb648afbfe16f843e7ae310752 100644 +--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java ++++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion; + import net.minecraft.advancements.CriterionProgress; + import net.minecraft.advancements.CriterionTrigger; + import net.minecraft.advancements.CriterionTriggerInstance; ++import net.minecraft.advancements.critereon.SimpleCriterionTrigger; + import net.minecraft.network.chat.ChatType; + import net.minecraft.network.chat.TranslatableComponent; + import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket; +@@ -70,6 +71,8 @@ public class PlayerAdvancements { + private Advancement lastSelectedTab; + private boolean isFirstPacket = true; + ++ public final Map> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage ++ + public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, File advancementFile, ServerPlayer owner) { + this.dataFixer = dataFixer; + this.playerList = playerManager; diff --git a/patches/server-remapped/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch similarity index 82% rename from patches/server-remapped/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch rename to patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index 468888ab9..9449b0ade 100644 --- a/patches/server-remapped/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 4436b3d23dc8f33925da1ec539ea16307e0785b9..793b1309528671ce822d5a484ff9e40d6eba4e9d 100644 +index f72471ac82907a0d5112598b3289689495285944..d79a711d4080ad8acb2c240870be9d99a0b84cea 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2609,6 +2609,7 @@ public class CraftWorld implements World { +@@ -2623,6 +2623,7 @@ public class CraftWorld implements World { lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.visualOnly = true; lightning.isSilent = isSilent; diff --git a/patches/server-remapped/0538-Fix-some-rails-connecting-improperly.patch b/patches/server/0488-Fix-some-rails-connecting-improperly.patch similarity index 71% rename from patches/server-remapped/0538-Fix-some-rails-connecting-improperly.patch rename to patches/server/0488-Fix-some-rails-connecting-improperly.patch index a1593c3e2..39dfbdd22 100644 --- a/patches/server-remapped/0538-Fix-some-rails-connecting-improperly.patch +++ b/patches/server/0488-Fix-some-rails-connecting-improperly.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix some rails connecting improperly diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -index 1a44c8b41928a83a22b53d1b6f45ce39b4caf2b2..7cef6d1fc2045c62d4e96a0fd0a311d089cb1406 100644 +index 41c23abf78c2ca95c26633860adb9360139b3ceb..1242eb55996bca8a63bd7b95d01d0299fb36d105 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -@@ -62,6 +62,7 @@ public abstract class BaseRailBlock extends Block { +@@ -65,6 +65,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl state = this.updateDir(world, pos, state, true); if (this.isStraight) { state.neighborChanged(world, pos, this, pos, notify); @@ -17,7 +17,7 @@ index 1a44c8b41928a83a22b53d1b6f45ce39b4caf2b2..7cef6d1fc2045c62d4e96a0fd0a311d0 return state; diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java -index 0ab1e15d8575c3e90a10b80b94030e15a01faac9..1854809e045300e84a713dc7c3a8264f53ec6c0f 100644 +index 2335e7af6bc16a0d65c7818c316f3194c680c69d..63c7f2cf530ac9562960ae5a3cbc6e511a009377 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java @@ -70,6 +70,7 @@ public class DetectorRailBlock extends BaseRailBlock { @@ -27,15 +27,15 @@ index 0ab1e15d8575c3e90a10b80b94030e15a01faac9..1854809e045300e84a713dc7c3a8264f + if (state.getBlock() != this) { return; } // Paper - not our block, don't do anything boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED); boolean flag1 = false; - List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (Predicate) null); + List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java -index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128cee6b276 100644 +index a205e04bce8706302e4a077646749d05dee98251..0f24187dc3f1340d142f88cbac64c4f5c333e5b8 100644 --- a/src/main/java/net/minecraft/world/level/block/RailState.java +++ b/src/main/java/net/minecraft/world/level/block/RailState.java -@@ -12,13 +12,19 @@ import net.minecraft.world.level.block.state.properties.RailShape; +@@ -10,13 +10,19 @@ import net.minecraft.world.level.block.state.BlockState; + import net.minecraft.world.level.block.state.properties.RailShape; public class RailState { - - private final Level level; - private final BlockPos pos; + private final Level level; public final Level getWorld() { return this.level; } // Paper - OBFHELPER @@ -55,7 +55,7 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128 public RailState(Level world, BlockPos pos, BlockState state) { this.level = world; this.pos = pos; -@@ -153,6 +159,11 @@ public class RailState { +@@ -143,6 +149,11 @@ public class RailState { } private void connectTo(RailState placementHelper) { @@ -65,10 +65,10 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128 + } + // Paper end - prevent desync this.connections.add(placementHelper.pos); - BlockPos blockposition = this.pos.north(); - BlockPos blockposition1 = this.pos.south(); -@@ -347,11 +358,16 @@ public class RailState { - this.state = (BlockState) this.state.setValue(this.block.getShapeProperty(), blockpropertytrackposition1); + BlockPos blockPos = this.pos.north(); + BlockPos blockPos2 = this.pos.south(); +@@ -333,10 +344,15 @@ public class RailState { + this.state = this.state.setValue(this.block.getShapeProperty(), railShape2); if (forceUpdate || this.level.getBlockState(this.pos) != this.state) { this.level.setBlock(this.pos, this.state, 3); + // Paper start - prevent desync @@ -77,15 +77,14 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128 + } + // Paper end - prevent desync - for (int i = 0; i < this.connections.size(); ++i) { - RailState minecarttracklogic = this.getRail((BlockPos) this.connections.get(i)); - -- if (minecarttracklogic != null) { -+ if (minecarttracklogic != null && minecarttracklogic.isValid()) { // Paper - prevent desync - minecarttracklogic.removeSoftConnections(); - if (minecarttracklogic.canConnectTo(this)) { - minecarttracklogic.connectTo(this); -@@ -364,6 +380,6 @@ public class RailState { + for(int i = 0; i < this.connections.size(); ++i) { + RailState railState = this.getRail(this.connections.get(i)); +- if (railState != null) { ++ if (railState != null && railState.isValid()) { // Paper - prevent desync + railState.removeSoftConnections(); + if (railState.canConnectTo(this)) { + railState.connectTo(this); +@@ -349,6 +365,6 @@ public class RailState { } public BlockState getState() { diff --git a/patches/server-remapped/0540-Incremental-player-saving.patch b/patches/server/0489-Incremental-player-saving.patch similarity index 63% rename from patches/server-remapped/0540-Incremental-player-saving.patch rename to patches/server/0489-Incremental-player-saving.patch index cd7713a51..dae7e913d 100644 --- a/patches/server-remapped/0540-Incremental-player-saving.patch +++ b/patches/server/0489-Incremental-player-saving.patch @@ -25,44 +25,52 @@ index b67ba8f75e4a3358d7c2462918b85b0bf9b5a922..fdbd8b89bb8bf3b61f60b812b90483c9 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 19544b794b5a46c129016172798ff7294fcfed33..735c3c983e96e4e6f36de0975909fc48cb042081 100644 +index 1feda8b44364c748497174944b26abc4f058f354..1889de77a5e3d9371005b6bd451e2c0e57e96a93 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1347,9 +1347,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down - //MinecraftServer.LOGGER.debug("Autosave started"); // Paper - serverAutoSave = (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0); // Paper -+ // Paper start -+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate; -+ if (playerSaveInterval < 0) { -+ playerSaveInterval = autosavePeriod; -+ } -+ // Paper end - this.profiler.push("save"); -- if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // Paper +@@ -955,7 +955,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { // Paper + this.playerList.removeAll(this.isRestarting); // Paper + try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets + } +@@ -1415,9 +1414,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit // Paper - move down + // MinecraftServer.LOGGER.debug("Autosave started"); // Paper + serverAutoSave = (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0); // Paper ++ // Paper start ++ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate; ++ if (playerSaveInterval < 0) { ++ playerSaveInterval = autosavePeriod; ++ } ++ // Paper end + this.profiler.push("save"); +- if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // Paper - moved from above +- this.playerList.saveAll(); ++ if (playerSaveInterval > 0) { // Paper + this.playerList.savePlayers(playerSaveInterval); // Paper - }// Paper - // Paper start - for (ServerLevel world : getAllLevels()) { + // this.saveAllChunks(true, false, false); // Paper - saved incrementally below + } // Paper start + for (ServerLevel level : this.getAllLevels()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c5717f45a0110492aad41f21cc06fb8cbeb1f791..bd4d4ace35e966e819aa461d3962fe06ff402be7 100644 +index cd34b5aa61c78d8138500a93f0a9714bedd7ed86..b49fa995973f860a95d937c98e2821435262ce25 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -173,6 +173,7 @@ import org.bukkit.inventory.MainHand; - public class ServerPlayer extends Player implements ContainerListener { +@@ -169,6 +169,7 @@ public class ServerPlayer extends Player { + public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder private static final Logger LOGGER = LogManager.getLogger(); + public long lastSave = MinecraftServer.currentTick; // Paper + 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; - public Connection networkManager; // Paper - public final MinecraftServer server; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 882cd25c9610f0b995c27291aa62846922ab531f..b76735531ef96f9d4c870a5107feea01524a7670 100644 +index 9c594c0f142ca10b7c1df50faf45ccb3f7468ba9..8c62367888af566dd9be4bb5cd301c26e0248e46 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -559,6 +559,7 @@ public abstract class PlayerList { +@@ -561,6 +561,7 @@ public abstract class PlayerList { protected void save(ServerPlayer player) { if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug) @@ -70,20 +78,21 @@ index 882cd25c9610f0b995c27291aa62846922ab531f..b76735531ef96f9d4c870a5107feea01 this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1218,10 +1219,21 @@ public abstract class PlayerList { +@@ -1198,10 +1199,21 @@ public abstract class PlayerList { } public void saveAll() { +- net.minecraft.server.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main + // Paper start - incremental player saving + savePlayers(null); + } + public void savePlayers(Integer interval) { - MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main ++ MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main MinecraftTimings.savePlayers.startTiming(); // Paper + int numSaved = 0; + long now = MinecraftServer.currentTick; for (int i = 0; i < this.players.size(); ++i) { -- this.save((ServerPlayer) this.players.get(i)); +- this.save(this.players.get(i)); + ServerPlayer entityplayer = this.players.get(i); + if (interval == null || now - entityplayer.lastSave >= interval) { + this.save(entityplayer); diff --git a/patches/server-remapped/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch b/patches/server/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch similarity index 79% rename from patches/server-remapped/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch rename to patches/server/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch index 3a19fd93b..0d7df8df1 100644 --- a/patches/server-remapped/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch +++ b/patches/server/0490-Don-t-mark-null-chunk-sections-for-block-updates.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Don't mark null chunk sections for block updates diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 9e3629884709126574a52ad44fe7523f01dbcce9..82205ad13ef0e987bd83979d06331545efe0a60a 100644 +index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..32bcc55ce15d832e2182d89acecd715947b1667d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -449,6 +449,7 @@ public class ChunkHolder { - this.broadcastBlockEntityIfNeeded(world, blockposition, iblockdata); +@@ -315,6 +315,7 @@ public class ChunkHolder { + this.a(world, blockposition, iblockdata); } else { - LevelChunkSection chunksection = chunk.getSections()[sectionposition.getY()]; + LevelChunkSection chunksection = chunk.getSections()[j]; + if (chunksection == null) chunksection = new LevelChunkSection(sectionposition.getY(), chunk, world, true); // Paper - make a new chunk section if none was found ClientboundSectionBlocksUpdatePacket packetplayoutmultiblockchange = new ClientboundSectionBlocksUpdatePacket(sectionposition, shortset, chunksection, this.resendLight); diff --git a/patches/server/0491-Fix-MC-187716-Use-configured-height.patch b/patches/server/0491-Fix-MC-187716-Use-configured-height.patch new file mode 100644 index 000000000..678b0ee0b --- /dev/null +++ b/patches/server/0491-Fix-MC-187716-Use-configured-height.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 15 Aug 2020 08:04:49 -0500 +Subject: [PATCH] Fix MC-187716 Use configured height + + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java +index 5ad6e0ef718a1775a2310925b8273120687230b1..88fbd8a925d84184116051082514ef4d45c98acf 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java +@@ -1,4 +1,5 @@ + package net.minecraft.world.level.levelgen.surfacebuilders; ++<<<<<<< found + + import com.google.common.collect.ImmutableList; + import com.google.common.collect.ImmutableMap; +@@ -42,7 +43,7 @@ public abstract class NetherCappedSurfaceBuilder extends SurfaceBuilder= i; --p) { ++ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height + mutableBlockPos.set(k, p, m); + BlockState blockState4 = chunk.getBlockState(mutableBlockPos); + if (blockState3.is(defaultBlock.getBlock()) && (blockState4.isAir() || blockState4 == defaultFluid)) { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java +index fbb756504609285d96e01c4079be06561f75331e..aa6be90ac272c7e1186d177768230b7f52371e68 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java +@@ -34,7 +34,7 @@ public class NetherForestSurfaceBuilder extends SurfaceBuilder= i; --p) { ++ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height + mutableBlockPos.set(k, p, m); + BlockState blockState2 = surfaceBuilderBaseConfiguration.getTopMaterial(); + BlockState blockState3 = chunk.getBlockState(mutableBlockPos); +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java +index 0cdb3a1ca76375fc69d1709cdd34d4176a99a617..206f74305a01604892ff98ece0c8344cc5582d14 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java +@@ -36,7 +36,7 @@ public class NetherSurfaceBuilder extends SurfaceBuilder= i; --p) { ++ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height + mutableBlockPos.set(k, p, m); + BlockState blockState3 = chunk.getBlockState(mutableBlockPos); + if (blockState3.isAir()) { diff --git a/patches/server-remapped/0545-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 94% rename from patches/server-remapped/0545-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch index c7a761474..be48fd5ae 100644 --- a/patches/server-remapped/0545-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch +++ b/patches/server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch @@ -13,7 +13,7 @@ This commit forces numbers to be present prior to the ending "i" letter. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java -index 94d46bc56b3bc4c4750fcfb1732eea0e49a04195..8ec09ff3b5aae4267b753bd715f0a9d4ef0381bd 100644 +index a7f4054002bd176fccf8357e9a23de66dd9e0dc5..207e4302161b3abe2ade56c9dc9c31820010fa42 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java @@ -19,7 +19,7 @@ import net.minecraft.nbt.TagParser; diff --git a/patches/server-remapped/0546-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch similarity index 68% rename from patches/server-remapped/0546-Do-not-let-the-server-load-chunks-from-newer-version.patch rename to patches/server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch index d47ebc8c6..f0ecafa55 100644 --- a/patches/server-remapped/0546-Do-not-let-the-server-load-chunks-from-newer-version.patch +++ b/patches/server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -9,25 +9,26 @@ the game, immediately stop the server to prevent data corruption. You can override this functionality at your own peril. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 0adf14af9841cd3a20a8b2c0c320eb06794ef261..f6a814f9305813eaafa56baa0327e0111cd4e38c 100644 +index b4246524dd11ad1e1dc94c56eee966c5a54d9ecc..fad795c67829f89b21d78e822c7b15f2ea560184 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -95,10 +95,24 @@ public class ChunkSerializer { +@@ -98,10 +98,25 @@ public class ChunkSerializer { + holder.tasks.forEach(Runnable::run); return holder.protoChunk; } - ++ + // Paper start + private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getWorldVersion(); + private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); + // Paper end + - public static InProgressChunkHolder loadChunk(ServerLevel worldserver, StructureManager definedstructuremanager, PoiManager villageplace, ChunkPos chunkcoordintpair, CompoundTag nbttagcompound, boolean distinguish) { - ArrayDeque tasksToExecuteOnMain = new ArrayDeque<>(); + public static InProgressChunkHolder loadChunk(ServerLevel world, StructureManager structureManager, PoiManager poiStorage, ChunkPos pos, CompoundTag nbt, boolean distinguish) { + java.util.ArrayDeque tasksToExecuteOnMain = new java.util.ArrayDeque<>(); // Paper end - ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator(); + ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator(); + // Paper start - Do NOT attempt to load chunks saved with newer versions -+ if (nbttagcompound.contains("DataVersion", 99)) { -+ int dataVersion = nbttagcompound.getInt("DataVersion"); ++ if (nbt.contains("DataVersion", 99)) { ++ int dataVersion = nbt.getInt("DataVersion"); + if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { + new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); + System.exit(1); @@ -35,5 +36,5 @@ index 0adf14af9841cd3a20a8b2c0c320eb06794ef261..f6a814f9305813eaafa56baa0327e011 + } + // Paper end BiomeSource worldchunkmanager = chunkgenerator.getBiomeSource(); - CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Level"); // Paper - diff on change, see ChunkRegionLoader#getChunkCoordinate - ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkRegionLoader#getChunkCoordinate + CompoundTag nbttagcompound1 = nbt.getCompound("Level"); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate + ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate diff --git a/patches/server-remapped/0547-Brand-support.patch b/patches/server/0494-Brand-support.patch similarity index 77% rename from patches/server-remapped/0547-Brand-support.patch rename to patches/server/0494-Brand-support.patch index e134b2718..4ce0bb26c 100644 --- a/patches/server-remapped/0547-Brand-support.patch +++ b/patches/server/0494-Brand-support.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d9257786f61e 100644 +index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e3111f4f2b7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -5,6 +5,7 @@ import com.google.common.primitives.Doubles; +@@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import com.google.common.primitives.Floats; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; +import io.netty.buffer.Unpooled; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; - import it.unimi.dsi.fastutil.ints.Int2ShortMap; -@@ -37,6 +38,7 @@ import net.minecraft.nbt.ListTag; + import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; +@@ -38,6 +39,7 @@ import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; import net.minecraft.network.Connection; @@ -24,7 +24,7 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925 import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -@@ -258,6 +260,8 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -259,6 +261,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit @@ -33,7 +33,7 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; this.connection = connection; -@@ -2998,6 +3002,8 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -3000,6 +3004,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -42,24 +42,23 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3025,6 +3031,16 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -3027,6 +3033,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); -+ + // Paper start - Brand support + if (packet.identifier.equals(MINECRAFT_BRAND)) { + try { -+ this.clientBrandName = new FriendlyByteBuf(Unpooled.copiedBuffer(data)).readUTF(256); ++ this.clientBrandName = new FriendlyByteBuf(Unpooled.copiedBuffer(data)).readUtf(256); + } catch (StringIndexOutOfBoundsException ex) { + this.clientBrandName = "illegal"; + } + } + // Paper end - craftServer.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.identifier.toString(), data); + this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3034,6 +3050,12 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -3036,6 +3051,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } @@ -73,10 +72,10 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925 return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 610eabd2e93f9efccee810c3b5a314bc3cc649d8..7aae63d22167dc1b3ec7e8bc8672855c2038007e 100644 +index 0a6d6ea67eaf8b2a59ec45fb3ffb85096f509997..b277c87c0834ddcefcfaebd85c9e69d8d389b59e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2385,6 +2385,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2386,6 +2386,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; @@ -89,4 +88,4 @@ index 610eabd2e93f9efccee810c3b5a314bc3cc649d8..7aae63d22167dc1b3ec7e8bc8672855c + public Player.Spigot spigot() { - return spigot; + return this.spigot; diff --git a/patches/server-remapped/0551-Add-setMaxPlayers-API.patch b/patches/server/0495-Add-setMaxPlayers-API.patch similarity index 77% rename from patches/server-remapped/0551-Add-setMaxPlayers-API.patch rename to patches/server/0495-Add-setMaxPlayers-API.patch index bfd99ce60..92e26244b 100644 --- a/patches/server-remapped/0551-Add-setMaxPlayers-API.patch +++ b/patches/server/0495-Add-setMaxPlayers-API.patch @@ -5,24 +5,24 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b76735531ef96f9d4c870a5107feea01524a7670..7e44c911f4abc5c7d0e89513bf2cfc3516f13492 100644 +index 8c62367888af566dd9be4bb5cd301c26e0248e46..2f73f1f770e5e1fa422bec9c27e5bd10e86b7538 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -141,7 +141,7 @@ public abstract class PlayerList { +@@ -142,7 +142,7 @@ public abstract class PlayerList { public final PlayerDataStorage playerIo; private boolean doWhiteList; private final RegistryAccess.RegistryHolder registryHolder; - protected final int maxPlayers; + protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter private int viewDistance; - private GameType overrideGameMode; private boolean allowCheatsForAllPlayers; + private static final boolean ALLOW_LOGOUTIVATOR = false; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e301aee53b19fc3f93a36d0ed03a649741123bfa..e599be15af17e5e45d2b694c30140cc4a787a7f5 100644 +index df2c41d18377d8519d5537186d529ecc1901f58a..74de169828d7e1e55d15546eb637a87268610700 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -613,6 +613,13 @@ public final class CraftServer implements Server { - return playerList.getMaxPlayers(); +@@ -616,6 +616,13 @@ public final class CraftServer implements Server { + return this.playerList.getMaxPlayers(); } + // Paper start diff --git a/patches/server-remapped/0552-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 90% rename from patches/server-remapped/0552-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch index e3089f12c..59a558413 100644 --- a/patches/server-remapped/0552-Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 067eaf1e05ced344eb168431403f3fe786eafddf..eb136af0f99f5d7520ceabb98cefd5a01122872c 100644 +index a7a6757b83c94a0c0926097021015815f8f18b8e..c01eae70fe12970e9f617bf14e542b33572bcf4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -806,5 +806,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server-remapped/0553-Don-t-require-FACING-data.patch b/patches/server/0497-Don-t-require-FACING-data.patch similarity index 94% rename from patches/server-remapped/0553-Don-t-require-FACING-data.patch rename to patches/server/0497-Don-t-require-FACING-data.patch index 5ecdef506..ca355d45a 100644 --- a/patches/server-remapped/0553-Don-t-require-FACING-data.patch +++ b/patches/server/0497-Don-t-require-FACING-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't require FACING data diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java -index f7e60cdfa0b3f5970a897b5d52aaa72210f2fa57..ab8e69f9fc38012844ce01bd0cc5be8de2fcf4ab 100644 +index 0c286d7254f653bc855b1cb329fa76e3c1669b3c..05c0f0049421bc897f8e722331e30a6756ebbeea 100644 --- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java @@ -14,20 +14,22 @@ import org.bukkit.event.block.BlockDispenseEvent; diff --git a/patches/server-remapped/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 81% rename from patches/server-remapped/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 7947c7314..f5f54e1c8 100644 --- a/patches/server-remapped/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 61aee2c109614a014149ae5a15ad2a28c796cb9d..22266fda4de9b5fbace3b8e55ce390b8d7e75a65 100644 +index bdabcdb60dbfb803ead13c42c8dd5e100b37dc00..4ae56444d258cdf44a02256315d6aae84e2f53be 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1981,12 +1981,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1679,12 +1679,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl } // Paper end + public final void setSpawn(BlockPos blockposition, float f) { this.setDefaultSpawnPos(blockposition, f); } // Paper - OBFHELPER public void setDefaultSpawnPos(BlockPos pos, float angle) { // Paper - configurable spawn radius - BlockPos prevSpawn = this.getSpawn(); + BlockPos prevSpawn = this.getSharedSpawnPos(); //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); this.levelData.setSpawn(pos, angle); @@ -24,20 +24,20 @@ index 61aee2c109614a014149ae5a15ad2a28c796cb9d..22266fda4de9b5fbace3b8e55ce390b8 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 793b1309528671ce822d5a484ff9e40d6eba4e9d..37513a1774f5a6611338c1b90018b974238ddbf6 100644 +index d79a711d4080ad8acb2c240870be9d99a0b84cea..4ca674fac0e1ed354a0c49284c21ca2b117dd852 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -371,11 +371,13 @@ public class CraftWorld implements World { +@@ -386,11 +386,13 @@ public class CraftWorld implements World { public boolean setSpawnLocation(int x, int y, int z, float angle) { try { - Location previousLocation = getSpawnLocation(); + Location previousLocation = this.getSpawnLocation(); - world.levelData.setSpawn(new BlockPos(x, y, z), angle); + world.setSpawn(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn + // Paper start - move to nms.World // Notify anyone who's listening. - SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); -- server.getPluginManager().callEvent(event); +- this.server.getPluginManager().callEvent(event); + // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); + // server.getPluginManager().callEvent(event); + // Paper end diff --git a/patches/server-remapped/0555-Add-moon-phase-API.patch b/patches/server/0499-Add-moon-phase-API.patch similarity index 78% rename from patches/server-remapped/0555-Add-moon-phase-API.patch rename to patches/server/0499-Add-moon-phase-API.patch index bd3ee0c1e..e6c06c4be 100644 --- a/patches/server-remapped/0555-Add-moon-phase-API.patch +++ b/patches/server/0499-Add-moon-phase-API.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 37513a1774f5a6611338c1b90018b974238ddbf6..28bf53bc9fca21f57cd4851adf508d833ecdd33b 100644 +index 4ca674fac0e1ed354a0c49284c21ca2b117dd852..d0b2de0f0a37554eb812aa8c7c20f1067807dc40 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -310,6 +310,11 @@ public class CraftWorld implements World { +@@ -325,6 +325,11 @@ public class CraftWorld implements World { public int getPlayerCount() { - return world.players.size(); + return world.players().size(); } + + @Override diff --git a/patches/server-remapped/0556-Prevent-headless-pistons-from-being-created.patch b/patches/server/0500-Prevent-headless-pistons-from-being-created.patch similarity index 87% rename from patches/server-remapped/0556-Prevent-headless-pistons-from-being-created.patch rename to patches/server/0500-Prevent-headless-pistons-from-being-created.patch index 15edeb8af..a8508e936 100644 --- a/patches/server-remapped/0556-Prevent-headless-pistons-from-being-created.patch +++ b/patches/server/0500-Prevent-headless-pistons-from-being-created.patch @@ -23,7 +23,7 @@ index fdbd8b89bb8bf3b61f60b812b90483c98a3d5ccb..faa1b775e45563b93ac1d5b904938b1f public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a099f76b1 100644 +index a12af10e28f2d023ba6f916b5e7a53539416713f..822a8dbfaea0a312c4eb2849f2386ecd401b13e9 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -15,6 +15,7 @@ import java.util.Random; @@ -41,11 +41,11 @@ index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a +import net.minecraft.world.level.block.piston.PistonHeadBlock; +import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; import net.minecraft.world.level.block.state.BlockState; + import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.FluidState; - import net.minecraft.world.level.storage.loot.LootContext; -@@ -161,6 +164,15 @@ public class Explosion { +@@ -189,6 +192,15 @@ public class Explosion { - if (f > 0.0F && this.damageCalculator.a(this, this.level, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions + if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions set.add(blockposition); + // Paper start - prevent headless pistons from forming + if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { @@ -60,10 +60,10 @@ index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a d4 += d0 * 0.30000001192092896D; diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 001e90da8b09e16b6df4849a5bac4f4821000c94..81f3c6fb7bab9de364537d3f3b2ea0f32795e5f1 100644 +index 87bedba9ab495edcce289c6665271d92b7165944..985f1112963c3b644a88788a6b4f8a9bd5f5c11a 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -65,6 +65,8 @@ public class PistonMovingBlockEntity extends BlockEntity implements TickableBloc +@@ -66,6 +66,8 @@ public class PistonMovingBlockEntity extends BlockEntity { return this.direction; }