From 5b6d9033021b60f87329b1393cfec50b2e6d4171 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 7 Dec 2022 22:05:01 +0100 Subject: [PATCH] More patchy patched patches --- ...-incremental-chunk-and-player-saving.patch | 4 +- ...99-Fix-GameProfileCache-concurrency.patch} | 0 ...g-when-the-async-catcher-is-tripped.patch} | 0 ...per-mobcaps-and-paper-playermobcaps.patch} | 12 +- ...itize-ResourceLocation-error-logging.patch | 28 +++++ ...rolled-flushing-for-network-manager.patch} | 0 .../0704-Optimise-general-POI-access.patch} | 34 +++--- .../0705-Optimise-chunk-tick-iteration.patch} | 14 +-- .../0706-Execute-chunk-tasks-mid-tick.patch} | 26 ++-- ...ulate-regionfile-header-if-it-is-co.patch} | 12 +- ...ementation-for-blockstate-state-loo.patch} | 6 +- ...-more-information-in-watchdog-dumps.patch} | 14 +-- ...lly-inline-methods-in-BlockPosition.patch} | 10 +- .../0711-Distance-manager-tick-timings.patch} | 0 ...ler-threads-according-to-the-plugin.patch} | 0 ...-getChunkAt-has-inlined-logic-for-l.patch} | 4 +- .../0714-Add-packet-limiter-config.patch} | 0 ...our-chunk-data-off-disk-when-conver.patch} | 0 ...sh-calls-for-entity-tracker-packets.patch} | 4 +- ...-lookup-fluid-state-when-raytracing.patch} | 0 .../0718-Time-scoreboard-search.patch} | 0 ...packets-for-hard-colliding-entities.patch} | 4 +- ...0-Do-not-run-raytrace-logic-for-AIR.patch} | 0 ...rimise-map-impl-for-tracked-players.patch} | 4 +- ...imise-BlockSoil-nearby-water-lookup.patch} | 0 .../0723-Optimise-random-block-ticking.patch} | 55 +++++---- ...4-Optimise-non-flush-packet-sending.patch} | 0 ...0725-Optimise-nearby-player-lookups.patch} | 36 +++--- ...0726-Remove-streams-for-villager-AI.patch} | 111 +++++++----------- ...city-compression-and-cipher-natives.patch} | 6 +- ...hread-worker-count-for-low-core-cou.patch} | 2 +- ...ifications-to-critical-entity-state.patch} | 0 ...ix-Bukkit-NamespacedKey-shenanigans.patch} | 0 ...ntory-not-closing-on-entity-removal.patch} | 4 +- ...rement-before-suggesting-root-nodes.patch} | 0 ...ServerboundCommandSuggestionPacket-.patch} | 4 +- ...nColor-on-tropical-fish-bucket-meta.patch} | 0 .../0735-Ensure-valid-vehicle-status.patch} | 4 +- ...ftlocked-end-exit-portal-generation.patch} | 4 +- ...r-causing-a-crash-when-trying-to-ge.patch} | 0 ...-t-log-debug-logging-being-disabled.patch} | 2 +- ...ous-menus-with-empty-level-accesses.patch} | 0 .../0740-Preserve-overstacked-loot.patch} | 45 +++---- ...ate-head-rotation-in-missing-places.patch} | 6 +- ...unintended-light-block-manipulation.patch} | 4 +- ...0743-Fix-CraftCriteria-defaults-map.patch} | 0 ...Fix-upstreams-block-state-factories.patch} | 45 +++++-- ...ion-for-logging-player-ip-addresses.patch} | 12 +- .../0746-Configurable-feature-seeds.patch} | 4 +- ...pper-didnt-account-for-entity-sende.patch} | 0 .../0748-Add-root-admin-user-detection.patch} | 4 +- ...ays-allow-item-changing-in-Fireball.patch} | 0 ...t-attempt-to-teleport-dead-entities.patch} | 2 +- ...ive-velocity-through-repeated-crits.patch} | 4 +- ...e-code-using-deprecated-for-removal.patch} | 4 +- ...itize-ResourceLocation-error-logging.patch | 22 ---- ...lStem-registry-when-loading-default-.patch | 45 ------- 57 files changed, 288 insertions(+), 313 deletions(-) rename patches/{unapplied/server/0704-Fix-GameProfileCache-concurrency.patch => server/0699-Fix-GameProfileCache-concurrency.patch} (100%) rename patches/{unapplied/server/0705-Log-when-the-async-catcher-is-tripped.patch => server/0700-Log-when-the-async-catcher-is-tripped.patch} (100%) rename patches/{unapplied/server/0706-Add-paper-mobcaps-and-paper-playermobcaps.patch => server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch} (97%) create mode 100644 patches/server/0702-Sanitize-ResourceLocation-error-logging.patch rename patches/{unapplied/server/0708-Allow-controlled-flushing-for-network-manager.patch => server/0703-Allow-controlled-flushing-for-network-manager.patch} (100%) rename patches/{unapplied/server/0709-Optimise-general-POI-access.patch => server/0704-Optimise-general-POI-access.patch} (97%) rename patches/{unapplied/server/0710-Optimise-chunk-tick-iteration.patch => server/0705-Optimise-chunk-tick-iteration.patch} (95%) rename patches/{unapplied/server/0711-Execute-chunk-tasks-mid-tick.patch => server/0706-Execute-chunk-tasks-mid-tick.patch} (89%) rename patches/{unapplied/server/0712-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch => server/0707-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch} (98%) rename patches/{unapplied/server/0713-Custom-table-implementation-for-blockstate-state-loo.patch => server/0708-Custom-table-implementation-for-blockstate-state-loo.patch} (98%) rename patches/{unapplied/server/0714-Detail-more-information-in-watchdog-dumps.patch => server/0709-Detail-more-information-in-watchdog-dumps.patch} (96%) rename patches/{unapplied/server/0715-Manually-inline-methods-in-BlockPosition.patch => server/0710-Manually-inline-methods-in-BlockPosition.patch} (84%) rename patches/{unapplied/server/0716-Distance-manager-tick-timings.patch => server/0711-Distance-manager-tick-timings.patch} (100%) rename patches/{unapplied/server/0717-Name-craft-scheduler-threads-according-to-the-plugin.patch => server/0712-Name-craft-scheduler-threads-according-to-the-plugin.patch} (100%) rename patches/{unapplied/server/0718-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch => server/0713-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch} (90%) rename patches/{unapplied/server/0719-Add-packet-limiter-config.patch => server/0714-Add-packet-limiter-config.patch} (100%) rename patches/{unapplied/server/0721-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch => server/0715-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch} (100%) rename patches/{unapplied/server/0722-Consolidate-flush-calls-for-entity-tracker-packets.patch => server/0716-Consolidate-flush-calls-for-entity-tracker-packets.patch} (93%) rename patches/{unapplied/server/0723-Don-t-lookup-fluid-state-when-raytracing.patch => server/0717-Don-t-lookup-fluid-state-when-raytracing.patch} (100%) rename patches/{unapplied/server/0724-Time-scoreboard-search.patch => server/0718-Time-scoreboard-search.patch} (100%) rename patches/{unapplied/server/0725-Send-full-pos-packets-for-hard-colliding-entities.patch => server/0719-Send-full-pos-packets-for-hard-colliding-entities.patch} (91%) rename patches/{unapplied/server/0726-Do-not-run-raytrace-logic-for-AIR.patch => server/0720-Do-not-run-raytrace-logic-for-AIR.patch} (100%) rename patches/{unapplied/server/0727-Oprimise-map-impl-for-tracked-players.patch => server/0721-Oprimise-map-impl-for-tracked-players.patch} (87%) rename patches/{unapplied/server/0728-Optimise-BlockSoil-nearby-water-lookup.patch => server/0722-Optimise-BlockSoil-nearby-water-lookup.patch} (100%) rename patches/{unapplied/server/0729-Optimise-random-block-ticking.patch => server/0723-Optimise-random-block-ticking.patch} (90%) rename patches/{unapplied/server/0730-Optimise-non-flush-packet-sending.patch => server/0724-Optimise-non-flush-packet-sending.patch} (100%) rename patches/{unapplied/server/0731-Optimise-nearby-player-lookups.patch => server/0725-Optimise-nearby-player-lookups.patch} (94%) rename patches/{unapplied/server/0732-Remove-streams-for-villager-AI.patch => server/0726-Remove-streams-for-villager-AI.patch} (65%) rename patches/{unapplied/server/0733-Use-Velocity-compression-and-cipher-natives.patch => server/0727-Use-Velocity-compression-and-cipher-natives.patch} (98%) rename patches/{unapplied/server/0734-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch => server/0728-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch} (93%) rename patches/{unapplied/server/0735-Async-catch-modifications-to-critical-entity-state.patch => server/0729-Async-catch-modifications-to-critical-entity-state.patch} (100%) rename patches/{unapplied/server/0736-Fix-Bukkit-NamespacedKey-shenanigans.patch => server/0730-Fix-Bukkit-NamespacedKey-shenanigans.patch} (100%) rename patches/{unapplied/server/0737-Fix-merchant-inventory-not-closing-on-entity-removal.patch => server/0731-Fix-merchant-inventory-not-closing-on-entity-removal.patch} (90%) rename patches/{unapplied/server/0738-Check-requirement-before-suggesting-root-nodes.patch => server/0732-Check-requirement-before-suggesting-root-nodes.patch} (100%) rename patches/{unapplied/server/0739-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch => server/0733-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch} (87%) rename patches/{unapplied/server/0740-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch => server/0734-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch} (100%) rename patches/{unapplied/server/0741-Ensure-valid-vehicle-status.patch => server/0735-Ensure-valid-vehicle-status.patch} (84%) rename patches/{unapplied/server/0742-Prevent-softlocked-end-exit-portal-generation.patch => server/0736-Prevent-softlocked-end-exit-portal-generation.patch} (87%) rename patches/{unapplied/server/0743-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch => server/0737-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch} (100%) rename patches/{unapplied/server/0744-Don-t-log-debug-logging-being-disabled.patch => server/0738-Don-t-log-debug-logging-being-disabled.patch} (88%) rename patches/{unapplied/server/0745-fix-various-menus-with-empty-level-accesses.patch => server/0739-fix-various-menus-with-empty-level-accesses.patch} (100%) rename patches/{unapplied/server/0746-Preserve-overstacked-loot.patch => server/0740-Preserve-overstacked-loot.patch} (59%) rename patches/{unapplied/server/0747-Update-head-rotation-in-missing-places.patch => server/0741-Update-head-rotation-in-missing-places.patch} (84%) rename patches/{unapplied/server/0748-prevent-unintended-light-block-manipulation.patch => server/0742-prevent-unintended-light-block-manipulation.patch} (86%) rename patches/{unapplied/server/0749-Fix-CraftCriteria-defaults-map.patch => server/0743-Fix-CraftCriteria-defaults-map.patch} (100%) rename patches/{unapplied/server/0750-Fix-upstreams-block-state-factories.patch => server/0744-Fix-upstreams-block-state-factories.patch} (90%) rename patches/{unapplied/server/0751-Add-config-option-for-logging-player-ip-addresses.patch => server/0745-Add-config-option-for-logging-player-ip-addresses.patch} (92%) rename patches/{unapplied/server/0752-Configurable-feature-seeds.patch => server/0746-Configurable-feature-seeds.patch} (94%) rename patches/{unapplied/server/0753-VanillaCommandWrapper-didnt-account-for-entity-sende.patch => server/0747-VanillaCommandWrapper-didnt-account-for-entity-sende.patch} (100%) rename patches/{unapplied/server/0754-Add-root-admin-user-detection.patch => server/0748-Add-root-admin-user-detection.patch} (96%) rename patches/{unapplied/server/0755-Always-allow-item-changing-in-Fireball.patch => server/0749-Always-allow-item-changing-in-Fireball.patch} (100%) rename patches/{unapplied/server/0756-don-t-attempt-to-teleport-dead-entities.patch => server/0750-don-t-attempt-to-teleport-dead-entities.patch} (91%) rename patches/{unapplied/server/0757-Prevent-excessive-velocity-through-repeated-crits.patch => server/0751-Prevent-excessive-velocity-through-repeated-crits.patch} (90%) rename patches/{unapplied/server/0758-Remove-client-side-code-using-deprecated-for-removal.patch => server/0752-Remove-client-side-code-using-deprecated-for-removal.patch} (89%) delete mode 100644 patches/unapplied/server/0707-Sanitize-ResourceLocation-error-logging.patch delete mode 100644 patches/unapplied/server/0720-Use-correct-LevelStem-registry-when-loading-default-.patch diff --git a/patches/server/0434-incremental-chunk-and-player-saving.patch b/patches/server/0434-incremental-chunk-and-player-saving.patch index de935d9cab..db9bb83617 100644 --- a/patches/server/0434-incremental-chunk-and-player-saving.patch +++ b/patches/server/0434-incremental-chunk-and-player-saving.patch @@ -73,7 +73,7 @@ index 298e4468f7b5346733257f7117f76c66e9a1d8f0..d1652c237b2b272f0dfe80f774cff160 public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3fff95ffe0e343f873dda31507567cbd8fa2460e..772512a77f67ef83b99241de930c07a0b8c96c8a 100644 +index 3fff95ffe0e343f873dda31507567cbd8fa2460e..750f41e03f54b0dbac85c2a46edae2cc1505d12c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1144,6 +1144,37 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -104,7 +104,7 @@ index 3fff95ffe0e343f873dda31507567cbd8fa2460e..772512a77f67ef83b99241de930c07a0 + + this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings()); + this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save()); -+ this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); ++ this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); + } + // CraftBukkit end + } diff --git a/patches/unapplied/server/0704-Fix-GameProfileCache-concurrency.patch b/patches/server/0699-Fix-GameProfileCache-concurrency.patch similarity index 100% rename from patches/unapplied/server/0704-Fix-GameProfileCache-concurrency.patch rename to patches/server/0699-Fix-GameProfileCache-concurrency.patch diff --git a/patches/unapplied/server/0705-Log-when-the-async-catcher-is-tripped.patch b/patches/server/0700-Log-when-the-async-catcher-is-tripped.patch similarity index 100% rename from patches/unapplied/server/0705-Log-when-the-async-catcher-is-tripped.patch rename to patches/server/0700-Log-when-the-async-catcher-is-tripped.patch diff --git a/patches/unapplied/server/0706-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 97% rename from patches/unapplied/server/0706-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch index 18e367f038..397f9049f0 100644 --- a/patches/unapplied/server/0706-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0701-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -265,10 +265,10 @@ index 0000000000000000000000000000000000000000..2e02d94e2903c48f6d08e743c1cf8bad + } +} diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index b031dece541d2765f9488a5ffcb0d339c38ccc9e..21941af701eab308f87ca64b2801c55444814acb 100644 +index bf3fb416d36a19958033cdbf5cc313556fa0201b..0a49769bfa83d0b9c435e3ab4bba85979d660ff8 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -191,6 +191,16 @@ public final class NaturalSpawner { +@@ -192,6 +192,16 @@ public final class NaturalSpawner { world.getProfiler().pop(); } @@ -286,10 +286,10 @@ index b031dece541d2765f9488a5ffcb0d339c38ccc9e..21941af701eab308f87ca64b2801c554 // Paper start - add parameters and int ret type spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3ebf81b45cf1897471a3262d23cc59dd45652b6d..c648acdd0066f6c480d08927a3c72524cde32ec7 100644 +index 1b4143092f709541469c037325d826f25d9e675f..3af2e5d3bdbf82c142f5ea2629456329bda7666f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2156,6 +2156,11 @@ public final class CraftServer implements Server { +@@ -2180,6 +2180,11 @@ public final class CraftServer implements Server { @Override public int getSpawnLimit(SpawnCategory spawnCategory) { @@ -302,10 +302,10 @@ index 3ebf81b45cf1897471a3262d23cc59dd45652b6d..c648acdd0066f6c480d08927a3c72524 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ef1b84c52722e33f1f3d346df60c11d5bb805a0b..80abef83b4b2533fdc50773d4d76c3c6af662df1 100644 +index 30561840201f3e560753d91f82a646bad20f1a93..7a3aaeb5191f03b8288dde7567bed686150e70a0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1701,9 +1701,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1700,9 +1700,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { Validate.notNull(spawnCategory, "SpawnCategory cannot be null"); Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported."); diff --git a/patches/server/0702-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0702-Sanitize-ResourceLocation-error-logging.patch new file mode 100644 index 0000000000..df7048125e --- /dev/null +++ b/patches/server/0702-Sanitize-ResourceLocation-error-logging.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Thu, 26 Aug 2021 12:09:47 +0200 +Subject: [PATCH] Sanitize ResourceLocation error logging + + +diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java +index bad95669727f0968f4a7d6e498ff6dfaab49a56e..6d8ce6885f879eb2bffbe45374ba87fb4c72dd42 100644 +--- a/src/main/java/net/minecraft/resources/ResourceLocation.java ++++ b/src/main/java/net/minecraft/resources/ResourceLocation.java +@@ -200,7 +200,7 @@ public class ResourceLocation implements Comparable { + + private static String assertValidNamespace(String namespace, String path) { + if (!isValidNamespace(namespace)) { +- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + namespace + ":" + path); ++ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper + } else { + return namespace; + } +@@ -221,7 +221,7 @@ public class ResourceLocation implements Comparable { + + private static String assertValidPath(String namespace, String path) { + if (!isValidPath(path)) { +- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + path); ++ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper + } else { + return path; + } diff --git a/patches/unapplied/server/0708-Allow-controlled-flushing-for-network-manager.patch b/patches/server/0703-Allow-controlled-flushing-for-network-manager.patch similarity index 100% rename from patches/unapplied/server/0708-Allow-controlled-flushing-for-network-manager.patch rename to patches/server/0703-Allow-controlled-flushing-for-network-manager.patch diff --git a/patches/unapplied/server/0709-Optimise-general-POI-access.patch b/patches/server/0704-Optimise-general-POI-access.patch similarity index 97% rename from patches/unapplied/server/0709-Optimise-general-POI-access.patch rename to patches/server/0704-Optimise-general-POI-access.patch index 5587bc9aea..88606cbfc1 100644 --- a/patches/unapplied/server/0709-Optimise-general-POI-access.patch +++ b/patches/server/0704-Optimise-general-POI-access.patch @@ -837,22 +837,22 @@ index 0000000000000000000000000000000000000000..05640f5f70e81833530e8098d30c400f + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index 4f75f2be7070d49c2c60866ad7146da19ab61652..43243537b765a2d270be6de3f053fea77ff67d18 100644 +index 9fd6cf0c98cbf6300ef23d4aab32a6110aeba665..d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -87,7 +87,11 @@ public class AcquirePoi extends Behavior { - return true; - } - }; -- Set, BlockPos>> set = poiManager.findAllClosestFirstWithType(this.poiType, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet()); -+ // Paper start - optimise POI access -+ java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); -+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, this.poiType, predicate, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); -+ Set, BlockPos>> set = new java.util.HashSet<>(poiposes); -+ // Paper end - optimise POI access - Path path = findPathToPois(entity, set); - if (path != null && path.canReach()) { - BlockPos blockPos = path.getTarget(); +@@ -62,7 +62,11 @@ public class AcquirePoi { + return true; + } + }; +- Set, BlockPos>> set = poiManager.findAllClosestFirstWithType(poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet()); ++ // Paper start - optimise POI access ++ java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); ++ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); ++ Set, BlockPos>> set = new java.util.HashSet<>(poiposes); ++ // Paper end - optimise POI access + Path path = findPathToPois(entity, set); + if (path != null && path.canReach()) { + BlockPos blockPos = path.getTarget(); diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c35854c59ec5d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java @@ -875,7 +875,7 @@ index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c3585 BlockPos blockPos = path.getTarget(); Optional> optional = poiManager.getType(blockPos); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 6d9ccb87265bcb5c2aecf2e5a0a043ac3c4cbefd..291af79b754ba1a78556f5c8b7b004268761a768 100644 +index 440e4f35e38d38e5407a6fecf09ab9511a44a670..8950b220b9a3512cd4667beb7bdec0e82e07edc6 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -127,43 +127,62 @@ public class PoiManager extends SectionStorage { @@ -961,7 +961,7 @@ index 6d9ccb87265bcb5c2aecf2e5a0a043ac3c4cbefd..291af79b754ba1a78556f5c8b7b00426 public boolean release(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index e921e3cce8c746e28d73e1a7e67a7efe656ec09f..8241320f5f01d0b093024ca27f6d8bdbac487ab3 100644 +index 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe34018b8df74 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -26,7 +26,7 @@ import org.slf4j.Logger; @@ -992,7 +992,7 @@ index c396076bfb1d41cc0f8248d6f3aa4fc3f7d1c998..d783072bc964e45c308197e6f79874eb return Optional.empty(); } else { 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 1369d4f818d203e3092fd6ba4def106dda16d6d2..b7cb9fbb15c83cd4225a241e44132279d9308f96 100644 +index faaf50cb9bce254aef554ed8b402b145532e12a4..92d13c9f1ec1e5ff72c1d68f924a8d1c86c91565 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -51,18 +51,39 @@ public class PortalForcer { diff --git a/patches/unapplied/server/0710-Optimise-chunk-tick-iteration.patch b/patches/server/0705-Optimise-chunk-tick-iteration.patch similarity index 95% rename from patches/unapplied/server/0710-Optimise-chunk-tick-iteration.patch rename to patches/server/0705-Optimise-chunk-tick-iteration.patch index d571907ab6..cada80f025 100644 --- a/patches/unapplied/server/0710-Optimise-chunk-tick-iteration.patch +++ b/patches/server/0705-Optimise-chunk-tick-iteration.patch @@ -72,10 +72,10 @@ index a61f55ed1fbe5aac5289014cb95cb6950b4c77fa..e11ec87e8007979a1c6932b414bcd70c int i = 0; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf48973472 100644 +index 993d04766c81990e72166f1348a01d8ef7e05d0f..109baae0c68b28720508af4a9e0b32b72b3dcb23 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -110,6 +110,8 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator; +@@ -113,6 +113,8 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator; import org.bukkit.entity.Player; // CraftBukkit end @@ -84,7 +84,7 @@ index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { private static final byte CHUNK_TYPE_REPLACEABLE = -1; -@@ -147,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -151,6 +153,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Queue unloadQueue; int viewDistance; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper @@ -93,10 +93,10 @@ index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832ce974505 100644 +index d1652c237b2b272f0dfe80f774cff16056f39046..b768767b92bf7691a6e57627c69818a1f5fd82c8 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -47,6 +47,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp +@@ -48,6 +48,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelStorageSource; @@ -104,7 +104,7 @@ index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832 public class ServerChunkCache extends ChunkSource { -@@ -723,42 +724,59 @@ public class ServerChunkCache extends ChunkSource { +@@ -724,42 +725,59 @@ public class ServerChunkCache extends ChunkSource { this.lastSpawnState = spawnercreature_d; gameprofilerfiller.popPush("filteringLoadedChunks"); @@ -181,7 +181,7 @@ index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832 this.level.timings.chunkTicks.stopTiming(); // Paper gameprofilerfiller.popPush("customSpawners"); if (flag2) { -@@ -766,15 +784,24 @@ public class ServerChunkCache extends ChunkSource { +@@ -767,15 +785,24 @@ public class ServerChunkCache extends ChunkSource { this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); } // Paper - timings } diff --git a/patches/unapplied/server/0711-Execute-chunk-tasks-mid-tick.patch b/patches/server/0706-Execute-chunk-tasks-mid-tick.patch similarity index 89% rename from patches/unapplied/server/0711-Execute-chunk-tasks-mid-tick.patch rename to patches/server/0706-Execute-chunk-tasks-mid-tick.patch index ea510bfa23..52ca020c51 100644 --- a/patches/unapplied/server/0711-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0706-Execute-chunk-tasks-mid-tick.patch @@ -19,10 +19,10 @@ index 23e564b05ba438924180c91f9b19a60731eedd1b..5ec241d49ff5e3a161a39006f05823a5 private MinecraftTimings() {} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1203076f688a16af17b7e55d913c9248e3f0fec7..ee6dc7d149f96c9a63e627e765b8d3a0107af864 100644 +index 213033a59be4239f1225286764be83dcc6fbf973..0868805c78d991c602d8f1d1b5aeb5c790c13384 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1298,6 +1298,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop void guardEntityTick(Consumer tickConsumer, T entity) { try { tickConsumer.accept(entity); diff --git a/patches/unapplied/server/0712-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/0707-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch similarity index 98% rename from patches/unapplied/server/0712-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch rename to patches/server/0707-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 65fc9468d8..dc7e3c7a35 100644 --- a/patches/unapplied/server/0712-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/0707-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -10,10 +10,10 @@ hoping that at least then we don't swap chunks, and maybe recover them all. 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 4236cf65b893bc21d2597010a2f9745fc0e107a4..6e39c2c1556f41140b92064a6fa3a38427504aee 100644 +index f8edcc9697289c2cf43c9021d5518955d0d701e7..313a3319c630a4f26f9c53255a0ac67f3c15e410 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 -@@ -68,6 +68,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks; +@@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks; import org.slf4j.Logger; public class ChunkSerializer { @@ -32,7 +32,7 @@ index 4236cf65b893bc21d2597010a2f9745fc0e107a4..6e39c2c1556f41140b92064a6fa3a384 public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states private static final Logger LOGGER = LogUtils.getLogger(); -@@ -480,7 +492,7 @@ public class ChunkSerializer { +@@ -486,7 +498,7 @@ public class ChunkSerializer { nbttagcompound.putInt("xPos", chunkcoordintpair.x); nbttagcompound.putInt("yPos", chunk.getMinSection()); nbttagcompound.putInt("zPos", chunkcoordintpair.z); @@ -685,7 +685,7 @@ index cda87a66fe80bf910f629c64e36c1fecbad81d77..9bae47f99336c377beb72c4b50b7f01c return bytebuffer; } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index c881d15efa94fc379ed2817a534fef3a4dd3d90d..e71a451a6b385716cc46db7350b58b4192304547 100644 +index 65fd57609e45ccd49ebfc1ba80d25243da13ab6e..d5b501bcb33a785ef0301bf6bb8d396b9d4fbb6a 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -26,7 +26,15 @@ public class RegionFileStorage implements AutoCloseable { @@ -705,12 +705,12 @@ index c881d15efa94fc379ed2817a534fef3a4dd3d90d..e71a451a6b385716cc46db7350b58b41 this.sync = dsync; } @@ -88,9 +96,9 @@ public class RegionFileStorage implements AutoCloseable { - Files.createDirectories(this.folder); + FileUtil.createDirectoriesSafe(this.folder); Path path = this.folder; int j = chunkcoordintpair.getRegionX(); - Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); + Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change - if (existingOnly && !Files.exists(path1)) return null; // CraftBukkit + if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit - RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync); + RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header diff --git a/patches/unapplied/server/0713-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/0708-Custom-table-implementation-for-blockstate-state-loo.patch similarity index 98% rename from patches/unapplied/server/0713-Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/0708-Custom-table-implementation-for-blockstate-state-loo.patch index 6cf6b743b6..db3121f51f 100644 --- a/patches/unapplied/server/0713-Custom-table-implementation-for-blockstate-state-loo.patch +++ b/patches/server/0708-Custom-table-implementation-for-blockstate-state-loo.patch @@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index ab712fd29b316e1235645bacaa79aa0a64d0bc00..340d0648fcf9b9749c4daa1c25a226b947707c3d 100644 +index b617f7e7a27284fbbad06d7a9926b938ba87cf18..170f5cb3f01a57ad76e3bbeacd5b7c7e52f29959 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java @@ -39,11 +39,13 @@ public abstract class StateHolder { @@ -235,8 +235,8 @@ index ab712fd29b316e1235645bacaa79aa0a64d0bc00..340d0648fcf9b9749c4daa1c25a226b9 + // Paper end - optimise state lookup } - public void populateNeighbours(Map, Comparable>, S> states) { -@@ -133,7 +129,7 @@ public abstract class StateHolder { + public , V extends T> S trySetValue(Property property, V value) { +@@ -147,7 +143,7 @@ public abstract class StateHolder { } } diff --git a/patches/unapplied/server/0714-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0709-Detail-more-information-in-watchdog-dumps.patch similarity index 96% rename from patches/unapplied/server/0714-Detail-more-information-in-watchdog-dumps.patch rename to patches/server/0709-Detail-more-information-in-watchdog-dumps.patch index e5e0e3edcb..74806cddfc 100644 --- a/patches/unapplied/server/0714-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0709-Detail-more-information-in-watchdog-dumps.patch @@ -78,10 +78,10 @@ index acfa1907bfc9c29d261cfccc00d65bad9ad1a002..d6f3869f5725c7f081efb7f486f74dbb }); throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc1b565e5d 100644 +index 390fdb2cf33901814c475b2e7da7dc1a79beda29..3ba995c8d21427a3dbbde22c8faa0a7888507880 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1042,7 +1042,26 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1063,7 +1063,26 @@ public class ServerLevel extends Level implements WorldGenLevel { } @@ -108,7 +108,7 @@ index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper -@@ -1082,7 +1101,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1103,7 +1122,13 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } // } finally { timer.stopTiming(); } // Paper - timings - move up @@ -124,7 +124,7 @@ index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03332464b1 100644 +index 15d9159bb67619a40edc4be5556615dcd9a211a0..a4d4e5cb3bd7a4816671b058c640ccc90dec8f54 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -971,7 +971,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -184,7 +184,7 @@ index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03 } protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { -@@ -3972,7 +4014,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4018,7 +4060,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public void setDeltaMovement(Vec3 velocity) { @@ -193,8 +193,8 @@ index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03 + } // Paper } - public void setDeltaMovement(double x, double y, double z) { -@@ -4054,7 +4098,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + public void addDeltaMovement(Vec3 velocity) { +@@ -4104,7 +4148,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } // Paper end - fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/patches/unapplied/server/0715-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0710-Manually-inline-methods-in-BlockPosition.patch similarity index 84% rename from patches/unapplied/server/0715-Manually-inline-methods-in-BlockPosition.patch rename to patches/server/0710-Manually-inline-methods-in-BlockPosition.patch index f8ac951367..e325b669c5 100644 --- a/patches/unapplied/server/0715-Manually-inline-methods-in-BlockPosition.patch +++ b/patches/server/0710-Manually-inline-methods-in-BlockPosition.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Manually inline methods in BlockPosition diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582d4300899 100644 +index 08fee16ab39d9da3c4262b356dd956fd5c967d06..b1d12c78edf21cc29a9f9ca54e7957ddc8875ffb 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -484,9 +484,9 @@ public class BlockPos extends Vec3i { +@@ -488,9 +488,9 @@ public class BlockPos extends Vec3i { } public BlockPos.MutableBlockPos set(int x, int y, int z) { @@ -21,7 +21,7 @@ index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582 return this; } -@@ -550,19 +550,19 @@ public class BlockPos extends Vec3i { +@@ -554,19 +554,19 @@ public class BlockPos extends Vec3i { // Paper start - comment out useless overrides @Override - TODO figure out why this is suddenly important to keep @Override public BlockPos.MutableBlockPos setX(int i) { @@ -45,11 +45,11 @@ index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582 } // Paper end diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 73b3c5f5c037fbe3f588f8f4b0113bef283632a4..c06c7da7de84bc764ea7b9612b3dc2303b49b22e 100644 +index 9482d5ca34bbc098a5afa785054d6d60d6a2decb..cc73ce9f860d1ed3a746e08364a3be97ffa5c8c2 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java @@ -19,9 +19,9 @@ public class Vec3i implements Comparable { - return IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ()); + return IntStream.of(vec.getX(), vec.getY(), vec.getZ()); }); public static final Vec3i ZERO = new Vec3i(0, 0, 0); - private int x; diff --git a/patches/unapplied/server/0716-Distance-manager-tick-timings.patch b/patches/server/0711-Distance-manager-tick-timings.patch similarity index 100% rename from patches/unapplied/server/0716-Distance-manager-tick-timings.patch rename to patches/server/0711-Distance-manager-tick-timings.patch diff --git a/patches/unapplied/server/0717-Name-craft-scheduler-threads-according-to-the-plugin.patch b/patches/server/0712-Name-craft-scheduler-threads-according-to-the-plugin.patch similarity index 100% rename from patches/unapplied/server/0717-Name-craft-scheduler-threads-according-to-the-plugin.patch rename to patches/server/0712-Name-craft-scheduler-threads-according-to-the-plugin.patch diff --git a/patches/unapplied/server/0718-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0713-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch similarity index 90% rename from patches/unapplied/server/0718-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch rename to patches/server/0713-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index 9f57ee0138..f630226ffd 100644 --- a/patches/unapplied/server/0718-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0713-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced here. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 70b6479ef8aeb51135b31add61e4fdab0c495233..97623e46160bf038bbcc4584bb921d524b3830c0 100644 +index 10f4cbf82cc4a79aacfd1f8e1e53a6c1f4963865..c56de0c388f5902d85b0810c6e105c24d721bcdd 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -367,6 +367,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -366,6 +366,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @Override public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline diff --git a/patches/unapplied/server/0719-Add-packet-limiter-config.patch b/patches/server/0714-Add-packet-limiter-config.patch similarity index 100% rename from patches/unapplied/server/0719-Add-packet-limiter-config.patch rename to patches/server/0714-Add-packet-limiter-config.patch diff --git a/patches/unapplied/server/0721-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch b/patches/server/0715-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch similarity index 100% rename from patches/unapplied/server/0721-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch rename to patches/server/0715-Don-t-read-neighbour-chunk-data-off-disk-when-conver.patch diff --git a/patches/unapplied/server/0722-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0716-Consolidate-flush-calls-for-entity-tracker-packets.patch similarity index 93% rename from patches/unapplied/server/0722-Consolidate-flush-calls-for-entity-tracker-packets.patch rename to patches/server/0716-Consolidate-flush-calls-for-entity-tracker-packets.patch index 72fc653534..68cff490cf 100644 --- a/patches/unapplied/server/0722-Consolidate-flush-calls-for-entity-tracker-packets.patch +++ b/patches/server/0716-Consolidate-flush-calls-for-entity-tracker-packets.patch @@ -22,10 +22,10 @@ With this change I could get all 200 on at 0ms ping. So in general this patch should reduce Netty I/O thread load. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2aba72cd7a87b8b999cfbc7a2e7a58ea95717c19..4ff563d903633f181e1268daa77f250cfec204a0 100644 +index ebd0da4f87c74f12d702e1ae4f3206885272e4f7..ca84eddbdb1e198b899750e5f6b3eafd25ce970f 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -804,7 +804,24 @@ public class ServerChunkCache extends ChunkSource { +@@ -805,7 +805,24 @@ public class ServerChunkCache extends ChunkSource { this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing gameprofilerfiller.pop(); // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded diff --git a/patches/unapplied/server/0723-Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/0717-Don-t-lookup-fluid-state-when-raytracing.patch similarity index 100% rename from patches/unapplied/server/0723-Don-t-lookup-fluid-state-when-raytracing.patch rename to patches/server/0717-Don-t-lookup-fluid-state-when-raytracing.patch diff --git a/patches/unapplied/server/0724-Time-scoreboard-search.patch b/patches/server/0718-Time-scoreboard-search.patch similarity index 100% rename from patches/unapplied/server/0724-Time-scoreboard-search.patch rename to patches/server/0718-Time-scoreboard-search.patch diff --git a/patches/unapplied/server/0725-Send-full-pos-packets-for-hard-colliding-entities.patch b/patches/server/0719-Send-full-pos-packets-for-hard-colliding-entities.patch similarity index 91% rename from patches/unapplied/server/0725-Send-full-pos-packets-for-hard-colliding-entities.patch rename to patches/server/0719-Send-full-pos-packets-for-hard-colliding-entities.patch index cb24315567..1ae392d87b 100644 --- a/patches/unapplied/server/0725-Send-full-pos-packets-for-hard-colliding-entities.patch +++ b/patches/server/0719-Send-full-pos-packets-for-hard-colliding-entities.patch @@ -9,10 +9,10 @@ Configurable under `send-full-pos-for-hard-colliding-entities` diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 98b8239205c61df5a2a4e344c50645e2cd2cbaad..523a4963b644cec57c7338cdda72b5e17247f49a 100644 +index 6281ade15b2700d16dc1f98c2affea8c0ba936c9..64683e218c9c43cfd30514800cfa8da42e37563e 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -165,7 +165,7 @@ public class ServerEntity { +@@ -169,7 +169,7 @@ public class ServerEntity { long i1 = this.positionCodec.encodeZ(vec3d); boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; diff --git a/patches/unapplied/server/0726-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0720-Do-not-run-raytrace-logic-for-AIR.patch similarity index 100% rename from patches/unapplied/server/0726-Do-not-run-raytrace-logic-for-AIR.patch rename to patches/server/0720-Do-not-run-raytrace-logic-for-AIR.patch diff --git a/patches/unapplied/server/0727-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch similarity index 87% rename from patches/unapplied/server/0727-Oprimise-map-impl-for-tracked-players.patch rename to patches/server/0721-Oprimise-map-impl-for-tracked-players.patch index 3276261701..aa79e9cced 100644 --- a/patches/unapplied/server/0727-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch @@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f2a8a1a47080cd3c62ece108d34f05cf48973472..315fec3941d71ee29c8f2fdc864c227bde54a0ca 100644 +index 109baae0c68b28720508af4a9e0b32b72b3dcb23..fab05c504ede66b91f07666341df70338ab4b6db 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1360,7 +1360,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1397,7 +1397,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/unapplied/server/0728-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0722-Optimise-BlockSoil-nearby-water-lookup.patch similarity index 100% rename from patches/unapplied/server/0728-Optimise-BlockSoil-nearby-water-lookup.patch rename to patches/server/0722-Optimise-BlockSoil-nearby-water-lookup.patch diff --git a/patches/unapplied/server/0729-Optimise-random-block-ticking.patch b/patches/server/0723-Optimise-random-block-ticking.patch similarity index 90% rename from patches/unapplied/server/0729-Optimise-random-block-ticking.patch rename to patches/server/0723-Optimise-random-block-ticking.patch index 503e12f650..ddddbaa824 100644 --- a/patches/unapplied/server/0729-Optimise-random-block-ticking.patch +++ b/patches/server/0723-Optimise-random-block-ticking.patch @@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdcbee89d18 100644 +index 3ba995c8d21427a3dbbde22c8faa0a7888507880..02e58f7de47af48c9e23dfd2ebe5fab9967dd82c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -706,6 +706,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -707,6 +707,10 @@ public class ServerLevel extends Level implements WorldGenLevel { entityplayer.stopSleepInBed(false, false); }); } @@ -104,7 +104,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc public void tickChunk(LevelChunk chunk, int randomTickSpeed) { ChunkPos chunkcoordintpair = chunk.getPos(); -@@ -715,10 +719,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -716,10 +720,10 @@ public class ServerLevel extends Level implements WorldGenLevel { ProfilerFiller gameprofilerfiller = this.getProfiler(); gameprofilerfiller.push("thunder"); @@ -117,9 +117,9 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper -@@ -742,64 +746,75 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -749,18 +753,26 @@ public class ServerLevel extends Level implements WorldGenLevel { + int l; - gameprofilerfiller.popPush("iceandsnow"); if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow - blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15)); - BlockPos blockposition1 = blockposition.below(); @@ -141,14 +141,21 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc } if (flag) { + int i1 = this.getGameRules().getInt(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT); + BlockState iblockdata; + + blockposition.setY(normalY); // Paper - if (biomebase.shouldSnow(this, blockposition)) { - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit + if (i1 > 0 && biomebase.shouldSnow(this, blockposition)) { + iblockdata = this.getBlockState(blockposition); + if (iblockdata.is(Blocks.SNOW)) { +@@ -775,52 +787,55 @@ public class ServerLevel extends Level implements WorldGenLevel { + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit + } } + blockposition.setY(downY); // Paper -- BlockState iblockdata = this.getBlockState(blockposition1); -+ BlockState iblockdata = this.getBlockState(blockposition); // Paper +- iblockdata = this.getBlockState(blockposition1); ++ iblockdata = this.getBlockState(blockposition); // Paper Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation(); - if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) { @@ -167,19 +174,19 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc timings.chunkTicksBlocks.startTiming(); // Paper if (randomTickSpeed > 0) { - LevelChunkSection[] achunksection = chunk.getSections(); -- int l = achunksection.length; +- int j1 = achunksection.length; - -- for (int i1 = 0; i1 < l; ++i1) { -- LevelChunkSection chunksection = achunksection[i1]; +- for (int k1 = 0; k1 < j1; ++k1) { +- LevelChunkSection chunksection = achunksection[k1]; - - if (chunksection.isRandomlyTicking()) { -- int j1 = chunksection.bottomBlockY(); +- int l1 = chunksection.bottomBlockY(); - -- for (int k1 = 0; k1 < randomTickSpeed; ++k1) { -- BlockPos blockposition2 = this.getBlockRandomPos(j, j1, k, 15); +- for (l = 0; l < randomTickSpeed; ++l) { +- BlockPos blockposition2 = this.getBlockRandomPos(j, l1, k, 15); - - gameprofilerfiller.push("randomTick"); -- BlockState iblockdata1 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k); +- BlockState iblockdata2 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - l1, blockposition2.getZ() - k); + LevelChunkSection[] sections = chunk.getSections(); + int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); + for (int sectionIndex = 0; sectionIndex < sections.length; ++sectionIndex) { @@ -188,8 +195,8 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc + continue; + } -- if (iblockdata1.isRandomlyTicking()) { -- iblockdata1.randomTick(this, blockposition2, this.random); +- if (iblockdata2.isRandomlyTicking()) { +- iblockdata2.randomTick(this, blockposition2, this.random); - } + int yPos = (sectionIndex + minSection) << 4; + for (int a = 0; a < randomTickSpeed; ++a) { @@ -199,7 +206,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc + continue; + } -- FluidState fluid = iblockdata1.getFluidState(); +- FluidState fluid = iblockdata2.getFluidState(); + long raw = section.tickingList.getRaw(index); + int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw); + int randomX = location & 15; @@ -216,7 +223,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc - } + iblockdata.randomTick(this, blockposition2, this.randomTickRandom); + // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock). -+ // TODO CHECK ON UPDATE ++ // TODO CHECK ON UPDATE (ping the Canadian) } } } @@ -299,7 +306,7 @@ index 9686ce7536c9924b1b2aced4f013f46759cbc72e..5d8e9bdf5538b19681f21949368d862f public void getAll(IntConsumer action) { for(int i = 0; i < this.size; ++i) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 0cea2eacfe3264a9b3500dc3a6a19d21d74d54e9..4764b975386f1c5629a59f762f7ba1c1ae2598c5 100644 +index 30663713e198bfe40b95c48524b71ea65f39965e..25503678e7d049a8b3172cfad8a5606958c32302 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java @@ -83,7 +83,7 @@ public class Turtle extends Animal { @@ -312,10 +319,10 @@ index 0cea2eacfe3264a9b3500dc3a6a19d21d74d54e9..4764b975386f1c5629a59f762f7ba1c1 public BlockPos getHomePos() { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 97623e46160bf038bbcc4584bb921d524b3830c0..b5fd3a9b58fb56db92d579d307edc99bbe344c79 100644 +index c56de0c388f5902d85b0810c6e105c24d721bcdd..62bf7fec8188e69e7811aa4e1f0f3131f8af0bd7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1306,10 +1306,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1368,10 +1368,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract RecipeManager getRecipeManager(); public BlockPos getBlockRandomPos(int x, int y, int z, int l) { @@ -429,7 +436,7 @@ index 066874d27495dcaa3dea254b7328257e46920357..c3f1334b2bb97f0633f3ea43b97ee49a public PalettedContainer getStates() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 9e652cf68b289696b5aee53ac157fc52cca10d2c..7908360dd47937b2cb702e381802b7b278a5198e 100644 +index 5cd4b81a9e89402c617aa3458200b95faa551c9c..2362688501d246f4a1ced41d63f75548a19ad013 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -383,6 +383,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer diff --git a/patches/unapplied/server/0730-Optimise-non-flush-packet-sending.patch b/patches/server/0724-Optimise-non-flush-packet-sending.patch similarity index 100% rename from patches/unapplied/server/0730-Optimise-non-flush-packet-sending.patch rename to patches/server/0724-Optimise-non-flush-packet-sending.patch diff --git a/patches/unapplied/server/0731-Optimise-nearby-player-lookups.patch b/patches/server/0725-Optimise-nearby-player-lookups.patch similarity index 94% rename from patches/unapplied/server/0731-Optimise-nearby-player-lookups.patch rename to patches/server/0725-Optimise-nearby-player-lookups.patch index b274fbcd07..2192d15dda 100644 --- a/patches/unapplied/server/0731-Optimise-nearby-player-lookups.patch +++ b/patches/server/0725-Optimise-nearby-player-lookups.patch @@ -39,10 +39,10 @@ index e11ec87e8007979a1c6932b414bcd70c10db746c..bc46479fd0622a90fd98ac88f92b2840 // Paper end diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd119aa2c44d 100644 +index fab05c504ede66b91f07666341df70338ab4b6db..fb47e820beb5b8224a44d41a7b83e10e6eb783c1 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -152,6 +152,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -156,6 +156,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final ReferenceOpenHashSet needsChangeBroadcasting = new ReferenceOpenHashSet<>(); // Paper - rewrite chunk system @@ -55,7 +55,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -204,6 +210,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -208,6 +214,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player))); } // Paper end - use distance map to optimise entity tracker @@ -63,7 +63,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11 } void removePlayerFromDistanceMaps(ServerPlayer player) { -@@ -213,6 +220,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -217,6 +224,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -71,7 +71,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11 // Paper start - per player mob spawning if (this.playerMobDistanceMap != null) { this.playerMobDistanceMap.remove(player); -@@ -244,6 +252,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -248,6 +256,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player))); } // Paper end - use distance map to optimise entity tracker @@ -79,7 +79,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11 } // Paper end // Paper start -@@ -397,6 +406,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -405,6 +414,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } }); // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning @@ -104,10 +104,10 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11 protected ChunkGenerator generator() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c077367581521cc1d 100644 +index 02e58f7de47af48c9e23dfd2ebe5fab9967dd82c..91b4866c15104ad8ed7b0967df1fc8d9e433b096 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -443,6 +443,84 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -446,6 +446,84 @@ public class ServerLevel extends Level implements WorldGenLevel { // Paper end public final ReferenceOpenHashSet pendingLogin = new ReferenceOpenHashSet<>(); // Paper @@ -191,8 +191,8 @@ index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c07736758 + // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { - // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error -@@ -546,6 +624,14 @@ public class ServerLevel extends Level implements WorldGenLevel { + // Holder holder = worlddimension.type(); // CraftBukkit - decompile error +@@ -549,6 +627,14 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void tick(BooleanSupplier shouldKeepTicking) { @@ -208,10 +208,10 @@ index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c07736758 this.handlingTick = true; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 147ec41ae4a3b9e9ad495ab4309c9f7306122749..cf40ebd06c52a7a00e6f704a29ae9d2b5186d35a 100644 +index 082da4f8eaede9d7f70341c207a2aaa6f07b997e..49b983064ea810382b6112f5dc7f93ba4e5710bd 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -808,7 +808,12 @@ public abstract class Mob extends LivingEntity { +@@ -826,7 +826,12 @@ public abstract class Mob extends LivingEntity { if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { @@ -226,10 +226,10 @@ index 147ec41ae4a3b9e9ad495ab4309c9f7306122749..cf40ebd06c52a7a00e6f704a29ae9d2b if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b5fd3a9b58fb56db92d579d307edc99bbe344c79..09c2d318330e03d0230a82b30985bba3a4231615 100644 +index 62bf7fec8188e69e7811aa4e1f0f3131f8af0bd7..363d908ef7707311210fa662f706c59a8a5e7f76 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -205,6 +205,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -204,6 +204,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.getChunkIfLoaded(chunkX, chunkZ) != null; } // Paper end @@ -300,10 +300,10 @@ index b5fd3a9b58fb56db92d579d307edc99bbe344c79..09c2d318330e03d0230a82b30985bba3 public abstract ResourceKey getTypeKey(); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c60f6c5e4a 100644 +index 0a49769bfa83d0b9c435e3ab4bba85979d660ff8..01b21f520ef1c834b9bafc3de85c1fa4fcf539d6 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -259,7 +259,7 @@ public final class NaturalSpawner { +@@ -260,7 +260,7 @@ public final class NaturalSpawner { blockposition_mutableblockposition.set(l, i, i1); double d0 = (double) l + 0.5D; double d1 = (double) i1 + 0.5D; @@ -312,7 +312,7 @@ index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c6 if (entityhuman != null) { double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); -@@ -333,7 +333,7 @@ public final class NaturalSpawner { +@@ -334,7 +334,7 @@ public final class NaturalSpawner { } private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { @@ -322,7 +322,7 @@ index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c6 private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index aa3adc628178962ce89df0e372c925e8f4801606..5e54cf312160e537d2fe6e6fedc618160359330e 100644 +index a3c1bba1c1f795d203207776bab41b4b8f4e69d7..28e4b302284f955a73e75d0f4276d55fb51826f5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -269,6 +269,98 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/unapplied/server/0732-Remove-streams-for-villager-AI.patch b/patches/server/0726-Remove-streams-for-villager-AI.patch similarity index 65% rename from patches/unapplied/server/0732-Remove-streams-for-villager-AI.patch rename to patches/server/0726-Remove-streams-for-villager-AI.patch index 7493d3ad6b..b4ef086afb 100644 --- a/patches/unapplied/server/0732-Remove-streams-for-villager-AI.patch +++ b/patches/server/0726-Remove-streams-for-villager-AI.patch @@ -5,97 +5,69 @@ Subject: [PATCH] Remove streams for villager AI diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a8f6fa4f0 100644 +index b45c4f50705f80163d44d9e588f86a5770f5be38..10cbb80c7cd9ba30150d8d935c0d115719c35509 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -@@ -30,11 +30,19 @@ public class GateBehavior extends Behavior { +@@ -52,7 +52,7 @@ public class GateBehavior implements BehaviorControl + if (this.hasRequiredMemories(entity)) { + this.status = Behavior.Status.RUNNING; + this.orderPolicy.apply(this.behaviors); +- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time); ++ this.runningPolicy.apply(this.behaviors.entries, world, entity, time); + return true; + } else { + return false; +@@ -61,11 +61,13 @@ public class GateBehavior implements BehaviorControl @Override - protected boolean canStillUse(ServerLevel world, E entity, long time) { -- return this.behaviors.stream().filter((task) -> { -- return task.getStatus() == Behavior.Status.RUNNING; -- }).anyMatch((task) -> { -- return task.canStillUse(world, entity, time); -- }); -+ // Paper start - remove streams -+ List>> entries = this.behaviors.entries; -+ for (int i = 0; i < entries.size(); i++) { -+ ShufflingList.WeightedEntry> entry = entries.get(i); -+ Behavior behavior = entry.getData(); -+ if (behavior.getStatus() == Status.RUNNING) { -+ if (behavior.canStillUse(world, entity, time)) { -+ return true; -+ } -+ } -+ } -+ return false; -+ // Paper end - remove streams - } - - @Override -@@ -45,25 +53,35 @@ public class GateBehavior extends Behavior { - @Override - protected void start(ServerLevel world, E entity, long time) { - this.orderPolicy.apply(this.behaviors); -- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time); -+ this.runningPolicy.apply(this.behaviors.entries, world, entity, time); // Paper - remove streams - } - - @Override - protected void tick(ServerLevel world, E entity, long time) { + public final void tickOrStop(ServerLevel world, E entity, long time) { - this.behaviors.stream().filter((task) -> { - return task.getStatus() == Behavior.Status.RUNNING; - }).forEach((task) -> { - task.tickOrStop(world, entity, time); - }); -+ // Paper start - remove streams -+ List>> entries = this.behaviors.entries; -+ for (int i = 0; i < entries.size(); i++) { -+ ShufflingList.WeightedEntry> entry = entries.get(i); -+ Behavior behavior = entry.getData(); -+ if (behavior.getStatus() == Status.RUNNING) { -+ behavior.tickOrStop(world, entity, time); ++ // Paper start ++ for (BehaviorControl task : this.behaviors) { ++ if (task.getStatus() == Behavior.Status.RUNNING) { ++ task.tickOrStop(world, entity, time); + } + } -+ // Paper end - remove streams - } - ++ // Paper end + if (this.behaviors.stream().noneMatch((task) -> { + return task.getStatus() == Behavior.Status.RUNNING; + })) { +@@ -77,11 +79,11 @@ public class GateBehavior implements BehaviorControl @Override - protected void stop(ServerLevel world, E entity, long time) { + public final void doStop(ServerLevel world, E entity, long time) { + this.status = Behavior.Status.STOPPED; - this.behaviors.stream().filter((task) -> { - return task.getStatus() == Behavior.Status.RUNNING; - }).forEach((task) -> { - task.doStop(world, entity, time); - }); -+ // Paper start - remove streams -+ List>> entries = this.behaviors.entries; -+ for (int i = 0; i < entries.size(); i++) { -+ ShufflingList.WeightedEntry> entry = entries.get(i); -+ Behavior behavior = entry.getData(); -+ if (behavior.getStatus() == Status.RUNNING) { ++ for (BehaviorControl behavior : this.behaviors) { ++ if (behavior.getStatus() == Behavior.Status.RUNNING) { + behavior.doStop(world, entity, time); + } + } -+ // Paper end - remove streams this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory); } -@@ -94,25 +112,33 @@ public class GateBehavior extends Behavior { +@@ -117,25 +119,31 @@ public class GateBehavior implements BehaviorControl public static enum RunningPolicy { RUN_ONE { @Override -- public void apply(Stream> tasks, ServerLevel world, E entity, long time) { +- public void apply(Stream> tasks, ServerLevel world, E entity, long time) { - tasks.filter((task) -> { - return task.getStatus() == Behavior.Status.STOPPED; - }).filter((task) -> { - return task.tryStart(world, entity, time); - }).findFirst(); + // Paper start - remove streams -+ public void apply(List>> tasks, ServerLevel world, E entity, long time) { -+ for (int i = 0; i < tasks.size(); i++) { -+ ShufflingList.WeightedEntry> task = tasks.get(i); -+ Behavior behavior = task.getData(); -+ if (behavior.getStatus() == Status.STOPPED && behavior.tryStart(world, entity, time)) { ++ public void apply(List>> tasks, ServerLevel world, E entity, long time) { ++ for (ShufflingList.WeightedEntry> task : tasks) { ++ final BehaviorControl behavior = task.getData(); ++ if (behavior.getStatus() == Behavior.Status.STOPPED && behavior.tryStart(world, entity, time)) { + break; + } + } @@ -104,18 +76,17 @@ index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a }, TRY_ALL { @Override -- public void apply(Stream> tasks, ServerLevel world, E entity, long time) { +- public void apply(Stream> tasks, ServerLevel world, E entity, long time) { - tasks.filter((task) -> { - return task.getStatus() == Behavior.Status.STOPPED; - }).forEach((task) -> { - task.tryStart(world, entity, time); - }); + // Paper start - remove streams -+ public void apply(List>> tasks, ServerLevel world, E entity, long time) { -+ for (int i = 0; i < tasks.size(); i++) { -+ ShufflingList.WeightedEntry> task = tasks.get(i); -+ Behavior behavior = task.getData(); -+ if (behavior.getStatus() == Status.STOPPED) { ++ public void apply(List>> tasks, ServerLevel world, E entity, long time) { ++ for (ShufflingList.WeightedEntry> task : tasks) { ++ final BehaviorControl behavior = task.getData(); ++ if (behavior.getStatus() == Behavior.Status.STOPPED) { + behavior.tryStart(world, entity, time); + } + } @@ -123,18 +94,18 @@ index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a } }; -- public abstract void apply(Stream> tasks, ServerLevel world, E entity, long time); -+ public abstract void apply(List>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams +- public abstract void apply(Stream> tasks, ServerLevel world, E entity, long time); ++ public abstract void apply(List>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams } } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java -index 090bba46b6ecd7d0e1415feb678b9b23264fe5e9..ca771d60283d94c00aa65d06ef93071e412357e8 100644 +index 731ef21dbbd25d6924717de42f4569a9b5935643..fe3ab3d388f0481fb0db06b7f730f868dbf8e8a5 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java -@@ -12,7 +12,7 @@ import java.util.stream.Stream; +@@ -14,7 +14,7 @@ import java.util.stream.Stream; import net.minecraft.util.RandomSource; - public class ShufflingList { + public class ShufflingList implements Iterable { - protected final List> entries; + public final List> entries; // Paper - public private final RandomSource random = RandomSource.create(); diff --git a/patches/unapplied/server/0733-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/0727-Use-Velocity-compression-and-cipher-natives.patch similarity index 98% rename from patches/unapplied/server/0733-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/0727-Use-Velocity-compression-and-cipher-natives.patch index 2d537af7f4..cfe7c74e18 100644 --- a/patches/unapplied/server/0733-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/0727-Use-Velocity-compression-and-cipher-natives.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index 2d1e639bd2880469d849ca1242184b0af1f6903c..88000dae363f55044f86e72e9f6fb0214cd320bc 100644 +index 8f32e0c3078366f4b07a499b1838929564a05b76..f9839f17bcda4619c257162e9bf14d5e00053c80 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,6 +27,11 @@ dependencies { @@ -341,10 +341,10 @@ index b80aedd2002959b4026c27ce76b3ed17f0acfb5b..2985271132c9ae822dcb0d7a7e6f0c26 protected void initChannel(Channel channel) { try { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index fa469313d4b38bd9441b3010743e1054420bd525..7d7d7336eea6db6505b57198cca2b03960fb1ec0 100644 +index 7661f248c1c0b8de3b15793f45bf239ab561083b..721de6bb83603be91e28ff13271697f9434d9f87 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -304,12 +304,14 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se +@@ -265,12 +265,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } SecretKey secretkey = packet.getSecretKey(privatekey); diff --git a/patches/unapplied/server/0734-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch b/patches/server/0728-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch similarity index 93% rename from patches/unapplied/server/0734-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch rename to patches/server/0728-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch index c69b1c2d8f..ca977f9517 100644 --- a/patches/unapplied/server/0734-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch +++ b/patches/server/0728-Reduce-worldgen-thread-worker-count-for-low-core-cou.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reduce worldgen thread worker count for low core count CPUs diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index adb1c48f42157fb127be4fd9f0a6f3784d8c4b39..998f63fba0d45a44eaf9cbe48a034bac4e02e965 100644 +index 439ae035d8b2787916e017e2636115b5455811f1..a54c0a4d0849087229d08ccc89872c3603f2f426 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -146,7 +146,19 @@ public class Util { diff --git a/patches/unapplied/server/0735-Async-catch-modifications-to-critical-entity-state.patch b/patches/server/0729-Async-catch-modifications-to-critical-entity-state.patch similarity index 100% rename from patches/unapplied/server/0735-Async-catch-modifications-to-critical-entity-state.patch rename to patches/server/0729-Async-catch-modifications-to-critical-entity-state.patch diff --git a/patches/unapplied/server/0736-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0730-Fix-Bukkit-NamespacedKey-shenanigans.patch similarity index 100% rename from patches/unapplied/server/0736-Fix-Bukkit-NamespacedKey-shenanigans.patch rename to patches/server/0730-Fix-Bukkit-NamespacedKey-shenanigans.patch diff --git a/patches/unapplied/server/0737-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0731-Fix-merchant-inventory-not-closing-on-entity-removal.patch similarity index 90% rename from patches/unapplied/server/0737-Fix-merchant-inventory-not-closing-on-entity-removal.patch rename to patches/server/0731-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 8138bbd8b7..7d0fc1ab3f 100644 --- a/patches/unapplied/server/0737-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0731-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 502da788bace6c078fc3c58c077367581521cc1d..ffe42e757d11978d861a70b69f9050014f7f8ea8 100644 +index 91b4866c15104ad8ed7b0967df1fc8d9e433b096..2b823f40c9435cfac6590487426e1ec1c051ecec 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2609,6 +2609,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2590,6 +2590,11 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/unapplied/server/0738-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0732-Check-requirement-before-suggesting-root-nodes.patch similarity index 100% rename from patches/unapplied/server/0738-Check-requirement-before-suggesting-root-nodes.patch rename to patches/server/0732-Check-requirement-before-suggesting-root-nodes.patch diff --git a/patches/unapplied/server/0739-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0733-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch similarity index 87% rename from patches/unapplied/server/0739-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch rename to patches/server/0733-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index 900fc0f6cf..bfb98e8fb3 100644 --- a/patches/unapplied/server/0739-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0733-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 131577917ef0420f6b75a3cfa896ba4306ded3e7..eab752600a2711a73516fa029b8eca17d52fde3c 100644 +index 875cf692f747b51c16c69e40e0fd5af0161cf858..045f1b81e568d9adca8e5f9374b5a3ce1267d118 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -847,6 +847,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -839,6 +839,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Paper end // CraftBukkit end diff --git a/patches/unapplied/server/0740-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch b/patches/server/0734-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch similarity index 100% rename from patches/unapplied/server/0740-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch rename to patches/server/0734-Fix-setPatternColor-on-tropical-fish-bucket-meta.patch diff --git a/patches/unapplied/server/0741-Ensure-valid-vehicle-status.patch b/patches/server/0735-Ensure-valid-vehicle-status.patch similarity index 84% rename from patches/unapplied/server/0741-Ensure-valid-vehicle-status.patch rename to patches/server/0735-Ensure-valid-vehicle-status.patch index 914ee7494b..58fb98c68f 100644 --- a/patches/unapplied/server/0741-Ensure-valid-vehicle-status.patch +++ b/patches/server/0735-Ensure-valid-vehicle-status.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index eac88fdb3c9184e9c0d3500c62fbc34958bfcb47..1463d210656c801f8da89d8a2060680684e9c46e 100644 +index d02cab4c09e2036f6b1ac3667ef8282475daf015..cbe4bf568d5bc97b316f3a9af7a1ad9d88f7f3b5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -498,7 +498,7 @@ public class ServerPlayer extends Player { +@@ -520,7 +520,7 @@ public class ServerPlayer extends Player { } } diff --git a/patches/unapplied/server/0742-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0736-Prevent-softlocked-end-exit-portal-generation.patch similarity index 87% rename from patches/unapplied/server/0742-Prevent-softlocked-end-exit-portal-generation.patch rename to patches/server/0736-Prevent-softlocked-end-exit-portal-generation.patch index 2286afa5f2..1d63ee96cc 100644 --- a/patches/unapplied/server/0742-Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/0736-Prevent-softlocked-end-exit-portal-generation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 99b175625c79fe5c4d944810e3fe11be5eed997f..f8d846345c1cc3c78f9ac14635b26f2affc77190 100644 +index abd13cefd3d8409e1ef8ea70d92877f76f89da6c..230de1c71b0a6d6370df2fedb337cf0e332a7596 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -413,6 +413,11 @@ public class EndDragonFight { +@@ -419,6 +419,11 @@ public class EndDragonFight { } } diff --git a/patches/unapplied/server/0743-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0737-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch similarity index 100% rename from patches/unapplied/server/0743-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch rename to patches/server/0737-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch diff --git a/patches/unapplied/server/0744-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0738-Don-t-log-debug-logging-being-disabled.patch similarity index 88% rename from patches/unapplied/server/0744-Don-t-log-debug-logging-being-disabled.patch rename to patches/server/0738-Don-t-log-debug-logging-being-disabled.patch index 83460a961a..82e266f96e 100644 --- a/patches/unapplied/server/0744-Don-t-log-debug-logging-being-disabled.patch +++ b/patches/server/0738-Don-t-log-debug-logging-being-disabled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index edc5f195cc3de8885b839469656650ba465346be..5d162f59fc5ef9adf7fa762b137bbcfca745d9c5 100644 +index 3ac48dafe2300ff4cf4591569fec9ce4916503cd..612c3169c3463d702b85975e1db79ae6e47d60d0 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -382,7 +382,7 @@ public class SpigotConfig diff --git a/patches/unapplied/server/0745-fix-various-menus-with-empty-level-accesses.patch b/patches/server/0739-fix-various-menus-with-empty-level-accesses.patch similarity index 100% rename from patches/unapplied/server/0745-fix-various-menus-with-empty-level-accesses.patch rename to patches/server/0739-fix-various-menus-with-empty-level-accesses.patch diff --git a/patches/unapplied/server/0746-Preserve-overstacked-loot.patch b/patches/server/0740-Preserve-overstacked-loot.patch similarity index 59% rename from patches/unapplied/server/0746-Preserve-overstacked-loot.patch rename to patches/server/0740-Preserve-overstacked-loot.patch index e39eb87bbc..7c769f4be4 100644 --- a/patches/unapplied/server/0746-Preserve-overstacked-loot.patch +++ b/patches/server/0740-Preserve-overstacked-loot.patch @@ -10,47 +10,52 @@ chunk bans via the large amount of NBT created by unstacking the items. Fixes GH-5140 and GH-4748. diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..375d26ac2453f637bac3fa89873b6760095916b7 100644 +index 1326539c88aabfbe1bbaf2905268abfa729d8167..3bc13092873609af9c6f412190dd989d39f1df23 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -@@ -56,9 +56,17 @@ public class LootTable { +@@ -56,14 +56,22 @@ public class LootTable { this.compositeFunction = LootItemFunctions.compose(functions); } -+ @Deprecated // Paper - preserve overstacked items - public static Consumer createStackSplitter(Consumer lootConsumer) { + // Paper start - preserve overstacked items -+ return createStackSplitter(lootConsumer, null); ++ @Deprecated + public static Consumer createStackSplitter(LootContext context, Consumer consumer) { ++ return createStackSplitter(context, consumer, null); + } -+ -+ public static Consumer createStackSplitter(Consumer lootConsumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel world) { -+ boolean skipSplitter = world != null && !world.paperConfig().fixes.splitOverstackedLoot; -+ // Paper end ++ public static Consumer createStackSplitter(LootContext context, Consumer consumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel level) { ++ boolean skipSplitter = level != null && !level.paperConfig().fixes.splitOverstackedLoot; ++ // Paper end return (itemstack) -> { -- if (itemstack.getCount() < itemstack.getMaxStackSize()) { -+ if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items - lootConsumer.accept(itemstack); - } else { - int i = itemstack.getCount(); -@@ -95,7 +103,7 @@ public class LootTable { + if (itemstack.isItemEnabled(context.getLevel().enabledFeatures())) { +- if (itemstack.getCount() < itemstack.getMaxStackSize()) { ++ if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items + consumer.accept(itemstack); + } else { + int i = itemstack.getCount(); + ++ + while (i > 0) { + ItemStack itemstack1 = itemstack.copy(); + +@@ -97,7 +105,7 @@ public class LootTable { } public void getRandomItems(LootContext context, Consumer lootConsumer) { -- this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer)); -+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items +- this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer)); ++ this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer, context.getLevel())); // Paper - preserve overstacked items } public ObjectArrayList getRandomItems(LootContext context) { diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java -index 057676201aa2d19032537832849f3857425d357a..b5c6b7280a9c6964e2ad4aa9bd4517146c98e727 100644 +index 880a0686519dc033b3c3b2bf0126f49af6fb48de..eddad9593bccd9e91fbb6d79fa2bdd766b004690 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java @@ -46,7 +46,7 @@ public class SetContainerContents extends LootItemConditionalFunction { NonNullList nonNullList = NonNullList.create(); this.entries.forEach((entry) -> { entry.expand(context, (choice) -> { -- choice.createItemStack(LootTable.createStackSplitter(nonNullList::add), context); -+ choice.createItemStack(LootTable.createStackSplitter(nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items +- choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add), context); ++ choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items }); }); CompoundTag compoundTag = new CompoundTag(); diff --git a/patches/unapplied/server/0747-Update-head-rotation-in-missing-places.patch b/patches/server/0741-Update-head-rotation-in-missing-places.patch similarity index 84% rename from patches/unapplied/server/0747-Update-head-rotation-in-missing-places.patch rename to patches/server/0741-Update-head-rotation-in-missing-places.patch index 416e9b0fff..9184900b7b 100644 --- a/patches/unapplied/server/0747-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0741-Update-head-rotation-in-missing-places.patch @@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8d342290a9ed81b20260e2e4f7262e03332464b1..3194c4461a5a86e28e73414a94dbfa7e611ee3a8 100644 +index a4d4e5cb3bd7a4816671b058c640ccc90dec8f54..9a6a3718788e7085f6defc3c82ba4bb66dd6c5b3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1763,6 +1763,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1778,6 +1778,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F); this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); @@ -19,7 +19,7 @@ index 8d342290a9ed81b20260e2e4f7262e03332464b1..3194c4461a5a86e28e73414a94dbfa7e } public void absMoveTo(double x, double y, double z) { -@@ -1801,6 +1802,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1816,6 +1817,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setXRot(pitch); this.setOldPosAndRot(); this.reapplyPosition(); diff --git a/patches/unapplied/server/0748-prevent-unintended-light-block-manipulation.patch b/patches/server/0742-prevent-unintended-light-block-manipulation.patch similarity index 86% rename from patches/unapplied/server/0748-prevent-unintended-light-block-manipulation.patch rename to patches/server/0742-prevent-unintended-light-block-manipulation.patch index 08bd6164f5..745b4cd9b5 100644 --- a/patches/unapplied/server/0748-prevent-unintended-light-block-manipulation.patch +++ b/patches/server/0742-prevent-unintended-light-block-manipulation.patch @@ -5,13 +5,13 @@ Subject: [PATCH] prevent unintended light block manipulation diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java -index d648902737350103c2078c80796038a054f16acc..98124ee3bea51e40a9a3cb9014ee84bfc26e91f7 100644 +index 6427302f53336fe035882d0a09e3e2d2d929d3b7..6eec44c484763f877aece6d9676ffc166bc10395 100644 --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java @@ -46,6 +46,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { - if (!world.isClientSide) { + if (!world.isClientSide && player.canUseGameMasterBlocks()) { + if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper world.setBlock(pos, state.cycle(LEVEL), 2); return InteractionResult.SUCCESS; diff --git a/patches/unapplied/server/0749-Fix-CraftCriteria-defaults-map.patch b/patches/server/0743-Fix-CraftCriteria-defaults-map.patch similarity index 100% rename from patches/unapplied/server/0749-Fix-CraftCriteria-defaults-map.patch rename to patches/server/0743-Fix-CraftCriteria-defaults-map.patch diff --git a/patches/unapplied/server/0750-Fix-upstreams-block-state-factories.patch b/patches/server/0744-Fix-upstreams-block-state-factories.patch similarity index 90% rename from patches/unapplied/server/0750-Fix-upstreams-block-state-factories.patch rename to patches/server/0744-Fix-upstreams-block-state-factories.patch index 7bd43e5ec1..39937c6c17 100644 --- a/patches/unapplied/server/0750-Fix-upstreams-block-state-factories.patch +++ b/patches/server/0744-Fix-upstreams-block-state-factories.patch @@ -13,7 +13,7 @@ the material type of the block at that location. public net.minecraft.world.level.block.entity.BlockEntityType validBlocks diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index b0174aedb7358af1e80278e2f5f13e00c35ab3c6..d62181bd8bccfcfdd7da8f635bdf7ebc36294705 100644 +index be98a87edbe62cfcf5c1b6f6cd1d8e31b546c144..4e2cd5435cc2c87bc604e7eba4f587c0b029e571 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -250,7 +250,7 @@ public abstract class BlockEntity { @@ -39,7 +39,7 @@ index 87c25170fbe8b0591d452612496ee1a627138de7..a2894f02ceb7c58f6eafe055e1ff47b1 private final T tileEntity; private final T snapshot; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f490fe4712f 100644 +index 812eb8c75bf5308a3a0771a1faabdb22a3d80c28..670d69c04626cb606081e06c4caf92686af4c860 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java @@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity; @@ -50,7 +50,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; import net.minecraft.world.level.block.entity.CampfireBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity; -@@ -108,187 +109,57 @@ public final class CraftBlockStates { +@@ -110,217 +111,58 @@ public final class CraftBlockStates { private static final BlockStateFactory DEFAULT_FACTORY = new BlockStateFactory(CraftBlockState.class) { @Override public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) { @@ -76,6 +76,8 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 - Arrays.asList( - Material.ACACIA_SIGN, - Material.ACACIA_WALL_SIGN, +- Material.BAMBOO_SIGN, +- Material.BAMBOO_WALL_SIGN, - Material.BIRCH_SIGN, - Material.BIRCH_WALL_SIGN, - Material.CRIMSON_SIGN, @@ -97,10 +99,37 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 - - register( - Arrays.asList( +- Material.ACACIA_HANGING_SIGN, +- Material.ACACIA_WALL_HANGING_SIGN, +- Material.BAMBOO_HANGING_SIGN, +- Material.BAMBOO_WALL_HANGING_SIGN, +- Material.BIRCH_HANGING_SIGN, +- Material.BIRCH_WALL_HANGING_SIGN, +- Material.CRIMSON_HANGING_SIGN, +- Material.CRIMSON_WALL_HANGING_SIGN, +- Material.DARK_OAK_HANGING_SIGN, +- Material.DARK_OAK_WALL_HANGING_SIGN, +- Material.JUNGLE_HANGING_SIGN, +- Material.JUNGLE_WALL_HANGING_SIGN, +- Material.MANGROVE_HANGING_SIGN, +- Material.MANGROVE_WALL_HANGING_SIGN, +- Material.OAK_HANGING_SIGN, +- Material.OAK_WALL_HANGING_SIGN, +- Material.SPRUCE_HANGING_SIGN, +- Material.SPRUCE_WALL_HANGING_SIGN, +- Material.WARPED_HANGING_SIGN, +- Material.WARPED_WALL_HANGING_SIGN +- ), CraftHangingSign.class, CraftHangingSign::new, HangingSignBlockEntity::new +- ); +- +- register( +- Arrays.asList( - Material.CREEPER_HEAD, - Material.CREEPER_WALL_HEAD, - Material.DRAGON_HEAD, - Material.DRAGON_WALL_HEAD, +- Material.PIGLIN_HEAD, +- Material.PIGLIN_WALL_HEAD, - Material.PLAYER_HEAD, - Material.PLAYER_WALL_HEAD, - Material.SKELETON_SKULL, @@ -220,6 +249,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 - register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new); - register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new); - register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new); +- register(Material.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new, ChiseledBookShelfBlockEntity::new); - register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new); - register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new); - register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new); @@ -257,6 +287,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 + register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new); + register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new); + register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); ++ register(BlockEntityType.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new); + register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new); + register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new); + register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new); @@ -283,7 +314,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 } private static void register(Material blockType, BlockStateFactory factory) { -@@ -296,30 +167,33 @@ public final class CraftBlockStates { +@@ -328,30 +170,33 @@ public final class CraftBlockStates { } private static > void register( @@ -332,7 +363,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 public static Class getBlockStateType(Material material) { Preconditions.checkNotNull(material, "material is null"); return CraftBlockStates.getFactory(material).blockStateType; -@@ -335,6 +209,13 @@ public final class CraftBlockStates { +@@ -367,6 +212,13 @@ public final class CraftBlockStates { return null; } @@ -346,7 +377,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 public static BlockState getBlockState(Block block) { // Paper start return CraftBlockStates.getBlockState(block, true); -@@ -392,7 +273,7 @@ public final class CraftBlockStates { +@@ -424,7 +276,7 @@ public final class CraftBlockStates { if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) { factory = CraftBlockStates.DEFAULT_FACTORY; } else { @@ -356,7 +387,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49 return factory.createBlockState(world, blockPosition, blockData, tileEntity); } diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java -index 15f760c4c71a0493c7c18c3908d229f6b8778a43..95e4a4080a4a168b53f69d9cd7d67c27263c1b7f 100644 +index a6dbd1919bce5b5092666372f4cc31d2e2190c42..58b6b214d3f90aa03ec172d7bfe8c97e2c17b9a5 100644 --- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java +++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java @@ -45,4 +45,11 @@ public class BlockStateTest extends AbstractTestingBase { diff --git a/patches/unapplied/server/0751-Add-config-option-for-logging-player-ip-addresses.patch b/patches/server/0745-Add-config-option-for-logging-player-ip-addresses.patch similarity index 92% rename from patches/unapplied/server/0751-Add-config-option-for-logging-player-ip-addresses.patch rename to patches/server/0745-Add-config-option-for-logging-player-ip-addresses.patch index 579b30b346..278ac88f37 100644 --- a/patches/unapplied/server/0751-Add-config-option-for-logging-player-ip-addresses.patch +++ b/patches/server/0745-Add-config-option-for-logging-player-ip-addresses.patch @@ -23,7 +23,7 @@ index d6f3869f5725c7f081efb7f486f74dbb99d4d005..8bc0cb9ad5bb4e76d962ff54305e2c08 net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error))); diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java -index 37cd7b44559e5705b31296df87c94d2ab200138d..37e52ea9ab694b466358981bc2a3c99f28a70c7d 100644 +index 21393ad40095a4049e5b6871169b2db7aa92d13c..e6553b936dac1eb25a310d1a33acb0b1a5e646d2 100644 --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java @@ -185,7 +185,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { @@ -49,10 +49,10 @@ index 2985271132c9ae822dcb0d7a7e6f0c268d1736cc..cfdbcd024de6ad0f9d4e83b2f912b36e networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 7d7d7336eea6db6505b57198cca2b03960fb1ec0..e8d3f455a1a08606568079a3811e2b3ed9d666c7 100644 +index 721de6bb83603be91e28ff13271697f9434d9f87..1a88f9f49aea58321d1c1d4d720944c565c00968 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -225,7 +225,10 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se +@@ -206,7 +206,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } public String getUserName() { @@ -63,12 +63,12 @@ index 7d7d7336eea6db6505b57198cca2b03960fb1ec0..e8d3f455a1a08606568079a3811e2b3e + // Paper end } - @Nullable + @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index eedcccde859d39fada71122488ea019cc7405e27..279b7953638d1400072bd153dc3d0c63efdf9035 100644 +index f734c7ea8c6ce468882ea758a358a8f19a16dcdb..c4e5e2b6283bd3163711a09d6a647c516ed8a1c3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -243,7 +243,7 @@ public abstract class PlayerList { +@@ -249,7 +249,7 @@ public abstract class PlayerList { final String s1; if (connection.getRemoteAddress() != null) { diff --git a/patches/unapplied/server/0752-Configurable-feature-seeds.patch b/patches/server/0746-Configurable-feature-seeds.patch similarity index 94% rename from patches/unapplied/server/0752-Configurable-feature-seeds.patch rename to patches/server/0746-Configurable-feature-seeds.patch index 76bc5d0b98..6b2b9024c9 100644 --- a/patches/unapplied/server/0752-Configurable-feature-seeds.patch +++ b/patches/server/0746-Configurable-feature-seeds.patch @@ -19,10 +19,10 @@ index 98171f6c8e23f6ef89b897e4b80e3afb2a1950a0..06bff37e4c1fddd3be6343049a66787c } final Object val = config.get(key); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index c35bf0709e83e05c2135d7a5c98bf44c48d0c31f..4ce5d41b23d6204f280e6d4d21713ec5d9a724d1 100644 +index d916159abb9c817b57897e6ec8b65a2079bf8e18..e0638949774215d4c2524761ffebf378206cd2d0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -606,7 +606,14 @@ public abstract class ChunkGenerator { +@@ -434,7 +434,14 @@ public abstract class ChunkGenerator { return (String) optional.orElseGet(placedfeature::toString); }; diff --git a/patches/unapplied/server/0753-VanillaCommandWrapper-didnt-account-for-entity-sende.patch b/patches/server/0747-VanillaCommandWrapper-didnt-account-for-entity-sende.patch similarity index 100% rename from patches/unapplied/server/0753-VanillaCommandWrapper-didnt-account-for-entity-sende.patch rename to patches/server/0747-VanillaCommandWrapper-didnt-account-for-entity-sende.patch diff --git a/patches/unapplied/server/0754-Add-root-admin-user-detection.patch b/patches/server/0748-Add-root-admin-user-detection.patch similarity index 96% rename from patches/unapplied/server/0754-Add-root-admin-user-detection.patch rename to patches/server/0748-Add-root-admin-user-detection.patch index a15ee81921..543b21aa35 100644 --- a/patches/unapplied/server/0754-Add-root-admin-user-detection.patch +++ b/patches/server/0748-Add-root-admin-user-detection.patch @@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 7dba8ef3291987cc428cd337693c3446d01e435b..c399aaeee89e12a7da4e054acd877fe033676dfd 100644 +index 7dcffb49a982a8db00d66441a03e2951b1d29ff9..5b46cabf4f2e2a1f7feaad378dd98d64aeef8671 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -184,6 +184,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -179,6 +179,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } diff --git a/patches/unapplied/server/0755-Always-allow-item-changing-in-Fireball.patch b/patches/server/0749-Always-allow-item-changing-in-Fireball.patch similarity index 100% rename from patches/unapplied/server/0755-Always-allow-item-changing-in-Fireball.patch rename to patches/server/0749-Always-allow-item-changing-in-Fireball.patch diff --git a/patches/unapplied/server/0756-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0750-don-t-attempt-to-teleport-dead-entities.patch similarity index 91% rename from patches/unapplied/server/0756-don-t-attempt-to-teleport-dead-entities.patch rename to patches/server/0750-don-t-attempt-to-teleport-dead-entities.patch index 2ba22b78e7..f45b63cc58 100644 --- a/patches/unapplied/server/0756-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0750-don-t-attempt-to-teleport-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3194c4461a5a86e28e73414a94dbfa7e611ee3a8..3f71b0f328842b3659bc01af8502cdc9561c7e5d 100644 +index 9a6a3718788e7085f6defc3c82ba4bb66dd6c5b3..9d7304e97ecc56b78e1a890762346d192c792f4c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -779,7 +779,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/unapplied/server/0757-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0751-Prevent-excessive-velocity-through-repeated-crits.patch similarity index 90% rename from patches/unapplied/server/0757-Prevent-excessive-velocity-through-repeated-crits.patch rename to patches/server/0751-Prevent-excessive-velocity-through-repeated-crits.patch index 72489b8a6a..aaee953a4c 100644 --- a/patches/unapplied/server/0757-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0751-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8b377ca58a0e4d11701a831c5f976e61f642f8a8..2aefacac58212d9ba76cf449455241d9c1fd36db 100644 +index 00726cca55d45043003032e32b045d84e74cf1d2..bd392ff909a217d069a81b2026ab3ce4c38662f3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2651,14 +2651,27 @@ public abstract class LivingEntity extends Entity { +@@ -2672,14 +2672,27 @@ public abstract class LivingEntity extends Entity { return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D; } diff --git a/patches/unapplied/server/0758-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0752-Remove-client-side-code-using-deprecated-for-removal.patch similarity index 89% rename from patches/unapplied/server/0758-Remove-client-side-code-using-deprecated-for-removal.patch rename to patches/server/0752-Remove-client-side-code-using-deprecated-for-removal.patch index 49bc5d68f8..1d83acbc37 100644 --- a/patches/unapplied/server/0758-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0752-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal Fixes warnings on build diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 998f63fba0d45a44eaf9cbe48a034bac4e02e965..6b7943e8348b0a41ca69fb56ccfd5f1c1484eb07 100644 +index a54c0a4d0849087229d08ccc89872c3603f2f426..5ef58831a857fd8aa4ac30147762dc17d773a53e 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -889,17 +889,7 @@ public class Util { +@@ -892,17 +892,7 @@ public class Util { } public void openUrl(URL url) { diff --git a/patches/unapplied/server/0707-Sanitize-ResourceLocation-error-logging.patch b/patches/unapplied/server/0707-Sanitize-ResourceLocation-error-logging.patch deleted file mode 100644 index c2ff3a02e4..0000000000 --- a/patches/unapplied/server/0707-Sanitize-ResourceLocation-error-logging.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Thu, 26 Aug 2021 12:09:47 +0200 -Subject: [PATCH] Sanitize ResourceLocation error logging - - -diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index 0e04275f62c5c2d8afede431f78f38f06e8009e6..7017dd42f832d928f1008a05f01701667d951644 100644 ---- a/src/main/java/net/minecraft/resources/ResourceLocation.java -+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -32,9 +32,9 @@ public class ResourceLocation implements Comparable { - this.namespace = StringUtils.isEmpty(id[0]) ? "minecraft" : id[0]; - this.path = id[1]; - if (!isValidNamespace(this.namespace)) { -- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + this.namespace + ":" + this.path); -+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper - } else if (!isValidPath(this.path)) { -- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + this.path); -+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper - } - } - diff --git a/patches/unapplied/server/0720-Use-correct-LevelStem-registry-when-loading-default-.patch b/patches/unapplied/server/0720-Use-correct-LevelStem-registry-when-loading-default-.patch deleted file mode 100644 index 3b4219d344..0000000000 --- a/patches/unapplied/server/0720-Use-correct-LevelStem-registry-when-loading-default-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Sat, 16 Oct 2021 17:38:35 -0700 -Subject: [PATCH] Use correct LevelStem registry when loading default - end/nether - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java -index 8da1226a6c293abb038d10c7921a77ed71ad06cc..f958f0ae738a6fb26400e17e54c8d69e95268cdd 100644 ---- a/src/main/java/net/minecraft/resources/RegistryLoader.java -+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java -@@ -46,6 +46,12 @@ public class RegistryLoader { - RegistryLoader.ReadCache readCache = this.readCache(registryRef); - DataResult> dataResult = readCache.values.get(entryKey); - if (dataResult != null) { -+ // Paper start - register in registry due to craftbukkit running this 3 times instead of once -+ if (registryRef == (ResourceKey) Registry.LEVEL_STEM_REGISTRY && dataResult.result().isPresent()) { -+ // OptionalInt.empty() because the LevelStem registry is only loaded from the resource manager, not the InMemory resource access -+ registry.registerOrOverride(java.util.OptionalInt.empty(), entryKey, dataResult.result().get().value(), dataResult.lifecycle()); -+ } -+ // Paper end - return dataResult; - } else { - Holder holder = registry.getOrCreateHolderOrThrow(entryKey); -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ee6dc7d149f96c9a63e627e765b8d3a0107af864..75651db840072806bb4ef15c4de370fdf6b46c05 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -553,7 +553,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver)); -- LevelStem worlddimension = (LevelStem) iregistry.get(dimensionKey); -+ // Paper start - Use correct LevelStem registry -+ final LevelStem worlddimension; -+ if (dimensionKey == LevelStem.END || dimensionKey == LevelStem.NETHER) { -+ worlddimension = generatorsettings.dimensions().get(dimensionKey); -+ } else { -+ worlddimension = iregistry.get(dimensionKey); -+ } -+ // Paper end - - org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value()); - if (biomeProvider == null && gen != null) {