From 68e86d72973cae11d1c42c042d37d07c38f3afb1 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 6 Apr 2024 12:53:39 -0700 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#10379) Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: f02baa38 PR-988: Add World#getIntersectingChunks(BoundingBox) 9321d665 Move getItemInUse up to LivingEntity 819eef73 PR-959: Add access to current item's remaining ticks c4fdadb0 SPIGOT-7601: Add AbstractArrow#getItem be8261ca Add support for Java 22 26119676 PR-979: Add more translation keys 66753362 PR-985: Correct book maximum pages and characters per page documentation c8be92fa PR-980: Improve getArmorContents() documentation f1120ee2 PR-983: Expose riptide velocity to PlayerRiptideEvent CraftBukkit Changes: dfaa89bbe PR-1369: Add World#getIntersectingChunks(BoundingBox) 51bbab2b9 Move getItemInUse up to LivingEntity 668e09602 PR-1331: Add access to current item's remaining ticks a639406d1 SPIGOT-7601: Add AbstractArrow#getItem 0398930fc SPIGOT-7602: Allow opening in-world horse and related inventories ffd15611c SPIGOT-7608: Allow empty lists to morph to any PDT list 2188dcfa9 Add support for Java 22 45d6a609f SPIGOT-7604: Revert "SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime" 06d915943 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime ca3bc3707 PR-1361: Add more translation keys 366c3ca80 SPIGOT-7600: EntityChangeBlockEvent is not fired for frog eggs 06d0f9ba8 SPIGOT-7593: Fix sapling growth physics / client-side updates 45c2608e4 PR-1366: Expose riptide velocity to PlayerRiptideEvent 29b6bb79b SPIGOT-7587: Remove fixes for now-resolved MC-142590 and MC-109346 --- Paper-MojangAPI/build.gradle.kts | 2 +- patches/api/Add-Entity-Body-Yaw-API.patch | 5 +- .../Add-LivingEntity-clearActiveItem.patch | 10 +- ...-swingHand-EquipmentSlot-convenience.patch | 5 +- patches/api/Add-entity-knockback-API.patch | 5 +- .../Add-methods-to-get-translation-keys.patch | 18 +- ...yPickupItemAnimation-to-LivingEntity.patch | 5 +- patches/api/Adventure.patch | 60 ++++++- ...low-plugins-to-use-SLF4J-for-logging.patch | 4 +- patches/api/Code-Generation.patch | 2 +- patches/api/Convert-project-to-Gradle.patch | 8 +- patches/api/Entity-Jump-API.patch | 9 +- .../Expose-LivingEntity-hurt-direction.patch | 5 +- .../api/Fix-Spigot-annotation-mistakes.patch | 8 +- patches/api/Fix-upstream-javadocs.patch | 13 +- patches/api/Improve-Registry.patch | 26 +-- patches/api/ItemStack-damage-API.patch | 5 +- .../api/LivingEntity-Active-Item-API.patch | 160 ++++++++++++++++++ ...ivingEntity-Hand-Raised-Item-Use-API.patch | 68 -------- patches/api/Missing-Entity-API.patch | 10 +- patches/api/More-Enchantment-API.patch | 4 +- patches/api/More-PotionEffectType-API.patch | 6 +- patches/api/More-Projectile-API.patch | 27 ++- patches/api/Paper-Plugins.patch | 2 +- patches/api/Use-ASM-for-event-executors.patch | 4 +- patches/server/Add-Entity-Body-Yaw-API.patch | 14 +- .../Add-LivingEntity-clearActiveItem.patch | 6 +- .../server/Add-drops-to-shear-events.patch | 4 +- patches/server/Add-entity-knockback-API.patch | 9 +- ...yPickupItemAnimation-to-LivingEntity.patch | 9 +- .../Add-support-for-Proxy-Protocol.patch | 2 +- patches/server/Adventure.patch | 40 ++++- patches/server/Build-system-changes.patch | 2 +- ...ktraces-in-log-messages-crash-report.patch | 2 +- ...l-more-information-in-watchdog-dumps.patch | 2 +- patches/server/Entity-Jump-API.patch | 7 +- .../Expose-LivingEntity-hurt-direction.patch | 9 +- ...ntityChangeBlockEvent-in-more-places.patch | 17 -- .../server/Fix-player-kick-on-shutdown.patch | 2 +- patches/server/Friction-API.patch | 10 +- patches/server/Implement-Mob-Goal-API.patch | 2 +- patches/server/Improve-Registry.patch | 4 +- .../server/Improve-java-version-check.patch | 4 +- patches/server/ItemStack-damage-API.patch | 27 ++- .../server/LivingEntity-Active-Item-API.patch | 53 ++++++ ...ivingEntity-Hand-Raised-Item-Use-API.patch | 42 ----- patches/server/More-Enchantment-API.patch | 5 +- .../server/More-PotionEffectType-API.patch | 2 +- patches/server/Paper-Plugins.patch | 2 +- patches/server/Paper-config-files.patch | 2 +- .../Remove-Spigot-Bug-Fix-for-MC-109346.patch | 23 --- patches/server/Rewrite-chunk-system.patch | 15 +- patches/server/Setup-Gradle-project.patch | 12 +- patches/server/Test-changes.patch | 4 +- patches/server/Timings-v2.patch | 2 +- ...when-a-captured-block-state-is-outda.patch | 18 -- ...oleAppender-for-console-improvements.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 59 files changed, 502 insertions(+), 327 deletions(-) create mode 100644 patches/api/LivingEntity-Active-Item-API.patch delete mode 100644 patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch create mode 100644 patches/server/LivingEntity-Active-Item-API.patch delete mode 100644 patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch delete mode 100644 patches/server/Remove-Spigot-Bug-Fix-for-MC-109346.patch delete mode 100644 patches/server/Update-the-flag-when-a-captured-block-state-is-outda.patch diff --git a/Paper-MojangAPI/build.gradle.kts b/Paper-MojangAPI/build.gradle.kts index a278ee93d7..e60be45e25 100644 --- a/Paper-MojangAPI/build.gradle.kts +++ b/Paper-MojangAPI/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { testImplementation("junit:junit:4.13.2") testImplementation("org.hamcrest:hamcrest-library:1.3") - testImplementation("org.ow2.asm:asm-tree:9.2") + testImplementation("org.ow2.asm:asm-tree:9.7") } configure { diff --git a/patches/api/Add-Entity-Body-Yaw-API.patch b/patches/api/Add-Entity-Body-Yaw-API.patch index 7012064b9d..b705aa316b 100644 --- a/patches/api/Add-Entity-Body-Yaw-API.patch +++ b/patches/api/Add-Entity-Body-Yaw-API.patch @@ -57,10 +57,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param amount the amount of damage to do */ void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); + // Paper end - ItemStack damage API + ++ // Paper start - body yaw API + /** + * Gets entity body yaw + * @@ -76,5 +77,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @see Location#setYaw(float) + */ + void setBodyYaw(float bodyYaw); - // Paper end ++ // Paper end - body yaw API } diff --git a/patches/api/Add-LivingEntity-clearActiveItem.patch b/patches/api/Add-LivingEntity-clearActiveItem.patch index 5fe57a9b46..8f14af4716 100644 --- a/patches/api/Add-LivingEntity-clearActiveItem.patch +++ b/patches/api/Add-LivingEntity-clearActiveItem.patch @@ -9,16 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @NotNull - org.bukkit.inventory.ItemStack getActiveItem(); + */ + org.bukkit.inventory.@NotNull ItemStack getActiveItem(); -+ // Paper start + /** + * Interrupts any ongoing active "usage" or consumption or an item. + */ + void clearActiveItem(); -+ // Paper end + /** - * Get's remaining time a player needs to keep hands raised with an item to finish using it. - * @return Remaining ticks to use the item + * Gets the remaining number of ticks for {@link #getActiveItem()}'s usage. + * diff --git a/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch index cfbbcbfcf9..26ff8c0a5c 100644 --- a/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ b/patches/api/Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch @@ -9,10 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ @Deprecated void setHurtDirection(float hurtDirection); + // Paper end - hurt direction API + ++ // Paper start - swing hand API + /** + * Makes this entity swing their hand. + * @@ -30,5 +31,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.swingOffHand(); + } + } - // Paper end ++ // Paper end - swing hand API } diff --git a/patches/api/Add-entity-knockback-API.patch b/patches/api/Add-entity-knockback-API.patch index 2e72ddaf17..93e72e93a7 100644 --- a/patches/api/Add-entity-knockback-API.patch +++ b/patches/api/Add-entity-knockback-API.patch @@ -9,10 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - this.swingOffHand(); } } + // Paper end - swing hand API + ++ // Paper start - knockback API + /** + * Knocks back this entity from a specific direction with a specified strength. Mechanics such + * as knockback resistance will be factored in. @@ -24,5 +25,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param directionZ The relative z position of the knockback source direction + */ + void knockback(double strength, double directionX, double directionZ); - // Paper end ++ // Paper end - knockback API } diff --git a/patches/api/Add-methods-to-get-translation-keys.patch b/patches/api/Add-methods-to-get-translation-keys.patch index e655560ae2..12386bc8c0 100644 --- a/patches/api/Add-methods-to-get-translation-keys.patch +++ b/patches/api/Add-methods-to-get-translation-keys.patch @@ -240,19 +240,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Types of attributes which may be present on an {@link Attributable}. */ --public enum Attribute implements Keyed { -+public enum Attribute implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations +-public enum Attribute implements Keyed, Translatable { ++public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations /** * Maximum health of an Entity. -@@ -0,0 +0,0 @@ public enum Attribute implements Keyed { - public NamespacedKey getKey() { - return key; +@@ -0,0 +0,0 @@ public enum Attribute implements Keyed, Translatable { + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); } ++ + // Paper start ++ @SuppressWarnings("deprecation") + @Override + public @NotNull String translationKey() { -+ return "attribute.name." + this.key.getKey(); ++ return Bukkit.getUnsafe().getTranslationKey(this); + } + // Paper end } @@ -315,8 +317,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * The various type of enchantments that may be added to armour or weapons */ --public abstract class Enchantment implements Keyed { -+public abstract class Enchantment implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations +-public abstract class Enchantment implements Keyed, Translatable { ++public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations /** * Provides protection against environmental damage */ diff --git a/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch index 85d650afda..6ba8e78cc6 100644 --- a/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/api/Add-playPickupItemAnimation-to-LivingEntity.patch @@ -9,10 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param jumping entity jump state */ void setJumping(boolean jumping); + // Paper end - entity jump API + ++ // Paper start - pickup animation API + /** + * Plays pickup item animation towards this entity. + *

