mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
d9c9b9a3d2
How long an entity has raised hands to charge an attack or use an item Also aliased isHandsRaised for isChargingAttack in RangedEntity
60 lines
No EOL
2.1 KiB
Diff
60 lines
No EOL
2.1 KiB
Diff
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/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
|
|
@@ -0,0 +0,0 @@ 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
|
|
@@ -0,0 +0,0 @@ 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
|
|
}
|
|
--
|