From 95a2e4ed32a3067d2df10a720658f974de8c11f3 Mon Sep 17 00:00:00 2001 From: MelnCat Date: Sun, 16 Oct 2022 12:10:17 -0700 Subject: [PATCH] Add entity knockback API --- .../org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 9399df20ba..5efa27ab1e 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1146,4 +1146,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); } // Paper end - hurt direction API + + // Paper start - knockback API + @Override + public void knockback(final double strength, final double directionX, final double directionZ) { + Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0"); + this.getHandle().knockback(strength, directionX, directionZ); + }; + // Paper end - knockback API }