@@ -35,5 +36,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param quantity quantity of item + */ + void playPickupItemAnimation(@NotNull Item item, int quantity); - // Paper end ++ // Paper end - pickup animation API } diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 3ed6adbe93..541f57bfc8 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -2183,7 +2183,7 @@ diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed { +@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable { * @return True if the enchantment may be applied, otherwise False */ public abstract boolean canEnchantItem(@NotNull ItemStack item); @@ -4510,7 +4510,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta { - * pages. Maximum 100 pages with 256 characters per page. + * pages. Maximum 100 pages with 1024 characters per page. * * @param pages A list of pages to set the book to use + * @deprecated in favour of {@link #pages(List)} @@ -4520,7 +4520,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta { - * pages. Maximum 50 pages with 256 characters per page. + * pages. Maximum 100 pages with 1024 characters per page. * * @param pages A list of strings, each being a page + * @deprecated in favour of {@link #pages(net.kyori.adventure.text.Component...)} @@ -4530,7 +4530,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta { - * 256 characters per page. + * 1024 characters per page. * * @param pages A list of strings, each being a page + * @deprecated in favour of {@link #addPages(net.kyori.adventure.text.Component...)} @@ -4695,6 +4695,58 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 void setLore(@Nullable List lore); /** +diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +@@ -0,0 +0,0 @@ public interface TrimMaterial extends Keyed, Translatable { + * {@link Material#AMETHYST_SHARD}. + */ + public static final TrimMaterial AMETHYST = Registry.TRIM_MATERIAL.get(NamespacedKey.minecraft("amethyst")); ++ ++ // Paper start - adventure ++ /** ++ * Get the description of this {@link TrimMaterial}. ++ * ++ * @return the description ++ */ ++ net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description(); ++ ++ /** ++ * @deprecated this method assumes that {@link #description()} will ++ * always be a translatable component which is not guaranteed. ++ */ ++ @Override ++ @Deprecated(forRemoval = true) ++ @org.jetbrains.annotations.NotNull String getTranslationKey(); ++ // Paper end - adventure + } +diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable { + * {@link Material#HOST_ARMOR_TRIM_SMITHING_TEMPLATE}. + */ + public static final TrimPattern HOST = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("host")); ++ ++ // Paper start - adventure ++ /** ++ * Get the description of this {@link TrimPattern}. ++ * ++ * @return the description ++ */ ++ net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description(); ++ ++ /** ++ * @deprecated this method assumes that {@link #description()} will ++ * always be a translatable component which is not guaranteed. ++ */ ++ @Override ++ @Deprecated(forRemoval = true) ++ @org.jetbrains.annotations.NotNull String getTranslationKey(); ++ // Paper end - adventure + } diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/map/MapCursor.java diff --git a/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch b/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch index e89980d4c1..d778abdf6c 100644 --- a/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/patches/api/Allow-plugins-to-use-SLF4J-for-logging.patch @@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + api("org.apache.logging.log4j:log4j-api:$log4jVersion") + api("org.slf4j:slf4j-api:$slf4jVersion") - implementation("org.ow2.asm:asm:9.5") - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm:9.7") + implementation("org.ow2.asm:asm-commons:9.7") @@ -0,0 +0,0 @@ tasks.withType { "https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/", "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", diff --git a/patches/api/Code-Generation.patch b/patches/api/Code-Generation.patch index 976bfb50e6..fa436e409f 100644 --- a/patches/api/Code-Generation.patch +++ b/patches/api/Code-Generation.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 java { @@ -0,0 +0,0 @@ dependencies { - testImplementation("org.ow2.asm:asm-tree:9.5") + testImplementation("org.ow2.asm:asm-tree:9.7") } +// Paper start diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index 7e43882b95..ffd585cece 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -63,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + testImplementation("org.apache.commons:commons-lang3:3.12.0") + testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") + testImplementation("org.hamcrest:hamcrest:2.2") -+ testImplementation("org.mockito:mockito-core:5.5.0") -+ testImplementation("org.ow2.asm:asm-tree:9.5") ++ testImplementation("org.mockito:mockito-core:5.11.0") ++ testImplementation("org.ow2.asm:asm-tree:9.7") +} + +configure { @@ -237,13 +237,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - org.mockito - mockito-core -- 5.5.0 +- 5.11.0 - test - - - org.ow2.asm - asm-tree -- 9.5 +- 9.7 - test - - diff --git a/patches/api/Entity-Jump-API.patch b/patches/api/Entity-Jump-API.patch index 28f3c16563..9f9850fcc3 100644 --- a/patches/api/Entity-Jump-API.patch +++ b/patches/api/Entity-Jump-API.patch @@ -65,10 +65,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - @NotNull - org.bukkit.inventory.EquipmentSlot getHandRaised(); + return this.getActiveItemHand(); + } + // Paper end - active item API + ++ // Paper start - entity jump API + /** + * Get entity jump state. + *

