From f0aea8123e4a6d3c854f7147c3aff150b79b4f63 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 8 Jun 2023 13:56:13 -0700 Subject: [PATCH] more compile fixes --- build-data/paper.at | 4 ++ patches/api/0343-Multi-Block-Change-API.patch | 14 ++-- patches/api/0371-More-Teleport-API.patch | 4 +- ...stom-Chat-Completion-Suggestions-API.patch | 4 +- .../0383-Elder-Guardian-appearance-API.patch | 4 +- .../0391-Add-Player-Warden-Warning-API.patch | 4 +- patches/api/0399-fix-Instruments.patch | 2 +- .../0401-Add-Sneaking-API-for-Entities.patch | 2 +- patches/api/0404-Flying-Fall-Damage-API.patch | 4 +- patches/api/0407-Win-Screen-API.patch | 4 +- patches/server/0009-MC-Utils.patch | 8 +-- patches/server/0010-Adventure.patch | 4 +- patches/server/0014-Timings-v2.patch | 2 +- .../server/0019-Rewrite-chunk-system.patch | 68 ++++++++++--------- ...nilla-per-world-scoreboard-coloring-.patch | 2 +- .../server/0141-Basic-PlayerProfile-API.patch | 2 +- ...0-PlayerNaturallySpawnCreaturesEvent.patch | 2 +- ...arseException-in-Entity-and-TE-names.patch | 2 +- patches/server/0268-Turtle-API.patch | 12 ++-- ...ement-optional-per-player-mob-spawns.patch | 2 +- ...e-getChunkAt-calls-for-loaded-chunks.patch | 2 +- .../0344-Add-debug-for-sync-chunk-loads.patch | 2 +- ...ntom-creative-and-insomniac-controls.patch | 8 +-- ...-incremental-chunk-and-player-saving.patch | 2 +- ...-should-not-bypass-cramming-gamerule.patch | 2 +- ...erTradeEvent-and-PlayerPurchaseEvent.patch | 4 +- ...ld-settings-for-mobs-picking-up-loot.patch | 4 +- ...onfigurable-door-breaking-difficulty.patch | 2 +- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 2 +- ...ditions-to-PlayerGameModeChangeEvent.patch | 8 +-- .../0620-Add-BellRevealRaiderEvent.patch | 4 +- .../0621-Fix-invulnerable-end-crystals.patch | 12 ++-- .../0631-Missing-Entity-Behavior-API.patch | 12 ++-- ...g-for-mobs-immune-to-default-effects.patch | 4 +- ...aper-mobcaps-and-paper-playermobcaps.patch | 4 +- ...erCloseEnoughForSpawning-to-use-dist.patch | 2 +- .../0686-Optimise-chunk-tick-iteration.patch | 2 +- .../0687-Execute-chunk-tasks-mid-tick.patch | 2 +- ...l-more-information-in-watchdog-dumps.patch | 4 +- ...ush-calls-for-entity-tracker-packets.patch | 2 +- .../0768-Fix-xp-reward-for-baby-zombies.patch | 2 +- ...ulti-Block-Change-API-Implementation.patch | 13 ++-- patches/server/0773-Dolphin-API.patch | 4 +- ...igurable-sculk-sensor-listener-range.patch | 32 +++++++-- ...hange-the-podium-for-the-EnderDragon.patch | 4 +- .../0834-Add-WardenAngerChangeEvent.patch | 4 +- patches/server/0848-More-Teleport-API.patch | 2 +- ...stom-Chat-Completion-Suggestions-API.patch | 2 +- .../0881-Elder-Guardian-appearance-API.patch | 2 +- .../0898-Add-Player-Warden-Warning-API.patch | 2 +- ...global-player-list-where-appropriate.patch | 4 +- ...ntrol-player-s-insomnia-and-phantoms.patch | 8 +-- .../0910-Properly-resend-entities.patch | 4 +- patches/server/0912-fix-Instruments.patch | 2 +- patches/server/0922-Flying-Fall-Damage.patch | 2 +- patches/server/0928-Win-Screen-API.patch | 2 +- ...0939-Fix-text-display-error-on-spawn.patch | 2 +- .../0963-Expand-PlayerItemMendEvent.patch | 2 +- 58 files changed, 177 insertions(+), 150 deletions(-) diff --git a/build-data/paper.at b/build-data/paper.at index 1c79532b5a..48a44de360 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick # AT remap issue? todo 1.18 public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch; public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag; + +# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason +public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component; +public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState; diff --git a/patches/api/0343-Multi-Block-Change-API.patch b/patches/api/0343-Multi-Block-Change-API.patch index 7c8e81a009..29bbe80a17 100644 --- a/patches/api/0343-Multi-Block-Change-API.patch +++ b/patches/api/0343-Multi-Block-Change-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multi Block Change API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 529b2a524dafa17fdaa8dedaf551aec114a5cb7f..d2b2660eb8c4302fc46de8cdc4bc522714d13c8f 100644 +index 529b2a524dafa17fdaa8dedaf551aec114a5cb7f..795984fbdd433b30e3680b3d3ae436944c86e533 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -672,6 +672,27 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -672,6 +672,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendBlockDamage(@NotNull Location loc, float progress); @@ -19,9 +19,7 @@ index 529b2a524dafa17fdaa8dedaf551aec114a5cb7f..d2b2660eb8c4302fc46de8cdc4bc5227 + * + * @param blockChanges A map of the positions you want to change to their new block data + */ -+ default void sendMultiBlockChange(@NotNull Map blockChanges) { -+ this.sendMultiBlockChange(blockChanges, false); -+ } ++ void sendMultiBlockChange(@NotNull Map blockChanges); + + /** + * Send multiple block changes. This fakes a multi block change packet for each @@ -29,8 +27,12 @@ index 529b2a524dafa17fdaa8dedaf551aec114a5cb7f..d2b2660eb8c4302fc46de8cdc4bc5227 + * + * @param blockChanges A map of the positions you want to change to their new block data + * @param suppressLightUpdates Whether to suppress light updates or not ++ * @deprecated suppressLightUpdates is no longer available in 1.20+, use {@link #sendMultiBlockChange(Map)} + */ -+ void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates); ++ @Deprecated ++ default void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates) { ++ this.sendMultiBlockChange(blockChanges); ++ } + // Paper end + /** diff --git a/patches/api/0371-More-Teleport-API.patch b/patches/api/0371-More-Teleport-API.patch index 43afea42ec..83d78500d5 100644 --- a/patches/api/0371-More-Teleport-API.patch +++ b/patches/api/0371-More-Teleport-API.patch @@ -165,10 +165,10 @@ index ab0ceaba9ddcbe20a8b8a1fc3ed19cb3c64ecd3d..97f0bc6573c8ba09de77061b6312b91c * Teleports this entity to the given location. If this entity is riding a * vehicle, it will be dismounted prior to teleportation. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d2b2660eb8c4302fc46de8cdc4bc522714d13c8f..e2e73dd0b75b9a5eb7175ae8b3cfce29c95d8510 100644 +index 795984fbdd433b30e3680b3d3ae436944c86e533..1e133186a1150fc78ee15bfd63044d366cbaa485 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2877,6 +2877,49 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2879,6 +2879,49 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM String getClientBrandName(); // Paper end diff --git a/patches/api/0373-Custom-Chat-Completion-Suggestions-API.patch b/patches/api/0373-Custom-Chat-Completion-Suggestions-API.patch index 8937fa8011..8c833b0747 100644 --- a/patches/api/0373-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/api/0373-Custom-Chat-Completion-Suggestions-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index e2e73dd0b75b9a5eb7175ae8b3cfce29c95d8510..fcd729614bdd8f01481d5db71e817ad1c31ae206 100644 +index 1e133186a1150fc78ee15bfd63044d366cbaa485..ff6006728406b10307742d4e773ba091aa6de137 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2764,6 +2764,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2766,6 +2766,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}). */ void sendOpLevel(byte level); diff --git a/patches/api/0383-Elder-Guardian-appearance-API.patch b/patches/api/0383-Elder-Guardian-appearance-API.patch index 0fe5ed3b0a..01e6e7fa55 100644 --- a/patches/api/0383-Elder-Guardian-appearance-API.patch +++ b/patches/api/0383-Elder-Guardian-appearance-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index fcd729614bdd8f01481d5db71e817ad1c31ae206..90733cb910e93a997525d955c4236db03cdbbcfb 100644 +index ff6006728406b10307742d4e773ba091aa6de137..c7595ad428711794b9459252d1cc6a2b3da065dd 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2939,6 +2939,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2941,6 +2941,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); // Paper end - Teleport API diff --git a/patches/api/0391-Add-Player-Warden-Warning-API.patch b/patches/api/0391-Add-Player-Warden-Warning-API.patch index 5f09835a99..38ff4386ea 100644 --- a/patches/api/0391-Add-Player-Warden-Warning-API.patch +++ b/patches/api/0391-Add-Player-Warden-Warning-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player Warden Warning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 90733cb910e93a997525d955c4236db03cdbbcfb..107845269618697e06b2e3b7507a70431643274c 100644 +index c7595ad428711794b9459252d1cc6a2b3da065dd..f2a22762c6394dca172289c8d8e15c2de8cff917 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2955,6 +2955,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -2957,6 +2957,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param silent whether sound should be silenced */ void showElderGuardian(boolean silent); diff --git a/patches/api/0399-fix-Instruments.patch b/patches/api/0399-fix-Instruments.patch index 4b41bfa6a8..d0b84927c4 100644 --- a/patches/api/0399-fix-Instruments.patch +++ b/patches/api/0399-fix-Instruments.patch @@ -98,7 +98,7 @@ index de976be7132d05506fde7a839cac3954b0dd8da4..642feb8b4578e6dbd2bf78d859283d20 public static Instrument getByType(final byte type) { return BY_DATA.get(type); diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 107845269618697e06b2e3b7507a70431643274c..4dc268e55e2f2efc90b1899832d3194aa27e7779 100644 +index f2a22762c6394dca172289c8d8e15c2de8cff917..4ac55bbc23fa3093ada14ee12122e0a93e06863b 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -393,9 +393,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0401-Add-Sneaking-API-for-Entities.patch b/patches/api/0401-Add-Sneaking-API-for-Entities.patch index 3ccadd4a27..1717416205 100644 --- a/patches/api/0401-Add-Sneaking-API-for-Entities.patch +++ b/patches/api/0401-Add-Sneaking-API-for-Entities.patch @@ -35,7 +35,7 @@ index 3f3ea5bb6b3ea6f55b5cd699f1c01ac159619add..a2a423d4e4c2702ba5967223cab0432d * Get the category of spawn to which this entity belongs. * diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 4dc268e55e2f2efc90b1899832d3194aa27e7779..7808491e895fbfb0fa9608259b765c53087b8f28 100644 +index 4ac55bbc23fa3093ada14ee12122e0a93e06863b..50b6809939dc77b94aa13df29bcd2721220456cb 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -296,6 +296,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0404-Flying-Fall-Damage-API.patch b/patches/api/0404-Flying-Fall-Damage-API.patch index 694b34c67a..2402367878 100644 --- a/patches/api/0404-Flying-Fall-Damage-API.patch +++ b/patches/api/0404-Flying-Fall-Damage-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Flying Fall Damage API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7808491e895fbfb0fa9608259b765c53087b8f28..1c6d6bba2e828dae703d697e139d69c6422ead8b 100644 +index 50b6809939dc77b94aa13df29bcd2721220456cb..fa638e80b76521f90d36b4665d51624dbd6167fd 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1534,6 +1534,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1536,6 +1536,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void setAllowFlight(boolean flight); diff --git a/patches/api/0407-Win-Screen-API.patch b/patches/api/0407-Win-Screen-API.patch index 4e48c47a83..1a55437992 100644 --- a/patches/api/0407-Win-Screen-API.patch +++ b/patches/api/0407-Win-Screen-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Win Screen API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 1c6d6bba2e828dae703d697e139d69c6422ead8b..a5be783b06f97d45897a359db4e2f213343adebc 100644 +index fa638e80b76521f90d36b4665d51624dbd6167fd..997afb6739c72529ea8226228a9905d72f77c89a 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -901,6 +901,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -903,6 +903,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendMap(@NotNull MapView map); diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index f4ea8f5fb2..a9b0fd0104 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -6112,7 +6112,7 @@ index 1bfa33253a154c66dc8b7e476c777b74cda8999f..d8b83c8c89143d78620f812c491a1950 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..07e1c75c0df7362ced6cffd125aec4fd553a9243 100644 +index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..5115342b51ccefe4430df47a498bc59b1d96bb0e 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -51,6 +51,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; @@ -6202,21 +6202,21 @@ index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..07e1c75c0df7362ced6cffd125aec4fd + + public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.ENTITY_TICKING, true, ++ this.level, x, z, FullChunkStatus.ENTITY_TICKING, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } + + public void getTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.TICKING, true, ++ this.level, x, z, FullChunkStatus.BLOCK_TICKING, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } + + public void getFullChunkAsync(int x, int z, java.util.function.Consumer onLoad) { + io.papermc.paper.chunk.system.ChunkSystem.scheduleTickingState( -+ this.level, x, z, ChunkHolder.FullChunkStatus.BORDER, true, ++ this.level, x, z, FullChunkStatus.FULL, true, + ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, onLoad + ); + } diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 1ddd987ede..1b9b65a4f8 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -255,7 +255,7 @@ index 0000000000000000000000000000000000000000..3b53d87a52cafb2503419f21ddd87d42 +} diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..f2141c1bb4e1fd6697326b50db74f78a8367b9e4 +index 0000000000000000000000000000000000000000..7ddec8e330ab058e72d90b68c5361a6c4feb2393 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java @@ -0,0 +1,412 @@ @@ -479,7 +479,7 @@ index 0000000000000000000000000000000000000000..f2141c1bb4e1fd6697326b50db74f78a + + final Set viewers = event.viewers(); + final ResourceKey chatTypeKey = renderer instanceof ChatRenderer.Default ? ChatType.CHAT : ChatType.RAW; -+ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player().level.registryAccess(), PaperAdventure.asVanilla(displayName(player))); ++ final ChatType.Bound chatType = ChatType.bind(chatTypeKey, this.player.level().registryAccess(), PaperAdventure.asVanilla(displayName(player))); + + OutgoingChat outgoingChat = viewers instanceof LazyChatAudienceSet lazyAudienceSet && lazyAudienceSet.isLazy() ? new ServerOutgoingChat() : new ViewersOutgoingChat(); + /* if (this.flags.get(FORCE_PREVIEW_USE)) { // TODO (future, maybe?) diff --git a/patches/server/0014-Timings-v2.patch b/patches/server/0014-Timings-v2.patch index bbea0f4acf..d9fa94c8ab 100644 --- a/patches/server/0014-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -1062,7 +1062,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 07e1c75c0df7362ced6cffd125aec4fd553a9243..fc1afda5a60ab0f3c275f849d8af08d308b36c3f 100644 +index 5115342b51ccefe4430df47a498bc59b1d96bb0e..6d5a160a9fdaa04bb930afae8a0765910f631d23 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -415,13 +415,15 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0019-Rewrite-chunk-system.patch b/patches/server/0019-Rewrite-chunk-system.patch index afc8f7195d..94fb3c4528 100644 --- a/patches/server/0019-Rewrite-chunk-system.patch +++ b/patches/server/0019-Rewrite-chunk-system.patch @@ -10911,10 +10911,10 @@ index 0000000000000000000000000000000000000000..396d72c00e47cf1669ae20dc839c1c96 +} diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java new file mode 100644 -index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa82986586b8022f5 +index 0000000000000000000000000000000000000000..cfd97d48ae77d33b68e11de3140a00f3faca34a4 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java -@@ -0,0 +1,2100 @@ +@@ -0,0 +1,2101 @@ +package io.papermc.paper.chunk.system.scheduling; + +import ca.spottedleaf.concurrentutil.completable.Completable; @@ -10939,6 +10939,7 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 +import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ChunkHolder; ++import net.minecraft.server.level.ChunkLevel; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.ServerLevel; @@ -11520,8 +11521,8 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + } + + // ticket level state -+ private int oldTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; -+ private int currentTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1; ++ private int oldTicketLevel = ChunkLevel.MAX_LEVEL + 1; ++ private int currentTicketLevel = ChunkLevel.MAX_LEVEL + 1; + + public int getTicketLevel() { + return this.currentTicketLevel; @@ -11605,7 +11606,7 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + } + + // chunk must be marked inaccessible (i.e unloaded to plugins) -+ if (this.getChunkStatus() != ChunkHolder.FullChunkStatus.INACCESSIBLE) { ++ if (this.getChunkStatus() != FullChunkStatus.INACCESSIBLE) { + return "fullchunkstatus"; + } + @@ -11844,8 +11845,8 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + + this.oldTicketLevel = newLevel; + -+ final ChunkHolder.FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel); -+ final ChunkHolder.FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel); ++ final FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel); ++ final FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel); + final boolean oldUnloaded = oldLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + final boolean newUnloaded = newLevel > ChunkHolderManager.MAX_TICKET_LEVEL; + @@ -11853,7 +11854,7 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + final ChunkStatus maxGenerationStatusNew = ChunkHolder.getStatus(newLevel); + + // check for cancellations from downgrading ticket level -+ if (this.requestedGenStatus != null && !newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newLevel > oldLevel) { ++ if (this.requestedGenStatus != null && !newState.isOrAfter(FullChunkStatus.FULL) && newLevel > oldLevel) { + // note: cancel() may invoke onChunkGenComplete synchronously here + if (newUnloaded) { + // need to cancel all tasks @@ -11888,7 +11889,7 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + if (newState != oldState) { + if (newState.isOrAfter(oldState)) { + // status upgrade -+ if (!oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { ++ if (!oldState.isOrAfter(FullChunkStatus.FULL) && newState.isOrAfter(FullChunkStatus.FULL)) { + // may need to schedule full load + if (this.currentGenStatus != ChunkStatus.FULL) { + if (this.requestedGenStatus != null) { @@ -11905,16 +11906,16 @@ index 0000000000000000000000000000000000000000..72c813e1d359486fe8d6776aa8298658 + } + } else { + // status downgrade -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.ENTITY_TICKING, null); ++ if (!newState.isOrAfter(FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(FullChunkStatus.ENTITY_TICKING)) { ++ this.completeFullStatusConsumers(FullChunkStatus.ENTITY_TICKING, null); + } + -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.TICKING, null); ++ if (!newState.isOrAfter(FullChunkStatus.BLOCK_TICKING) && oldState.isOrAfter(FullChunkStatus.BLOCK_TICKING)) { ++ this.completeFullStatusConsumers(FullChunkStatus.BLOCK_TICKING, null); + } + -+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) { -+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.BORDER, null); ++ if (!newState.isOrAfter(FullChunkStatus.FULL) && oldState.isOrAfter(FullChunkStatus.FULL)) { ++ this.completeFullStatusConsumers(FullChunkStatus.FULL, null); + } + } + } @@ -13924,10 +13925,10 @@ index a52e6e8be323863ece6624a8ae7f9455279bdc23..e3467aaf6d0c8d486b84362e3c20b3fe .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) diff --git a/src/main/java/io/papermc/paper/command/subcommands/ChunkDebugCommand.java b/src/main/java/io/papermc/paper/command/subcommands/ChunkDebugCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631f65697fa +index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629618f289c --- /dev/null +++ b/src/main/java/io/papermc/paper/command/subcommands/ChunkDebugCommand.java -@@ -0,0 +1,264 @@ +@@ -0,0 +1,265 @@ +package io.papermc.paper.command.subcommands; + +import io.papermc.paper.command.CommandUtil; @@ -13942,6 +13943,7 @@ index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631 +import io.papermc.paper.util.MCUtil; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ChunkHolder; ++import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ImposterProtoChunk; @@ -14031,8 +14033,8 @@ index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631 + + int total = 0; + int inactive = 0; -+ int border = 0; -+ int ticking = 0; ++ int full = 0; ++ int blockTicking = 0; + int entityTicking = 0; + + for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) { @@ -14042,29 +14044,29 @@ index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631 + + ++total; + -+ ChunkHolder.FullChunkStatus state = chunk.getFullStatus(); ++ FullChunkStatus state = chunk.getFullStatus(); + + switch (state) { + case INACCESSIBLE -> ++inactive; -+ case BORDER -> ++border; -+ case TICKING -> ++ticking; ++ case FULL -> ++full; ++ case BLOCK_TICKING -> ++blockTicking; + case ENTITY_TICKING -> ++entityTicking; + } + } + + accumulatedTotal += total; + accumulatedInactive += inactive; -+ accumulatedBorder += border; -+ accumulatedTicking += ticking; ++ accumulatedBorder += full; ++ accumulatedTicking += blockTicking; + accumulatedEntityTicking += entityTicking; + + sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":"))); + sender.sendMessage(text().color(DARK_AQUA).append( + text("Total: ", BLUE), text(total), + text(" Inactive: ", BLUE), text(inactive), -+ text(" Border: ", BLUE), text(border), -+ text(" Ticking: ", BLUE), text(ticking), -+ text(" Entity: ", BLUE), text(entityTicking) ++ text(" Full: ", BLUE), text(full), ++ text(" Block Ticking: ", BLUE), text(blockTicking), ++ text(" Entity Ticking: ", BLUE), text(entityTicking) + )); + } + if (worlds.size() > 1) { @@ -14072,9 +14074,9 @@ index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631 + sender.sendMessage(text().color(DARK_AQUA).append( + text("Total: ", BLUE), text(accumulatedTotal), + text(" Inactive: ", BLUE), text(accumulatedInactive), -+ text(" Border: ", BLUE), text(accumulatedBorder), -+ text(" Ticking: ", BLUE), text(accumulatedTicking), -+ text(" Entity: ", BLUE), text(accumulatedEntityTicking) ++ text(" Full: ", BLUE), text(accumulatedBorder), ++ text(" Block Ticking: ", BLUE), text(accumulatedTicking), ++ text(" Entity Ticking: ", BLUE), text(accumulatedEntityTicking) + )); + } + } @@ -14316,7 +14318,7 @@ index cea9c098ade00ee87b8efc8164ab72f5279758f0..197224e31175252d8438a8df585bbb65 + } } diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 902317d2dc198a1cbfc679810bcb2173644354cb..2e830847155e7c43ef411d28e81592c21446143b 100644 +index 902317d2dc198a1cbfc679810bcb2173644354cb..67064aa46043cad3ad14b1293c767e6fa461fb6a 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -2,16 +2,29 @@ package io.papermc.paper.util; @@ -14387,7 +14389,7 @@ index 902317d2dc198a1cbfc679810bcb2173644354cb..2e830847155e7c43ef411d28e81592c2 + JsonObject playerData = new JsonObject(); + players.add(playerData); + -+ Level playerWorld = player.getLevel(); ++ Level playerWorld = player.level(); + org.bukkit.World craftWorld = playerWorld.getWorld(); + Entity.RemovalReason removalReason = player.getRemovalReason(); + @@ -17564,7 +17566,7 @@ index f3c9a3dbb6f0e6f825b7477c89ed72ed52845419..20d600d29c2f2e47c798721d1f151e62 + */ // 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 fc1afda5a60ab0f3c275f849d8af08d308b36c3f..caff28e2446177d622c999b84d8889fbf61d0b3d 100644 +index 6d5a160a9fdaa04bb930afae8a0765910f631d23..a558e9a364a13fc2e81b73fa00cc0eff59eacb9a 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -367,7 +367,7 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index b26a9e0c5d..499f968897 100644 --- a/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -12,7 +12,7 @@ for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index f2141c1bb4e1fd6697326b50db74f78a8367b9e4..27c63ef4fcfcf763926261cbd48c9a6e754142d6 100644 +index 7ddec8e330ab058e72d90b68c5361a6c4feb2393..774fb97912f766589f3548f659618ad554e0503f 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java @@ -19,6 +19,7 @@ import net.kyori.adventure.audience.Audience; diff --git a/patches/server/0141-Basic-PlayerProfile-API.patch b/patches/server/0141-Basic-PlayerProfile-API.patch index 2c79f498eb..bffd309f82 100644 --- a/patches/server/0141-Basic-PlayerProfile-API.patch +++ b/patches/server/0141-Basic-PlayerProfile-API.patch @@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9 + @NotNull GameProfile buildGameProfile(); +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 2e830847155e7c43ef411d28e81592c21446143b..4d7604a63fb996f869b5d853738cab37fc22cb15 100644 +index 67064aa46043cad3ad14b1293c767e6fa461fb6a..77da7a3b51c500ff251f776acc85a752a99fb356 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -1,5 +1,7 @@ diff --git a/patches/server/0170-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0170-PlayerNaturallySpawnCreaturesEvent.patch index 4e4ed2afee..9dfe89b9ab 100644 --- a/patches/server/0170-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0170-PlayerNaturallySpawnCreaturesEvent.patch @@ -40,7 +40,7 @@ index a502d293cedb2f507e6cf1792429b36685ed1910..e50af28f806593a0171ad7cee5805f74 return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index caff28e2446177d622c999b84d8889fbf61d0b3d..d7022cda5f4654b1cbfeed3f096af028a9fbc564 100644 +index a558e9a364a13fc2e81b73fa00cc0eff59eacb9a..0cf7c33f80e67eccc1bf5e1d2101325ab94d8f45 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -716,6 +716,15 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0267-Catch-JsonParseException-in-Entity-and-TE-names.patch b/patches/server/0267-Catch-JsonParseException-in-Entity-and-TE-names.patch index 240ae61f5b..ecc4930408 100644 --- a/patches/server/0267-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/patches/server/0267-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -13,7 +13,7 @@ Shulkers) may need to be changed in order for it to re-save properly No more crashing though. diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 4d7604a63fb996f869b5d853738cab37fc22cb15..c856a9a0d085b278da416c59996fc131811f790c 100644 +index 77da7a3b51c500ff251f776acc85a752a99fb356..2d11a67bdc82088abf0b3ca134f352f155c8eb1f 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -15,6 +15,8 @@ import it.unimi.dsi.fastutil.objects.ReferenceArrayList; diff --git a/patches/server/0268-Turtle-API.patch b/patches/server/0268-Turtle-API.patch index 5f00388ace..e2997b3063 100644 --- a/patches/server/0268-Turtle-API.patch +++ b/patches/server/0268-Turtle-API.patch @@ -60,7 +60,7 @@ index fcd760cb88f84ff79811631612956fde79905132..99fc97051c61ac8d08afdc0ea4845e96 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java -index 96462a29551c301d3c80029cab2bec3839914237..a14d0a688b9054988b5c86c94738e4aaca9f9cfd 100644 +index 96462a29551c301d3c80029cab2bec3839914237..d3546fb082a56b4ce077ded5d25909e15f7eb593 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java @@ -34,4 +34,31 @@ public class CraftTurtle extends CraftAnimals implements Turtle { @@ -71,27 +71,27 @@ index 96462a29551c301d3c80029cab2bec3839914237..a14d0a688b9054988b5c86c94738e4aa + // Paper start + @Override + public org.bukkit.Location getHome() { -+ return io.papermc.paper.util.MCUtil.toLocation(getHandle().getLevel(), getHandle().getHomePos()); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getHomePos()); + } + + @Override + public void setHome(org.bukkit.Location location) { -+ getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location)); ++ this.getHandle().setHomePos(io.papermc.paper.util.MCUtil.toBlockPosition(location)); + } + + @Override + public boolean isGoingHome() { -+ return getHandle().isGoingHome(); ++ return this.getHandle().isGoingHome(); + } + + @Override + public boolean isDigging() { -+ return getHandle().isLayingEgg(); ++ return this.getHandle().isLayingEgg(); + } + + @Override + public void setHasEgg(boolean hasEgg) { -+ getHandle().setHasEgg(hasEgg); ++ this.getHandle().setHasEgg(hasEgg); + } + // Paper end } diff --git a/patches/server/0340-implement-optional-per-player-mob-spawns.patch b/patches/server/0340-implement-optional-per-player-mob-spawns.patch index 06d43093be..73fb1b1e40 100644 --- a/patches/server/0340-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0340-implement-optional-per-player-mob-spawns.patch @@ -338,7 +338,7 @@ index 8c4d2b2f206d7662c0aceb30f49fa58f9426ec5c..1711170ef98831dacfbf30ac22e19f47 double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index d7022cda5f4654b1cbfeed3f096af028a9fbc564..aa603e26f7fb1cc9043fd0e7a820b4cd38fa9a79 100644 +index 0cf7c33f80e67eccc1bf5e1d2101325ab94d8f45..ed1510776a0c71dea33e7a8fedd289927031d34b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -694,7 +694,18 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0343-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0343-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 71d63d07a4..3721985b42 100644 --- a/patches/server/0343-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0343-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,7 +7,7 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index aa603e26f7fb1cc9043fd0e7a820b4cd38fa9a79..a2ddede2113a8ec6d99a19ee77e4e5a1381e2b5a 100644 +index ed1510776a0c71dea33e7a8fedd289927031d34b..9f019946c6098314b1aeba48ee5b1aba9f2935f2 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -421,6 +421,12 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0344-Add-debug-for-sync-chunk-loads.patch b/patches/server/0344-Add-debug-for-sync-chunk-loads.patch index 9916445aa8..c4da57f0cf 100644 --- a/patches/server/0344-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0344-Add-debug-for-sync-chunk-loads.patch @@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..95d6022c9cfb2e36ec5a71be6e343540 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a2ddede2113a8ec6d99a19ee77e4e5a1381e2b5a..ca8535c0532a0c97f6b6d84758f025f29ab1ef93 100644 +index 9f019946c6098314b1aeba48ee5b1aba9f2935f2..1806b0903185561a16581e10a75fff8c8e5f0464 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -445,6 +445,7 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0380-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0380-Add-phantom-creative-and-insomniac-controls.patch index bdb3a87dae..edb2d58386 100644 --- a/patches/server/0380-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0380-Add-phantom-creative-and-insomniac-controls.patch @@ -5,26 +5,26 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..9edea92834306b39abda36ba9be4e8796f113cc4 100644 +index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..d15e62da0307728a7c2be191a27f87da1bb29f49 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -27,6 +27,7 @@ public final class EntitySelector { return !entity.isSpectator(); }; public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); -+ public static Predicate isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper ++ public static Predicate IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper private EntitySelector() {} // Paper start diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..9660f517963459396f3ff112fbcab9bb1f9c1949 100644 +index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..ab639cb2faaafaeb33be91bfe99ffad6d23088db 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -563,6 +563,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { -+ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.isInsomniac.test(entityhuman)) // Paper ++ if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(entityhuman)) // Paper Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason return true; } diff --git a/patches/server/0422-incremental-chunk-and-player-saving.patch b/patches/server/0422-incremental-chunk-and-player-saving.patch index 1792fb6ecc..a3ffaf2580 100644 --- a/patches/server/0422-incremental-chunk-and-player-saving.patch +++ b/patches/server/0422-incremental-chunk-and-player-saving.patch @@ -53,7 +53,7 @@ index 2a55f9e0ab6fa07ba913203bb62acd54add450a0..7bd02abf039f7e047b6b6b1de0bc4788 // Paper start - move executeAll() into full server tick timing try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index ca8535c0532a0c97f6b6d84758f025f29ab1ef93..604e1f1113457d7dbd368d40a668aab7c7466d40 100644 +index 1806b0903185561a16581e10a75fff8c8e5f0464..dfcb9a57d4b6c9bab7305a5ec8a4136a8c66c9d4 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -603,6 +603,15 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0498-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0498-Climbing-should-not-bypass-cramming-gamerule.patch index 3fd654cd6b..f42c613548 100644 --- a/patches/server/0498-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0498-Climbing-should-not-bypass-cramming-gamerule.patch @@ -22,7 +22,7 @@ index bae55a65fbd8c270395c9b56d129814fb1614520..01ab92e1e0c316ef262ea53a4b534dbd } diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index 9edea92834306b39abda36ba9be4e8796f113cc4..f6e5406f84410ab9c177213157106739a2074cf8 100644 +index d15e62da0307728a7c2be191a27f87da1bb29f49..de06ae3e8757c923a6f3f475a34885d2f15af46e 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -45,11 +45,17 @@ public final class EntitySelector { diff --git a/patches/server/0509-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0509-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index 83659338a5..d4054979d0 100644 --- a/patches/server/0509-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/0509-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -219,7 +219,7 @@ index d41f44ed2e497ba3373d170c08488b49e88334c4..d3a99ba6f3085ad12b67ddc94cc4ab39 void notifyTradeUpdated(ItemStack stack); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 257776a12ca26c1e75be22a67c94b0aa012fd687..5074e8b2259b3fb969bd0ff99c296b7537920273 100644 +index 257776a12ca26c1e75be22a67c94b0aa012fd687..e7b8ade2c83bb72b4213d0ea93b97861ee43e599 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -74,10 +74,25 @@ public class CraftMerchantCustom extends CraftMerchant { @@ -235,7 +235,7 @@ index 257776a12ca26c1e75be22a67c94b0aa012fd687..5074e8b2259b3fb969bd0ff99c296b75 + merchantRecipe.increaseUses(); + } + if (event == null || event.isRewardingExp()) { -+ this.tradingPlayer.level.addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(tradingPlayer.level, tradingPlayer.getX(), tradingPlayer.getY(), tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); ++ this.tradingPlayer.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.tradingPlayer.level(), this.tradingPlayer.getX(), this.tradingPlayer.getY(), this.tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); + } + } + this.notifyTrade(merchantRecipe); diff --git a/patches/server/0525-Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/0525-Added-world-settings-for-mobs-picking-up-loot.patch index 62a8f8b8ad..7228b93ce4 100644 --- a/patches/server/0525-Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/0525-Added-world-settings-for-mobs-picking-up-loot.patch @@ -18,7 +18,7 @@ index 4ea7a6bd6fdc98bef30546e19e2676a78fb29007..ef525e5f523966c9af7380e8d09ff509 LocalDate localdate = LocalDate.now(); int i = localdate.get(ChronoField.DAY_OF_MONTH); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 3ca308bb6668392a4f7ce1296e1ef6094060491f..9a0a2331642b250eae94bb9da316969fe8eda4a9 100644 +index 3ca308bb6668392a4f7ce1296e1ef6094060491f..0911a232dcc334503dbeb5f8198d2acc75a954f0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -514,7 +514,7 @@ public class Zombie extends Monster { @@ -26,7 +26,7 @@ index 3ca308bb6668392a4f7ce1296e1ef6094060491f..9a0a2331642b250eae94bb9da316969f float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); -+ this.setCanPickUpLoot(this.level.paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper ++ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper if (object == null) { object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); } diff --git a/patches/server/0529-Configurable-door-breaking-difficulty.patch b/patches/server/0529-Configurable-door-breaking-difficulty.patch index 984045edac..627c3d4ee2 100644 --- a/patches/server/0529-Configurable-door-breaking-difficulty.patch +++ b/patches/server/0529-Configurable-door-breaking-difficulty.patch @@ -23,7 +23,7 @@ index e6139ff42470cfa9bcad02d746f15b99b1096b48..2acc531bd9e948251cac77d979f97367 } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 9a0a2331642b250eae94bb9da316969fe8eda4a9..77688c906a934f1e4844c1fd804bfa83571f7a15 100644 +index 0911a232dcc334503dbeb5f8198d2acc75a954f0..e58c3e2163be271ff2668a55098ea8f48f8636ad 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -99,7 +99,7 @@ public class Zombie extends Monster { diff --git a/patches/server/0599-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0599-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 2cf1a84049..45fefcead5 100644 --- a/patches/server/0599-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/0599-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -48,7 +48,7 @@ index ef525e5f523966c9af7380e8d09ff5092e56e7c5..9ca1e9d95e62929c0015d5ca2c2f9c70 @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 9660f517963459396f3ff112fbcab9bb1f9c1949..38230578c7e280a4aaa699e2a81990094e2aa264 100644 +index ab639cb2faaafaeb33be91bfe99ffad6d23088db..4a132c3eff6978e927bcd4df56b9ce0306af6d19 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -144,7 +144,7 @@ public class Phantom extends FlyingMob implements Enemy { diff --git a/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch index 00407cd577..ac5960d526 100644 --- a/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/0603-additions-to-PlayerGameModeChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] additions to PlayerGameModeChangeEvent diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java -index 50e581613156cca765dfd8e3596dcb3b58520cec..04fd33e9d50eb675ed1d4633bf0903ec526d32d0 100644 +index 50e581613156cca765dfd8e3596dcb3b58520cec..12d4c141a1bc72e53e18f73d7ee4d5a2467e08e1 100644 --- a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java +++ b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java @@ -25,9 +25,13 @@ public class DefaultGameModeCommands { @@ -17,7 +17,7 @@ index 50e581613156cca765dfd8e3596dcb3b58520cec..04fd33e9d50eb675ed1d4633bf0903ec + // Paper start - extend PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); + if (event != null && event.isCancelled()) { -+ source.sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); ++ source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); } + // Paper end + ++i; @@ -25,7 +25,7 @@ index 50e581613156cca765dfd8e3596dcb3b58520cec..04fd33e9d50eb675ed1d4633bf0903ec } diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -index aee8618e27b893b72931e925724dd683d2e6d2aa..3131a9ee89ce0598626da4ce4983d4a8d3be91d1 100644 +index aee8618e27b893b72931e925724dd683d2e6d2aa..5cb15e2209d7b315904a1fc6d650ce1e75584271 100644 --- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java @@ -48,9 +48,14 @@ public class GameModeCommand { @@ -39,7 +39,7 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..3131a9ee89ce0598626da4ce4983d4a8 logGamemodeChange(context.getSource(), serverPlayer, gameMode); ++i; + } else if (event != null && event.cancelMessage() != null) { -+ context.getSource().sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); ++ context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + // Paper end } } diff --git a/patches/server/0620-Add-BellRevealRaiderEvent.patch b/patches/server/0620-Add-BellRevealRaiderEvent.patch index 7ae9f6eb2d..ed8e81f6a2 100644 --- a/patches/server/0620-Add-BellRevealRaiderEvent.patch +++ b/patches/server/0620-Add-BellRevealRaiderEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BellRevealRaiderEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -index b446d6549922f3dabaaa05793d8ee3eb45566ac3..79e74a5f020ad971fdbef75c502a5aa8bead2258 100644 +index b446d6549922f3dabaaa05793d8ee3eb45566ac3..f07222c8c9c82478d492b0916cd394be1ab0c804 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java @@ -156,7 +156,7 @@ public class BellBlockEntity extends BlockEntity { @@ -25,7 +25,7 @@ index b446d6549922f3dabaaa05793d8ee3eb45566ac3..79e74a5f020ad971fdbef75c502a5aa8 + // Paper start + private static void glow(LivingEntity entity) { glow(entity, null); } + private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) { -+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return; ++ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level().getWorld().getBlockAt(io.papermc.paper.util.MCUtil.toLocation(entity.level(), pos)), entity.getBukkitEntity()).callEvent()) return; + // Paper end entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); } diff --git a/patches/server/0621-Fix-invulnerable-end-crystals.patch b/patches/server/0621-Fix-invulnerable-end-crystals.patch index 48f458bd71..b023697625 100644 --- a/patches/server/0621-Fix-invulnerable-end-crystals.patch +++ b/patches/server/0621-Fix-invulnerable-end-crystals.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix invulnerable end crystals MC-108513 diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java -index e6d137cd6d89ac8cca76105edbab75c506c966d6..13514a583c04a3bc555099dffa5997c79fce1d69 100644 +index e6d137cd6d89ac8cca76105edbab75c506c966d6..5465711d486e5f265a26042031e895fb09e30608 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java @@ -29,6 +29,7 @@ public class EndCrystal extends Entity { @@ -22,11 +22,11 @@ index e6d137cd6d89ac8cca76105edbab75c506c966d6..13514a583c04a3bc555099dffa5997c7 // CraftBukkit end } + // Paper start - Fix invulnerable end crystals -+ if (this.level.paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { -+ if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld()) -+ || ((ServerLevel) this.level).dragonFight() == null -+ || ((ServerLevel) this.level).dragonFight().respawnStage == null -+ || ((ServerLevel) this.level).dragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) { ++ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { ++ if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld()) ++ || ((ServerLevel) this.level()).getDragonFight() == null ++ || ((ServerLevel) this.level()).getDragonFight().respawnStage == null ++ || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) { + this.setInvulnerable(false); + this.setBeamTarget(null); + } diff --git a/patches/server/0631-Missing-Entity-Behavior-API.patch b/patches/server/0631-Missing-Entity-Behavior-API.patch index d6e36a6e48..d1cd66fa4c 100644 --- a/patches/server/0631-Missing-Entity-Behavior-API.patch +++ b/patches/server/0631-Missing-Entity-Behavior-API.patch @@ -429,7 +429,7 @@ index 254d4f2e45d7c8f572a4368eccd84560d4d0d836..299ab868252c8f326e3a56e878c9ee23 + // Paper end - Horse API } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java -index 3b960a832df1fe496ea036962083f1ac507a7db7..8f25bb253c2b22e1964afeae705901e926432ef0 100644 +index 3b960a832df1fe496ea036962083f1ac507a7db7..e405488ba5e0159ff84a72fac1d2da6e9c45238e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java @@ -33,4 +33,25 @@ public class CraftBat extends CraftAmbient implements Bat { @@ -444,7 +444,7 @@ index 3b960a832df1fe496ea036962083f1ac507a7db7..8f25bb253c2b22e1964afeae705901e9 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override @@ -870,7 +870,7 @@ index ff9f711b83a8ea1bf4135751a9ba865224bce787..1f6dcad764240e15083731d017f9bb1c @Override public boolean isRolling() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -index 6b71f8b373ef524f5df16023b773e92249bb2532..9a3734c670972ee91a0d44a1b1fa8493de854a9c 100644 +index 6b71f8b373ef524f5df16023b773e92249bb2532..63e31c237dc3cf37a5e06c1cf3f030c9f1df3d38 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java @@ -50,5 +50,25 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy { @@ -885,7 +885,7 @@ index 6b71f8b373ef524f5df16023b773e92249bb2532..9a3734c670972ee91a0d44a1b1fa8493 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override @@ -1157,7 +1157,7 @@ index e98242321fcaa5cbaa242cb7e77832378a8aecf6..3954fe7e5f9ce8ea9300bfb92b7e4f4b } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java -index fa7107593b20e0151d8d67104e4a92dcc697d461..ecf0c4a7d1ce2b254d91b3276fa24c149329737a 100644 +index fa7107593b20e0151d8d67104e4a92dcc697d461..f9a3d060ff4da6047d11f2b024d144572c513399 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java @@ -55,5 +55,25 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande @@ -1172,7 +1172,7 @@ index fa7107593b20e0151d8d67104e4a92dcc697d461..ecf0c4a7d1ce2b254d91b3276fa24c14 + return null; + } + -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().getLevel(), pos); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override diff --git a/patches/server/0638-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0638-Add-config-for-mobs-immune-to-default-effects.patch index ed0cecb017..ce42532bd2 100644 --- a/patches/server/0638-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0638-Add-config-for-mobs-immune-to-default-effects.patch @@ -44,7 +44,7 @@ index b9acef460ff7e8bc9e24997771beeba6bea1f28a..d506091a739b04caf213e8fb0f71b5b7 public boolean isClimbing() { diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java -index ea6233cb3ca30864e54d553a5d1071ea9147a868..6449213d717271bcc516e393a78dfe1e5c762d68 100644 +index ea6233cb3ca30864e54d553a5d1071ea9147a868..9a81cb0c3a5ac40ff50dc7c81f6196a447cd03c6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java @@ -123,6 +123,6 @@ public class WitherSkeleton extends AbstractSkeleton { @@ -52,6 +52,6 @@ index ea6233cb3ca30864e54d553a5d1071ea9147a868..6449213d717271bcc516e393a78dfe1e @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.WITHER && this.level.paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper } } diff --git a/patches/server/0681-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0681-Add-paper-mobcaps-and-paper-playermobcaps.patch index de7beb426c..f26260d5cb 100644 --- a/patches/server/0681-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0681-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -23,7 +23,7 @@ index 6d56c812262f7f109598ef4a941d0226b1eb638a..db9567711f7e0ad1778d41e79b59e319 .flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue()))) diff --git a/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java b/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..99c41a39cdad0271d089c6e03bebfdafba1aaa57 +index 0000000000000000000000000000000000000000..d3b39d88a72ca25057fd8574d32f28db0d420818 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/subcommands/MobcapsCommand.java @@ -0,0 +1,229 @@ @@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..99c41a39cdad0271d089c6e03bebfdaf + } + + final ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); -+ final ServerLevel level = serverPlayer.getLevel(); ++ final ServerLevel level = serverPlayer.serverLevel(); + + if (!level.paperConfig().entities.spawning.perPlayerMobSpawns) { + sender.sendMessage(Component.text("Use '/paper mobcaps' for worlds where per-player mob spawning is disabled.", NamedTextColor.RED)); diff --git a/patches/server/0685-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/0685-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 074eb59fa2..e3070e3ff3 100644 --- a/patches/server/0685-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/0685-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -263,7 +263,7 @@ index fcbdf311e981e010adc78342f0865d3f803354f9..40e17a8f182fea7c99b64cd074ce1757 public String getDebugStatus() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 604e1f1113457d7dbd368d40a668aab7c7466d40..8f1949cf33bdc35d6d024dd82faae37fec325d6f 100644 +index dfcb9a57d4b6c9bab7305a5ec8a4136a8c66c9d4..6ee93972a362a81d4a12108b14c564d07fc272c8 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -668,6 +668,37 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0686-Optimise-chunk-tick-iteration.patch b/patches/server/0686-Optimise-chunk-tick-iteration.patch index 764c7adeae..55ea38b4ec 100644 --- a/patches/server/0686-Optimise-chunk-tick-iteration.patch +++ b/patches/server/0686-Optimise-chunk-tick-iteration.patch @@ -93,7 +93,7 @@ index 7d80cfd701d910badf1feaecaa4ce5129584e21d..03b802f9f6e31b1ab23af0ff7b235f64 // 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 8f1949cf33bdc35d6d024dd82faae37fec325d6f..d9a14c1c42ce9adc53543e7b95a4083b4109cb33 100644 +index 6ee93972a362a81d4a12108b14c564d07fc272c8..55c813ed1df716747164dd02e482851fa51f9459 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -48,6 +48,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp diff --git a/patches/server/0687-Execute-chunk-tasks-mid-tick.patch b/patches/server/0687-Execute-chunk-tasks-mid-tick.patch index 9b1bb6a636..b822a4c250 100644 --- a/patches/server/0687-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0687-Execute-chunk-tasks-mid-tick.patch @@ -106,7 +106,7 @@ index b800249823e413933a5d469e431a003f977f59e7..d8fa1cb0b340f97debceb7e5b90051d2 + // Paper end - execute chunk tasks mid tick } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index d9a14c1c42ce9adc53543e7b95a4083b4109cb33..371f7e71610ddfbdb32dcd493f15d6ff9b90326e 100644 +index 55c813ed1df716747164dd02e482851fa51f9459..54318b327f464d299c0712f24c1eeba02b2b9263 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -750,6 +750,8 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0690-Detail-more-information-in-watchdog-dumps.patch b/patches/server/0690-Detail-more-information-in-watchdog-dumps.patch index 75ecaa7d34..e8f666aad8 100644 --- a/patches/server/0690-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/0690-Detail-more-information-in-watchdog-dumps.patch @@ -203,7 +203,7 @@ index 19fc6ce5a3b87ea4a7e538c3718c130cb38e6ee6..491917c05b894cf7486513ea7aabca79 int j = Mth.floor(y); int k = Mth.floor(z); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index e0a71bfc1498a517456b21747ab6ef3f1067a3f3..e9fa7faaa4451e36b3908cbcbbe0baf213abde96 100644 +index e0a71bfc1498a517456b21747ab6ef3f1067a3f3..98fba0288be9ed2cb18ffba5cf81148157dd4fcf 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -22,6 +22,78 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa @@ -230,7 +230,7 @@ index e0a71bfc1498a517456b21747ab6ef3f1067a3f3..e9fa7faaa4451e36b3908cbcbbe0baf2 + + String entityType = net.minecraft.world.entity.EntityType.getKey(entity.getType()).toString(); + java.util.UUID entityUUID = entity.getUUID(); -+ net.minecraft.world.level.Level world = entity.level; ++ net.minecraft.world.level.Level world = entity.level(); + + log.log(Level.SEVERE, "Ticking entity: " + entityType + ", entity class: " + entity.getClass().getName()); + log.log(Level.SEVERE, "Entity status: removed: " + entity.isRemoved() + ", valid: " + entity.valid + ", alive: " + entity.isAlive() + ", is passenger: " + entity.isPassenger()); diff --git a/patches/server/0697-Consolidate-flush-calls-for-entity-tracker-packets.patch b/patches/server/0697-Consolidate-flush-calls-for-entity-tracker-packets.patch index b1941d9b7a..5d6cec1c0a 100644 --- a/patches/server/0697-Consolidate-flush-calls-for-entity-tracker-packets.patch +++ b/patches/server/0697-Consolidate-flush-calls-for-entity-tracker-packets.patch @@ -22,7 +22,7 @@ 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 371f7e71610ddfbdb32dcd493f15d6ff9b90326e..42526088af333f818b02c80a3f8aa890ab78f6fb 100644 +index 54318b327f464d299c0712f24c1eeba02b2b9263..000d500d8bb4a1852b87a57a7beb7f9bb498d252 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -807,7 +807,24 @@ public class ServerChunkCache extends ChunkSource { diff --git a/patches/server/0768-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0768-Fix-xp-reward-for-baby-zombies.patch index ace5d75aa1..399ad48f22 100644 --- a/patches/server/0768-Fix-xp-reward-for-baby-zombies.patch +++ b/patches/server/0768-Fix-xp-reward-for-baby-zombies.patch @@ -9,7 +9,7 @@ so this resets it after each call to Zombie#getExperienceReward diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 77688c906a934f1e4844c1fd804bfa83571f7a15..d0bad074c13e7ab738b3f88bfd896385153ec035 100644 +index e58c3e2163be271ff2668a55098ea8f48f8636ad..3f8c1d1d3c408fc4f15c4b5680bc22c86f104a9d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -174,11 +174,16 @@ public class Zombie extends Monster { diff --git a/patches/server/0770-Multi-Block-Change-API-Implementation.patch b/patches/server/0770-Multi-Block-Change-API-Implementation.patch index df3c22576e..528fd87162 100644 --- a/patches/server/0770-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0770-Multi-Block-Change-API-Implementation.patch @@ -5,19 +5,18 @@ Subject: [PATCH] Multi Block Change API Implementation diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java -index f96d61bdeb556665d6e6e5023f9d77fd82204e89..45bfc2af4942c029537805fce2f14e150d3440b1 100644 +index f96d61bdeb556665d6e6e5023f9d77fd82204e89..e3f355c85eb7cc8c1683e3009502c10a5ed32daa 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java -@@ -59,6 +59,15 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet blockChanges, boolean suppressLightUpdates) { ++ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap blockChanges) { + this.sectionPos = sectionPos; + this.positions = blockChanges.keySet().toShortArray(); + this.states = blockChanges.values().toArray(new BlockState[0]); -+ this.suppressLightUpdates = suppressLightUpdates; + } + // Paper end + @@ -25,7 +24,7 @@ index f96d61bdeb556665d6e6e5023f9d77fd82204e89..45bfc2af4942c029537805fce2f14e15 public void write(FriendlyByteBuf buf) { buf.writeLong(this.sectionPos.asLong()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 59683479af9fa4058cab286caed2fa990c4bd293..41784e46737a4a22aee53df4d4bdf170850b7a75 100644 +index 59683479af9fa4058cab286caed2fa990c4bd293..6373c2df3acd6dcae321e9914bea7a6beaa51c5d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -920,6 +920,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -34,7 +33,7 @@ index 59683479af9fa4058cab286caed2fa990c4bd293..41784e46737a4a22aee53df4d4bdf170 + // Paper start + @Override -+ public void sendMultiBlockChange(final Map blockChanges, final boolean suppressLightUpdates) { ++ public void sendMultiBlockChange(final Map blockChanges) { + if (this.getHandle().connection == null) return; + + Map> sectionMap = new HashMap<>(); @@ -52,7 +51,7 @@ index 59683479af9fa4058cab286caed2fa990c4bd293..41784e46737a4a22aee53df4d4bdf170 + SectionPos sectionPos = entry.getKey(); + it.unimi.dsi.fastutil.shorts.Short2ObjectMap blockData = entry.getValue(); + -+ net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData, suppressLightUpdates); ++ net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket packet = new net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket(sectionPos, blockData); + this.getHandle().connection.send(packet); + } + } diff --git a/patches/server/0773-Dolphin-API.patch b/patches/server/0773-Dolphin-API.patch index 7b62597b9e..9fd01d6fb1 100644 --- a/patches/server/0773-Dolphin-API.patch +++ b/patches/server/0773-Dolphin-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dolphin API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java -index 938e141f161acf5de5d3361382b514caea02c6fb..c1db88ceb65eb81c542171fc5465224ef613ce3b 100644 +index 938e141f161acf5de5d3361382b514caea02c6fb..18623159932df2dd5e43133b4396b43731693780 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java @@ -24,4 +24,34 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin { @@ -35,7 +35,7 @@ index 938e141f161acf5de5d3361382b514caea02c6fb..c1db88ceb65eb81c542171fc5465224e + + @Override + public org.bukkit.Location getTreasureLocation() { -+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level, this.getHandle().getTreasurePos()); ++ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos()); + } + + @Override diff --git a/patches/server/0784-Configurable-sculk-sensor-listener-range.patch b/patches/server/0784-Configurable-sculk-sensor-listener-range.patch index 9e9b13a2d6..2cbe4542b2 100644 --- a/patches/server/0784-Configurable-sculk-sensor-listener-range.patch +++ b/patches/server/0784-Configurable-sculk-sensor-listener-range.patch @@ -7,14 +7,14 @@ Subject: [PATCH] Configurable sculk sensor listener range public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java -index a6c226da995eecc323d69a3eff1f8d202410e069..c058187786686190adb8602984580ad7fa6b0069 100644 +index a6c226da995eecc323d69a3eff1f8d202410e069..ce42474501b4e168b7877df4d071c5f2eca549ea 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java @@ -48,9 +48,11 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList this.vibrationData = listener; }); } -+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.listener.listenerRange = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper ++ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) this.getListener().rangeOverride = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); // Paper } @@ -26,12 +26,32 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..c058187786686190adb8602984580ad7 VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { nbt.put("listener", listenerNbt); }); -+ if (this.listener.listenerRange != ((SculkSensorBlock) net.minecraft.world.level.block.Blocks.SCULK_SENSOR).getListenerRange()) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.listener.listenerRange); // Paper - only save if it's different from the default ++ if (this.getListener().rangeOverride != null || this.getListener().rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.getListener().rangeOverride); // Paper - only save if it's different from the default } @Override +diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +index 405709bed99bb0ddd3a746f0f7815b59394c1b81..ac8394b9caa4e0b3101897190a26c28ef8acfbd2 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +@@ -261,6 +261,7 @@ public interface VibrationSystem { + public static class Listener implements GameEventListener { + + private final VibrationSystem system; ++ @Nullable public Integer rangeOverride = null; // Paper + + public Listener(VibrationSystem receiver) { + this.system = receiver; +@@ -273,6 +274,7 @@ public interface VibrationSystem { + + @Override + public int getListenerRadius() { ++ if (this.rangeOverride != null) return this.rangeOverride; // Paper + return this.system.getVibrationUser().getListenerRadius(); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java -index de804383467518ef0f063aea948514db568f59db..38ab3ec08c2f95a14ee6de762e29f91b4a4b4500 100644 +index de804383467518ef0f063aea948514db568f59db..ba4069544de16d3562b55df4d7973e877d66ee1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkSensor.java @@ -21,4 +21,16 @@ public class CraftSculkSensor extends CraftBlo @@ -41,13 +61,13 @@ index de804383467518ef0f063aea948514db568f59db..38ab3ec08c2f95a14ee6de762e29f91b + // Paper start + @Override + public int getListenerRange() { -+ return this.getSnapshot().getListener().listenerRange; ++ return this.getSnapshot().getListener().getListenerRadius(); + } + + @Override + public void setListenerRange(int range) { + Preconditions.checkArgument(range > 0, "Vibration listener range must be greater than 0"); -+ this.getSnapshot().getListener().listenerRange = range; ++ this.getSnapshot().getListener().rangeOverride = range; + } + // Paper end } diff --git a/patches/server/0808-Allow-to-change-the-podium-for-the-EnderDragon.patch b/patches/server/0808-Allow-to-change-the-podium-for-the-EnderDragon.patch index 89168564a0..5ed62ee0e3 100644 --- a/patches/server/0808-Allow-to-change-the-podium-for-the-EnderDragon.patch +++ b/patches/server/0808-Allow-to-change-the-podium-for-the-EnderDragon.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow to change the podium for the EnderDragon diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index fada988941c33e09bce5e71bcb2bb733185f6c12..35681b380d22cb0ddeef2aec3553b9835c122aca 100644 +index fada988941c33e09bce5e71bcb2bb733185f6c12..92666c48620078623a451fbf68f673cb9f81c4b5 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -101,6 +101,10 @@ public class EnderDragon extends Mob implements Enemy { @@ -26,7 +26,7 @@ index fada988941c33e09bce5e71bcb2bb733185f6c12..35681b380d22cb0ddeef2aec3553b983 + // Paper start + public BlockPos getPodium() { + if (this.podium == null) { -+ return EndPodiumFeature.END_PODIUM_LOCATION; ++ return EndPodiumFeature.getLocation(this.getFightOrigin()); + } + return this.podium; + } diff --git a/patches/server/0834-Add-WardenAngerChangeEvent.patch b/patches/server/0834-Add-WardenAngerChangeEvent.patch index 03c36bc26f..2e66f62a0c 100644 --- a/patches/server/0834-Add-WardenAngerChangeEvent.patch +++ b/patches/server/0834-Add-WardenAngerChangeEvent.patch @@ -18,7 +18,7 @@ index 02abc5f387d781094bd2f39233444add3a470be1..ece82743df21f0b776382821ad75dee9 if (bl) { int j = this.angerByUuid.removeInt(entity.getUUID()); diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 64d3467322e6db1fc223ded9d4d1b26bc628b4e1..0b274c3937daf274c78d8d5854f740bbcadfb385 100644 +index 64d3467322e6db1fc223ded9d4d1b26bc628b4e1..97b763431bc5015448ee7a26a340635a932c950b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -486,6 +486,15 @@ public class Warden extends Monster implements VibrationSystem { @@ -28,7 +28,7 @@ index 64d3467322e6db1fc223ded9d4d1b26bc628b4e1..0b274c3937daf274c78d8d5854f740bb + // Paper start + int activeAnger = this.angerManagement.getActiveAnger(entity); + io.papermc.paper.event.entity.WardenAngerChangeEvent event = new io.papermc.paper.event.entity.WardenAngerChangeEvent((org.bukkit.entity.Warden) this.getBukkitEntity(), entity.getBukkitEntity(), activeAnger, Math.min(150, activeAnger + amount)); -+ this.level.getCraftServer().getPluginManager().callEvent(event); ++ this.level().getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } diff --git a/patches/server/0848-More-Teleport-API.patch b/patches/server/0848-More-Teleport-API.patch index 3630dfe237..091ae1381c 100644 --- a/patches/server/0848-More-Teleport-API.patch +++ b/patches/server/0848-More-Teleport-API.patch @@ -74,7 +74,7 @@ index 8317d5100d16fb242e4ff9f7b965e1dbd147cede..14b97388b89978b1c0997beeebd7c851 // Let the server handle cross world teleports if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 41784e46737a4a22aee53df4d4bdf170850b7a75..4b2ff9527d6af588a4947c6eea66eee89f888aaa 100644 +index 6373c2df3acd6dcae321e9914bea7a6beaa51c5d..e21efd74f8989f00c65c78b2963238aa822f129e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1233,13 +1233,100 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0853-Custom-Chat-Completion-Suggestions-API.patch b/patches/server/0853-Custom-Chat-Completion-Suggestions-API.patch index 6f2ca99ef1..c3db0a6b5f 100644 --- a/patches/server/0853-Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/server/0853-Custom-Chat-Completion-Suggestions-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom Chat Completion Suggestions API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4b2ff9527d6af588a4947c6eea66eee89f888aaa..62e4356f01e35da79af4b60eef271d250f850310 100644 +index e21efd74f8989f00c65c78b2963238aa822f129e..2fa044c3433c8c8a8d23f076e1c2e9f4786282ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -642,6 +642,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0881-Elder-Guardian-appearance-API.patch b/patches/server/0881-Elder-Guardian-appearance-API.patch index ca02d67fd2..6007ed7698 100644 --- a/patches/server/0881-Elder-Guardian-appearance-API.patch +++ b/patches/server/0881-Elder-Guardian-appearance-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Elder Guardian appearance API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 62e4356f01e35da79af4b60eef271d250f850310..5eea6d85606df02d342f3ff88d2a9f3f8b01303c 100644 +index 2fa044c3433c8c8a8d23f076e1c2e9f4786282ed..8ad996a3da13d1c98c892a65d1e02459b422a2eb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3108,6 +3108,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0898-Add-Player-Warden-Warning-API.patch b/patches/server/0898-Add-Player-Warden-Warning-API.patch index 399d146481..bf200500cf 100644 --- a/patches/server/0898-Add-Player-Warden-Warning-API.patch +++ b/patches/server/0898-Add-Player-Warden-Warning-API.patch @@ -10,7 +10,7 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5eea6d85606df02d342f3ff88d2a9f3f8b01303c..82ba1b4d0fbfb72bd858eafe942555f46577ca1e 100644 +index 8ad996a3da13d1c98c892a65d1e02459b422a2eb..6613c04d1812f89fc91dfe16020577ce8dc34703 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3113,6 +3113,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0901-check-global-player-list-where-appropriate.patch b/patches/server/0901-check-global-player-list-where-appropriate.patch index c2c99300b2..2206846285 100644 --- a/patches/server/0901-check-global-player-list-where-appropriate.patch +++ b/patches/server/0901-check-global-player-list-where-appropriate.patch @@ -66,7 +66,7 @@ index d860ddae508f53d06f74d8ae0efdfc500c1ddf07..3b959f42d958bf0f426853aee56753d6 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index faad948f089575e4988d989790cc1dd13f8a79cd..8a4c51204c591b420b25684d680ac1acb0cf4e12 100644 +index faad948f089575e4988d989790cc1dd13f8a79cd..5935cf23ec11ae48b6c7cec9bd696d10d808e729 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java @@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi @@ -75,7 +75,7 @@ index faad948f089575e4988d989790cc1dd13f8a79cd..8a4c51204c591b420b25684d680ac1ac public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { + // Paper start - ensure level is the same for sculk events + final ServerPlayer player = tryGetPlayer0(entity); -+ return player != null && player.level == entity.level ? player : null; ++ return player != null && player.level() == entity.level() ? player : null; + } + @Nullable + private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) { diff --git a/patches/server/0905-Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/server/0905-Ability-to-control-player-s-insomnia-and-phantoms.patch index 736015494c..458d74cc9c 100644 --- a/patches/server/0905-Ability-to-control-player-s-insomnia-and-phantoms.patch +++ b/patches/server/0905-Ability-to-control-player-s-insomnia-and-phantoms.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Ability to control player's insomnia and phantoms diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index f6e5406f84410ab9c177213157106739a2074cf8..f6ab024266e4fd36566a23db0c9af740dd7fa8fc 100644 +index de06ae3e8757c923a6f3f475a34885d2f15af46e..3ff999734d14e2b6e7828e117f5ee32a60c26bc1 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -27,7 +27,18 @@ public final class EntitySelector { return !entity.isSpectator(); }; public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); -- public static Predicate isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper +- public static Predicate IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper + // Paper start -+ public static Predicate isInsomniac = (player) -> { ++ public static Predicate IS_INSOMNIAC = (player) -> { + net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player; -+ int playerInsomniaTicks = serverPlayer.getLevel().paperConfig().entities.behavior.playerInsomniaStartTicks; ++ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks; + + if (playerInsomniaTicks <= 0) { + return false; diff --git a/patches/server/0910-Properly-resend-entities.patch b/patches/server/0910-Properly-resend-entities.patch index 28f7ca3d1c..06f6683a35 100644 --- a/patches/server/0910-Properly-resend-entities.patch +++ b/patches/server/0910-Properly-resend-entities.patch @@ -14,7 +14,7 @@ See: https://github.com/PaperMC/Paper/pull/1896 public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java -index d088479d160dbd2fc90b48a30553be141db8eef2..9e7a9e2fc19a0ac7a80a07efacf9cd2366826fa3 100644 +index d088479d160dbd2fc90b48a30553be141db8eef2..bf6a70a69bb695ec1a202cd1e863c468329f80fc 100644 --- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java +++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java @@ -253,14 +253,46 @@ public class SynchedEntityData { @@ -58,7 +58,7 @@ index d088479d160dbd2fc90b48a30553be141db8eef2..9e7a9e2fc19a0ac7a80a07efacf9cd23 + + net.minecraft.server.level.ServerEntity serverEntity = this.entity.tracker.serverEntity; + if (player.getBukkitEntity().canSee(entity.getBukkitEntity())) { -+ serverEntity.sendPairingData(player.connection::send, player); ++ serverEntity.sendPairingData(player, player.connection::send); + } + } + // Paper end diff --git a/patches/server/0912-fix-Instruments.patch b/patches/server/0912-fix-Instruments.patch index d8b3ab9e46..4fa1f7414a 100644 --- a/patches/server/0912-fix-Instruments.patch +++ b/patches/server/0912-fix-Instruments.patch @@ -6,7 +6,7 @@ Subject: [PATCH] fix Instruments properly handle Player#playNote diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 82ba1b4d0fbfb72bd858eafe942555f46577ca1e..b4f19650ae6486991bb83147b9fb589474aadb2d 100644 +index 6613c04d1812f89fc91dfe16020577ce8dc34703..6f0ad2bc2abacf7dd6309eca24694dc2e6f06819 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -744,62 +744,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0922-Flying-Fall-Damage.patch b/patches/server/0922-Flying-Fall-Damage.patch index 1a8b5cd95c..512f962eff 100644 --- a/patches/server/0922-Flying-Fall-Damage.patch +++ b/patches/server/0922-Flying-Fall-Damage.patch @@ -26,7 +26,7 @@ index 53487f0a4fe672298c3b83d24a2a603641afcde8..58152160d609d0e9d105153aeb166a56 } else { if (fallDistance >= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b4f19650ae6486991bb83147b9fb589474aadb2d..9d9881b0adc33fa72a61b019f328c254c13dc1b2 100644 +index 6f0ad2bc2abacf7dd6309eca24694dc2e6f06819..c90c92139277ee95edd5f8ed19d1bb5edc58be9f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2303,6 +2303,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0928-Win-Screen-API.patch b/patches/server/0928-Win-Screen-API.patch index 2020d18a37..1521d3f72a 100644 --- a/patches/server/0928-Win-Screen-API.patch +++ b/patches/server/0928-Win-Screen-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Win Screen API public net.minecraft.server.level.ServerPlayer seenCredits diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9d9881b0adc33fa72a61b019f328c254c13dc1b2..6e9c25337bf9b4bb80558174bdc24181dcbd695c 100644 +index c90c92139277ee95edd5f8ed19d1bb5edc58be9f..2eba253e58018ea7ee137cb8e902ed237360019d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1203,6 +1203,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0939-Fix-text-display-error-on-spawn.patch b/patches/server/0939-Fix-text-display-error-on-spawn.patch index f8962d532b..cb6ccd7e5e 100644 --- a/patches/server/0939-Fix-text-display-error-on-spawn.patch +++ b/patches/server/0939-Fix-text-display-error-on-spawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix text display error on spawn diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java -index cafecbdaa00984c6e0db83f39d4d4908756dd2c3..c9fb211412f936cde32b66b92dddfa04dd6de77f 100644 +index a291b809e39483ab350a1c861d160cb514281695..b7e77397c3c20d8112e17c8aed24e2186c1a72bc 100644 --- a/src/main/java/net/minecraft/world/entity/Display.java +++ b/src/main/java/net/minecraft/world/entity/Display.java @@ -800,7 +800,7 @@ public abstract class Display extends Entity { diff --git a/patches/server/0963-Expand-PlayerItemMendEvent.patch b/patches/server/0963-Expand-PlayerItemMendEvent.patch index f482fcc55d..dcb2fec231 100644 --- a/patches/server/0963-Expand-PlayerItemMendEvent.patch +++ b/patches/server/0963-Expand-PlayerItemMendEvent.patch @@ -33,7 +33,7 @@ index 000c13afc6bb3acb68b9adcaeefb7bb1cb703702..673327af0f77aeac0d704b0fb6bebebc return k > 0 ? this.repairPlayerItems(player, k) : 0; } else { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6e9c25337bf9b4bb80558174bdc24181dcbd695c..8fe9e6c540ae40b29c4e45b5efd6ff94478ba2dd 100644 +index 2eba253e58018ea7ee137cb8e902ed237360019d..be933acd3004e7e092be3688d0d9ee97b159ab5a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1673,11 +1673,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {