2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2020-09-02 11:12:25 +02:00
|
|
|
index 9ef4929554a98f4ea0f2265670817404ebb6029f..4c48ff8fad90686da65097e4be6bcedca9761c3d 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
|
2020-09-02 11:12:25 +02:00
|
|
|
@@ -119,7 +119,7 @@ public abstract class EntityLiving extends Entity {
|
2020-08-25 04:22:08 +02:00
|
|
|
private float bu;
|
2019-04-30 03:20:24 +02:00
|
|
|
private int jumpTicks;
|
2020-08-25 04:22:08 +02:00
|
|
|
private float bw;
|
2018-07-22 07:27:46 +02:00
|
|
|
- protected ItemStack activeItem;
|
|
|
|
+ public ItemStack activeItem; // Paper - public
|
2020-08-25 04:22:08 +02:00
|
|
|
protected int bd;
|
|
|
|
protected int be;
|
|
|
|
private BlockPosition bx;
|
2020-09-02 11:12:25 +02:00
|
|
|
@@ -3181,10 +3181,12 @@ public abstract class EntityLiving extends Entity {
|
2018-06-29 06:55:29 +02:00
|
|
|
return this.activeItem;
|
|
|
|
}
|
|
|
|
|
2020-06-25 16:09:55 +02:00
|
|
|
+ public int getItemUseRemainingTime() { return this.dY(); } // Paper - OBFHELPER
|
|
|
|
public int dY() {
|
2020-08-25 04:22:08 +02:00
|
|
|
return this.bd;
|
2018-06-29 06:55:29 +02:00
|
|
|
}
|
|
|
|
|
2020-06-25 16:09:55 +02:00
|
|
|
+ public int getHandRaisedTime() { return this.dZ(); } // Paper - OBFHELPER
|
|
|
|
public int dZ() {
|
|
|
|
return this.isHandRaised() ? this.activeItem.k() - this.dY() : 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
|
2020-09-02 11:12:25 +02:00
|
|
|
index caace62396e2612737ee5031bbbea699c5887fd2..b54961ead096d05e147e32ab16c25c382a7756c6 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
|
2020-09-02 11:12:25 +02:00
|
|
|
@@ -709,5 +709,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() {
|
2018-07-22 07:27:46 +02:00
|
|
|
+ return getHandle().activeItem.asBukkitMirror();
|
2018-06-29 06:55:29 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getItemUseRemainingTime() {
|
|
|
|
+ return getHandle().getItemUseRemainingTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int getHandRaisedTime() {
|
|
|
|
+ return getHandle().getHandRaisedTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isHandRaised() {
|
|
|
|
+ return getHandle().isHandRaised();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|