Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
cc6fd371b2
Fixes #6357 Closes #6508 Closes #6358
43 Zeilen
1.6 KiB
Diff
43 Zeilen
1.6 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/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 1ffdc8785d1073511e58d4826457efa9d71c357d..918f87cc79062602e1db41d9368921c0092b1840 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -745,5 +745,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
public void setShieldBlockingDelay(int delay) {
|
|
getHandle().setShieldBlockingDelay(delay);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public ItemStack getActiveItem() {
|
|
+ return getHandle().getUseItem().asBukkitMirror();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getItemUseRemainingTime() {
|
|
+ return getHandle().getUseItemRemainingTicks();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getHandRaisedTime() {
|
|
+ return getHandle().getTicksUsingItem();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isHandRaised() {
|
|
+ return getHandle().isUsingItem();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.inventory.EquipmentSlot getHandRaised() {
|
|
+ return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
|
|
+ }
|
|
// Paper end
|
|
}
|