2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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
|
|
|
|
|
2022-06-24 10:04:02 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
2023-02-07 16:55:53 +01:00
|
|
|
index 9715a9d36187e2eecfeab1a05087d27c28b8690e..12068d14af5731494a839b87b67ed3cc26bf8f36 100644
|
2022-06-24 10:04:02 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
2023-02-07 16:55:53 +01:00
|
|
|
@@ -328,7 +328,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
|
2022-06-24 10:04:02 +02:00
|
|
|
*
|
|
|
|
* @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();
|
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
2023-02-07 16:43:20 +01:00
|
|
|
index 81d89daf9691b5338b53bb7b0749ad802f5d026f..8241a89ac92845a2a8c2398dbeb76529abebd37c 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
2023-02-07 16:43:20 +01:00
|
|
|
@@ -745,5 +745,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
2021-06-11 14:02:28 +02:00
|
|
|
* @param delay Delay in ticks
|
|
|
|
*/
|
|
|
|
void setShieldBlockingDelay(int delay);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get's the item being actively "used" or consumed.
|
2022-06-24 10:04:02 +02:00
|
|
|
+ * @return The item
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
2022-06-24 10:04:02 +02:00
|
|
|
+ @NotNull
|
|
|
|
+ org.bukkit.inventory.ItemStack getActiveItem();
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
|
|
|
}
|