From 11044315fd2f4d676ed72a5aa4eb3f767a3b426e Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 24 Apr 2024 16:25:57 -0700 Subject: [PATCH] 955 --- ...ion-calls-in-plugins-using-internals.patch | 2 +- ...-Add-WorldEdit-plugin-flag-test-task.patch | 2 +- ...4-build-replace-use-of-shadow-plugin.patch | 2 +- .../server/0286-Brigadier-Mojang-API.patch | 2 +- .../server/0366-Implement-Mob-Goal-API.patch | 2 +- .../0575-Fix-potions-splash-events.patch | 6 +- patches/server/0700-More-Projectile-API.patch | 8 +- ...lock-data-for-EntityChangeBlockEvent.patch | 2 +- .../0727-Add-support-for-Proxy-Protocol.patch | 2 +- .../0932-Expand-LingeringPotion-API.patch | 2 +- ...h-event-for-all-player-interactions.patch} | 22 ++--- ...everal-issues-with-EntityBreedEvent.patch} | 26 +++--- ...937-Add-UUID-attribute-modifier-API.patch} | 2 +- ...-event-call-for-entity-teleport-API.patch} | 2 +- ...y-create-LootContext-for-criterions.patch} | 0 ...-t-fire-sync-events-during-worldgen.patch} | 44 +++++----- .../0941-Add-Structure-check-API.patch} | 2 +- ...-getAttributeModifier-duplication-c.patch} | 4 +- ...store-vanilla-entity-drops-behavior.patch} | 40 +++++----- ...-Dont-resend-blocks-on-interactions.patch} | 28 +++---- .../0945-add-more-scoreboard-API.patch} | 0 .../0946-Improve-Registry.patch} | 16 ++-- ...on-null-loc-for-EntityTeleportEvent.patch} | 14 ++-- .../0948-Add-experience-points-API.patch} | 8 +- .../0949-Add-drops-to-shear-events.patch} | 46 +++++------ .../0950-Add-PlayerShieldDisableEvent.patch | 53 ++++++++++++ ...ate-ResourceLocation-in-NBT-reading.patch} | 52 ++++++------ ...-experience-dropping-on-block-break.patch} | 14 ++-- .../0953-Fixup-NamespacedKey-handling.patch} | 69 ++++++++-------- ...54-Expose-LootTable-of-DecoratedPot.patch} | 4 +- ...location-of-Vec3D-by-entity-tracker.patch} | 6 +- .../0983-Add-PlayerShieldDisableEvent.patch | 80 ------------------- 32 files changed, 268 insertions(+), 294 deletions(-) rename patches/{unapplied/server/0968-Add-hand-to-fish-event-for-all-player-interactions.patch => server/0935-Add-hand-to-fish-event-for-all-player-interactions.patch} (86%) rename patches/{unapplied/server/0969-Fix-several-issues-with-EntityBreedEvent.patch => server/0936-Fix-several-issues-with-EntityBreedEvent.patch} (85%) rename patches/{unapplied/server/0970-Add-UUID-attribute-modifier-API.patch => server/0937-Add-UUID-attribute-modifier-API.patch} (96%) rename patches/{unapplied/server/0971-Fix-missing-event-call-for-entity-teleport-API.patch => server/0938-Fix-missing-event-call-for-entity-teleport-API.patch} (93%) rename patches/{unapplied/server/0972-Lazily-create-LootContext-for-criterions.patch => server/0939-Lazily-create-LootContext-for-criterions.patch} (100%) rename patches/{unapplied/server/0973-Don-t-fire-sync-events-during-worldgen.patch => server/0940-Don-t-fire-sync-events-during-worldgen.patch} (83%) rename patches/{unapplied/server/0974-Add-Structure-check-API.patch => server/0941-Add-Structure-check-API.patch} (91%) rename patches/{unapplied/server/0975-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch => server/0942-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch} (88%) rename patches/{unapplied/server/0976-Restore-vanilla-entity-drops-behavior.patch => server/0943-Restore-vanilla-entity-drops-behavior.patch} (91%) rename patches/{unapplied/server/0977-Dont-resend-blocks-on-interactions.patch => server/0944-Dont-resend-blocks-on-interactions.patch} (92%) rename patches/{unapplied/server/0978-add-more-scoreboard-API.patch => server/0945-add-more-scoreboard-API.patch} (100%) rename patches/{unapplied/server/0979-Improve-Registry.patch => server/0946-Improve-Registry.patch} (88%) rename patches/{unapplied/server/0980-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch => server/0947-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch} (87%) rename patches/{unapplied/server/0981-Add-experience-points-API.patch => server/0948-Add-experience-points-API.patch} (91%) rename patches/{unapplied/server/0982-Add-drops-to-shear-events.patch => server/0949-Add-drops-to-shear-events.patch} (91%) create mode 100644 patches/server/0950-Add-PlayerShieldDisableEvent.patch rename patches/{unapplied/server/0984-Validate-ResourceLocation-in-NBT-reading.patch => server/0951-Validate-ResourceLocation-in-NBT-reading.patch} (73%) rename patches/{unapplied/server/0985-Properly-handle-experience-dropping-on-block-break.patch => server/0952-Properly-handle-experience-dropping-on-block-break.patch} (92%) rename patches/{unapplied/server/0986-Fixup-NamespacedKey-handling.patch => server/0953-Fixup-NamespacedKey-handling.patch} (65%) rename patches/{unapplied/server/0987-Expose-LootTable-of-DecoratedPot.patch => server/0954-Expose-LootTable-of-DecoratedPot.patch} (92%) rename patches/{unapplied/server/0988-Reduce-allocation-of-Vec3D-by-entity-tracker.patch => server/0955-Reduce-allocation-of-Vec3D-by-entity-tracker.patch} (93%) delete mode 100644 patches/unapplied/server/0983-Add-PlayerShieldDisableEvent.patch diff --git a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch index 7e111b3d00..5bf7abd221 100644 --- a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remap reflection calls in plugins using internals Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> diff --git a/build.gradle.kts b/build.gradle.kts -index 33c3cc405c67d536c8a3038b83fd470fda10680e..79b386948c9d199d8d26bfc7300cdcd3ac7da25a 100644 +index 33c3cc405c67d536c8a3038b83fd470fda10680e..ab1aaf53f9a897982c93b754b8dbe8b6f4812f21 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,6 @@ dependencies { diff --git a/patches/server/0023-Add-WorldEdit-plugin-flag-test-task.patch b/patches/server/0023-Add-WorldEdit-plugin-flag-test-task.patch index c8cf42e78e..b708dd3bac 100644 --- a/patches/server/0023-Add-WorldEdit-plugin-flag-test-task.patch +++ b/patches/server/0023-Add-WorldEdit-plugin-flag-test-task.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add WorldEdit plugin flag test task diff --git a/build.gradle.kts b/build.gradle.kts -index 79b386948c9d199d8d26bfc7300cdcd3ac7da25a..81180537130fc04af698eb1b072de004dc8d1724 100644 +index ab1aaf53f9a897982c93b754b8dbe8b6f4812f21..0aa7351e918a577f231a209443389d4bfdb4a93e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,11 @@ diff --git a/patches/server/0024-build-replace-use-of-shadow-plugin.patch b/patches/server/0024-build-replace-use-of-shadow-plugin.patch index b7aa7c79a0..93f409099f 100644 --- a/patches/server/0024-build-replace-use-of-shadow-plugin.patch +++ b/patches/server/0024-build-replace-use-of-shadow-plugin.patch @@ -5,7 +5,7 @@ Subject: [PATCH] build: replace use of shadow plugin diff --git a/build.gradle.kts b/build.gradle.kts -index 81180537130fc04af698eb1b072de004dc8d1724..ad86fc6ed56bdf8227e92ffdce17e5cd2ef19cc0 100644 +index 0aa7351e918a577f231a209443389d4bfdb4a93e..e8f0f110532ad63be170152082dd5805a3e3c12c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,6 @@ import xyz.jpenilla.runpaper.task.RunServer diff --git a/patches/server/0286-Brigadier-Mojang-API.patch b/patches/server/0286-Brigadier-Mojang-API.patch index b9793bf83b..6e752e5008 100644 --- a/patches/server/0286-Brigadier-Mojang-API.patch +++ b/patches/server/0286-Brigadier-Mojang-API.patch @@ -10,7 +10,7 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/build.gradle.kts b/build.gradle.kts -index ad86fc6ed56bdf8227e92ffdce17e5cd2ef19cc0..a668438780c5b77d6b8bcbcc52d24bd92c59b85f 100644 +index e8f0f110532ad63be170152082dd5805a3e3c12c..f97ee2b7c1ef419746600c04eec3dbdf0e3fd5df 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,6 +15,7 @@ val alsoShade: Configuration by configurations.creating diff --git a/patches/server/0366-Implement-Mob-Goal-API.patch b/patches/server/0366-Implement-Mob-Goal-API.patch index 9551765728..587df4859c 100644 --- a/patches/server/0366-Implement-Mob-Goal-API.patch +++ b/patches/server/0366-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index a668438780c5b77d6b8bcbcc52d24bd92c59b85f..d104cf1064630698035025acbfbbf1f5e3da142a 100644 +index f97ee2b7c1ef419746600c04eec3dbdf0e3fd5df..9d570d0289ff33b78cea805070e684f8b00b5fe8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -42,6 +42,7 @@ dependencies { diff --git a/patches/server/0575-Fix-potions-splash-events.patch b/patches/server/0575-Fix-potions-splash-events.patch index 98d903cc5c..66e5ec5995 100644 --- a/patches/server/0575-Fix-potions-splash-events.patch +++ b/patches/server/0575-Fix-potions-splash-events.patch @@ -8,7 +8,7 @@ Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6 Fix splash events cancellation that still show particles/sound diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index d7fe99e55b64b66af7795c2d0aeca69023f93bae..14444325c0ed62c5f0ec230a7e191b0904e7b1ae 100644 +index d7fe99e55b64b66af7795c2d0aeca69023f93bae..bf627d66310f201172d3cd3ea12f1d321cd3cd62 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -104,55 +104,76 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @@ -22,10 +22,10 @@ index d7fe99e55b64b66af7795c2d0aeca69023f93bae..14444325c0ed62c5f0ec230a7e191b09 } else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply if (this.isLingering()) { - this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition -+ showParticles = this.makeAreaOfEffectCloud(itemstack, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper ++ showParticles = this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } else { - this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition -+ showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper ++ showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } } diff --git a/patches/server/0700-More-Projectile-API.patch b/patches/server/0700-More-Projectile-API.patch index 06f684d5ba..ae29e94f99 100644 --- a/patches/server/0700-More-Projectile-API.patch +++ b/patches/server/0700-More-Projectile-API.patch @@ -20,7 +20,7 @@ public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecr Co-authored-by: Nassim Jahnke diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index 14444325c0ed62c5f0ec230a7e191b0904e7b1ae..125941177bc7c74ee743449c5ea498781ee34975 100644 +index bf627d66310f201172d3cd3ea12f1d321cd3cd62..5adaeb59f7733809f1cf6b52031292c9611a3a86 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -100,6 +100,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @@ -37,10 +37,10 @@ index 14444325c0ed62c5f0ec230a7e191b0904e7b1ae..125941177bc7c74ee743449c5ea49878 PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); @@ -111,7 +116,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie if (this.isLingering()) { - showParticles = this.makeAreaOfEffectCloud(itemstack, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper + showParticles = this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper } else { -- showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper -+ showParticles = this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API +- showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper ++ showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API } } diff --git a/patches/server/0709-Fix-new-block-data-for-EntityChangeBlockEvent.patch b/patches/server/0709-Fix-new-block-data-for-EntityChangeBlockEvent.patch index 329db7ba4c..bcb92f2018 100644 --- a/patches/server/0709-Fix-new-block-data-for-EntityChangeBlockEvent.patch +++ b/patches/server/0709-Fix-new-block-data-for-EntityChangeBlockEvent.patch @@ -131,7 +131,7 @@ index 9ff42b0ae2b82dc3092e38e1439d89b4ab554b17..860e385fc83f9787dca92efe35d21fd6 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index 125941177bc7c74ee743449c5ea498781ee34975..d5e9f2bb692a162c3a2ed93498aa9649d6554cd9 100644 +index 5adaeb59f7733809f1cf6b52031292c9611a3a86..d8ac724d01d81b8c52f8e05451212ac1cd775c0b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -290,7 +290,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie diff --git a/patches/server/0727-Add-support-for-Proxy-Protocol.patch b/patches/server/0727-Add-support-for-Proxy-Protocol.patch index 4d1db35776..7988c329fc 100644 --- a/patches/server/0727-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0727-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index d104cf1064630698035025acbfbbf1f5e3da142a..4dd185f68ff99f598d9a6557d8bec2d254af052f 100644 +index 9d570d0289ff33b78cea805070e684f8b00b5fe8..2fb342f9d86e169571070b2b40538633f4b0d7cf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { diff --git a/patches/server/0932-Expand-LingeringPotion-API.patch b/patches/server/0932-Expand-LingeringPotion-API.patch index 7aa0199950..b203b03355 100644 --- a/patches/server/0932-Expand-LingeringPotion-API.patch +++ b/patches/server/0932-Expand-LingeringPotion-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand LingeringPotion API diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index d5e9f2bb692a162c3a2ed93498aa9649d6554cd9..eb144ebe10c51d73a5da9b731e8d4a789e8664d0 100644 +index d8ac724d01d81b8c52f8e05451212ac1cd775c0b..c64e0d623124ad9116cb6c5c7c3320fad7cc1aa3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -272,7 +272,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie diff --git a/patches/unapplied/server/0968-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/server/0935-Add-hand-to-fish-event-for-all-player-interactions.patch similarity index 86% rename from patches/unapplied/server/0968-Add-hand-to-fish-event-for-all-player-interactions.patch rename to patches/server/0935-Add-hand-to-fish-event-for-all-player-interactions.patch index 39764d836e..3bc8cd9b24 100644 --- a/patches/unapplied/server/0968-Add-hand-to-fish-event-for-all-player-interactions.patch +++ b/patches/server/0935-Add-hand-to-fish-event-for-all-player-interactions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add hand to fish event for all player interactions diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a15ed3bc0 100644 +index a9ea83ea03ab23abc1eb463dadcdd742bfa20036..35299affb699d745804a3b60cb78b9323f3e068e 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -475,7 +475,15 @@ public class FishingHook extends Projectile { +@@ -476,7 +476,15 @@ public class FishingHook extends Projectile { @Override public void readAdditionalSaveData(CompoundTag nbt) {} @@ -24,7 +24,7 @@ index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner(); if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) { -@@ -483,7 +491,7 @@ public class FishingHook extends Projectile { +@@ -484,7 +492,7 @@ public class FishingHook extends Projectile { if (this.hookedIn != null) { // CraftBukkit start @@ -33,7 +33,7 @@ index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); if (playerFishEvent.isCancelled()) { -@@ -512,7 +520,7 @@ public class FishingHook extends Projectile { +@@ -513,7 +521,7 @@ public class FishingHook extends Projectile { } // Paper end // CraftBukkit start @@ -42,7 +42,7 @@ index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1); this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); -@@ -546,7 +554,7 @@ public class FishingHook extends Projectile { +@@ -547,7 +555,7 @@ public class FishingHook extends Projectile { if (this.onGround()) { // CraftBukkit start @@ -51,7 +51,7 @@ index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent); if (playerFishEvent.isCancelled()) { -@@ -557,7 +565,7 @@ public class FishingHook extends Projectile { +@@ -558,7 +566,7 @@ public class FishingHook extends Projectile { } // CraftBukkit start if (i == 0) { @@ -61,15 +61,15 @@ index a87fcd5b837e1c824cbd5587c3350986e2fd7acb..91497f5e6c07fcf1b05eca6846c51e1a if (playerFishEvent.isCancelled()) { return 0; diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java -index b9aca584c9765e995d1f8b9b2e45e5257fb6ab9d..95144f0ea5e99285c0a82b9d2e60766b785a236d 100644 +index 87e1f74c3d37c9dd23350c9cbc190252e8cb88cd..fd71efd124e54168e6f9b35b1a5ab836141ab2d2 100644 --- a/src/main/java/net/minecraft/world/item/FishingRodItem.java +++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java -@@ -29,7 +29,7 @@ public class FishingRodItem extends Item implements Vanishable { +@@ -30,7 +30,7 @@ public class FishingRodItem extends Item { if (user.fishing != null) { if (!world.isClientSide) { - i = user.fishing.retrieve(itemstack); + i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent - itemstack.hurtAndBreak(i, user, (entityhuman1) -> { - entityhuman1.broadcastBreakEvent(hand); - }); + itemstack.hurtAndBreak(i, user, LivingEntity.getSlotForHand(hand)); + } + diff --git a/patches/unapplied/server/0969-Fix-several-issues-with-EntityBreedEvent.patch b/patches/server/0936-Fix-several-issues-with-EntityBreedEvent.patch similarity index 85% rename from patches/unapplied/server/0969-Fix-several-issues-with-EntityBreedEvent.patch rename to patches/server/0936-Fix-several-issues-with-EntityBreedEvent.patch index e7f91ee16c..96a98989cc 100644 --- a/patches/unapplied/server/0969-Fix-several-issues-with-EntityBreedEvent.patch +++ b/patches/server/0936-Fix-several-issues-with-EntityBreedEvent.patch @@ -11,10 +11,10 @@ also changed. Also in several places, the breed item was stored after it was decreased by one to consume the item. diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java -index 907ed82fea71254d6624eda878e2668cd26422a7..081d1e38b7b1f286e138b0981aaa760e58761215 100644 +index 3bd13c9b8c7573726ae7defdc3c0f32876d1cf1f..5193cf1d3c922d750a11e492b7636215e23ad0d6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java -@@ -152,8 +152,9 @@ public abstract class Animal extends AgeableMob { +@@ -147,8 +147,9 @@ public abstract class Animal extends AgeableMob { int i = this.getAge(); if (!this.level().isClientSide && i == 0 && this.canFallInLove()) { @@ -25,7 +25,7 @@ index 907ed82fea71254d6624eda878e2668cd26422a7..081d1e38b7b1f286e138b0981aaa760e return InteractionResult.SUCCESS; } -@@ -182,10 +183,18 @@ public abstract class Animal extends AgeableMob { +@@ -174,10 +175,18 @@ public abstract class Animal extends AgeableMob { return this.inLove <= 0; } @@ -44,7 +44,7 @@ index 907ed82fea71254d6624eda878e2668cd26422a7..081d1e38b7b1f286e138b0981aaa760e return; } this.inLove = entityEnterLoveModeEvent.getTicksInLove(); -@@ -193,7 +202,7 @@ public abstract class Animal extends AgeableMob { +@@ -185,7 +194,7 @@ public abstract class Animal extends AgeableMob { if (player != null) { this.loveCause = player.getUUID(); } @@ -54,10 +54,10 @@ index 907ed82fea71254d6624eda878e2668cd26422a7..081d1e38b7b1f286e138b0981aaa760e this.level().broadcastEntityEvent(this, (byte) 18); } diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java -index 0297e234f17c6157cfff79420b9eeaf4e0e2c3ab..d683c49fdf2d1e5b0f2620641f9c241e82f96825 100644 +index 0440fd2d1bb3f87641ad88de6d5ae64617536a6d..db60b91c2b26ca8cdb66e05deab7742ffe212767 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java -@@ -650,8 +650,9 @@ public class Panda extends Animal { +@@ -668,8 +668,9 @@ public class Panda extends Animal { this.usePlayerItem(player, hand, itemstack); this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true); } else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { @@ -69,10 +69,10 @@ index 0297e234f17c6157cfff79420b9eeaf4e0e2c3ab..d683c49fdf2d1e5b0f2620641f9c241e if (this.level().isClientSide || this.isSitting() || this.isInWater()) { return InteractionResult.PASS; diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 7860331b640fe48d1f2357d9f8e2e40c682b3620..84ae19bf9bddd2b6ee4737577d8836d59be028c2 100644 +index 33531cbdd9b2a5607092d2364ce5655a63c2361c..9229948c90e278cbdacd0f82689144c8dc50956f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -398,7 +398,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -389,7 +389,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl boolean flag1 = this.isTamed() && this.getAge() == 0 && this.canFallInLove(); if (flag1) { @@ -82,10 +82,10 @@ index 7860331b640fe48d1f2357d9f8e2e40c682b3620..84ae19bf9bddd2b6ee4737577d8836d5 boolean flag2 = this.isBaby(); diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -index 94dd97662ba07689fbfa16ef5c7d99fe12ce83de..815eb15086976b8f9e03bf8182d9ed50aec14720 100644 +index 8cae4e154ca07493aba9acadd4ff7150d7ae4f67..9357cf0179d19fbdfe76413e909a99b924c85780 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -513,7 +513,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, +@@ -571,7 +571,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, b0 = 5; if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { flag = true; @@ -94,7 +94,7 @@ index 94dd97662ba07689fbfa16ef5c7d99fe12ce83de..815eb15086976b8f9e03bf8182d9ed50 } } else if (item.is(Items.GOLDEN_APPLE) || item.is(Items.ENCHANTED_GOLDEN_APPLE)) { f = 10.0F; -@@ -521,7 +521,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, +@@ -579,7 +579,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, b0 = 10; if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { flag = true; @@ -104,10 +104,10 @@ index 94dd97662ba07689fbfa16ef5c7d99fe12ce83de..815eb15086976b8f9e03bf8182d9ed50 } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java -index 9b5b894d43f25566ab9c3698705e978ab823a0d2..6623674136b0f865d5b3d7a10d3bf05793b82f87 100644 +index d4eceb535561e11f5f7ab891e81aac285f3cd828..1dd4290287725898ace29e46b439b55df8fdd1af 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java -@@ -191,7 +191,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder implements FeatureElement, EntityTypeT +@@ -592,9 +592,15 @@ public class EntityType implements FeatureElement, EntityTypeT } public static Optional create(CompoundTag nbt, Level world) { @@ -68,10 +68,10 @@ index 656c68b37bc25d6b77f295f9efe0a81dd20b69c1..8ba573bb4099ee5b27b61f333e72d794 }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e534e926f 100644 +index a8b168f56c74feeaca55335731b1d485289736cb..281d2f3df347e911eee459e06b917a0e075078e9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1142,6 +1142,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1163,6 +1163,11 @@ public abstract class LivingEntity extends Entity implements Attackable { } public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) { @@ -83,7 +83,7 @@ index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API if (this.isTickingEffects) { this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause)); -@@ -1161,10 +1166,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1182,10 +1187,13 @@ public abstract class LivingEntity extends Entity implements Attackable { override = new MobEffectInstance(mobeffect1).update(mobeffect); } @@ -97,9 +97,9 @@ index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e // CraftBukkit end if (mobeffect1 == null) { -@@ -1172,7 +1180,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.onEffectAdded(mobeffect, entity); +@@ -1194,7 +1202,7 @@ public abstract class LivingEntity extends Entity implements Attackable { flag = true; + mobeffect.onEffectAdded(this); // CraftBukkit start - } else if (event.isOverride()) { + } else if (override) { // Paper - Don't fire sync event during generation @@ -107,23 +107,23 @@ index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e this.onEffectUpdated(mobeffect1, true, entity); // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index d90da2f9e4d6214577bc81bd6c70ba8593788898..ffa4f34d964fbcc53e2dfe11677832db21a6eb93 100644 +index 6006480d9f6d60bb7b5628eabe6740013066cde4..f0127f1b55999aa4a841341ad02cbcde45702b50 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java -@@ -182,7 +182,7 @@ public class Spider extends Monster { - MobEffect mobeffectlist = entityspider_groupdataspider.effect; +@@ -172,7 +172,7 @@ public class Spider extends Monster { + Holder holder = entityspider_groupdataspider.effect; - if (mobeffectlist != null) { -- this.addEffect(new MobEffectInstance(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit -+ this.addEffect(new MobEffectInstance(mobeffectlist, -1), null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN, world instanceof net.minecraft.server.level.ServerLevel); // CraftBukkit // Paper - Don't fire sync event during generation; only if this is happening in a ServerLevel + if (holder != null) { +- this.addEffect(new MobEffectInstance(holder, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit ++ this.addEffect(new MobEffectInstance(holder, -1), null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN, world instanceof net.minecraft.server.level.ServerLevel); // CraftBukkit } } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index ae8a42261337bf736d0cc1bbe18da2b773417ca4..471e8493622c89d44a82f42f135cb308c9e0fbfe 100644 +index b5365dce7882c98b5be4f5df877165eee80933dd..9b4e2f96299bb12af7090ef70ac158c825d49d19 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -518,7 +518,7 @@ public class StructureTemplate { +@@ -525,7 +525,7 @@ public class StructureTemplate { private static Optional createEntityIgnoreException(ServerLevelAccessor world, CompoundTag nbt) { // CraftBukkit start // try { @@ -133,10 +133,10 @@ index ae8a42261337bf736d0cc1bbe18da2b773417ca4..471e8493622c89d44a82f42f135cb308 // return Optional.empty(); // } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java -index e37c2d82ed606cbfe00c152b08c3ab99ac751f69..7ed861cd67889e525ab4987c0afed245aca08833 100644 +index 0794d92c42b0db6b367505ae28f09f1fd39fa312..cd7f1309cf01a5f01a28aded03a36fe15adb1756 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java -@@ -93,15 +93,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { +@@ -92,15 +92,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { return this.handle.getLevel(); } @@ -164,7 +164,7 @@ index e37c2d82ed606cbfe00c152b08c3ab99ac751f69..7ed861cd67889e525ab4987c0afed245 @Override public ServerLevel getMinecraftWorld() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java -index b4b297945fb601701aac845d09e88fb74b09c3fa..7482dfe64458320d44089c0778591694202e9f70 100644 +index 35ecf6f824aca56a20280dd683123df1d0c7d66e..1d1fdcf10498c421f106158254e052da6d68d8a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java @@ -39,21 +39,23 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess { diff --git a/patches/unapplied/server/0974-Add-Structure-check-API.patch b/patches/server/0941-Add-Structure-check-API.patch similarity index 91% rename from patches/unapplied/server/0974-Add-Structure-check-API.patch rename to patches/server/0941-Add-Structure-check-API.patch index 551c80ce78..a1ff274d21 100644 --- a/patches/unapplied/server/0974-Add-Structure-check-API.patch +++ b/patches/server/0941-Add-Structure-check-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Structure check API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index cdcab87bfe2e207ee1f4f8a111682efefbd96511..35cc9bc399386344c1acc6446262d278d57febd0 100644 +index d50cd69b3c26605852a8b01efe768abfc43728b4..9be7221d24f7036e2fe76bbea2c7585cc75f9854 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -237,6 +237,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/unapplied/server/0975-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch b/patches/server/0942-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch similarity index 88% rename from patches/unapplied/server/0975-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch rename to patches/server/0942-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch index bbc3e41f85..c118aba6df 100644 --- a/patches/unapplied/server/0975-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch +++ b/patches/server/0942-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 9137d6d56386111dfd072859df84e533580ee294..5cd0fbac267f9c69c5de4c200a95860f5c56d42e 100644 +index b355663fe21510b8b15deefb28cdb0460c4d1baa..4fe613191ffd564d681311311504e44fd4709721 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1174,7 +1174,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1255,7 +1255,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); this.checkAttributeList(); for (Map.Entry entry : this.attributeModifiers.entries()) { diff --git a/patches/unapplied/server/0976-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0943-Restore-vanilla-entity-drops-behavior.patch similarity index 91% rename from patches/unapplied/server/0976-Restore-vanilla-entity-drops-behavior.patch rename to patches/server/0943-Restore-vanilla-entity-drops-behavior.patch index 531ac1d639..edb6769a27 100644 --- a/patches/unapplied/server/0976-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0943-Restore-vanilla-entity-drops-behavior.patch @@ -9,10 +9,10 @@ on dropping the item instead of generalizing it for all dropped items like CB does. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 2bb82dcffd8fdc25d658ec36a34f959b25217396..bd6c60ebfc76d19313bf01048268f8ce7e6603c5 100644 +index b2bf086506ba7eda6ba6912ebf51a9da154cd414..bee8cc19d7912d2ab1b731c47cf7e31d21d61866 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -891,22 +891,20 @@ public class ServerPlayer extends Player { +@@ -958,22 +958,20 @@ public class ServerPlayer extends Player { if (this.isRemoved()) { return; } @@ -38,7 +38,7 @@ index 2bb82dcffd8fdc25d658ec36a34f959b25217396..bd6c60ebfc76d19313bf01048268f8ce this.drops.clear(); // SPIGOT-5188: make sure to clear } // Paper - fix player loottables running when mob loot gamerule is false -@@ -2389,8 +2387,8 @@ public class ServerPlayer extends Player { +@@ -2471,8 +2469,8 @@ public class ServerPlayer extends Player { } @Override @@ -50,10 +50,10 @@ index 2bb82dcffd8fdc25d658ec36a34f959b25217396..bd6c60ebfc76d19313bf01048268f8ce if (entityitem == null) { return null; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2848be4604e08d0d651d16e960cda9a4d0234d41..5275e7a34f86830d43edcab3a0e94f8d8e9cfae5 100644 +index ee38f76e46c20e9fadfb5d4d602b7b82a8a22e51..4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2496,6 +2496,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2524,6 +2524,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) { @@ -79,7 +79,7 @@ index 2848be4604e08d0d651d16e960cda9a4d0234d41..5275e7a34f86830d43edcab3a0e94f8d if (stack.isEmpty()) { return null; } else if (this.level().isClientSide) { -@@ -2503,14 +2522,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2531,14 +2550,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -104,10 +104,10 @@ index 2848be4604e08d0d651d16e960cda9a4d0234d41..5275e7a34f86830d43edcab3a0e94f8d return this.spawnAtLocation(entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a648cc01f2cdfac46fd2e760705cf85e534e926f..d396201655fde7ff35cf2a342fa458e5ea3f80a8 100644 +index 281d2f3df347e911eee459e06b917a0e075078e9..f948f4051607611e7105790c3b6bacc5d3ec39db 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -255,7 +255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -266,7 +266,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // CraftBukkit start public int expToDrop; public boolean forceDrops; @@ -117,10 +117,10 @@ index a648cc01f2cdfac46fd2e760705cf85e534e926f..d396201655fde7ff35cf2a342fa458e5 public boolean collides = true; public Set collidableExemptions = new HashSet<>(); diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 6c215470ad05d59f903cbeff15088a03b42c3f66..12440ee2dccc0a697fb403765f2e1b987ccc0283 100644 +index aa22829c3d41118664a872540fdc8f716120c407..c23d4ee0a16d1ae7168b2496d97189a14256bdcc 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -535,10 +535,10 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -537,10 +537,10 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) { super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops); @@ -134,19 +134,19 @@ index 6c215470ad05d59f903cbeff15088a03b42c3f66..12440ee2dccc0a697fb403765f2e1b98 } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index f62b5976e307a69ca40d51ae76126005c801df0c..bbe299afd361a107e3936c8ea1a62067fcac9b7e 100644 +index b1b0b0554e0ad035463fd53aa440d9c079b7cfb4..2ed6845f16fab175e2e9e96e76391e63ab4a43e2 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -611,7 +611,7 @@ public class ArmorStand extends LivingEntity { - itemstack.setHoverName(this.getCustomName()); - } +@@ -614,7 +614,7 @@ public class ArmorStand extends LivingEntity { + ItemStack itemstack = new ItemStack(Items.ARMOR_STAND); + itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName()); - this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops + this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior return this.brokenByAnything(damageSource); // Paper } -@@ -625,7 +625,7 @@ public class ArmorStand extends LivingEntity { +@@ -628,7 +628,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -155,7 +155,7 @@ index f62b5976e307a69ca40d51ae76126005c801df0c..bbe299afd361a107e3936c8ea1a62067 this.handItems.set(i, ItemStack.EMPTY); } } -@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity { +@@ -636,7 +636,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -165,10 +165,10 @@ index f62b5976e307a69ca40d51ae76126005c801df0c..bbe299afd361a107e3936c8ea1a62067 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 53c3b2123d6fa78367aef53d6949e58170cb9fce..99292a908b36e3c75d51c6877c7a0c01d9671aa6 100644 +index eefdb3da069d9615db7c663bcf8a72b78a0e6817..822bfebc779646dde655239ac217bad011a9eee4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -965,17 +965,23 @@ public class CraftEventFactory { +@@ -964,17 +964,23 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim) { @@ -196,7 +196,7 @@ index 53c3b2123d6fa78367aef53d6949e58170cb9fce..99292a908b36e3c75d51c6877c7a0c01 populateFields(victim, event); // Paper - make cancellable CraftWorld world = (CraftWorld) entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); -@@ -989,19 +995,23 @@ public class CraftEventFactory { +@@ -988,19 +994,23 @@ public class CraftEventFactory { victim.expToDrop = event.getDroppedExp(); lootCheck.run(); // Paper - advancement triggers before destroying items @@ -224,7 +224,7 @@ index 53c3b2123d6fa78367aef53d6949e58170cb9fce..99292a908b36e3c75d51c6877c7a0c01 event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel populateFields(victim, event); // Paper - make cancellable -@@ -1020,10 +1030,14 @@ public class CraftEventFactory { +@@ -1019,10 +1029,14 @@ public class CraftEventFactory { victim.expToDrop = event.getDroppedExp(); victim.newExp = event.getNewExp(); diff --git a/patches/unapplied/server/0977-Dont-resend-blocks-on-interactions.patch b/patches/server/0944-Dont-resend-blocks-on-interactions.patch similarity index 92% rename from patches/unapplied/server/0977-Dont-resend-blocks-on-interactions.patch rename to patches/server/0944-Dont-resend-blocks-on-interactions.patch index 8a8a5bb4ed..3da20203de 100644 --- a/patches/unapplied/server/0977-Dont-resend-blocks-on-interactions.patch +++ b/patches/server/0944-Dont-resend-blocks-on-interactions.patch @@ -8,10 +8,10 @@ In general, the client now has an acknowledgment system which will prevent block It should be noted that this system does not yet support block entities, so those still need to resynced when needed. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5bf8fa354e 100644 +index cef3a64b5e6c4d34ed079078420078a7adfcd574..3dff328c5e4456aae291a8dec82766681f49af06 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -199,7 +199,7 @@ public class ServerPlayerGameMode { +@@ -202,7 +202,7 @@ public class ServerPlayerGameMode { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); if (event.isCancelled()) { // Let the client know the block still exists @@ -20,7 +20,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b // Update any tile entity data for this block capturedBlockEntity = true; // Paper - Send block entities after destroy prediction return; -@@ -214,7 +214,7 @@ public class ServerPlayerGameMode { +@@ -217,7 +217,7 @@ public class ServerPlayerGameMode { // Spigot start - handle debug stick left click for non-creative if (this.player.getMainHandItem().is(net.minecraft.world.item.Items.DEBUG_STICK) && ((net.minecraft.world.item.DebugStickItem) net.minecraft.world.item.Items.DEBUG_STICK).handleInteraction(this.player, this.level.getBlockState(pos), this.level, pos, false, this.player.getMainHandItem())) { @@ -29,7 +29,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b return; } // Spigot end -@@ -232,15 +232,17 @@ public class ServerPlayerGameMode { +@@ -235,15 +235,17 @@ public class ServerPlayerGameMode { // CraftBukkit start - Swings at air do *NOT* exist. if (event.useInteractedBlock() == Event.Result.DENY) { // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. @@ -56,7 +56,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b } else if (!iblockdata.isAir()) { iblockdata.attack(this.level, pos, this.player); f = iblockdata.getDestroyProgress(this.player, this.player.level(), pos); -@@ -249,7 +251,7 @@ public class ServerPlayerGameMode { +@@ -252,7 +254,7 @@ public class ServerPlayerGameMode { if (event.useItemInHand() == Event.Result.DENY) { // If we 'insta destroyed' then the client needs to be informed. if (f > 1.0f) { @@ -65,7 +65,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b } return; } -@@ -257,7 +259,7 @@ public class ServerPlayerGameMode { +@@ -260,7 +262,7 @@ public class ServerPlayerGameMode { if (blockEvent.isCancelled()) { // Let the client know the block still exists @@ -74,7 +74,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b return; } -@@ -348,7 +350,7 @@ public class ServerPlayerGameMode { +@@ -351,7 +353,7 @@ public class ServerPlayerGameMode { // Tell client the block is gone immediately then process events // Don't tell the client if its a creative sword break because its not broken! @@ -83,7 +83,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(pos, Blocks.AIR.defaultBlockState()); this.player.connection.send(packet); } -@@ -374,13 +376,15 @@ public class ServerPlayerGameMode { +@@ -377,13 +379,15 @@ public class ServerPlayerGameMode { if (isSwordNoBreak) { return false; } @@ -103,7 +103,7 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b // Update any tile entity data for this block if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction -@@ -537,16 +541,18 @@ public class ServerPlayerGameMode { +@@ -532,16 +536,18 @@ public class ServerPlayerGameMode { if (event.useInteractedBlock() == Event.Result.DENY) { // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. if (iblockdata.getBlock() instanceof DoorBlock) { @@ -127,10 +127,10 @@ index d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7..5063eb6d4a24600262c32d2c9eb5fb5b } else if (iblockdata.is(Blocks.STRUCTURE_BLOCK) || iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) { player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId)); diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java -index 4b9e726e6ac255e743479d5c2e0cdb98464399a4..6371f326fc86cfc53e39bf8ed13b646f7705fbbc 100644 +index 6d494b80ae002aea00afa44adf83dad1ae5bbbc1..49557d6f22c5725c663a231deab019d4f6fe95fa 100644 --- a/src/main/java/net/minecraft/world/item/BucketItem.java +++ b/src/main/java/net/minecraft/world/item/BucketItem.java -@@ -77,7 +77,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { +@@ -78,7 +78,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand); if (event.isCancelled()) { @@ -139,7 +139,7 @@ index 4b9e726e6ac255e743479d5c2e0cdb98464399a4..6371f326fc86cfc53e39bf8ed13b646f ((ServerPlayer) user).getBukkitEntity().updateInventory(); // SPIGOT-4541 return InteractionResultHolder.fail(itemstack); } -@@ -186,7 +186,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { +@@ -185,7 +185,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { if (flag2 && entityhuman != null) { PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); if (event.isCancelled()) { @@ -149,10 +149,10 @@ index 4b9e726e6ac255e743479d5c2e0cdb98464399a4..6371f326fc86cfc53e39bf8ed13b646f return false; } diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 9b4e20d4bfba2de08084f1d69cb2ebfff7455c14..06dc04a1fbb91a5a20d662aeee168b6a319551d0 100644 +index 789740cadc1b66531b465bb0a052e2392852c4a8..36ea5ec6d2d2b994dfdf581141132a423569e4a1 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -458,10 +458,12 @@ public final class ItemStack { +@@ -471,10 +471,12 @@ public final class ItemStack implements DataComponentHolder { world.preventPoiUpdated = false; // Brute force all possible updates diff --git a/patches/unapplied/server/0978-add-more-scoreboard-API.patch b/patches/server/0945-add-more-scoreboard-API.patch similarity index 100% rename from patches/unapplied/server/0978-add-more-scoreboard-API.patch rename to patches/server/0945-add-more-scoreboard-API.patch diff --git a/patches/unapplied/server/0979-Improve-Registry.patch b/patches/server/0946-Improve-Registry.patch similarity index 88% rename from patches/unapplied/server/0979-Improve-Registry.patch rename to patches/server/0946-Improve-Registry.patch index aed822acfc..0d7c6b94e6 100644 --- a/patches/unapplied/server/0979-Improve-Registry.patch +++ b/patches/server/0946-Improve-Registry.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Improve Registry diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java -index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f317374d2a42f 100644 +index c7d377dbb53cdc1f823a839e3a113136efc16349..73472890e30180dc3cb6aa1bd9c5815087334682 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java -@@ -131,6 +131,7 @@ public class CraftRegistry implements Registry { +@@ -150,6 +150,7 @@ public class CraftRegistry implements Registry { private final Class bukkitClass; private final Map cache = new HashMap<>(); @@ -16,7 +16,7 @@ index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f3173 private final net.minecraft.core.Registry minecraftRegistry; private final BiFunction minecraftToBukkit; private boolean init; -@@ -175,6 +176,7 @@ public class CraftRegistry implements Registry { +@@ -194,6 +195,7 @@ public class CraftRegistry implements Registry { } this.cache.put(namespacedKey, bukkit); @@ -24,7 +24,7 @@ index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f3173 return bukkit; } -@@ -197,4 +199,11 @@ public class CraftRegistry implements Registry { +@@ -216,4 +218,11 @@ public class CraftRegistry implements Registry { return this.minecraftToBukkit.apply(namespacedKey, minecraft); } @@ -37,10 +37,10 @@ index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f3173 + // Paper end - improve Registry } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java -index 147950b8a1c853e1b52fdb29b26e839c2dd7bd01..8a20186618de8de8dd941a12aeb7d4f3b7e70c18 100644 +index cd3e35867075e65f46051fb88d8a2460a8bb4b53..76627683f256a034a147765db693a9fd2ab9613f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java -@@ -35,6 +35,7 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable= 0, "Total experience points must not be negative (%s)", exp); this.getHandle().totalExperience = exp; } diff --git a/patches/unapplied/server/0982-Add-drops-to-shear-events.patch b/patches/server/0949-Add-drops-to-shear-events.patch similarity index 91% rename from patches/unapplied/server/0982-Add-drops-to-shear-events.patch rename to patches/server/0949-Add-drops-to-shear-events.patch index a249a70023..c216d7236e 100644 --- a/patches/unapplied/server/0982-Add-drops-to-shear-events.patch +++ b/patches/server/0949-Add-drops-to-shear-events.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Add drops to shear events diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -index 45d356c1ed888b4d749379ceaa8a95d7d7c876d5..8d65cdb013706a932c2c73231108b2810b99e1c7 100644 +index fbed5d57db0c0e79996f85571b9af0071fa953c7..a024c697a65bbab27408da1d6a75e531d9719b47 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -@@ -103,11 +103,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { - +@@ -104,11 +104,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { + if (entityliving instanceof Shearable ishearable) { if (ishearable.readyForShearing()) { // CraftBukkit start - if (CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem).isCancelled()) { @@ -22,7 +22,7 @@ index 45d356c1ed888b4d749379ceaa8a95d7d7c876d5..8d65cdb013706a932c2c73231108b281 // CraftBukkit end - ishearable.shear(SoundSource.BLOCKS); + ishearable.shear(SoundSource.BLOCKS, CraftItemStack.asNMSCopy(event.getDrops())); // Paper - Add drops to shear events - worldserver.gameEvent((Entity) null, GameEvent.SHEAR, blockposition); + worldserver.gameEvent((Entity) null, (Holder) GameEvent.SHEAR, blockposition); return true; } diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java @@ -44,7 +44,7 @@ index 5e8cc5cfac8888628c6d513148f41be09ca65a2c..2ee48ac3b665db2b02bcb1a30ec972d4 + // Paper end - custom shear drops } diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java -index 7243e4b95e98fda68d9e6adef0e41bebe825961a..161c128d27f50f145f88142191f1a5c93649ea65 100644 +index aa125e3043b120935aaa015803f065f99eb8d050..7bcdbe173098ee0fcdcc34f97c7c87afdb3c28b3 100644 --- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java +++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java @@ -123,11 +123,18 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder { -@@ -168,6 +175,22 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder { - entityhuman1.broadcastBreakEvent(hand); -@@ -273,13 +280,30 @@ public class Sheep extends Animal implements Shearable { + itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); + return InteractionResult.SUCCESS; +@@ -276,13 +283,30 @@ public class Sheep extends Animal implements Shearable { @Override public void shear(SoundSource shearedSoundCategory) { @@ -175,10 +175,10 @@ index 55afa58f3df53ce548c7484d8fff62c903f9dc07..1d80678f7e8f658e43616f0baf723f09 if (entityitem != null) { diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java -index 54c01fdaf507a30196fb8f38888a570f9e393559..9eab1170cb123d3b60a02314702516704f959ab7 100644 +index 2de1a2f666da9db1832907e1651dbff948e37252..5c2ed3c39c8eb850f3be1e2ea5b5a7ea266e16d1 100644 --- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java -@@ -153,11 +153,18 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM +@@ -146,11 +146,18 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { // CraftBukkit start @@ -199,8 +199,8 @@ index 54c01fdaf507a30196fb8f38888a570f9e393559..9eab1170cb123d3b60a0231470251670 + this.shear(SoundSource.PLAYERS, drops); // Paper this.gameEvent(GameEvent.SHEAR, player); if (!this.level().isClientSide) { - itemstack.hurtAndBreak(1, player, (entityhuman1) -> { -@@ -173,12 +180,28 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM + itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); +@@ -164,12 +171,28 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM @Override public void shear(SoundSource shearedSoundCategory) { @@ -220,12 +220,12 @@ index 54c01fdaf507a30196fb8f38888a570f9e393559..9eab1170cb123d3b60a0231470251670 if (!this.level().isClientSide()) { this.setPumpkin(false); - this.forceDrops = true; // CraftBukkit -- this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F); +- this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight()); - this.forceDrops = false; // CraftBukkit + // Paper start - custom shear drops (moved drop generation to separate method) + for (final ItemStack drop : drops) { + this.forceDrops = true; -+ this.spawnAtLocation(drop, 1.7F); ++ this.spawnAtLocation(drop, this.getEyeHeight()); + this.forceDrops = false; + } + // Paper end - custom shear drops @@ -233,10 +233,10 @@ index 54c01fdaf507a30196fb8f38888a570f9e393559..9eab1170cb123d3b60a0231470251670 } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 99292a908b36e3c75d51c6877c7a0c01d9671aa6..0a041d0e56dfe1319e5174cb0e6085dc35fa5c48 100644 +index 822bfebc779646dde655239ac217bad011a9eee4..444287fea080182df533198f5c659533de86c5dc 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1674,20 +1674,20 @@ public class CraftEventFactory { +@@ -1669,20 +1669,20 @@ public class CraftEventFactory { player.level().getCraftServer().getPluginManager().callEvent(event); } @@ -264,10 +264,10 @@ index 99292a908b36e3c75d51c6877c7a0c01d9671aa6..0a041d0e56dfe1319e5174cb0e6085dc public static Cancellable handleStatisticsIncrease(net.minecraft.world.entity.player.Player entityHuman, net.minecraft.stats.Stat statistic, int current, int newValue) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 38ceeca108c258852eeb7a48015010a689ac43ec..f67b048c3831fcab24acd12249cbd32d386c3ffe 100644 +index 97e1bd56de2c7f6d606e3a4968b2f55cd4689b91..6138bcfeac622e091267b226f5be3a807f01312d 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -66,6 +66,16 @@ public final class CraftItemStack extends ItemStack { +@@ -65,6 +65,16 @@ public final class CraftItemStack extends ItemStack { return stack; } diff --git a/patches/server/0950-Add-PlayerShieldDisableEvent.patch b/patches/server/0950-Add-PlayerShieldDisableEvent.patch new file mode 100644 index 0000000000..a4316fd237 --- /dev/null +++ b/patches/server/0950-Add-PlayerShieldDisableEvent.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 1 May 2023 16:22:43 -0500 +Subject: [PATCH] Add PlayerShieldDisableEvent + +Called whenever a players shield is disabled. This is mainly caused by +attacking players or monsters that carry axes. + +The event, while similar to the PlayerItemCooldownEvent, offers other +behaviour and can hence not be implemented as a childtype of said event. +Specifically, cancelling the event prevents the game events from being +sent to the player. + +Plugins listening to just the PlayerItemCooldownEvent may not want said +sideeffects, meaning the disable event cannot share a handlerlist with +the cooldown event + +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index 446556028028b25c35dbf3d099bf14a59e32a266..70d225dbf5649e6a3fa658291de734f54a6f73dc 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -989,7 +989,7 @@ public abstract class Player extends LivingEntity { + protected void blockUsingShield(LivingEntity attacker) { + super.blockUsingShield(attacker); + if (attacker.canDisableShield()) { +- this.disableShield(); ++ this.disableShield(attacker); // Paper - Add PlayerShieldDisableEvent + } + + } +@@ -1473,8 +1473,21 @@ public abstract class Player extends LivingEntity { + this.attack(target); + } + ++ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - Add PlayerShieldDisableEvent + public void disableShield() { +- this.getCooldowns().addCooldown(Items.SHIELD, 100); ++ // Paper start - Add PlayerShieldDisableEvent ++ this.disableShield(null); ++ } ++ public void disableShield(@Nullable LivingEntity attacker) { ++ final org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; ++ if (finalAttacker != null) { ++ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100); ++ if (!shieldDisableEvent.callEvent()) return; ++ this.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown()); ++ } else { ++ this.getCooldowns().addCooldown(Items.SHIELD, 100); ++ } ++ // Paper end - Add PlayerShieldDisableEvent + this.stopUsingItem(); + this.level().broadcastEntityEvent(this, (byte) 30); + } diff --git a/patches/unapplied/server/0984-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0951-Validate-ResourceLocation-in-NBT-reading.patch similarity index 73% rename from patches/unapplied/server/0984-Validate-ResourceLocation-in-NBT-reading.patch rename to patches/server/0951-Validate-ResourceLocation-in-NBT-reading.patch index 147ec449fe..c414b4e4e8 100644 --- a/patches/unapplied/server/0984-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0951-Validate-ResourceLocation-in-NBT-reading.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate ResourceLocation in NBT reading diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index f3b11b08358fdd93464cd19b05047e10727a5799..c192ddee39afe1de0b5454bc94593b10fefbb24d 100644 +index 1d7c20fe14882fdeddf315a8923669e3385652f5..f88dd37783b3c155c23b547c360b8d3c16e030c0 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -222,8 +222,10 @@ public final class NbtUtils { +@@ -149,8 +149,10 @@ public final class NbtUtils { if (!nbt.contains("Name", 8)) { return Blocks.AIR.defaultBlockState(); } else { @@ -22,10 +22,10 @@ index f3b11b08358fdd93464cd19b05047e10727a5799..c192ddee39afe1de0b5454bc94593b10 return Blocks.AIR.defaultBlockState(); } else { diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index 3908f88959e43d2f485d5f239257e6564dbda6cd..b549f65d0e276a5ed5b8b2f6956268d05910724f 100644 +index d93b623ce973b63d4f3a77bfe459f51af7cb3c1c..2c4553312f2f37f8613ac813708b4b95f9675e9f 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -33,6 +33,13 @@ public class ResourceLocation implements Comparable { +@@ -37,6 +37,13 @@ public class ResourceLocation implements Comparable { private final String path; protected ResourceLocation(String namespace, String path, @Nullable ResourceLocation.Dummy extraData) { @@ -40,10 +40,10 @@ index 3908f88959e43d2f485d5f239257e6564dbda6cd..b549f65d0e276a5ed5b8b2f6956268d0 this.path = path; } diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 8ba573bb4099ee5b27b61f333e72d794c48d5f29..69bdf3f2ee731e59e8d454816a9ca72cb49c0fe0 100644 +index 066c7033fdd9506a0edc5f5a0ec3bb1f1fbae336..d2503224a1697636b3f9c26126d6bb201143076a 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -614,7 +614,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -623,7 +623,7 @@ public class EntityType implements FeatureElement, EntityTypeT } public static Optional> by(CompoundTag nbt) { @@ -53,10 +53,10 @@ index 8ba573bb4099ee5b27b61f333e72d794c48d5f29..69bdf3f2ee731e59e8d454816a9ca72c @Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bb52d084637c97d9cc1ebaeec28358a0ddb3952b..40e21effc948b02874a6ed1d1c340c4dc87579d6 100644 +index 68c312dc39ef6fdb88e201ba096c9bd99aebddd7..0416af1342dad6a6789aa743aadf61b32b70f338 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -879,12 +879,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -911,12 +911,13 @@ public abstract class LivingEntity extends Entity implements Attackable { if (nbt.contains("SleepingX", 99) && nbt.contains("SleepingY", 99) && nbt.contains("SleepingZ", 99)) { BlockPos blockposition = new BlockPos(nbt.getInt("SleepingX"), nbt.getInt("SleepingY"), nbt.getInt("SleepingZ")); @@ -72,23 +72,23 @@ index bb52d084637c97d9cc1ebaeec28358a0ddb3952b..40e21effc948b02874a6ed1d1c340c4d if (nbt.contains("Brain", 10)) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index f7818fd5e59784554732c39ef5c56461ea0d62c4..11c933a662c2275e2ef239cb0b5dd2480cc55490 100644 +index 506101a692c73f6acf2e647c3ab18024ccdff866..4f2148d13fc26ad2c43460f46c376832c1bb8150 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -608,7 +608,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -642,7 +642,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti this.setLeftHanded(nbt.getBoolean("LeftHanded")); if (nbt.contains("DeathLootTable", 8)) { -- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable")); -+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // Paper - Validate ResourceLocation +- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("DeathLootTable"))); ++ this.lootTable = net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("DeathLootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl)); // Paper - Validate ResourceLocation this.lootTableSeed = nbt.getLong("DeathLootTableSeed"); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index c30f19162e33dbe8f018b7dc66210681b6027389..e8faca6e443239968f0111519f9e5cd018ed3297 100644 +index 2df84bc367f650c3d468e0f09ed565e68de43a82..7ea5f496dc9ffab8311fcc79de47362a66c703e6 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -561,7 +561,7 @@ public abstract class AbstractArrow extends Projectile { +@@ -556,7 +556,7 @@ public abstract class AbstractArrow extends Projectile { this.setCritArrow(nbt.getBoolean("crit")); this.setPierceLevel(nbt.getByte("PierceLevel")); if (nbt.contains("SoundEvent", 8)) { @@ -98,23 +98,23 @@ index c30f19162e33dbe8f018b7dc66210681b6027389..e8faca6e443239968f0111519f9e5cd0 this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow")); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index f4ad1eea5bced6997edbc3a5ed1360b12b70f68f..648eefb973a4e5e543818c417a6ee39f283ea361 100644 +index f33e5cf6d456e615050047e924d9b24268a2c51e..c660e9b1e9635011b32fa19cf64118d64408f158 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -66,7 +66,7 @@ public interface ContainerEntity extends Container, MenuProvider { - default void readChestVehicleSaveData(CompoundTag nbt) { +@@ -72,7 +72,7 @@ public interface ContainerEntity extends Container, MenuProvider { + default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) { this.clearItemStacks(); if (nbt.contains("LootTable", 8)) { -- this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); -+ this.setLootTable(ResourceLocation.tryParse(nbt.getString("LootTable"))); // Paper - Validate ResourceLocation +- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable")))); ++ this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation this.setLootTableSeed(nbt.getLong("LootTableSeed")); } - ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain + ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index d04fc84eef11adb5ea64077f48794b6ed7fb3ada..89d06253b00604114e543ebbe12a9993ae95dc41 100644 +index f40b2582d9087f9dbb5cab950304698f33fdd879..a99fe191c429bb528209dd0f31b509acf9cccbb5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -290,7 +290,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -295,7 +295,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit while (iterator.hasNext()) { String s = (String) iterator.next(); @@ -129,15 +129,15 @@ index d04fc84eef11adb5ea64077f48794b6ed7fb3ada..89d06253b00604114e543ebbe12a9993 // Paper start - cook speed multiplier API diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java -index b5b1831631e233a96b6fd55972a8862b0f420da8..3f62e823bf9b5aa696e3c240613a0fb50340875e 100644 +index f78a9698afc87408fc46de2d3d00c923500885f4..dc02a3d84b397f634f77f4df9c06e245cc4dcb75 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java -@@ -199,7 +199,7 @@ public class BrushableBlockEntity extends BlockEntity { +@@ -202,7 +202,7 @@ public class BrushableBlockEntity extends BlockEntity { private boolean tryLoadLootTable(CompoundTag nbt) { if (nbt.contains("LootTable", 8)) { -- this.lootTable = new ResourceLocation(nbt.getString("LootTable")); -+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Paper - Validate ResourceLocation +- this.lootTable = ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable"))); ++ this.lootTable = net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl)); // Paper - Validate ResourceLocation this.lootTableSeed = nbt.getLong("LootTableSeed"); return true; } else { diff --git a/patches/unapplied/server/0985-Properly-handle-experience-dropping-on-block-break.patch b/patches/server/0952-Properly-handle-experience-dropping-on-block-break.patch similarity index 92% rename from patches/unapplied/server/0985-Properly-handle-experience-dropping-on-block-break.patch rename to patches/server/0952-Properly-handle-experience-dropping-on-block-break.patch index 57e56e24ab..9303d64d44 100644 --- a/patches/unapplied/server/0985-Properly-handle-experience-dropping-on-block-break.patch +++ b/patches/server/0952-Properly-handle-experience-dropping-on-block-break.patch @@ -7,10 +7,10 @@ This causes spawnAfterBreak to spawn xp by default, removing the need to manuall For classes that use custom xp amounts, they can drop the resources with disabling diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e881ed9de9d864e0522e1f7f97dc3debf57cf4b6..cedde2235227eb5820beefb98549994e1cca1198 100644 +index f3486d042a592cb538c5e8f681673a0c2c45ffd9..6ef8b68ceaf710e37ceb63040db95ca47b103ac3 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -625,7 +625,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -619,7 +619,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (drop) { BlockEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(pos) : null; @@ -21,10 +21,10 @@ index e881ed9de9d864e0522e1f7f97dc3debf57cf4b6..cedde2235227eb5820beefb98549994e boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index c4bf01177b2dfcc88f6992dc85de216d448a79f8..6896d46fce2e466ebee23ac2dc00312ec1beefdb 100644 +index a757a45d423e1729c9374391df4186ae0522e1ac..7f0c0ca49e7575c18935b71e3180d112440289f7 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -321,23 +321,31 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -313,23 +313,31 @@ public class Block extends BlockBehaviour implements ItemLike { for (ItemStack drop : Block.getDrops(state, serverLevel, pos, blockEntity)) { items.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(drop)); } @@ -58,7 +58,7 @@ index c4bf01177b2dfcc88f6992dc85de216d448a79f8..6896d46fce2e466ebee23ac2dc00312e } } -@@ -421,7 +429,7 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -413,7 +421,7 @@ public class Block extends BlockBehaviour implements ItemLike { player.awardStat(Stats.BLOCK_MINED.get(this)); player.causeFoodExhaustion(0.005F, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.BLOCK_MINED); // CraftBukkit - EntityExhaustionEvent if (includeDrops) { // Paper - fix drops not preventing stats/food exhaustion @@ -68,10 +68,10 @@ index c4bf01177b2dfcc88f6992dc85de216d448a79f8..6896d46fce2e466ebee23ac2dc00312e } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index e57e3a26b0fb856e1ab693df5783fe8b9bee9719..64300077fce6eb28b6bddd42b3467eaa4c80c9f5 100644 +index f76ce68ed8e08167cf1cbd7bfec67ae01567c38d..84033e07fa357bf401190d5b5fadfd783a63ddf9 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1183,6 +1183,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1118,6 +1118,7 @@ public abstract class BlockBehaviour implements FeatureElement { public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) { this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience); diff --git a/patches/unapplied/server/0986-Fixup-NamespacedKey-handling.patch b/patches/server/0953-Fixup-NamespacedKey-handling.patch similarity index 65% rename from patches/unapplied/server/0986-Fixup-NamespacedKey-handling.patch rename to patches/server/0953-Fixup-NamespacedKey-handling.patch index 14ddcf111d..2666cb6589 100644 --- a/patches/unapplied/server/0986-Fixup-NamespacedKey-handling.patch +++ b/patches/server/0953-Fixup-NamespacedKey-handling.patch @@ -31,10 +31,10 @@ index 9cfa5d36a6991067a3866e0d437749fafcc0158e..2ee4ee14ab3345486dad6b24fd9a4fcc @Override diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java -index 8c9ce07f6a9c2799ce4d8b6a7d8eccd37cce6d43..f9e8c1f8416c4e5ae11e1d742cf3655faa480ce9 100644 +index 6fd032dfb50f6051d6a0b5fbd9d76f42c23354d6..c52f64bb608b67ac7e30fec0c3c9bdef080fa716 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttribute.java -@@ -24,7 +24,10 @@ public class CraftAttribute { +@@ -29,7 +29,10 @@ public class CraftAttribute { public static Attribute stringToBukkit(String bukkit) { Preconditions.checkArgument(bukkit != null); @@ -47,57 +47,58 @@ index 8c9ce07f6a9c2799ce4d8b6a7d8eccd37cce6d43..f9e8c1f8416c4e5ae11e1d742cf3655f public static net.minecraft.world.entity.ai.attributes.Attribute bukkitToMinecraft(Attribute bukkit) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java -index 24b87a1566b48be1367970a9ba887a6b3a785bb9..9f2626c8c5cb8e713f7263b73d6a31d39f024f31 100644 +index 12b95c4455e741b65b844eab362f02bce54eb525..ac9279f7acb7077c08d7741435126adfef9e17b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java -@@ -67,14 +67,22 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta { - if (tag.contains(CraftMetaArmor.TRIM.NBT)) { - CompoundTag trimCompound = tag.getCompound(CraftMetaArmor.TRIM.NBT); +@@ -69,8 +69,9 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta { + super(tag); -- if (trimCompound.contains(CraftMetaArmor.TRIM_MATERIAL.NBT) && trimCompound.contains(CraftMetaArmor.TRIM_PATTERN.NBT)) { -- TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_MATERIAL.NBT))); -- TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(CraftMetaArmor.TRIM_PATTERN.NBT))); -+ // Paper start - Fixup NamedspacedKey handling -+ if (trimCompound.contains(CraftMetaArmor.TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(CraftMetaArmor.TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // TODO Can also be inlined in a compound tag -+ TrimMaterial trimMaterial = registryEntry(Registry.TRIM_MATERIAL, trimCompound.getString(TRIM_MATERIAL.NBT)); -+ TrimPattern trimPattern = registryEntry(Registry.TRIM_PATTERN, trimCompound.getString(TRIM_PATTERN.NBT)); + getOrEmpty(tag, CraftMetaArmor.TRIM).ifPresent((trimCompound) -> { +- TrimMaterial trimMaterial = CraftTrimMaterial.minecraftHolderToBukkit(trimCompound.material()); +- TrimPattern trimPattern = CraftTrimPattern.minecraftHolderToBukkit(trimCompound.pattern()); ++ TrimMaterial trimMaterial = this.unwrapAndConvertHolder(Registry.TRIM_MATERIAL, trimCompound.material()); // Paper - fix upstream not being correct ++ TrimPattern trimPattern = this.unwrapAndConvertHolder(Registry.TRIM_PATTERN, trimCompound.pattern()); // Paper - fix upstream not being correct ++ if (trimMaterial == null || trimPattern == null) return; // Paper - just delete the trim because upstream is not doing this right -- this.trim = new ArmorTrim(trimMaterial, trimPattern); -+ this.trim = trimMaterial != null && trimPattern != null ? new ArmorTrim(trimMaterial, trimPattern) : null; -+ // Paper end - Fixup NamedspacedKey handling + this.trim = new ArmorTrim(trimMaterial, trimPattern); + +@@ -79,6 +80,11 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta { } - } + }); } -+ // Paper start - Fixup NamedspacedKey handling -+ private T registryEntry(final Registry registry, final String value) { -+ final NamespacedKey key = NamespacedKey.fromString(value); -+ return key != null ? registry.get(key) : null; ++ // Paper start - fixup upstream being dum ++ private T unwrapAndConvertHolder(final Registry registry, final net.minecraft.core.Holder value) { ++ return value.unwrap().map(key -> registry.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location())), v -> null); + } -+ // Paper end - Fixup NamedspacedKey handling ++ // Paper end - fixup upstream being dum CraftMetaArmor(Map map) { super(map); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java -index fad6295e75179edfc4e88d15c21b0b09f9156692..63e3c5c3f5aff273498d25db0fc9feb76ab27c2f 100644 +index e17093289884b904fc3720600ffa3e772e0935b3..7032f07e3872c65bbebb905e9d50057a113100d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java -@@ -30,7 +30,10 @@ public class CraftMetaMusicInstrument extends CraftMetaItem implements MusicInst +@@ -33,9 +33,14 @@ public class CraftMetaMusicInstrument extends CraftMetaItem implements MusicInst + super(tag); - if (tag.contains(CraftMetaMusicInstrument.GOAT_HORN_INSTRUMENT.NBT)) { - String string = tag.getString(CraftMetaMusicInstrument.GOAT_HORN_INSTRUMENT.NBT); -- this.instrument = Registry.INSTRUMENT.get(NamespacedKey.fromString(string)); -+ // Paper start - Fixup NamespacedKey handling -+ final NamespacedKey key = NamespacedKey.fromString(string); -+ this.instrument = key != null ? Registry.INSTRUMENT.get(key) : null; -+ // Paper end - Fixup NamespacedKey handling - } + getOrEmpty(tag, CraftMetaMusicInstrument.GOAT_HORN_INSTRUMENT).ifPresent((instrument) -> { +- this.instrument = CraftMusicInstrument.minecraftHolderToBukkit(instrument); ++ this.instrument = this.unwrapAndConvertHolder(Registry.INSTRUMENT, instrument); // Paper - fix upstream not handling custom instruments + }); } ++ // Paper start - fixup upstream being dum ++ private T unwrapAndConvertHolder(final Registry registry, final net.minecraft.core.Holder value) { ++ return value.unwrap().map(key -> registry.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location())), v -> null); ++ } ++ // Paper end - fixup upstream being dum + CraftMetaMusicInstrument(Map map) { + super(map); diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionType.java -index 1ce2cf121c0768d06cbd4f9238286b02e139768b..afeb1f634a8d9e46136d8b425453e6c745132fbe 100644 +index 7dc83b02810490c21b68be962c5ef6eb45e32baf..71cc45c4ef9ab98d509b0f8bf7b033a2b32641db 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionType.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionType.java -@@ -43,7 +43,10 @@ public class CraftPotionType implements PotionType.InternalPotionData { +@@ -61,7 +61,10 @@ public class CraftPotionType implements PotionType.InternalPotionData { public static PotionType stringToBukkit(String string) { Preconditions.checkArgument(string != null); diff --git a/patches/unapplied/server/0987-Expose-LootTable-of-DecoratedPot.patch b/patches/server/0954-Expose-LootTable-of-DecoratedPot.patch similarity index 92% rename from patches/unapplied/server/0987-Expose-LootTable-of-DecoratedPot.patch rename to patches/server/0954-Expose-LootTable-of-DecoratedPot.patch index 6d5e2738de..c3556cc29b 100644 --- a/patches/unapplied/server/0987-Expose-LootTable-of-DecoratedPot.patch +++ b/patches/server/0954-Expose-LootTable-of-DecoratedPot.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose LootTable of DecoratedPot diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java -index d595495943bd94a86aa32a6510e46a7ea5c8a723..e2fe5d8d7d8c00ed5d21cfe409933cdde8932e97 100644 +index 6e0258d4d6a07e0f471640a9edda0adf7ef6cd9e..34ed28be8ac79181e6cd29a38b923cd16e6d25da 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDecoratedPot.java -@@ -40,6 +40,39 @@ public class CraftDecoratedPot extends CraftBlockEntityState -Date: Mon, 1 May 2023 16:22:43 -0500 -Subject: [PATCH] Add PlayerShieldDisableEvent - -Called whenever a players shield is disabled. This is mainly caused by -attacking players or monsters that carry axes. - -The event, while similar to the PlayerItemCooldownEvent, offers other -behaviour and can hence not be implemented as a childtype of said event. -Specifically, cancelling the event prevents the game events from being -sent to the player. - -Plugins listening to just the PlayerItemCooldownEvent may not want said -sideeffects, meaning the disable event cannot share a handlerlist with -the cooldown event - -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index a59ee9d9b93404060e7a4702497071859daec6df..f7818fd5e59784554732c39ef5c56461ea0d62c4 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1699,7 +1699,11 @@ public abstract class Mob extends LivingEntity implements Targeting { - float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F; - - if (this.random.nextFloat() < f) { -- player.getCooldowns().addCooldown(Items.SHIELD, 100); -+ // Paper start - Add PlayerShieldDisableEvent -+ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity(), 100); -+ if (!shieldDisableEvent.callEvent()) return; -+ player.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown()); -+ // Paper end - Add PlayerShieldDisableEvent - this.level().broadcastEntityEvent(player, (byte) 30); - } - } -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 020b74065f7489a46b70ac52e5abbdb22132f8d8..3e9c6e7e356ac08ec41736eaabf38714a8841d18 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -973,7 +973,7 @@ public abstract class Player extends LivingEntity { - protected void blockUsingShield(LivingEntity attacker) { - super.blockUsingShield(attacker); - if (attacker.canDisableShield()) { -- this.disableShield(true); -+ this.disableShield(true, attacker); // Paper - Add PlayerShieldDisableEvent - } - - } -@@ -1456,7 +1456,14 @@ public abstract class Player extends LivingEntity { - this.attack(target); - } - -+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - Add PlayerShieldDisableEvent - public void disableShield(boolean sprinting) { -+ // Paper start - Add PlayerShieldDisableEvent -+ disableShield(sprinting, null); -+ } -+ -+ public void disableShield(boolean sprinting, @Nullable LivingEntity attacker) { -+ // Paper end - Add PlayerShieldDisableEvent - float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F; - - if (sprinting) { -@@ -1464,7 +1471,16 @@ public abstract class Player extends LivingEntity { - } - - if (this.random.nextFloat() < f) { -- this.getCooldowns().addCooldown(Items.SHIELD, 100); -+ // Paper start - Add PlayerShieldDisableEvent -+ final org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; -+ if (finalAttacker != null) { -+ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100); -+ if (!shieldDisableEvent.callEvent()) return; -+ this.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown()); -+ } else { -+ this.getCooldowns().addCooldown(Items.SHIELD, 100); -+ } -+ // Paper end - Add PlayerShieldDisableEvent - this.stopUsingItem(); - this.level().broadcastEntityEvent(this, (byte) 30); - }