From bd0ca3a1fc35cd9cc9635bba9a2a6f568756bce8 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Fri, 24 Jun 2022 04:04:02 -0400 Subject: [PATCH] Cleanup LivingEntity Hand Raised/Item Use API (#7995) --- .../Add-LivingEntity-clearActiveItem.patch | 4 +-- ...ivingEntity-Hand-Raised-Item-Use-API.patch | 28 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/patches/api/Add-LivingEntity-clearActiveItem.patch b/patches/api/Add-LivingEntity-clearActiveItem.patch index 9c52dbc181..5fe57a9b46 100644 --- a/patches/api/Add-LivingEntity-clearActiveItem.patch +++ b/patches/api/Add-LivingEntity-clearActiveItem.patch @@ -9,8 +9,8 @@ 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 - @Nullable - ItemStack getActiveItem(); + @NotNull + org.bukkit.inventory.ItemStack getActiveItem(); + // Paper start + /** diff --git a/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch index 7de09d651f..b22db0d7c6 100644 --- a/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch @@ -5,18 +5,24 @@ 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 @@ import org.bukkit.attribute.Attributable; - import org.bukkit.block.Block; - import org.bukkit.entity.memory.MemoryKey; - import org.bukkit.inventory.EntityEquipment; -+import org.bukkit.inventory.ItemStack; - import org.bukkit.potion.PotionEffect; - import org.bukkit.potion.PotionEffectType; - import org.bukkit.projectiles.ProjectileSource; @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param delay Delay in ticks */ @@ -24,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + /** + * Get's the item being actively "used" or consumed. -+ * @return The item. Will be null if no active item. ++ * @return The item + */ -+ @Nullable -+ ItemStack getActiveItem(); ++ @NotNull ++ org.bukkit.inventory.ItemStack getActiveItem(); + + /** + * Get's remaining time a player needs to keep hands raised with an item to finish using it.