@@ -88,5 +89,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param jumping entity jump state + */ + void setJumping(boolean jumping); - // Paper end ++ // Paper end - entity jump API } diff --git a/patches/api/Expose-LivingEntity-hurt-direction.patch b/patches/api/Expose-LivingEntity-hurt-direction.patch index 5272e803b9..b43cb226b7 100644 --- a/patches/api/Expose-LivingEntity-hurt-direction.patch +++ b/patches/api/Expose-LivingEntity-hurt-direction.patch @@ -30,10 +30,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param quantity quantity of item */ void playPickupItemAnimation(@NotNull Item item, int quantity); + // Paper end - pickup animation API + ++ // Paper start - hurt direction API + /** + * Gets player hurt direction + * @@ -49,5 +50,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + @Deprecated + void setHurtDirection(float hurtDirection); - // Paper end ++ // Paper end - hurt direction API } diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 73ddf3eb97..f6b4067a7c 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -1442,8 +1442,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/inventory/PlayerInventory.java +++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java @@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory { - * - * @return All the ItemStacks from the armor slots. Individual items can be null. + * null and are returned in a fixed order starting from the boots and going + * up to the helmet */ - @NotNull - public ItemStack[] getArmorContents(); @@ -1865,7 +1865,7 @@ diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed { +@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed, Translatable { * Returns the unique ID of this type. * * @return Unique ID @@ -1877,7 +1877,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public abstract int getId(); /** -@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed { +@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed, Translatable { * * @param id Unique ID to fetch * @return Resulting type, or null if not found. diff --git a/patches/api/Fix-upstream-javadocs.patch b/patches/api/Fix-upstream-javadocs.patch index 08f5678202..fefb73132d 100644 --- a/patches/api/Fix-upstream-javadocs.patch +++ b/patches/api/Fix-upstream-javadocs.patch @@ -1161,12 +1161,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface EntityEquipment { - void setBoots(@Nullable ItemStack boots, boolean silent); - /** -- * Gets a copy of all worn armor -+ * Gets all worn armor -+ * + * Gets all ItemStacks from the armor slots. + * + *

