Paper/patches/api/0384-Add-entity-knockback-API.patch
Jake Potrebic 2f92d4e00e
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
2023-12-08 11:00:39 -08: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 ac87b7a28553425dc45af11ac6f5089f5197ce20..eced9bfd35aa822b1ba141ea60e603bca5a137f8 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1158,5 +1158,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
}