mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 08:27:36 +01:00
526795bacd
* Update patches to handle vineflower decompiler * update patches again to handle inlined simple lambdas * update vf again and re-apply/rebuild patches * update patches after removal of verify-merges flag * fix compile issue * remove maven local * fix some issues * address more issues * fix collision patch * use paperweight release * more fixes * update fineflower and fix patches again * add missing comment descriptor --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SoSeDiK <mrsosedik@gmail.com>
|
|
Date: Tue, 11 Oct 2022 22:35:56 +0300
|
|
Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
index be9fa1b6209a41712767283c6329046ca2795c09..35b0eb94e291dae7a4705fa85b10d23fcd38f49e 100644
|
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
|
@@ -1329,4 +1329,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|
@Deprecated
|
|
void setHurtDirection(float hurtDirection);
|
|
// Paper end - hurt direction API
|
|
+
|
|
+ // Paper start - swing hand API
|
|
+ /**
|
|
+ * Makes this entity swing their hand.
|
|
+ *
|
|
+ * <p>This method does nothing if this entity does not
|
|
+ * have an animation for swinging their hand.
|
|
+ *
|
|
+ * @param hand hand to be swung, either {@link org.bukkit.inventory.EquipmentSlot#HAND} or {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}
|
|
+ * @throws IllegalArgumentException if invalid hand is passed
|
|
+ */
|
|
+ default void swingHand(@NotNull org.bukkit.inventory.EquipmentSlot hand) {
|
|
+ com.google.common.base.Preconditions.checkArgument(hand != null && hand.isHand(), String.format("Expected a valid hand, got \"%s\" instead!", hand));
|
|
+ if (hand == org.bukkit.inventory.EquipmentSlot.HAND) {
|
|
+ this.swingMainHand();
|
|
+ } else {
|
|
+ this.swingOffHand();
|
|
+ }
|
|
+ }
|
|
+ // Paper end - swing hand API
|
|
}
|