aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0380-Add-entity-knockback-API.patch
blob: cf91cd8304302275ce1190848cf0beaa7667bc47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MelnCat <melncatuwu@gmail.com>
Date: Sun, 16 Oct 2022 12:10:00 -0700
Subject: [PATCH] Add entity knockback API


diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index aa20ec645476b2cbb0330c206f163094aebf238e..70953573a7bcfa682dbaeaa8e3db0c847b254fdd 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1221,5 +1221,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
             this.swingOffHand();
         }
     }
+
+    /**
+     * Knocks back this entity from a specific direction with a specified strength. Mechanics such
+     * as knockback resistance will be factored in.
+     *
+     * The direction specified in this method will be the direction of the source of the knockback,
+     * so the entity will be pushed in the opposite direction.
+     * @param strength The strength of the knockback. Must be greater than 0.
+     * @param directionX The relative x position of the knockback source direction
+     * @param directionZ The relative z position of the knockback source direction
+     */
+    void knockback(double strength, double directionX, double directionZ);
     // Paper end
 }