+ * This returns a copy if this equipment instance is from a non-player, + * or it's an empty stack (has AIR as its type). @@ -1180,8 +1177,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * equipment.getArmorContents(); // will return an array of copies + * } + * } - * - * @return The array of worn armor. Individual items may be null. ++ * + * @return all the ItemStacks from the armor slots. Individual items can be + * null and are returned in a fixed order starting from the boots and going + * up to the helmet */ - @NotNull - ItemStack[] getArmorContents(); diff --git a/patches/api/Improve-Registry.patch b/patches/api/Improve-Registry.patch index 51a6fab479..52c1b1671b 100644 --- a/patches/api/Improve-Registry.patch +++ b/patches/api/Improve-Registry.patch @@ -80,11 +80,12 @@ diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -@@ -0,0 +0,0 @@ public interface TrimMaterial extends Keyed { - * {@link Material#AMETHYST_SHARD}. - */ - public static final TrimMaterial AMETHYST = Registry.TRIM_MATERIAL.get(NamespacedKey.minecraft("amethyst")); -+ // Paper start +@@ -0,0 +0,0 @@ public interface TrimMaterial extends Keyed, Translatable { + @Deprecated(forRemoval = true) + @org.jetbrains.annotations.NotNull String getTranslationKey(); + // Paper end - adventure ++ ++ // Paper start - Registry#getKey + /** + * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#TRIM_MATERIAL}. TrimMaterials + * can exist without a key. @@ -92,17 +93,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated(forRemoval = true, since = "1.20.4") + @Override + org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); -+ // Paper end ++ // Paper end - Registry#getKey } diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed { - * {@link Material#HOST_ARMOR_TRIM_SMITHING_TEMPLATE}. - */ - public static final TrimPattern HOST = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("host")); -+ // Paper start +@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable { + @Deprecated(forRemoval = true) + @org.jetbrains.annotations.NotNull String getTranslationKey(); + // Paper end - adventure ++ ++ // Paper start - Registry#getKey + /** + * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#TRIM_PATTERN}. TrimPatterns + * can exist without a key. @@ -110,5 +112,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated(forRemoval = true, since = "1.20.4") + @Override + org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); -+ // Paper end ++ // Paper end - Registry#getKey } diff --git a/patches/api/ItemStack-damage-API.patch b/patches/api/ItemStack-damage-API.patch index d6d843b5a2..912a4c54aa 100644 --- a/patches/api/ItemStack-damage-API.patch +++ b/patches/api/ItemStack-damage-API.patch @@ -12,10 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param directionZ The relative z position of the knockback source direction */ void knockback(double strength, double directionX, double directionZ); + // Paper end - knockback API + ++ // Paper start - ItemStack damage API + /** + * Notifies all clients tracking this entity that the item in + * the slot of this entity broke. @@ -62,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param amount the amount of damage to do + */ + void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); - // Paper end ++ // Paper end - ItemStack damage API } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/api/LivingEntity-Active-Item-API.patch b/patches/api/LivingEntity-Active-Item-API.patch new file mode 100644 index 0000000000..2557048d86 --- /dev/null +++ b/patches/api/LivingEntity-Active-Item-API.patch @@ -0,0 +1,160 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 29 Jun 2018 00:19:19 -0400 +Subject: [PATCH] LivingEntity Active Item API + +API relating to items being actively used by a LivingEntity +such as a bow or eating food. + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + * blocking). + * + * @return Whether their hand is raised ++ * @see LivingEntity#hasActiveItem() + */ ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.4") // Paper - active item API + public boolean isHandRaised(); + + /** +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * + * @return the item being used by the player, or null if they are not using + * an item ++ * @deprecated Use {@link #getActiveItem()} + */ + @Nullable ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper + public ItemStack getItemInUse(); + + /** + * Gets the number of ticks remaining for the current item's usage. + * + * @return The number of ticks remaining ++ * @deprecated use {@link #getActiveItemRemainingTime()} + */ ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper + public int getItemInUseTicks(); + + /** +@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * or throwing a trident. + * + * @param ticks The number of ticks remaining ++ * @deprecated use {@link #setActiveItemRemainingTime(int)} + */ ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper + public void setItemInUseTicks(int ticks); + + /** +@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + void setShieldBlockingDelay(int delay); + // Paper end ++ ++ // Paper start - active item API ++ /** ++ * Gets the item being actively "used" or consumed. ++ * ++ * @return the item ++ */ ++ org.bukkit.inventory.@NotNull ItemStack getActiveItem(); ++ ++ /** ++ * Gets the remaining number of ticks for {@link #getActiveItem()}'s usage. ++ * ++ * @return remaining ticks to use {@link #getActiveItem()} ++ */ ++ int getActiveItemRemainingTime(); ++ ++ /** ++ * Sets the number of ticks that remain for {@link #getActiveItem()}'s ++ * usage. ++ *

++ * Valid values are between 0 and the max item use duration for ++ * the specific item type. ++ * ++ * @param ticks time in ticks remaining ++ */ ++ void setActiveItemRemainingTime(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks); ++ ++ /** ++ * Gets if the entity is using an item (eating, drinking, etc). ++ * ++ * @return true if using an item ++ */ ++ boolean hasActiveItem(); ++ ++ /** ++ * Get how long the {@link #getActiveItem()} has been in use for. ++ * ++ * @return time used in ticks ++ */ ++ int getActiveItemUsedTime(); ++ ++ /** ++ * Get the hand using the active item. Will be either ++ * {@link org.bukkit.inventory.EquipmentSlot#HAND} or ++ * {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}. ++ * ++ * @return the hand being used ++ */ ++ org.bukkit.inventory.@NotNull EquipmentSlot getActiveItemHand(); ++ ++ /** ++ * Gets remaining time a player needs to keep hands raised with an item to finish using it. ++ * ++ * @return remaining ticks to use the item ++ * @see #getActiveItemRemainingTime() ++ */ ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.4") ++ default int getItemUseRemainingTime() { ++ return this.getActiveItemRemainingTime(); ++ } ++ ++ /** ++ * Get how long the entity's hands have been raised (Charging Bow attack, using a potion, etc) ++ * ++ * @return Get how long the players hands have been raised (Charging Bow attack, using a potion, etc) ++ * @see #getActiveItemUsedTime() ++ */ ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.4") ++ default int getHandRaisedTime() { ++ return this.getActiveItemUsedTime(); ++ } ++ ++ /** ++ * Whether this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) ++ * ++ * @return whether this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) ++ * @see #hasActiveItem() ++ */ ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.4") ++ default boolean isHandRaised() { ++ return this.hasActiveItem(); ++ } ++ ++ /** ++ * Gets the hand raised by this living entity. Will be either ++ * {@link org.bukkit.inventory.EquipmentSlot#HAND} or ++ * {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}. ++ * ++ * @return the hand raised ++ * @see #getActiveItemHand() ++ */ ++ @NotNull ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.4") ++ default org.bukkit.inventory.EquipmentSlot getHandRaised() { ++ return this.getActiveItemHand(); ++ } ++ // Paper end - active item API + } diff --git a/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch deleted file mode 100644 index b22db0d7c6..0000000000 --- a/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 29 Jun 2018 00:19:19 -0400 -Subject: [PATCH] LivingEntity Hand Raised/Item Use API - -How long an entity has raised hands to charge an attack or use an item - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - * - * @return the item being used by the player, or null if they are not using - * an item -+ * @deprecated Deprecated in favor of {@link LivingEntity#getActiveItem()} - */ -+ @Deprecated // Paper - @Nullable - public ItemStack getItemInUse(); - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param delay Delay in ticks - */ - void setShieldBlockingDelay(int delay); -+ -+ /** -+ * Get's the item being actively "used" or consumed. -+ * @return The item -+ */ -+ @NotNull -+ org.bukkit.inventory.ItemStack getActiveItem(); -+ -+ /** -+ * Get's remaining time a player needs to keep hands raised with an item to finish using it. -+ * @return Remaining ticks to use the item -+ */ -+ int getItemUseRemainingTime(); -+ -+ /** -+ * Get how long the players hands have been raised (Charging Bow attack, using a potion, etc) -+ * -+ * @return Get how long the players hands have been raised (Charging Bow attack, using a potion, etc) -+ */ -+ int getHandRaisedTime(); -+ -+ /** -+ * Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) -+ * -+ * @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) -+ */ -+ boolean isHandRaised(); -+ -+ /** -+ * Gets the hand raised by this living entity. Will be either -+ * {@link org.bukkit.inventory.EquipmentSlot#HAND} or -+ * {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}. -+ * -+ * @return the hand raised -+ */ -+ @NotNull -+ org.bukkit.inventory.EquipmentSlot getHandRaised(); - // Paper end - } diff --git a/patches/api/Missing-Entity-API.patch b/patches/api/Missing-Entity-API.patch index 4e7f7a2345..f8b3a61c7c 100644 --- a/patches/api/Missing-Entity-API.patch +++ b/patches/api/Missing-Entity-API.patch @@ -605,10 +605,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - void clearActiveItem(); + void setShieldBlockingDelay(int delay); // Paper end -+ // Paper start ++ // Paper start - missing entity API + /** + * Retrieves the sideways movement direction of the entity. + *

