Add playPickupItemAnimation to LivingEntity
This commit is contained in:
parent
20fc1b5c2a
commit
4cc7de6c51
|
@ -0,0 +1,39 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Sun, 23 Aug 2020 19:36:08 +0200
|
||||||
|
Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
index a60523cc9c05396ce5c3ebabd231f3ca374c3efe..bed428d1bae3d90da41531cf135b19f78cccb2db 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
@@ -752,5 +752,28 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
|
* @param jumping entity jump state
|
||||||
|
*/
|
||||||
|
void setJumping(boolean jumping);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Plays pickup item animation towards this entity.
|
||||||
|
+ * <p/>
|
||||||
|
+ * <b>This will remove the item on the client.</b>
|
||||||
|
+ * <p/>
|
||||||
|
+ * Quantity is inferred to be that of the {@link Item}.
|
||||||
|
+ *
|
||||||
|
+ * @param item item to pickup
|
||||||
|
+ */
|
||||||
|
+ default void playPickupItemAnimation(@NotNull Item item) {
|
||||||
|
+ playPickupItemAnimation(item, item.getItemStack().getAmount());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Plays pickup item animation towards this entity.
|
||||||
|
+ * <p/>
|
||||||
|
+ * <b>This will remove the item on the client.</b>
|
||||||
|
+ *
|
||||||
|
+ * @param item item to pickup
|
||||||
|
+ * @param quantity quantity of item
|
||||||
|
+ */
|
||||||
|
+ void playPickupItemAnimation(@NotNull Item item, int quantity);
|
||||||
|
// Paper end
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Sun, 23 Aug 2020 19:36:22 +0200
|
||||||
|
Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
index 3777aba5f32f58f4620d4fe496af4e641ff8c858..e0ec715ef363867665ea14dc71e219c1023e0819 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
@@ -751,5 +751,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Override
|
||||||
|
+ public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
||||||
|
+ getHandle().receive(((CraftItem) item).getHandle(), quantity);
|
||||||
|
+ }
|
||||||
|
// Paper end
|
||||||
|
}
|
Loading…
Reference in New Issue