From 5fee1ac76f2d18cb85bb1f948fe50990db66d1a1 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 19 Feb 2020 23:02:09 +0000 Subject: [PATCH] #479: Add LivingEntity#attack, LivingEntity#swingMainHand, LivingEntity#swingOffHand By: konsolas --- .../java/org/bukkit/entity/LivingEntity.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java index 69482398ed..203d135f15 100644 --- a/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/LivingEntity.java @@ -458,6 +458,33 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ boolean hasAI(); + /** + * Makes this entity attack the given entity with a melee attack. + * + * Attack damage is calculated by the server from the attributes and + * equipment of this mob, and knockback is applied to {@code target} as + * appropriate. + * + * @param target entity to attack. + */ + public void attack(@NotNull Entity target); + + /** + * Makes this entity swing their main hand. + * + * This method does nothing if this entity does not have an animation for + * swinging their main hand. + */ + public void swingMainHand(); + + /** + * Makes this entity swing their off hand. + * + * This method does nothing if this entity does not have an animation for + * swinging their off hand. + */ + public void swingOffHand(); + /** * Set if this entity will be subject to collisions other entities. *