@@ -657,11 +657,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return Forwards movement direction, ranging from -1 (backward) to 1 (forward). + */ + float getForwardsMovement(); -+ // Paper end ++ // Paper end - missing entity API + + // Paper start - active item API /** - * Get's remaining time a player needs to keep hands raised with an item to finish using it. - * @return Remaining ticks to use the item + * Gets the item being actively "used" or consumed. diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Llama.java diff --git a/patches/api/More-Enchantment-API.patch b/patches/api/More-Enchantment-API.patch index c0eb8ccbee..c83224b2e4 100644 --- a/patches/api/More-Enchantment-API.patch +++ b/patches/api/More-Enchantment-API.patch @@ -39,7 +39,7 @@ diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, net.kyori.adventure.translat +@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve * Cursed enchantments are found the same way treasure enchantments are * * @return true if the enchantment is cursed @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public abstract boolean isCursed(); /** -@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, net.kyori.adventure.translat +@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve * @return the name of the enchantment with {@code level} applied */ public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); diff --git a/patches/api/More-PotionEffectType-API.patch b/patches/api/More-PotionEffectType-API.patch index 25f5852329..c9c48cadb3 100644 --- a/patches/api/More-PotionEffectType-API.patch +++ b/patches/api/More-PotionEffectType-API.patch @@ -48,12 +48,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Represents a type of potion and its effect on an entity. */ --public abstract class PotionEffectType implements Keyed { -+public abstract class PotionEffectType implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable +-public abstract class PotionEffectType implements Keyed, Translatable { ++public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable private static final BiMap ID_MAP = HashBiMap.create(); /** -@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed { +@@ -0,0 +0,0 @@ public abstract class PotionEffectType implements Keyed, Translatable { return from; } diff --git a/patches/api/More-Projectile-API.patch b/patches/api/More-Projectile-API.patch index 8dedca669d..fc63148d06 100644 --- a/patches/api/More-Projectile-API.patch +++ b/patches/api/More-Projectile-API.patch @@ -10,10 +10,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/AbstractArrow.java +++ b/src/main/java/org/bukkit/entity/AbstractArrow.java @@ -0,0 +0,0 @@ public interface AbstractArrow extends Projectile { - ALLOWED, + * Gets the ItemStack which will be picked up from this arrow. + * + * @return The picked up ItemStack ++ * @deprecated use {@link #getItemStack()} + */ + @NotNull + @ApiStatus.Experimental ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper + public ItemStack getItem(); + + /** + * Sets the ItemStack which will be picked up from this arrow. + * + * @param item ItemStack set to be picked up ++ * @deprecated until 1.20.5 when the behavior is more defined + */ + @ApiStatus.Experimental ++ @Deprecated // Paper - remove in 1.20.5 + public void setItem(@NotNull ItemStack item); + + /** +@@ -0,0 +0,0 @@ public interface AbstractArrow extends Projectile { CREATIVE_ONLY; } + // Paper end + ++ // Paper start - more projectile API + /** + * Gets the ItemStack for this arrow. + * @@ -51,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param sound sound that is played + */ + void setHitSound(@NotNull org.bukkit.Sound sound); - // Paper end ++ // Paper end - more projectile API } diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/api/Paper-Plugins.patch b/patches/api/Paper-Plugins.patch index 0ec28302bb..78e78542a9 100644 --- a/patches/api/Paper-Plugins.patch +++ b/patches/api/Paper-Plugins.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -0,0 +0,0 @@ dependencies { - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm-commons:9.7") // Paper end - compileOnly("org.apache.maven:maven-resolver-provider:3.9.6") diff --git a/patches/api/Use-ASM-for-event-executors.patch b/patches/api/Use-ASM-for-event-executors.patch index 415bd0983b..81cf3961dd 100644 --- a/patches/api/Use-ASM-for-event-executors.patch +++ b/patches/api/Use-ASM-for-event-executors.patch @@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 apiAndDocs("net.kyori:adventure-text-serializer-plain") apiAndDocs("net.kyori:adventure-text-logger-slf4j") + -+ implementation("org.ow2.asm:asm:9.5") -+ implementation("org.ow2.asm:asm-commons:9.5") ++ implementation("org.ow2.asm:asm:9.7") ++ implementation("org.ow2.asm:asm-commons:9.7") // Paper end compileOnly("org.apache.maven:maven-resolver-provider:3.9.6") diff --git a/patches/server/Add-Entity-Body-Yaw-API.patch b/patches/server/Add-Entity-Body-Yaw-API.patch index 2493c6b621..370910ce84 100644 --- a/patches/server/Add-Entity-Body-Yaw-API.patch +++ b/patches/server/Add-Entity-Body-Yaw-API.patch @@ -45,19 +45,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot); + this.getHandle().frictionState = state; } - + // Paper end - friction API ++ ++ // Paper start - body yaw API + @Override + public float getBodyYaw() { + return this.getHandle().getVisualRotationYInDegrees(); + } + + @Override -+ public void setBodyYaw(float bodyYaw) { ++ public void setBodyYaw(final float bodyYaw) { + this.getHandle().setYBodyRot(bodyYaw); + } -+ - private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) { - nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> { - if (slot != null) { ++ // Paper end - body yaw API + } diff --git a/patches/server/Add-LivingEntity-clearActiveItem.patch b/patches/server/Add-LivingEntity-clearActiveItem.patch index 2a0bd1b478..3d911fbb95 100644 --- a/patches/server/Add-LivingEntity-clearActiveItem.patch +++ b/patches/server/Add-LivingEntity-clearActiveItem.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - return getHandle().getUseItem().asBukkitMirror(); + return this.getHandle().getUseItem().asBukkitMirror(); } + // Paper start @@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + @Override - public int getItemUseRemainingTime() { - return getHandle().getUseItemRemainingTicks(); + public int getActiveItemRemainingTime() { + return this.getHandle().getUseItemRemainingTicks(); diff --git a/patches/server/Add-drops-to-shear-events.patch b/patches/server/Add-drops-to-shear-events.patch index 6fc6a6c45d..ad1d73998f 100644 --- a/patches/server/Add-drops-to-shear-events.patch +++ b/patches/server/Add-drops-to-shear-events.patch @@ -237,12 +237,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -0,0 +0,0 @@ public class CraftEventFactory { - return event; + player.level().getCraftServer().getPluginManager().callEvent(event); } - public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is) { - BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is); -+ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, Block dispenser, CraftItemStack is, List drops) { // Paper - custom shear drops ++ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is, List drops) { // Paper - custom shear drops + BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is, Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops Bukkit.getPluginManager().callEvent(bse); return bse; diff --git a/patches/server/Add-entity-knockback-API.patch b/patches/server/Add-entity-knockback-API.patch index 6a1d31442e..1d65cf2023 100644 --- a/patches/server/Add-entity-knockback-API.patch +++ b/patches/server/Add-entity-knockback-API.patch @@ -9,14 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - } throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category"); } + // Paper end - more enchant API + ++ // Paper start - knockback API + @Override -+ public void knockback(double strength, double directionX, double directionZ) { ++ public void knockback(final double strength, final double directionX, final double directionZ) { + Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0"); -+ getHandle().knockback(strength, directionX, directionZ); ++ this.getHandle().knockback(strength, directionX, directionZ); + }; - // Paper end ++ // Paper end - knockback API } diff --git a/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch index e9c74d32a0..66bfb11bbb 100644 --- a/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch @@ -9,13 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - ((Mob) getHandle()).getJumpControl().jump(); } } + // Paper end - entity jump API + ++ // Paper start - pickup animation API + @Override -+ public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) { -+ getHandle().take(((CraftItem) item).getHandle(), quantity); ++ public void playPickupItemAnimation(final org.bukkit.entity.Item item, final int quantity) { ++ this.getHandle().take(((CraftItem) item).getHandle(), quantity); + } - // Paper end ++ // Paper end - pickup animation API } diff --git a/patches/server/Add-support-for-Proxy-Protocol.patch b/patches/server/Add-support-for-Proxy-Protocol.patch index 4bc15d9cb1..cc5ee7e4ab 100644 --- a/patches/server/Add-support-for-Proxy-Protocol.patch +++ b/patches/server/Add-support-for-Proxy-Protocol.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm-commons:9.7") diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 3b509cc7d4..c95bd261df 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -4054,7 +4054,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override - public boolean equals(Object other) { + public String getTranslationKey() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -5167,6 +5167,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean hasRepairCost() { return this.repairCost > 0; +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java +@@ -0,0 +0,0 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable { // Paper - Fix preemptive player kick on a server shutdown + packetProcessing.push(listener); // Paper - detailed watchdog information + try { // Paper - detailed watchdog information - if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players if (listener.shouldHandleMessage(packet)) { co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings @@ -0,0 +0,0 @@ public class PacketUtils { diff --git a/patches/server/Entity-Jump-API.patch b/patches/server/Entity-Jump-API.patch index 7911cd924b..b2a0865bd0 100644 --- a/patches/server/Entity-Jump-API.patch +++ b/patches/server/Entity-Jump-API.patch @@ -54,10 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - public org.bukkit.inventory.EquipmentSlot getHandRaised() { - return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND; + return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand()); } + // Paper end - active item API + ++ // Paper start - entity jump API + @Override + public boolean isJumping() { + return getHandle().jumping; @@ -71,5 +72,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ((Mob) getHandle()).getJumpControl().jump(); + } + } - // Paper end ++ // Paper end - entity jump API } diff --git a/patches/server/Expose-LivingEntity-hurt-direction.patch b/patches/server/Expose-LivingEntity-hurt-direction.patch index ebced81435..6167883135 100644 --- a/patches/server/Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/Expose-LivingEntity-hurt-direction.patch @@ -40,18 +40,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) { - getHandle().take(((CraftItem) item).getHandle(), quantity); + this.getHandle().take(((CraftItem) item).getHandle(), quantity); } + // Paper end - pickup animation API + ++ // Paper start - hurt direction API + @Override + public float getHurtDirection() { + return this.getHandle().getHurtDir(); + } + + @Override -+ public void setHurtDirection(float hurtDirection) { ++ public void setHurtDirection(final float hurtDirection) { + throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); + } - // Paper end ++ // Paper end - hurt direction API } diff --git a/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch index 11e9750d4f..002a8da2ba 100644 --- a/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch @@ -79,23 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error }); world.levelEvent(3002, blockposition1, -1); -diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java b/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java -+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java -@@ -0,0 +0,0 @@ public class TryLaySpawnOnWaterNearLand { - BlockPos blockPos3 = blockPos2.above(); - if (world.getBlockState(blockPos3).isAir()) { - BlockState blockState = frogSpawn.defaultBlockState(); -+ // Paper start -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPos3, blockState)) { -+ isPregnant.erase(); // forgot pregnant memory -+ return true; -+ } -+ // Paper end - world.setBlock(blockPos3, blockState, 3); - world.gameEvent(GameEvent.BLOCK_PLACE, blockPos3, GameEvent.Context.of(entity, blockState)); - world.playSound((Player)null, entity, SoundEvents.FROG_LAY_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F); diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/AxeItem.java diff --git a/patches/server/Fix-player-kick-on-shutdown.patch b/patches/server/Fix-player-kick-on-shutdown.patch index a07bc946ad..b909eee77b 100644 --- a/patches/server/Fix-player-kick-on-shutdown.patch +++ b/patches/server/Fix-player-kick-on-shutdown.patch @@ -18,6 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!engine.isSameThread()) { - engine.executeIfPossible(() -> { + engine.execute(() -> { // Paper - Fix preemptive player kick on a server shutdown - if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players if (listener.shouldHandleMessage(packet)) { co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings diff --git a/patches/server/Friction-API.patch b/patches/server/Friction-API.patch index 863ce9addc..bbc02f37fc 100644 --- a/patches/server/Friction-API.patch +++ b/patches/server/Friction-API.patch @@ -139,7 +139,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { }); } - + // Paper end - ItemStack damage API ++ ++ // Paper start - friction API + @org.jetbrains.annotations.NotNull + @Override + public net.kyori.adventure.util.TriState getFrictionState() { @@ -151,7 +153,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + java.util.Objects.requireNonNull(state, "state may not be null"); + this.getHandle().frictionState = state; + } -+ - @Override - public void knockback(double strength, double directionX, double directionZ) { - Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0"); ++ // Paper end - friction API + } diff --git a/patches/server/Implement-Mob-Goal-API.patch b/patches/server/Implement-Mob-Goal-API.patch index c088b28c13..932883924a 100644 --- a/patches/server/Implement-Mob-Goal-API.patch +++ b/patches/server/Implement-Mob-Goal-API.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.5.0") + testImplementation("org.mockito:mockito-core:5.11.0") diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/server/Improve-Registry.patch b/patches/server/Improve-Registry.patch index f248288e66..b7d03a9dc2 100644 --- a/patches/server/Improve-Registry.patch +++ b/patches/server/Improve-Registry.patch @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.TRIM_MATERIAL.getKey(this), () -> this + " doesn't have a key"); // Paper return this.key; } - } + diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.TRIM_PATTERN.getKey(this), () -> this + " doesn't have a key"); // Paper return this.key; } - } + diff --git a/src/test/java/org/bukkit/registry/PerRegistryTest.java b/src/test/java/org/bukkit/registry/PerRegistryTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/org/bukkit/registry/PerRegistryTest.java diff --git a/patches/server/Improve-java-version-check.patch b/patches/server/Improve-java-version-check.patch index 46968649c4..c7264ad551 100644 --- a/patches/server/Improve-java-version-check.patch +++ b/patches/server/Improve-java-version-check.patch @@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'."); - return; - } -- if (javaVersion > 65.0) { -- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 21 is supported."); +- if (javaVersion > 66.0) { +- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 22 is supported."); + boolean isOldVersion = javaVersion < 61.0; + if (!skip && isOldVersion) { + System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install"); diff --git a/patches/server/ItemStack-damage-API.patch b/patches/server/ItemStack-damage-API.patch index f69e4216a5..6d985d9357 100644 --- a/patches/server/ItemStack-damage-API.patch +++ b/patches/server/ItemStack-damage-API.patch @@ -15,16 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category"); - } - -+ @Override -+ public void broadcastSlotBreak(org.bukkit.inventory.EquipmentSlot slot) { + this.getHandle().knockback(strength, directionX, directionZ); + }; + // Paper end - knockback API ++ ++ // Paper start - ItemStack damage API ++ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot) { + this.getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); + } + + @Override -+ public void broadcastSlotBreak(org.bukkit.inventory.EquipmentSlot slot, Collection players) { ++ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot, final Collection players) { + if (players.isEmpty()) { + return; + } @@ -36,9 +37,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public ItemStack damageItemStack(ItemStack stack, int amount) { ++ public ItemStack damageItemStack(ItemStack stack, final int amount) { + final net.minecraft.world.item.ItemStack nmsStack; -+ if (stack instanceof CraftItemStack craftItemStack) { ++ if (stack instanceof final CraftItemStack craftItemStack) { + if (craftItemStack.handle == null || craftItemStack.handle.isEmpty()) { + return stack; + } @@ -52,19 +53,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public void damageItemStack(org.bukkit.inventory.EquipmentSlot slot, int amount) { ++ public void damageItemStack(final org.bukkit.inventory.EquipmentSlot slot, final int amount) { + final net.minecraft.world.entity.EquipmentSlot nmsSlot = org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot); + this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot); + } + -+ private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) { ++ private void damageItemStack0(final net.minecraft.world.item.ItemStack nmsStack, final int amount, final net.minecraft.world.entity.EquipmentSlot slot) { + nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> { + if (slot != null) { + livingEntity.broadcastBreakEvent(slot); + } + }); + } -+ - @Override - public void knockback(double strength, double directionX, double directionZ) { - Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0"); ++ // Paper end - ItemStack damage API + } diff --git a/patches/server/LivingEntity-Active-Item-API.patch b/patches/server/LivingEntity-Active-Item-API.patch new file mode 100644 index 0000000000..56c80ebd5d --- /dev/null +++ b/patches/server/LivingEntity-Active-Item-API.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 29 Jun 2018 00:21:28 -0400 +Subject: [PATCH] LivingEntity Active Item API + +API relating to items being actively used by a LivingEntity +such as a bow or eating food. + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + getHandle().setShieldBlockingDelay(delay); + } + // Paper end ++ ++ // Paper start - active item API ++ @Override ++ public ItemStack getActiveItem() { ++ return this.getHandle().getUseItem().asBukkitMirror(); ++ } ++ ++ @Override ++ public int getActiveItemRemainingTime() { ++ return this.getHandle().getUseItemRemainingTicks(); ++ } ++ ++ @Override ++ public void setActiveItemRemainingTime(final int ticks) { ++ Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0"); ++ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(), "ticks must be <= item use duration"); ++ this.getHandle().useItemRemaining = ticks; ++ } ++ ++ @Override ++ public int getActiveItemUsedTime() { ++ return this.getHandle().getTicksUsingItem(); ++ } ++ ++ @Override ++ public boolean hasActiveItem() { ++ return this.getHandle().isUsingItem(); ++ } ++ ++ @Override ++ public org.bukkit.inventory.EquipmentSlot getActiveItemHand() { ++ return org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(this.getHandle().getUsedItemHand()); ++ } ++ // Paper end - active item API + } diff --git a/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch deleted file mode 100644 index e948b54b5d..0000000000 --- a/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 29 Jun 2018 00:21:28 -0400 -Subject: [PATCH] LivingEntity Hand Raised/Item Use API - -How long an entity has raised hands to charge an attack or use an item - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - public void setShieldBlockingDelay(int delay) { - getHandle().setShieldBlockingDelay(delay); - } -+ -+ @Override -+ public ItemStack getActiveItem() { -+ return getHandle().getUseItem().asBukkitMirror(); -+ } -+ -+ @Override -+ public int getItemUseRemainingTime() { -+ return getHandle().getUseItemRemainingTicks(); -+ } -+ -+ @Override -+ public int getHandRaisedTime() { -+ return getHandle().getTicksUsingItem(); -+ } -+ -+ @Override -+ public boolean isHandRaised() { -+ return getHandle().isUsingItem(); -+ } -+ -+ @Override -+ public org.bukkit.inventory.EquipmentSlot getHandRaised() { -+ return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND; -+ } - // Paper end - } diff --git a/patches/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch index d595e6aa79..d8fe697e12 100644 --- a/patches/server/More-Enchantment-API.patch +++ b/patches/server/More-Enchantment-API.patch @@ -82,10 +82,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - public void setHurtDirection(float hurtDirection) { throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); } + // Paper end - hurt direction API + ++ // Paper start - more enchant API + public static MobType fromBukkitEntityCategory(EntityCategory entityCategory) { + switch (entityCategory) { + case NONE: @@ -101,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category"); + } - // Paper end ++ // Paper end - more enchant API } diff --git a/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java b/src/test/java/io/papermc/paper/enchantments/EnchantmentRarityTest.java new file mode 100644 diff --git a/patches/server/More-PotionEffectType-API.patch b/patches/server/More-PotionEffectType-API.patch index 684a675298..301db76a96 100644 --- a/patches/server/More-PotionEffectType-API.patch +++ b/patches/server/More-PotionEffectType-API.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java @@ -0,0 +0,0 @@ public class CraftPotionEffectType extends PotionEffectType implements Handleabl - return Color.fromRGB(this.handle.getColor()); + return this.handle.getDescriptionId(); } + // Paper start diff --git a/patches/server/Paper-Plugins.patch b/patches/server/Paper-Plugins.patch index ee335fbcc8..be083a9f31 100644 --- a/patches/server/Paper-Plugins.patch +++ b/patches/server/Paper-Plugins.patch @@ -7268,7 +7268,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override - public FeatureFlag getFeatureFlag(NamespacedKey namespacedKey) { + public String getTranslationKey(final Attribute attribute) { diff --git a/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier b/src/main/resources/META-INF/services/io.papermc.paper.plugin.entrypoint.classloader.ClassloaderBytecodeModifier new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index a3653ddf30..aa7088d265 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ dependencies { implementation("jline:jline:2.12.1") implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm-commons:9.7") + implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files implementation("commons-lang:commons-lang:2.6") runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1") diff --git a/patches/server/Remove-Spigot-Bug-Fix-for-MC-109346.patch b/patches/server/Remove-Spigot-Bug-Fix-for-MC-109346.patch deleted file mode 100644 index 52ffcbdf29..0000000000 --- a/patches/server/Remove-Spigot-Bug-Fix-for-MC-109346.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sat, 23 Sep 2023 01:51:22 -0400 -Subject: [PATCH] Remove Spigot Bug Fix for MC-109346 - - -diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerEntity.java -+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -0,0 +0,0 @@ public class ServerEntity { - ((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending - } - -- // CraftBukkit start - MC-109346: Fix for nonsensical head yaw -- if (this.entity instanceof ServerPlayer) { -- sender.accept(new ClientboundRotateHeadPacket(this.entity, (byte) Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F))); -- } -- // CraftBukkit end -- - if (!this.entity.getPassengers().isEmpty()) { - sender.accept(new ClientboundSetPassengersPacket(this.entity)); - } diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 98a24e6af3..48643174c6 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -15668,14 +15668,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 continue; } @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop - org.ow2.asm - asm-commons -- 9.5 +- 9.7 - compile - - @@ -466,13 +466,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - org.mockito - mockito-core -- 5.5.0 +- 5.11.0 - test - - - org.ow2.asm - asm-tree -- 9.5 +- 9.7 - test - - diff --git a/patches/server/Test-changes.patch b/patches/server/Test-changes.patch index 1ae3d1bfb2..d52902423a 100644 --- a/patches/server/Test-changes.patch +++ b/patches/server/Test-changes.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/build.gradle.kts @@ -0,0 +0,0 @@ dependencies { testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.5.0") - testImplementation("org.ow2.asm:asm-tree:9.5") + testImplementation("org.mockito:mockito-core:5.11.0") + testImplementation("org.ow2.asm:asm-tree:9.7") + testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest } diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 8fb5c1615b..56b8396937 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -705,7 +705,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java @@ -0,0 +0,0 @@ public class PacketUtils { engine.executeIfPossible(() -> { - if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players if (listener.shouldHandleMessage(packet)) { - try { + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings diff --git a/patches/server/Update-the-flag-when-a-captured-block-state-is-outda.patch b/patches/server/Update-the-flag-when-a-captured-block-state-is-outda.patch deleted file mode 100644 index e1b388ce85..0000000000 --- a/patches/server/Update-the-flag-when-a-captured-block-state-is-outda.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Sat, 18 Feb 2023 16:23:18 +0100 -Subject: [PATCH] Update the flag when a captured block state is outdated - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); - this.capturedBlockStates.put(pos.immutable(), blockstate); - } -+ blockstate.setFlag(flags); // Paper - update the flag also - blockstate.setData(state); - return true; - } diff --git a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch index 570bf14e6f..1ab0f48204 100644 --- a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + alsoShade(log4jPlugins.output) + // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion - implementation("org.ow2.asm:asm-commons:9.5") + implementation("org.ow2.asm:asm-commons:9.7") implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files @@ -0,0 +0,0 @@ relocation { } diff --git a/work/Bukkit b/work/Bukkit index 7ca2b46c1a..f02baa3869 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 7ca2b46c1a7d7479e45a79aa2db86de5c7fd20d8 +Subproject commit f02baa38696abb62cc2588af8aaed4c9e0e1b30f diff --git a/work/CraftBukkit b/work/CraftBukkit index 176c0ad39f..dfaa89bbe3 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 176c0ad39fffd8a6003e686b910fc02b669f1434 +Subproject commit dfaa89bbe33da3db95b8cc61f9897845076ba757