2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-06-29 04:55:29 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
2021-05-30 01:51:13 +00:00
|
|
|
index 879dec59f202ee95043bd7317a672cd59ab3bbbe..4f62a49e7b0538f0ce9cecd2c1b645f40ce17b3d 100644
|
2018-06-29 04:55:29 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
2020-06-25 02:33:35 +00:00
|
|
|
@@ -12,6 +12,7 @@ import org.bukkit.attribute.Attributable;
|
2018-06-29 04:55:29 +00:00
|
|
|
import org.bukkit.block.Block;
|
2019-05-22 04:14:56 +00:00
|
|
|
import org.bukkit.entity.memory.MemoryKey;
|
2018-06-29 04:55:29 +00:00
|
|
|
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;
|
2021-05-30 01:51:13 +00:00
|
|
|
@@ -642,5 +643,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
2018-06-29 04:55:29 +00:00
|
|
|
* @param delay Delay in ticks
|
|
|
|
*/
|
|
|
|
void setShieldBlockingDelay(int delay);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get's the item being actively "used" or consumed.
|
|
|
|
+ * @return The item. Will be null if no active item.
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @Nullable
|
2018-06-29 04:55:29 +00:00
|
|
|
+ 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)
|
2018-08-16 11:20:58 +00:00
|
|
|
+ *
|
|
|
|
+ * @return Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)
|
2018-06-29 04:55:29 +00:00
|
|
|
+ */
|
|
|
|
+ int getHandRaisedTime();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
|
2018-08-16 11:20:58 +00:00
|
|
|
+ *
|
|
|
|
+ * @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
|
2018-06-29 04:55:29 +00:00
|
|
|
+ */
|
|
|
|
+ boolean isHandRaised();
|
2021-05-30 01:51:13 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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();
|
2018-06-29 04:55:29 +00:00
|
|
|
// Paper end
|
|
|
|
}
|