aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0384-Add-entity-knockback-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/api/0384-Add-entity-knockback-API.patch')
-rw-r--r--patches/api/0384-Add-entity-knockback-API.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/api/0384-Add-entity-knockback-API.patch b/patches/api/0384-Add-entity-knockback-API.patch
new file mode 100644
index 0000000000..a9ff8ddd0d
--- /dev/null
+++ b/patches/api/0384-Add-entity-knockback-API.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: MelnCat <[email protected]>
+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 8d75d2a2afd1a4c75a00c0acbd292c6b18ace827..8489aae76d649e2e60b7004ecca6ab437917ca78 100644
+--- a/src/main/java/org/bukkit/entity/LivingEntity.java
++++ b/src/main/java/org/bukkit/entity/LivingEntity.java
+@@ -1074,5 +1074,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
+ }