From 918ca965d919fc3ed4d11e09317b1dd91be774ff Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Fri, 25 Oct 2024 14:55:49 +0200 Subject: [PATCH] Compiler issues v3 --- patches/server/0002-Remap-fixes.patch | 13 ------- patches/server/0006-MC-Dev-fixes.patch | 39 +++++++++++++++++++ patches/server/0009-MC-Utils.patch | 18 ++++----- patches/server/0023-Timings-v2.patch | 2 +- ...able-API-and-replenishable-lootables.patch | 10 ++--- .../0101-Fix-global-sound-handling.patch | 11 +++--- ...-profile-lookups-to-worldgen-threads.patch | 2 +- ...4-PlayerNaturallySpawnCreaturesEvent.patch | 2 +- .../0212-PlayerLaunchProjectileEvent.patch | 4 +- ...er-Thread-Pool-and-Thread-Priorities.patch | 2 +- .../0306-Tracking-Range-Improvements.patch | 2 +- ...-PlayerChunkMap-adds-crashing-server.patch | 2 +- ...nEvent-when-Player-is-actually-ready.patch | 2 +- .../0432-Add-PlayerItemCooldownEvent.patch | 6 +-- .../0437-Add-PlayerShearBlockEvent.patch | 8 ++-- ...1-Add-PlayerFlowerPotManipulateEvent.patch | 4 +- ...gistryAccess-for-managing-Registries.patch | 2 +- .../0468-Add-StructuresLocateEvent.patch | 6 +-- .../0528-ItemStack-repair-check-API.patch | 4 +- ...5-Improve-item-default-attribute-API.patch | 2 +- .../0580-Get-entity-default-attributes.patch | 8 ++-- ...89-Add-Raw-Byte-Entity-Serialization.patch | 4 +- ...primise-map-impl-for-tracked-players.patch | 2 +- .../0620-Configurable-feature-seeds.patch | 2 +- ...de-code-using-deprecated-for-removal.patch | 2 +- ...d-missing-structure-set-seed-configs.patch | 2 +- ..._destroyed-trigger-in-the-correct-pl.patch | 2 +- ...us-missing-EntityDropItemEvent-calls.patch | 2 +- ...0727-Add-NamespacedKey-biome-methods.patch | 6 +-- ...ntityChangeBlockEvent-in-more-places.patch | 27 +++++++------ .../0737-fix-Jigsaw-block-kicking-user.patch | 4 +- .../0740-Fix-a-bunch-of-vanilla-bugs.patch | 2 +- .../0768-Player-Entity-Tracking-Events.patch | 2 +- ...ItemEvent-and-EntityCompostItemEvent.patch | 2 +- ...x-custom-statistic-criteria-creation.patch | 2 +- ...y-handle-BlockBreakEvent-isDropItems.patch | 2 +- ...ntity-tracking-range-by-Y-coordinate.patch | 2 +- ...e-nearest-structure-border-iteration.patch | 2 +- .../0874-Fix-spigot-s-Forced-Stats.patch | 4 +- ...883-Fix-UnsafeValues-loadAdvancement.patch | 2 +- ...k-if-we-can-see-non-visible-entities.patch | 2 +- ...llocation-of-Vec3D-by-entity-tracker.patch | 2 +- ...Add-api-for-spawn-egg-texture-colors.patch | 2 +- .../0918-Add-Lifecycle-Event-system.patch | 2 +- .../server/0919-ItemStack-Tooltip-API.patch | 2 +- patches/server/0979-Anti-Xray.patch | 12 +++--- ...y-type-tags-suggestions-in-selectors.patch | 4 +- ...heck-distance-in-entity-interactions.patch | 2 +- .../0993-Registry-Modification-API.patch | 20 +++++----- ...95-Proxy-ItemStack-to-CraftItemStack.patch | 2 +- patches/server/1020-Add-FeatureFlag-API.patch | 2 +- .../server/1021-Tag-Lifecycle-Events.patch | 2 +- .../1022-Item-serialization-as-json.patch | 2 +- 53 files changed, 154 insertions(+), 124 deletions(-) diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 2bb4aff8a2..d7cff4215b 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -58,19 +58,6 @@ index 7344cff32fa6fe3dedb74ed98126072c55b0abd2..d98b28e9488a5a7736719cf656736bb0 entityliving1 = entityliving2; } else { entityliving1 = null; -diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java -index 33170f2f1d3f030fbf342e44a1baa109a34c31a7..db8bb6e47b28bac6cf568415af3ffdd6eeac6ac7 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java -@@ -349,7 +349,7 @@ public class Dolphin extends AgeableWaterCreature { - - @Nullable - @Override -- protected SoundEvent getDeathSound() { -+ public SoundEvent getDeathSound() { // Paper - remap fixes - return SoundEvents.DOLPHIN_DEATH; - } - diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java index f3a2612f0e27c36d5206334307eac1880ce8c4b7..4d4d413b8527e1a109276928611b8c857ad6f6aa 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java diff --git a/patches/server/0006-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch index 2f90f68dd2..6c9bb2f227 100644 --- a/patches/server/0006-MC-Dev-fixes.patch +++ b/patches/server/0006-MC-Dev-fixes.patch @@ -4,6 +4,19 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes +diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java +index 5b9ca3d968fd4884b1b7f2c06477ae00c09f202e..0842080f1840a83b34c2cc829dfddba78ba12157 100644 +--- a/src/main/java/net/minecraft/Util.java ++++ b/src/main/java/net/minecraft/Util.java +@@ -533,7 +533,7 @@ public class Util { + public static , V> EnumMap makeEnumMap(Class enumClass, Function mapper) { + EnumMap enumMap = new EnumMap<>(enumClass); + +- for (K enum_ : (Enum[])enumClass.getEnumConstants()) { ++ for (K enum_ : enumClass.getEnumConstants()) { // Paper - decompile error + enumMap.put(enum_, mapper.apply(enum_)); + } + diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java index 643bb8860962ad691b11073f6dbf406bf7ec5fb1..9b8ec1fd158f6e51779be263fd56b9119d0d9bbb 100644 --- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java @@ -70,6 +83,19 @@ index a614e960fcd5958ad17b679eee8a8e6926f58e62..da101bca71f4710812621b98f0a0d8ca } if (!this.hasElementSeparator()) { +diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java +index f4f1a99d53ffb953beb2a944f54d28fa6349fa29..a75f6fefdd72188fa8d16df2b5cbb34c4129f52d 100644 +--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java ++++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java +@@ -74,7 +74,7 @@ import org.slf4j.Logger; + + public class RegistryDataLoader { + private static final Logger LOGGER = LogUtils.getLogger(); +- private static final Comparator> ERROR_KEY_COMPARATOR = Comparator.comparing(ResourceKey::registry).thenComparing(ResourceKey::location); ++ private static final Comparator> ERROR_KEY_COMPARATOR = Comparator., ResourceLocation>comparing(ResourceKey::registry).thenComparing(ResourceKey::location); // Paper - decompile fix + private static final RegistrationInfo NETWORK_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental()); + private static final Function, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize(knownPacks -> { + Lifecycle lifecycle = knownPacks.map(KnownPack::isVanilla).map(vanilla -> Lifecycle.stable()).orElse(Lifecycle.experimental()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 3fc0abef2c4e2c8ceb3b8c4f02c59700aa3d0803..8e16bc7da15824723f1d7d4bff87fac181978500 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -96,6 +122,19 @@ index 661a6274a800ca9b91bdb809d026972d23c3b263..ea72dcb064a35bc6245bc5c94d592efe } public static SortedArraySet create(Comparator comparator) { +diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java +index 33170f2f1d3f030fbf342e44a1baa109a34c31a7..dde1ccca98f58200910334160f0f79eb00dd2388 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java +@@ -349,7 +349,7 @@ public class Dolphin extends AgeableWaterCreature { + + @Nullable + @Override +- protected SoundEvent getDeathSound() { ++ public SoundEvent getDeathSound() { // Paper - decompile error + return SoundEvents.DOLPHIN_DEATH; + } + diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java index cf025d7a4392213db3cf04e7ace3e2b166e710eb..3e8631c7bd1e7591051ca21c6ae7acd87d3c7529 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index d98cff6991..1adc5ed577 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -3868,7 +3868,7 @@ index 0000000000000000000000000000000000000000..11b7f15755dde766140c29bedca456c8 +} diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..af9623240ff2d389aa7090623f507720e7dbab7d +index 0000000000000000000000000000000000000000..561a1a3ff418393d0a0db58de91b336f4c33aa4e --- /dev/null +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java @@ -0,0 +1,54 @@ @@ -3882,11 +3882,11 @@ index 0000000000000000000000000000000000000000..af9623240ff2d389aa7090623f507720 + // min, max are inclusive + + public static int getMaxSection(final LevelHeightAccessor world) { -+ return world.getMaxSection() - 1; // getMaxSection() is exclusive ++ return world.getMaxSectionY() - 1; // getMaxSection() is exclusive + } + + public static int getMinSection(final LevelHeightAccessor world) { -+ return world.getMinSection(); ++ return world.getMinSectionY(); + } + + public static int getMaxLightSection(final LevelHeightAccessor world) { @@ -4288,7 +4288,7 @@ index 0000000000000000000000000000000000000000..f7114d5b8f2f93f62883e24da29afaf9 + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 5b9ca3d968fd4884b1b7f2c06477ae00c09f202e..5d0ef11671beb2381e0e1959f5e5f845789a2982 100644 +index 0842080f1840a83b34c2cc829dfddba78ba12157..2ff5a6517d717bbd4c944572040bd30866347341 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -136,7 +136,7 @@ public class Util { @@ -4538,7 +4538,7 @@ index 59bc334ade71c106e01e54db8d21fb65563dd3f1..b9ab241b930edc63a39dbbcf14cd0b5e } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 952936754cbe5a6fae543d19432599e30eb495b0..88e98f49565a098debcea8d58368e53d7623f6b5 100644 +index 952936754cbe5a6fae543d19432599e30eb495b0..3bb6eaabe8f62b556a52b83227b48f8324a9d0f0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -174,6 +174,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -4616,29 +4616,27 @@ index 952936754cbe5a6fae543d19432599e30eb495b0..88e98f49565a098debcea8d58368e53d } private void processUnloads(BooleanSupplier shouldKeepTicking) { -@@ -568,9 +583,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -568,8 +583,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.scheduleUnload(pos, chunk); } else { ChunkAccess ichunkaccess = chunk.getLatestChunk(); - - if (this.pendingUnloads.remove(pos, chunk) && ichunkaccess != null) { -- LevelChunk chunk1; + // Paper start + boolean removed; + if ((removed = this.pendingUnloads.remove(pos, chunk)) && ichunkaccess != null) { + ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk); + // Paper end -+ LevelChunk chunk; + LevelChunk chunk1; if (ichunkaccess instanceof LevelChunk) { - chunk1 = (LevelChunk) ichunkaccess; @@ -587,7 +605,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.nextChunkSaveTime.remove(ichunkaccess.getPos().toLong()); - } + } else if (removed) { // Paper start -+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, holder); ++ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk); + } // Paper end } diff --git a/patches/server/0023-Timings-v2.patch b/patches/server/0023-Timings-v2.patch index a8f502b7e6..0fd756a82d 100644 --- a/patches/server/0023-Timings-v2.patch +++ b/patches/server/0023-Timings-v2.patch @@ -991,7 +991,7 @@ index 9d6be455c3bbcdbcb9d3d24b0bad79f46ba6a8cb..de6cceeec4fc4a64d325b506ae9d9b0e // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 88e98f49565a098debcea8d58368e53d7623f6b5..84ea1974445fc7be80ed474d8a2133b58ee4c8fe 100644 +index 3bb6eaabe8f62b556a52b83227b48f8324a9d0f0..30b28d9523820ed138c837ab9ee9bbb23c0dd285 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,8 +1,10 @@ diff --git a/patches/server/0095-LootTable-API-and-replenishable-lootables.patch b/patches/server/0095-LootTable-API-and-replenishable-lootables.patch index edb6659a69..373db66b1f 100644 --- a/patches/server/0095-LootTable-API-and-replenishable-lootables.patch +++ b/patches/server/0095-LootTable-API-and-replenishable-lootables.patch @@ -109,7 +109,7 @@ index 0000000000000000000000000000000000000000..0699c60920333ea1fec04e3c94d95224 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java new file mode 100644 -index 0000000000000000000000000000000000000000..de528b8bafd75b6f14b1384157f3a8a27e06b4a2 +index 0000000000000000000000000000000000000000..d933054535c83f877888cd36cd8bd8bf9d93a9df --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntity.java @@ -0,0 +1,29 @@ @@ -128,18 +128,18 @@ index 0000000000000000000000000000000000000000..de528b8bafd75b6f14b1384157f3a8a2 + /* Lootable */ + @Override + default @Nullable LootTable getLootTable() { -+ return CraftLootTable.minecraftToBukkit(this.getHandle().getLootTable()); ++ return CraftLootTable.minecraftToBukkit(this.getHandle().getContainerLootTable()); + } + + @Override + default void setLootTable(final @Nullable LootTable table, final long seed) { -+ this.getHandle().setLootTable(CraftLootTable.bukkitToMinecraft(table)); -+ this.getHandle().setLootTableSeed(seed); ++ this.getHandle().setContainerLootTable(CraftLootTable.bukkitToMinecraft(table)); ++ this.getHandle().setContainerLootTableSeed(seed); + } + + @Override + default long getSeed() { -+ return this.getHandle().getLootTableSeed(); ++ return this.getHandle().getContainerLootTableSeed(); + } +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java diff --git a/patches/server/0101-Fix-global-sound-handling.patch b/patches/server/0101-Fix-global-sound-handling.patch index 68b8b9a1b8..e96dd9f673 100644 --- a/patches/server/0101-Fix-global-sound-handling.patch +++ b/patches/server/0101-Fix-global-sound-handling.patch @@ -80,21 +80,22 @@ index 4c284ccd5b2eb05f487aba18e1daa0b59c3e8129..10c79cbc25383c0b65fb22a734751313 double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 04fce5cc4350df81c7ea103b74b845313dd6cc37..770467bd319f8e2fdf3d713591368aa825cfa5ae 100644 +index 04fce5cc4350df81c7ea103b74b845313dd6cc37..08cbf02bba3633a84cce90c202d13f2beb5b88a2 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -@@ -66,11 +66,12 @@ public class EnderEyeItem extends Item { +@@ -66,11 +66,13 @@ public class EnderEyeItem extends Item { // world.globalLevelEvent(1038, blockposition1.offset(1, 0, 1), 0); int viewDistance = world.getCraftServer().getViewDistance() * 16; BlockPos soundPos = blockposition1.offset(1, 0, 1); - for (ServerPlayer player : world.getServer().getPlayerList().players) { -+ for (ServerPlayer player : world.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule ++ final net.minecraft.server.level.ServerLevel serverLevel = (net.minecraft.server.level.ServerLevel) world; // Paper - respect global sound events gamerule - ensured by isClientSide check above ++ for (ServerPlayer player : serverLevel.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule double deltaX = soundPos.getX() - player.getX(); double deltaZ = soundPos.getZ() - player.getZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; - if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot -+ final double soundRadiusSquared = world.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule -+ if (!world.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule ++ final double soundRadiusSquared = serverLevel.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule ++ if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule if (distanceSquared > viewDistance * viewDistance) { double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; diff --git a/patches/server/0135-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0135-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 572b69e96e..11222ddf7d 100644 --- a/patches/server/0135-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0135-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -10,7 +10,7 @@ out due to a sync load, as the worldgen threads will be stalling on profile lookups. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 5d0ef11671beb2381e0e1959f5e5f845789a2982..b87d3ac2700eedb492bd55a631c60630c2f9c96c 100644 +index 2ff5a6517d717bbd4c944572040bd30866347341..8cac2075077b1d9c2b01e09c99780ff9e204abb2 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -95,6 +95,22 @@ public class Util { diff --git a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch index 1c3173436b..176e327764 100644 --- a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,7 +9,7 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 84ea1974445fc7be80ed474d8a2133b58ee4c8fe..aa3155bb57c09895d13914b46c77de78a90f250a 100644 +index 30b28d9523820ed138c837ab9ee9bbb23c0dd285..01c32ed14b1047671883911f8606ef2924ebee73 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1100,7 +1100,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0212-PlayerLaunchProjectileEvent.patch b/patches/server/0212-PlayerLaunchProjectileEvent.patch index 14e01c4e3f..1905955997 100644 --- a/patches/server/0212-PlayerLaunchProjectileEvent.patch +++ b/patches/server/0212-PlayerLaunchProjectileEvent.patch @@ -201,7 +201,7 @@ index 7a5045469bc2d383ed087dcc094b6f97df4ec7ab..fa92a1346825f00a585503d0a0825711 } } diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main/java/net/minecraft/world/item/SnowballItem.java -index ada9bc42a788b5f472324a0765edf5766d729784..1e996276a80b34e353c6a7c7fee765c9db7123ea 100644 +index ada9bc42a788b5f472324a0765edf5766d729784..57872ebef6beb8cdc03c9f8f19de94652ee19062 100644 --- a/src/main/java/net/minecraft/world/item/SnowballItem.java +++ b/src/main/java/net/minecraft/world/item/SnowballItem.java @@ -26,17 +26,26 @@ public class SnowballItem extends Item implements ProjectileItem { @@ -212,7 +212,7 @@ index ada9bc42a788b5f472324a0765edf5766d729784..1e996276a80b34e353c6a7c7fee765c9 - itemstack.consume(1, user); + // Paper start - PlayerLaunchProjectileEvent + final Projectile.Delayed snowball = Projectile.spawnProjectileFromRotationDelayed(Snowball::new, worldserver, itemstack, user, 0.0F, 1.5F, 1.0F); -+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity()); ++ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) snowball.projectile().getBukkitEntity()); + if (event.callEvent() && snowball.attemptSpawn()) { + user.awardStat(Stats.ITEM_USED.get(this)); + if (event.shouldConsume()) { diff --git a/patches/server/0260-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0260-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 7ea32f4967..3d0645bfc4 100644 --- a/patches/server/0260-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0260-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index b87d3ac2700eedb492bd55a631c60630c2f9c96c..0fbe4ea495a8101f6bc1b9830ce3f47af2aa5be4 100644 +index 8cac2075077b1d9c2b01e09c99780ff9e204abb2..bf2833c92eca6491699b4a89410e4e46b5bbe4d1 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -92,7 +92,7 @@ public class Util { diff --git a/patches/server/0306-Tracking-Range-Improvements.patch b/patches/server/0306-Tracking-Range-Improvements.patch index 45bbbb2ad5..a7cfc3f988 100644 --- a/patches/server/0306-Tracking-Range-Improvements.patch +++ b/patches/server/0306-Tracking-Range-Improvements.patch @@ -8,7 +8,7 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index aa3155bb57c09895d13914b46c77de78a90f250a..b849d24144dc9f7d24484398cec3b2b90befb507 100644 +index 01c32ed14b1047671883911f8606ef2924ebee73..f8decd2f1841da947a3cff5b275efff63ba37def 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1604,6 +1604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 538add8493..3a9e4f516e 100644 --- a/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index b849d24144dc9f7d24484398cec3b2b90befb507..f3b99cd96672363e0d60e56b744f0bea8fa00c3f 100644 +index f8decd2f1841da947a3cff5b275efff63ba37def..926e1ebfe3a011a28fb82b855511aaabca0c4072 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1300,6 +1300,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch b/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch index 7d3cdd3d1c..0863194ba3 100644 --- a/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch +++ b/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch @@ -31,7 +31,7 @@ delays anymore. public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f3b99cd96672363e0d60e56b744f0bea8fa00c3f..8121f7f5fb4dadb1c929b3d81121e3649981bfac 100644 +index 926e1ebfe3a011a28fb82b855511aaabca0c4072..4d8dcc47b39d28ab715110e55110869fe3c9b456 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1307,6 +1307,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0432-Add-PlayerItemCooldownEvent.patch b/patches/server/0432-Add-PlayerItemCooldownEvent.patch index 70845dd2e6..954ff181f9 100644 --- a/patches/server/0432-Add-PlayerItemCooldownEvent.patch +++ b/patches/server/0432-Add-PlayerItemCooldownEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerItemCooldownEvent diff --git a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java -index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..872813ef19fc08cad93786367e15f59400825c33 100644 +index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..2a80b8e962bf9d01e720b5967f0feac7d5dcaa28 100644 --- a/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java +++ b/src/main/java/net/minecraft/world/item/ServerItemCooldowns.java @@ -11,6 +11,16 @@ public class ServerItemCooldowns extends ItemCooldowns { @@ -14,8 +14,8 @@ index 3a45a149ec4a28f25ea9e45803ecbb7392b63f86..872813ef19fc08cad93786367e15f594 + // Paper start - Add PlayerItemCooldownEvent + @Override -+ public void addCooldown(Item item, int duration) { -+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item), duration); ++ public void addCooldown(ItemStack item, int duration) { ++ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item.getItem()), duration); + if (event.callEvent()) { + super.addCooldown(item, event.getCooldown()); + } diff --git a/patches/server/0437-Add-PlayerShearBlockEvent.patch b/patches/server/0437-Add-PlayerShearBlockEvent.patch index ea5d3db951..db7c1ccc71 100644 --- a/patches/server/0437-Add-PlayerShearBlockEvent.patch +++ b/patches/server/0437-Add-PlayerShearBlockEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerShearBlockEvent diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a165757d1c 100644 +index 7e2a39a1ee092b46ab46caec0214255d9c333536..20f705c90a0a96321cfe29c0cf564013dcccd18f 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java @@ -141,7 +141,7 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -25,7 +25,7 @@ index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a1 + io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); + event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3))); + if (!event.callEvent()) { -+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.PASS; + } + // Paper end world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); @@ -39,7 +39,7 @@ index 7e2a39a1ee092b46ab46caec0214255d9c333536..a5b84e6844e16cf1fdfb6f45efb8a7a1 flag = true; world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos); diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -index dad7a610286b0ab6b916a6169fa8f6f641deb39a..42413723b3c826debb310ef1d5d2c9f80a616e86 100644 +index dad7a610286b0ab6b916a6169fa8f6f641deb39a..2b43c77d5aa609d4716df827cefcf008dfd13a06 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java @@ -38,16 +38,24 @@ public class PumpkinBlock extends Block { @@ -50,7 +50,7 @@ index dad7a610286b0ab6b916a6169fa8f6f641deb39a..42413723b3c826debb310ef1d5d2c9f8 + io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); + event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4))); + if (!event.callEvent()) { -+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.PASS; + } + // Paper end - Add PlayerShearBlockEvent Direction direction = hit.getDirection(); diff --git a/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch index aa78c43c60..5b13a05793 100644 --- a/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/0451-Add-PlayerFlowerPotManipulateEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -index c6de1b6587b300404c38c27f566c80de11bc0814..863eec736b4941930c62ca357703a56d4d21c950 100644 +index c6de1b6587b300404c38c27f566c80de11bc0814..bee71ed48365694c488af88317a738fc6a4e5893 100644 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java @@ -61,6 +61,18 @@ public class FlowerPotBlock extends Block { @@ -21,7 +21,7 @@ index c6de1b6587b300404c38c27f566c80de11bc0814..863eec736b4941930c62ca357703a56d + // Update client + player.containerMenu.sendAllDataToRemote(); + -+ return ItemInteractionResult.CONSUME; ++ return InteractionResult.CONSUME; + } + // Paper end - Add PlayerFlowerPotManipulateEvent world.setBlock(pos, blockState, 3); diff --git a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch index 2dfbc6b560..5c38218948 100644 --- a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch @@ -719,7 +719,7 @@ index 3f72e30b57fb2a4231e22a2234729408c1240af4..4638ba98dbbdb0f880337347be85a6e0 LOADERS.put(resourceLocation, () -> initializer.run(registry)); WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -index f4f1a99d53ffb953beb2a944f54d28fa6349fa29..144a6f5b0c53110804d6d099fe857d25f107d938 100644 +index a75f6fefdd72188fa8d16df2b5cbb34c4129f52d..61774165a25209ee6d26cf8d80149b220c3874e6 100644 --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java @@ -351,6 +351,7 @@ public class RegistryDataLoader { diff --git a/patches/server/0468-Add-StructuresLocateEvent.patch b/patches/server/0468-Add-StructuresLocateEvent.patch index 5312adefad..5556e96212 100644 --- a/patches/server/0468-Add-StructuresLocateEvent.patch +++ b/patches/server/0468-Add-StructuresLocateEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add StructuresLocateEvent Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 115deba41ec48143570489e8494785a3a48cd789..fd2dd6d25b8d6f3066c60a7f30a58a72cb418b85 100644 +index 115deba41ec48143570489e8494785a3a48cd789..e3c5a49611d584fbd19a44da5aa78ff6d7c43881 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -126,6 +126,24 @@ public abstract class ChunkGenerator { @@ -23,12 +23,12 @@ index 115deba41ec48143570489e8494785a3a48cd789..fd2dd6d25b8d6f3066c60a7f30a58a72 + return null; + } + if (event.getResult() != null) { -+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure()))); ++ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure()))); + } + center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin()); + radius = event.getRadius(); + skipReferencedStructures = event.shouldFindUnexplored(); -+ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures()); ++ structures = HolderSet.direct(api -> world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures()); + } + // Paper end ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState(); diff --git a/patches/server/0528-ItemStack-repair-check-API.patch b/patches/server/0528-ItemStack-repair-check-API.patch index cd4d723393..46a3c41921 100644 --- a/patches/server/0528-ItemStack-repair-check-API.patch +++ b/patches/server/0528-ItemStack-repair-check-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e546cf93d79b109d50840ebf1fb133ad3c9331d3..1ae77ef4bd47a4aea894242cd48dbf042477da33 100644 +index e546cf93d79b109d50840ebf1fb133ad3c9331d3..844dbd996858aa02e81a4256383df6992b87bde2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -532,6 +532,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -18,7 +18,7 @@ index e546cf93d79b109d50840ebf1fb133ad3c9331d3..1ae77ef4bd47a4aea894242cd48dbf04 + if (!itemToBeRepaired.getType().isItem() || !repairMaterial.getType().isItem()) { + return false; + } -+ return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); ++ return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial)); + } // Paper end diff --git a/patches/server/0535-Improve-item-default-attribute-API.patch b/patches/server/0535-Improve-item-default-attribute-API.patch index c9eb3843be..b970088c75 100644 --- a/patches/server/0535-Improve-item-default-attribute-API.patch +++ b/patches/server/0535-Improve-item-default-attribute-API.patch @@ -62,7 +62,7 @@ index 68756419ac6ee292db9569eab380a5c14d748002..6d76cc1db3ac3f1ae74c13511937fb86 return defaultAttributes.build(); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1ae77ef4bd47a4aea894242cd48dbf042477da33..0d9c90a99aa2d8fcf421680aeef4c2fd7ec0fd57 100644 +index 844dbd996858aa02e81a4256383df6992b87bde2..7e33f55e4a269fd8e96080776c97f49d65e895c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -391,7 +391,11 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0580-Get-entity-default-attributes.patch b/patches/server/0580-Get-entity-default-attributes.patch index d383f32269..ef862f64a6 100644 --- a/patches/server/0580-Get-entity-default-attributes.patch +++ b/patches/server/0580-Get-entity-default-attributes.patch @@ -81,23 +81,23 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0d9c90a99aa2d8fcf421680aeef4c2fd7ec0fd57..5c0a6d93b424db91a5f6474165434f5db3d15a8a 100644 +index 7e33f55e4a269fd8e96080776c97f49d65e895c4..c9e0a2a4c7c8ab50f6dbb6079f2cba06652a92a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -544,6 +544,18 @@ public final class CraftMagicNumbers implements UnsafeValues { } - return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); + return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial)); } + + @Override + public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) { -+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); ++ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); + } + + @Override + public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) { + Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes"); -+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); ++ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); + return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); + } // Paper end diff --git a/patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch index 75c80fef00..3464fbf215 100644 --- a/patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0589-Add-Raw-Byte-Entity-Serialization.patch @@ -50,7 +50,7 @@ index 0c1c9033646dedcf1d11dee74d6965683adadf0a..1ed01978611cddb2558e441863dadc46 @Override public boolean isInvisible() { // Paper - moved up from LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 5c0a6d93b424db91a5f6474165434f5db3d15a8a..e2873a1eeb01516b689d0175b091808b2797995f 100644 +index c9e0a2a4c7c8ab50f6dbb6079f2cba06652a92a3..8d51786837448db1a96d0071293025d07e14c225 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -494,7 +494,33 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -80,7 +80,7 @@ index 5c0a6d93b424db91a5f6474165434f5db3d15a8a..e2873a1eeb01516b689d0175b091808b + // Generate a new UUID so we don't have to worry about deserializing the same entity twice + compound.remove("UUID"); + } -+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle()) ++ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle(), net.minecraft.world.entity.EntitySpawnReason.LOAD) + .orElseThrow(() -> new IllegalArgumentException("An ID was not found for the data. Did you downgrade?")).getBukkitEntity(); + } + diff --git a/patches/server/0602-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0602-Oprimise-map-impl-for-tracked-players.patch index fb3f239856..c0bbabf27c 100644 --- a/patches/server/0602-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0602-Oprimise-map-impl-for-tracked-players.patch @@ -7,7 +7,7 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 8121f7f5fb4dadb1c929b3d81121e3649981bfac..7f18146c0dea654c62b3e01e6848fd1c05f87946 100644 +index 4d8dcc47b39d28ab715110e55110869fe3c9b456..75854574aa8d4aef35d84ba4c0fc7df9a67ae48c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1520,7 +1520,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0620-Configurable-feature-seeds.patch b/patches/server/0620-Configurable-feature-seeds.patch index 9085e326c3..ffca9db1e2 100644 --- a/patches/server/0620-Configurable-feature-seeds.patch +++ b/patches/server/0620-Configurable-feature-seeds.patch @@ -19,7 +19,7 @@ index 49028463ba47e760281545c2f7597e3db8d6c453..7620c72a4c243cbeea245203ce03a97c } final Object val = config.get(key); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index fd2dd6d25b8d6f3066c60a7f30a58a72cb418b85..575fa665ff9c8f52056a0e7305540ec5c3da4785 100644 +index e3c5a49611d584fbd19a44da5aa78ff6d7c43881..fc8e3edd9734fa7b69f0fc6b4eefd8a704e451cf 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -436,7 +436,14 @@ public abstract class ChunkGenerator { diff --git a/patches/server/0624-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0624-Remove-client-side-code-using-deprecated-for-removal.patch index 3640523f9a..1a9d2657f1 100644 --- a/patches/server/0624-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0624-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Remove client-side code using deprecated for removal Fixes warnings on build diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 0fbe4ea495a8101f6bc1b9830ce3f47af2aa5be4..60e523f4de1cbafc2c58a5d568fe3989b7b07c34 100644 +index bf2833c92eca6491699b4a89410e4e46b5bbe4d1..57223285860f61119b6cf348aa78e59384a04e22 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -1082,16 +1082,7 @@ public class Util { diff --git a/patches/server/0655-Add-missing-structure-set-seed-configs.patch b/patches/server/0655-Add-missing-structure-set-seed-configs.patch index 2862998d84..42bd7f0c4b 100644 --- a/patches/server/0655-Add-missing-structure-set-seed-configs.patch +++ b/patches/server/0655-Add-missing-structure-set-seed-configs.patch @@ -20,7 +20,7 @@ seeds/salts to the frequency reducer which has a similar effect. Co-authored-by: William Blake Galbreath diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 575fa665ff9c8f52056a0e7305540ec5c3da4785..906f56d07c26ef3c2dc1a3b62e9349dd91a37742 100644 +index fc8e3edd9734fa7b69f0fc6b4eefd8a704e451cf..31c5f54c90d6e35875f762747f8618e58e2eed91 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -573,7 +573,7 @@ public abstract class ChunkGenerator { diff --git a/patches/server/0690-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch b/patches/server/0690-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch index 3ba905932f..3ecc56a332 100644 --- a/patches/server/0690-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch +++ b/patches/server/0690-Trigger-bee_nest_destroyed-trigger-in-the-correct-pl.patch @@ -40,7 +40,7 @@ index e000a918230187f6841b03b7b0dd73687f3cc15e..5c3e5c348e6fececccd8097355f423b9 return true; // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index a5b84e6844e16cf1fdfb6f45efb8a7a165757d1c..90f69a0c4d0707fd2319db71aea7dfdc14636d82 100644 +index 20f705c90a0a96321cfe29c0cf564013dcccd18f..d5ed53c37bba79f84b60d616887cd5176e124f10 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java @@ -103,7 +103,7 @@ public class BeehiveBlock extends BaseEntityBlock { diff --git a/patches/server/0714-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0714-Add-various-missing-EntityDropItemEvent-calls.patch index 0a9ed2d8c1..410a98a923 100644 --- a/patches/server/0714-Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/0714-Add-various-missing-EntityDropItemEvent-calls.patch @@ -24,7 +24,7 @@ index 37111113f6ab6d77c558b10c4162758135db99b0..911b6391455402922e8bd52cfe9e5694 EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java -index db8bb6e47b28bac6cf568415af3ffdd6eeac6ac7..59b00aa57f62ec9d56c28d18c493e952e66f39c7 100644 +index dde1ccca98f58200910334160f0f79eb00dd2388..5af4d590a9b0f17ba53c6959d9c18bd1269878a4 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java +++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java @@ -604,7 +604,7 @@ public class Dolphin extends AgeableWaterCreature { diff --git a/patches/server/0727-Add-NamespacedKey-biome-methods.patch b/patches/server/0727-Add-NamespacedKey-biome-methods.patch index 0991968c4d..547d0fb0b7 100644 --- a/patches/server/0727-Add-NamespacedKey-biome-methods.patch +++ b/patches/server/0727-Add-NamespacedKey-biome-methods.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e2873a1eeb01516b689d0175b091808b2797995f..66913ab43bb1e9066487749ff60248c22fc8e824 100644 +index 8d51786837448db1a96d0071293025d07e14c225..9e0af05e066132b66fafff84ff0a0957c1a44f9f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -584,6 +584,21 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -17,13 +17,13 @@ index e2873a1eeb01516b689d0175b091808b2797995f..66913ab43bb1e9066487749ff60248c2 + @Override + public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) { + org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor; -+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value())); ++ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value())); + } + + @Override + public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) { + org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor; -+ net.minecraft.core.Holder biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); ++ net.minecraft.core.Holder biomeBase = cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); + cra.setBiome(x, y, z, biomeBase); + } + // Paper end - namespaced key biome methods diff --git a/patches/server/0730-Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/0730-Fire-EntityChangeBlockEvent-in-more-places.patch index 3fab5db628..1d46619357 100644 --- a/patches/server/0730-Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/0730-Fire-EntityChangeBlockEvent-in-more-places.patch @@ -7,18 +7,23 @@ Co-authored-by: ChristopheG <61288881+chrisgdt@users.noreply.github.com> Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java -index e311f94918fb03e9d202cbae71b0909ea3219180..d090126dbe6b69489490e6b1e2d443fa171ddde6 100644 +index e311f94918fb03e9d202cbae71b0909ea3219180..b751748196b458c8a89d512fdd9f9632d25e8be8 100644 --- a/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java +++ b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java -@@ -25,7 +25,7 @@ class WeavingMobEffect extends MobEffect { +@@ -25,11 +25,11 @@ class WeavingMobEffect extends MobEffect { @Override public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) { if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { - this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition()); -+ this.spawnCobwebsRandomlyAround(entity, world, entity.getRandom(), entity.blockPosition()); // Paper - Fire EntityChangeBlockEvent in more places ++ this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places } } +- private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos) { ++ private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places + Set set = Sets.newHashSet(); + int i = this.maxCobwebs.applyAsInt(random); + @@ -46,6 +46,7 @@ class WeavingMobEffect extends MobEffect { } @@ -117,7 +122,7 @@ index 74c9966093377b67e31b50483c2f24b70734faf6..abff08f2d61014944235ffe2f5494a71 CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack); } diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 770467bd319f8e2fdf3d713591368aa825cfa5ae..b00a2fe4cefff26b65789829777b25bbc8e024fa 100644 +index 08cbf02bba3633a84cce90c202d13f2beb5b88a2..c71a426c47e0ebc57ecb8c9c1d171737a084ccab 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java @@ -45,6 +45,11 @@ public class EnderEyeItem extends Item { @@ -152,7 +157,7 @@ index 6c0fe41692c9d1fa50a4f421eb4735860a9ae0e9..d7924825823b2bf79ca3a26272de11ff CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, blockPos, itemStack); } diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java -index 1c8fd643c32226d72d51abc869a49e256dd2432b..627439c3aa8171e9a54dbcb8842af50cc58f7f23 100644 +index 1c8fd643c32226d72d51abc869a49e256dd2432b..f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d 100644 --- a/src/main/java/net/minecraft/world/item/PotionItem.java +++ b/src/main/java/net/minecraft/world/item/PotionItem.java @@ -42,6 +42,12 @@ public class PotionItem extends Item { @@ -160,8 +165,8 @@ index 1c8fd643c32226d72d51abc869a49e256dd2432b..627439c3aa8171e9a54dbcb8842af50c BlockState blockState = level.getBlockState(blockPos); if (context.getClickedFace() != Direction.DOWN && blockState.is(BlockTags.CONVERTABLE_TO_MUD) && potionContents.is(Potions.WATER)) { + // Paper start -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState())) { -+ entityhuman.containerMenu.sendAllDataToRemote(); ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, Blocks.MUD.defaultBlockState())) { ++ player.containerMenu.sendAllDataToRemote(); + return InteractionResult.PASS; + } + // Paper end @@ -204,7 +209,7 @@ index c0377341227e8f4f1f7b1448580b3c7bc1b65f48..55c18f182166f4905d623d6f5e909eef level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockState3)); if (player != null) { diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java -index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fadb964222f 100644 +index 7629b9212ded7155e94f67ca429f62271e5f5aa0..648c2510beb162e73aed236a3169d0bbb8fc5050 100644 --- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java @@ -66,6 +66,12 @@ public class CakeBlock extends Block { @@ -214,7 +219,7 @@ index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fad + // Paper start - call change block event + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) { + player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease -+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.TRY_WITH_EMPTY_HAND; + } + // Paper end - call change block event stack.consume(1, player); @@ -245,7 +250,7 @@ index 7629b9212ded7155e94f67ca429f62271e5f5aa0..1104f620a050555f71d058711cc34fad world.gameEvent((Entity) player, (Holder) GameEvent.EAT, pos); if (i < 6) { diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -index 2bcd246a26dad560cf69682b29983d320ebf1884..60bf63c2cff3ce8a1892ba5c2303738c35b83d79 100644 +index 2bcd246a26dad560cf69682b29983d320ebf1884..05b2eab26e2dc8e143e9fff2dcec40cfe927a197 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java @@ -243,6 +243,11 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -254,7 +259,7 @@ index 2bcd246a26dad560cf69682b29983d320ebf1884..60bf63c2cff3ce8a1892ba5c2303738c BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack); + // Paper start - handle cancelled events + if (iblockdata1 == null) { -+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; ++ return InteractionResult.PASS; + } + // Paper end diff --git a/patches/server/0737-fix-Jigsaw-block-kicking-user.patch b/patches/server/0737-fix-Jigsaw-block-kicking-user.patch index a7960e5bc3..749d498f57 100644 --- a/patches/server/0737-fix-Jigsaw-block-kicking-user.patch +++ b/patches/server/0737-fix-Jigsaw-block-kicking-user.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix Jigsaw block kicking user diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java -index 42300114e3baf31fd26090fca3b497c8157d4bb9..8fda7f812ba266cf8051f6796d2c35cba197e904 100644 +index 42300114e3baf31fd26090fca3b497c8157d4bb9..6410cd7a7324bb04e9285a5b090b1675a5ffa16f 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java @@ -131,7 +131,12 @@ public class JigsawBlockEntity extends BlockEntity { @@ -14,7 +14,7 @@ index 42300114e3baf31fd26090fca3b497c8157d4bb9..8fda7f812ba266cf8051f6796d2c35cb Registry registry = world.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL); - Holder holder = registry.getOrThrow(this.pool); + // Paper start - Replace getHolderOrThrow with a null check -+ Holder holder = registry.getHolder(this.pool).orElse(null); ++ Holder holder = registry.get(this.pool).orElse(null); + if (holder == null) { + return; + } diff --git a/patches/server/0740-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0740-Fix-a-bunch-of-vanilla-bugs.patch index c52bbed900..0de43bc77c 100644 --- a/patches/server/0740-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0740-Fix-a-bunch-of-vanilla-bugs.patch @@ -91,7 +91,7 @@ index 6854ca4d4fec2b4fa541c3fabf63787665572609..e7b444a10b244828827b3c66c5346520 } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7f18146c0dea654c62b3e01e6848fd1c05f87946..1a724f9bb6ef82a0b5fdd9ade036d7365167f14b 100644 +index 75854574aa8d4aef35d84ba4c0fc7df9a67ae48c..3f3124bbb5077a18c3d3afac7748a47e84b8fe35 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1080,7 +1080,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0768-Player-Entity-Tracking-Events.patch b/patches/server/0768-Player-Entity-Tracking-Events.patch index c3458e621d..3cf77bc532 100644 --- a/patches/server/0768-Player-Entity-Tracking-Events.patch +++ b/patches/server/0768-Player-Entity-Tracking-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player Entity Tracking Events diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1a724f9bb6ef82a0b5fdd9ade036d7365167f14b..ec19eb88705a07db45f1a3541571fb7f43efb5a9 100644 +index 3f3124bbb5077a18c3d3afac7748a47e84b8fe35..7810df9c5045a78c2731ee416366da4f973e5d29 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1592,7 +1592,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0791-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/server/0791-Add-CompostItemEvent-and-EntityCompostItemEvent.patch index eba5cdc5c9..2e105236ee 100644 --- a/patches/server/0791-Add-CompostItemEvent-and-EntityCompostItemEvent.patch +++ b/patches/server/0791-Add-CompostItemEvent-and-EntityCompostItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -index 60bf63c2cff3ce8a1892ba5c2303738c35b83d79..2d7712fae0801b6ae48d23cabd46a7700c0c0bec 100644 +index 05b2eab26e2dc8e143e9fff2dcec40cfe927a197..db837b250fc35af5b528bf973b3b07f63e79bc46 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java @@ -340,7 +340,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { diff --git a/patches/server/0845-Fix-custom-statistic-criteria-creation.patch b/patches/server/0845-Fix-custom-statistic-criteria-creation.patch index 6e562a7f2d..420f7179e9 100644 --- a/patches/server/0845-Fix-custom-statistic-criteria-creation.patch +++ b/patches/server/0845-Fix-custom-statistic-criteria-creation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix custom statistic criteria creation diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 66913ab43bb1e9066487749ff60248c22fc8e824..78b5578ece76c88a4dafcd4220a82081e85cf735 100644 +index 9e0af05e066132b66fafff84ff0a0957c1a44f9f..766ef49d72eef0ff80247a807db5379f7fc60302 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -599,6 +599,14 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch index 047d717ba6..6c61a65a1c 100644 --- a/patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch +++ b/patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch @@ -24,7 +24,7 @@ index 2aee9c2fbe38076317a3de7c3fdbd6988b64b389..3bd4ab8161c29bb8df2ba496a4430393 // return true; // CraftBukkit diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index 90f69a0c4d0707fd2319db71aea7dfdc14636d82..9591870420390fe1a69d44855a8f4de779332b7d 100644 +index d5ed53c37bba79f84b60d616887cd5176e124f10..6c0ea0bde1c36edda92807e317ed37f8b1bdac6a 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java @@ -94,8 +94,8 @@ public class BeehiveBlock extends BaseEntityBlock { diff --git a/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch index 6c2edf83e2..75dd71166a 100644 --- a/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch +++ b/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable entity tracking range by Y coordinate Options to configure entity tracking by Y coordinate, also for each entity category. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index ec19eb88705a07db45f1a3541571fb7f43efb5a9..49d926313b0d0f2ed2e93ca824009c8d0a988f67 100644 +index 7810df9c5045a78c2731ee416366da4f973e5d29..502d73830ed87e06529f194090a4ffb895b2623c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1583,7 +1583,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0863-Optimize-nearest-structure-border-iteration.patch b/patches/server/0863-Optimize-nearest-structure-border-iteration.patch index f16f98ea9b..edd50774cc 100644 --- a/patches/server/0863-Optimize-nearest-structure-border-iteration.patch +++ b/patches/server/0863-Optimize-nearest-structure-border-iteration.patch @@ -14,7 +14,7 @@ ensure that the returned found structure (which may for example be a buried treasure that will be marked on a treasure map) is the same as in vanilla. diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 906f56d07c26ef3c2dc1a3b62e9349dd91a37742..4cbc68d8e950f8d7c8b00535b82e916964c88ce0 100644 +index 31c5f54c90d6e35875f762747f8618e58e2eed91..582065b2d4e818c0edec36b2e9847f8ed3266b10 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -265,12 +265,15 @@ public abstract class ChunkGenerator { diff --git a/patches/server/0874-Fix-spigot-s-Forced-Stats.patch b/patches/server/0874-Fix-spigot-s-Forced-Stats.patch index 554f1f8844..8e920d0d89 100644 --- a/patches/server/0874-Fix-spigot-s-Forced-Stats.patch +++ b/patches/server/0874-Fix-spigot-s-Forced-Stats.patch @@ -8,7 +8,7 @@ disables saving any forced stats, so it stays at the same value (without enablin fixes stat initialization to not cause a NullPointerException diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java -index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..fb7342f7a5008a283c3400c6313c637de8210dfa 100644 +index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..da7e1a69ecb4e6b3be2d8544ac406aa519bd196e 100644 --- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java +++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java @@ -48,13 +48,6 @@ public class ServerStatsCounter extends StatsCounter { @@ -36,7 +36,7 @@ index ec437644adff6a6ec1e3fe2dd3a6354edafde1db..fb7342f7a5008a283c3400c6313c637d + // Spigot start + for ( Map.Entry entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() ) + { -+ Stat wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.get(entry.getKey()))); // Paper - ensured by SpigotConfig#stats ++ Stat wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.getValue(entry.getKey()))); // Paper - ensured by SpigotConfig#stats + this.stats.put( wrapper, entry.getValue().intValue() ); + } + // Spigot end diff --git a/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch b/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch index 57e986f1b7..fa08d471ab 100644 --- a/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 78b5578ece76c88a4dafcd4220a82081e85cf735..bd77a942a264a5d9cdaba4cc63099b8ae00c48f6 100644 +index 766ef49d72eef0ff80247a807db5379f7fc60302..3900f95f3ea41b010b8ea79c043fe322fa233461 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -308,9 +308,30 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch b/patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch index e86be5d784..5078fe7f01 100644 --- a/patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch +++ b/patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't check if we can see non-visible entities diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 49d926313b0d0f2ed2e93ca824009c8d0a988f67..29a28e160f6ca87d263b84fbf0c5429d30e34a21 100644 +index 502d73830ed87e06529f194090a4ffb895b2623c..95c70de2c9f0e26742c0d66ad6c3bcc310a923f6 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1596,7 +1596,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index a9f20c91ac..2fd7060c00 100644 --- a/patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -18,7 +18,7 @@ index a043ac10834562d357ef0b5aded2e916e2a0d056..74276c368016fcc4dbf9579b2ecbadc9 @VisibleForTesting static long encode(double value) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 29a28e160f6ca87d263b84fbf0c5429d30e34a21..a43eef8bf05855270601761494b6a67dc55cb1c9 100644 +index 95c70de2c9f0e26742c0d66ad6c3bcc310a923f6..182513bb175feb5f30f0fb1cd5db501b6d483afd 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1578,10 +1578,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch index 255e25785b..ee55eb2e4a 100644 --- a/patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch +++ b/patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add api for spawn egg texture colors diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index bd77a942a264a5d9cdaba4cc63099b8ae00c48f6..db177cb5a99b3529b2eed291bc794234214f8e7c 100644 +index 3900f95f3ea41b010b8ea79c043fe322fa233461..7ae4567bc6f2f0374d1a4a3859f6329eaace7415 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -643,6 +643,15 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0918-Add-Lifecycle-Event-system.patch b/patches/server/0918-Add-Lifecycle-Event-system.patch index e2eaeec2f9..d93b26d6b3 100644 --- a/patches/server/0918-Add-Lifecycle-Event-system.patch +++ b/patches/server/0918-Add-Lifecycle-Event-system.patch @@ -743,7 +743,7 @@ index dbdf52a306d7018f0bf01fcf6c24a6d1dc269be5..fb55dced981d16a82e4cc233fbf25695 this.reloadCount++; this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index db177cb5a99b3529b2eed291bc794234214f8e7c..5a94b9a5c400818818cc427160d696f10470f3a2 100644 +index 7ae4567bc6f2f0374d1a4a3859f6329eaace7415..ca201861b383bac4ea93284ac017e85ae0b3b17c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -652,6 +652,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0919-ItemStack-Tooltip-API.patch b/patches/server/0919-ItemStack-Tooltip-API.patch index c7e83e2f18..7279f30261 100644 --- a/patches/server/0919-ItemStack-Tooltip-API.patch +++ b/patches/server/0919-ItemStack-Tooltip-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 5a94b9a5c400818818cc427160d696f10470f3a2..b24ccbff89db873f5bdf62cbebcca0049b94a8d5 100644 +index ca201861b383bac4ea93284ac017e85ae0b3b17c..8feba2bd411abe36e64a39a0c599c73d07c19e20 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -628,6 +628,21 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0979-Anti-Xray.patch b/patches/server/0979-Anti-Xray.patch index f19373b3ed..88fd107647 100644 --- a/patches/server/0979-Anti-Xray.patch +++ b/patches/server/0979-Anti-Xray.patch @@ -199,7 +199,7 @@ index 0000000000000000000000000000000000000000..52d2e2b744f91914802506e52a071617 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a89502a49a12 +index 0000000000000000000000000000000000000000..4b44053cf7704e3889440361bb4971d7aa03e3ba --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +1,676 @@ @@ -331,7 +331,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895 + } + } + -+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS)); ++ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS)); + BlockPos zeroPos = new BlockPos(0, 0, 0); + + for (int i = 0; i < solidGlobal.length; i++) { @@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895 + LevelChunkSection[] nearbyChunkSections = new LevelChunkSection[4]; + LevelChunk chunk = chunkPacketInfoAntiXray.getChunk(); + Level level = chunk.getLevel(); -+ int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSection(), chunk.getSectionsCount()) - 1; ++ int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSectionY(), chunk.getSectionsCount()) - 1; + boolean[] solidTemp = null; + boolean[] obfuscateTemp = null; + bitStorageReader.setBuffer(chunkPacketInfoAntiXray.getBuffer()); @@ -485,7 +485,7 @@ index 0000000000000000000000000000000000000000..e7fe98ea30ae6d0baea3ec1f9f98a895 + presetBlockStateBitsTemp = switch (level.getWorld().getEnvironment()) { + case NETHER -> presetBlockStateBitsNetherrackGlobal; + case THE_END -> presetBlockStateBitsEndStoneGlobal; -+ default -> chunkSectionIndex + chunk.getMinSection() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal; ++ default -> chunkSectionIndex + chunk.getMinSectionY() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal; + }; + } else { + presetBlockStateBitsTemp = presetBlockStateBitsGlobal; @@ -1519,7 +1519,7 @@ index 303e59be721d0e16e8822cf4e407595348ee7abf..51f74dd7b276e858889803d7f341d735 int getSerializedSize(); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index b86b3bf713668999a21c4120b1d16c295531b2ad..57998a47fa39cac141226c75bd68d4b37e8424ae 100644 +index b86b3bf713668999a21c4120b1d16c295531b2ad..f6c42532d4921628072d44313404696890087b9f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -111,6 +111,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun @@ -1540,7 +1540,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..57998a47fa39cac141226c75bd68d4b3 if (nbttagcompound3.contains("block_states", 10)) { - datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> { -+ Codec> blockStateCodec = presetBlockStates == null ? ChunkSerializer.BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray ++ Codec> blockStateCodec = presetBlockStates == null ? BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray + datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray logErrors(chunkcoordintpair, b0, s1); }).getOrThrow(SerializableChunkData.ChunkReadException::new); diff --git a/patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch index 7fdb68ae3b..1b14145b71 100644 --- a/patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -114,7 +114,7 @@ index 9d31e29ec62f437e642ed60da69c4b106bd9e770..ce200e673b54c66cfdf34657db28d3ee this.level = MinMaxBounds.Ints.ANY; this.rotX = WrappedMinMaxBounds.ANY; diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -index 5d0c82ba9465bf75640e52bf71924ee5862937f0..e27bd295adcf3289a7c71e044ae392884fe01e0a 100644 +index 5d0c82ba9465bf75640e52bf71924ee5862937f0..9d5c766416cf34ddf0d7e250f13c0985195cb135 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java @@ -76,6 +76,19 @@ public class EntitySelectorOptions { @@ -142,7 +142,7 @@ index 5d0c82ba9465bf75640e52bf71924ee5862937f0..e27bd295adcf3289a7c71e044ae39288 if (reader.isTag()) { TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); + // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) -+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { ++ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(tagKey).isEmpty()) { + reader.getReader().setCursor(i); + throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); + } diff --git a/patches/server/0990-Check-distance-in-entity-interactions.patch b/patches/server/0990-Check-distance-in-entity-interactions.patch index d142b760dd..8fe3898ba0 100644 --- a/patches/server/0990-Check-distance-in-entity-interactions.patch +++ b/patches/server/0990-Check-distance-in-entity-interactions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Check distance in entity interactions diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 60e523f4de1cbafc2c58a5d568fe3989b7b07c34..dd2037fe9389765f79330036ec7fa3c5e7c7327a 100644 +index 57223285860f61119b6cf348aa78e59384a04e22..ccfe9ef24dce9f34613692adb13738d3ad0e7aac 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -128,6 +128,7 @@ public class Util { diff --git a/patches/server/0993-Registry-Modification-API.patch b/patches/server/0993-Registry-Modification-API.patch index ac28f625c7..d61a98a7a4 100644 --- a/patches/server/0993-Registry-Modification-API.patch +++ b/patches/server/0993-Registry-Modification-API.patch @@ -1134,7 +1134,7 @@ index 71e04e5c1bc0722abf8ca2e0738bd60b6d7ae21c..063630c1ffcce099139c59d598fc5a21 + // Paper end } diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3aeb3811f 100644 +index 4638ba98dbbdb0f880337347be85a6e0fbed2191..bc448f8511c629d1f13d4baf717a11e6a6ad24f9 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java @@ -296,6 +296,17 @@ public class BuiltInRegistries { @@ -1145,9 +1145,9 @@ index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3 + public static final io.papermc.paper.registry.data.util.Conversions BUILT_IN_CONVERSIONS = new io.papermc.paper.registry.data.util.Conversions(new net.minecraft.resources.RegistryOps.RegistryInfoLookup() { + @Override + public java.util.Optional> lookup(final ResourceKey> registryRef) { -+ final Registry registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.registryOrThrow(registryRef); ++ final Registry registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.lookupOrThrow(registryRef); + return java.util.Optional.of( -+ new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry.asLookup(), registry.asTagAddingLookup(), Lifecycle.experimental()) ++ new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry, registry, Lifecycle.experimental()) + ); + } + }); @@ -1172,7 +1172,7 @@ index 4638ba98dbbdb0f880337347be85a6e0fbed2191..12ba8bc0a946c107b076e2c995aca6a3 } } diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -index 144a6f5b0c53110804d6d099fe857d25f107d938..f2236665eaf3e6d0f9d44605db3cd5afe0cced4e 100644 +index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b68f8daaf8 100644 --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java @@ -130,7 +130,7 @@ public class RegistryDataLoader { @@ -1323,7 +1323,7 @@ index 6fddef967b6314ca0158f5bd4b8898670ea5e9ec..b5ca1a0acb16d0cd8dccc854f309d425 return writableRegistry; }, prepareExecutor); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java -index f8450a2abd1e96fac7827d252cc00038b9dee839..a812a42ea81b1543287e78ea55da6cbf4e0d27f8 100644 +index f8450a2abd1e96fac7827d252cc00038b9dee839..891ccc39d52331648a11b4e7cce78d4c848cdea0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java @@ -167,11 +167,11 @@ public class CraftRegistry implements Registry { @@ -1348,18 +1348,18 @@ index f8450a2abd1e96fac7827d252cc00038b9dee839..a812a42ea81b1543287e78ea55da6cbf + // Paper start - RegistrySet API + @Override + public boolean hasTag(final io.papermc.paper.registry.tag.TagKey key) { -+ return this.minecraftRegistry.getTag(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent(); ++ return this.minecraftRegistry.get(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent(); + } + + @Override + public io.papermc.paper.registry.tag.Tag getTag(final io.papermc.paper.registry.tag.TagKey key) { -+ final net.minecraft.core.HolderSet.Named namedHolderSet = this.minecraftRegistry.getTag(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow(); ++ final net.minecraft.core.HolderSet.Named namedHolderSet = this.minecraftRegistry.get(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow(); + return new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(key, namedHolderSet); + } + // Paper end - RegistrySet API } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..49b898ed5e9de2507a6a6aac61dea4fe902649ca 100644 +index 8feba2bd411abe36e64a39a0c599c73d07c19e20..75b5ec1023e2cf974696ee077195b195025ddc74 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -674,6 +674,21 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -1373,9 +1373,9 @@ index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..49b898ed5e9de2507a6a6aac61dea4fe + throw new UnsupportedOperationException(tagKey.registryKey() + " doesn't have tags"); + } + final net.minecraft.resources.ResourceKey> nmsKey = io.papermc.paper.registry.PaperRegistries.registryToNms(tagKey.registryKey()); -+ final net.minecraft.core.Registry nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().registryOrThrow(nmsKey); ++ final net.minecraft.core.Registry nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().lookupOrThrow(nmsKey); + return nmsRegistry -+ .getTag(io.papermc.paper.registry.PaperRegistries.toNms(tagKey)) ++ .get(io.papermc.paper.registry.PaperRegistries.toNms(tagKey)) + .map(named -> new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(tagKey, named)) + .orElse(null); + } diff --git a/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch index 684b037d30..f37751ee6f 100644 --- a/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch @@ -205,7 +205,7 @@ index 6cc9d7a9e6d4bfdc27e52fc581b2bb832616f121..6930d0afb230a88aa813b02e4d55c95d + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 49b898ed5e9de2507a6a6aac61dea4fe902649ca..02745957a08a27af6a032453b8b20a8fed2911b3 100644 +index 75b5ec1023e2cf974696ee077195b195025ddc74..f1178a6c8ccd1ad099d67b906f755eea1dfc0e53 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -689,6 +689,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/1020-Add-FeatureFlag-API.patch b/patches/server/1020-Add-FeatureFlag-API.patch index c8da36ae78..deea8b504e 100644 --- a/patches/server/1020-Add-FeatureFlag-API.patch +++ b/patches/server/1020-Add-FeatureFlag-API.patch @@ -282,7 +282,7 @@ index 6cf790c9fa23ea313423fdaeb7c181bf530828c6..0bcb9df1103050441f8922a688b163dc public static PotionEffectType minecraftHolderToBukkit(Holder minecraft) { return CraftPotionEffectType.minecraftToBukkit(minecraft.value()); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 02745957a08a27af6a032453b8b20a8fed2911b3..293757b8e96ae7b0e807d807affa3fdab5181d39 100644 +index f1178a6c8ccd1ad099d67b906f755eea1dfc0e53..e1186f840670aabb73668e03d66789f9e306e234 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -47,7 +47,7 @@ import org.bukkit.advancement.Advancement; diff --git a/patches/server/1021-Tag-Lifecycle-Events.patch b/patches/server/1021-Tag-Lifecycle-Events.patch index dcd0a5334a..fb7d66db7d 100644 --- a/patches/server/1021-Tag-Lifecycle-Events.patch +++ b/patches/server/1021-Tag-Lifecycle-Events.patch @@ -461,7 +461,7 @@ index 0000000000000000000000000000000000000000..d6d4bfc6f45d646afeace422a038c670 +) { +} diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -index f2236665eaf3e6d0f9d44605db3cd5afe0cced4e..28d809a0e2fccd15a09bc6b55ca024526867ada7 100644 +index fdc88e52235a152dbe3cca273990b4b68f8daaf8..13797035494a1e010e1da529fb46040f8a6e859f 100644 --- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java +++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java @@ -278,7 +278,7 @@ public class RegistryDataLoader { diff --git a/patches/server/1022-Item-serialization-as-json.patch b/patches/server/1022-Item-serialization-as-json.patch index 51d1f7f808..9e7e7399ca 100644 --- a/patches/server/1022-Item-serialization-as-json.patch +++ b/patches/server/1022-Item-serialization-as-json.patch @@ -28,7 +28,7 @@ index c80fd4960dfbb0fde37363e7df25b0a5411bdb11..ff7f6916f65466c25a7bde35d64682c1 public static final Codec CODEC_WITH_ID = CODEC.validate( component -> component.getUnsafe().contains("id", 8) ? DataResult.success(component) : DataResult.error(() -> "Missing id for entity in: " + component) diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 293757b8e96ae7b0e807d807affa3fdab5181d39..f880bf91155b017c954e3e321c5a203c05c2162f 100644 +index e1186f840670aabb73668e03d66789f9e306e234..2a5c5e9e04d90c4e218b200bb55ff6bf2877ad73 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -511,6 +511,39 @@ public final class CraftMagicNumbers implements UnsafeValues {