aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch')
-rw-r--r--patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch
new file mode 100644
index 0000000000..3ceb2c48e7
--- /dev/null
+++ b/patches/server/0209-LivingEntity-Hand-Raised-Item-Use-API.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+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 3805b32d3a4655577b59a0bc4bb6a508faf1e3e1..5001873aba00da0a1daf0e473593a332f0856cdd 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+@@ -824,5 +824,30 @@ 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
+ }