2018-07-04 09:55:24 +02:00
|
|
|
From 14736699b8f04a3ba9fe7e1ded6ab047a0e9cb4d Mon Sep 17 00:00:00 2001
|
2018-06-29 06:55:29 +02:00
|
|
|
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/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
index 156bf8ee0..14637be49 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
@@ -2466,14 +2466,17 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public ItemStack getActiveItem() { return cJ(); } // Paper - OBFHELPER
|
|
|
|
public ItemStack cJ() {
|
|
|
|
return this.activeItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int getItemUseRemainingTime() { return cK(); } // Paper - OBFHELPER
|
|
|
|
public int cK() {
|
|
|
|
return this.bp;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int getHandRaisedTime() { return cL(); } // Paper - OBFHELPER
|
|
|
|
public int cL() {
|
|
|
|
return this.isHandRaised() ? this.activeItem.m() - this.cK() : 0;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
index 14fb474f7..9c750efc7 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
@@ -525,5 +525,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
|
|
public void setShieldBlockingDelay(int delay) {
|
|
|
|
getHandle().setShieldBlockingDelay(delay);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack getActiveItem() {
|
|
|
|
+ return getHandle().getActiveItem().asBukkitMirror();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getItemUseRemainingTime() {
|
|
|
|
+ return getHandle().getItemUseRemainingTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getHandRaisedTime() {
|
|
|
|
+ return getHandle().getHandRaisedTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isHandRaised() {
|
|
|
|
+ return getHandle().isHandRaised();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
|
|
|
2.18.0
|
|
|
|
|