Paper/patches/api/0392-Add-entity-knockback-API.patch
Nassim Jahnke 2cd29ddbb5
API 'done'
2023-03-14 18:21:11 +01:00

29 lines
1.3 KiB
Diff

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 aa2c3c4648844908b2699f6f220393f98836ed5d..f5a4160afb75549dd56a237cf99ec733efef9b4c 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1070,5 +1070,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
}