2021-06-12 21:30:37 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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
|
2023-12-25 23:51:56 +01:00
|
|
|
index 4ae1f2c25f3012cee5abdb579e6b452a78ba8a1c..a4af5db4d2d45429a46830e4af0ba45c8c5008be 100644
|
2021-06-12 21:30:37 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2023-12-25 23:51:56 +01:00
|
|
|
@@ -823,5 +823,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2021-06-12 21:30:37 +02:00
|
|
|
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
|
|
|
|
}
|