Paper/patches/server/0901-Add-entity-knockback-API.patch
Jake Potrebic 6a7fef0e4a
Allow entity effect changes off the main thread for worldgen (#8942)
* Allow entity effect modification off the main thread for worldgen

* squash all async catcher patches
2023-04-09 11:38:32 -07:00

23 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MelnCat <melncatuwu@gmail.com>
Date: Sun, 16 Oct 2022 12:10:17 -0700
Subject: [PATCH] Add entity knockback API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5f20251a7d9c3cfa48775d825e557b75930d7923..f6e5de14a674a2dd7841c1e03f136cc48e2352cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -995,5 +995,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
}
+
+ @Override
+ public void knockback(double strength, double directionX, double directionZ) {
+ Preconditions.checkArgument(strength > 0, "Knockback strength must be > 0");
+ getHandle().knockback(strength, directionX, directionZ);
+ };
// Paper end
}