Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-22 14:28:09 +01:00
c99e4a22aa
I need more creative commit messages.
63 Zeilen
2.1 KiB
Diff
63 Zeilen
2.1 KiB
Diff
From 35c788a70a57c803f5042576501d679b63acac95 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 1d7b9c525..6036915a8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2569,14 +2569,17 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
}
|
|
|
|
+ public ItemStack getActiveItem() { return cV(); } // Paper - OBFHELPER
|
|
public ItemStack cV() {
|
|
return this.activeItem;
|
|
}
|
|
|
|
+ public int getItemUseRemainingTime() { return cW(); } // Paper - OBFHELPER
|
|
public int cW() {
|
|
return this.bu;
|
|
}
|
|
|
|
+ public int getHandRaisedTime() { return cX(); } // Paper - OBFHELPER
|
|
public int cX() {
|
|
return this.isHandRaised() ? this.activeItem.k() - this.cW() : 0;
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 0237ac769..8b3659c82 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -539,5 +539,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
|
|
|