2018-07-20 21:57:43 +02:00
|
|
|
From 42f348c4866235a751a95a6c69abeaaf826dad17 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
|
2018-07-20 21:57:43 +02:00
|
|
|
index f67b4ca353..cda8151487 100644
|
2018-06-29 06:55:29 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2018-07-20 21:57:43 +02:00
|
|
|
@@ -2646,14 +2646,17 @@ public abstract class EntityLiving extends Entity {
|
2018-06-29 06:55:29 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-19 01:16:19 +02:00
|
|
|
+ public ItemStack getActiveItem() { return cV(); } // Paper - OBFHELPER
|
|
|
|
public ItemStack cV() {
|
2018-06-29 06:55:29 +02:00
|
|
|
return this.activeItem;
|
|
|
|
}
|
|
|
|
|
2018-07-19 01:16:19 +02:00
|
|
|
+ public int getItemUseRemainingTime() { return cW(); } // Paper - OBFHELPER
|
|
|
|
public int cW() {
|
|
|
|
return this.bu;
|
2018-06-29 06:55:29 +02:00
|
|
|
}
|
|
|
|
|
2018-07-19 01:16:19 +02:00
|
|
|
+ public int getHandRaisedTime() { return cX(); } // Paper - OBFHELPER
|
|
|
|
public int cX() {
|
|
|
|
return this.isHandRaised() ? this.activeItem.k() - this.cW() : 0;
|
2018-06-29 06:55:29 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2018-07-20 21:57:43 +02:00
|
|
|
index 35ba95e0f5..0975181e06 100644
|
2018-06-29 06:55:29 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2018-07-20 21:57:43 +02:00
|
|
|
@@ -540,5 +540,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2018-06-29 06:55:29 +02:00
|
|
|
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
|
|
|
|
|