2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-06-29 04:55:29 +00: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
|
2020-11-03 02:22:15 +00:00
|
|
|
index a962f695f3f3508f8ce32f72a56990eb0e601589..51d1d9abcb66bef329fa2396e9e338b9d962733b 100644
|
2018-06-29 04:55:29 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-09-02 09:12:25 +00:00
|
|
|
@@ -119,7 +119,7 @@ public abstract class EntityLiving extends Entity {
|
2020-08-25 02:22:08 +00:00
|
|
|
private float bu;
|
2019-04-30 01:20:24 +00:00
|
|
|
private int jumpTicks;
|
2020-08-25 02:22:08 +00:00
|
|
|
private float bw;
|
2018-07-22 05:27:46 +00:00
|
|
|
- protected ItemStack activeItem;
|
|
|
|
+ public ItemStack activeItem; // Paper - public
|
2020-08-25 02:22:08 +00:00
|
|
|
protected int bd;
|
|
|
|
protected int be;
|
|
|
|
private BlockPosition bx;
|
2020-09-10 23:47:58 +00:00
|
|
|
@@ -3182,10 +3182,12 @@ public abstract class EntityLiving extends Entity {
|
2018-06-29 04:55:29 +00:00
|
|
|
return this.activeItem;
|
|
|
|
}
|
|
|
|
|
2020-11-03 02:22:15 +00:00
|
|
|
+ public int getItemUseRemainingTime() { return this.dZ(); } // Paper - OBFHELPER
|
|
|
|
public int dZ() {
|
2020-08-25 02:22:08 +00:00
|
|
|
return this.bd;
|
2018-06-29 04:55:29 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 02:22:15 +00:00
|
|
|
+ public int getHandRaisedTime() { return this.ea(); } // Paper - OBFHELPER
|
|
|
|
public int ea() {
|
|
|
|
return this.isHandRaised() ? this.activeItem.k() - this.dZ() : 0;
|
2018-06-29 04:55:29 +00:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
index 2e146ec4ba0c6db67c558a48ce5ec60bc2ca337f..a91070c3674dc47e0019e642f0f76a3cf76b7387 100644
|
2018-06-29 04:55:29 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
@@ -720,5 +720,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2018-06-29 04:55:29 +00:00
|
|
|
public void setShieldBlockingDelay(int delay) {
|
|
|
|
getHandle().setShieldBlockingDelay(delay);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ItemStack getActiveItem() {
|
2018-07-22 05:27:46 +00:00
|
|
|
+ return getHandle().activeItem.asBukkitMirror();
|
2018-06-29 04:55:29 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getItemUseRemainingTime() {
|
|
|
|
+ return getHandle().getItemUseRemainingTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getHandRaisedTime() {
|
|
|
|
+ return getHandle().getHandRaisedTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isHandRaised() {
|
|
|
|
+ return getHandle().isHandRaised();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|