Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item Also aliased isHandsRaised for isChargingAttack in RangedEntity
- Loading branch information
Showing
10 changed files
with
195 additions
and
44 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
Spigot-API-Patches/0119-LivingEntity-Hand-Raised-Item-Use-API.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From d76f522b7f164a56a7f9651170e439739ef6e015 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 | ||
|
||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java | ||
index 5921c952..5ccb8ef3 100644 | ||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java | ||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java | ||
@@ -10,6 +10,7 @@ import org.bukkit.Material; | ||
import org.bukkit.attribute.Attributable; | ||
import org.bukkit.block.Block; | ||
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; | ||
@@ -399,5 +400,27 @@ public interface LivingEntity extends Attributable, Entity, Damageable, Projecti | ||
* @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. | ||
+ */ | ||
+ 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) | ||
+ */ | ||
+ int getHandRaisedTime(); | ||
+ | ||
+ /** | ||
+ * Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) | ||
+ */ | ||
+ boolean isHandRaised(); | ||
// Paper end | ||
} | ||
-- | ||
2.18.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.