Paper/patches/api/0416-Add-speed-argument-to-...

54 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: wyrdix <wyrdix@github.com>
Date: Sat, 22 Apr 2023 17:39:23 +0200
Subject: [PATCH] Add speed argument to ProjectileSource#launchProjectile
diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
index 6cb28e65b82198b19f159f8e8334208f7f62d394..cca8a25fc56998fc6ba07b0329d03bf69ac24856 100644
--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java
+++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
@@ -50,5 +50,42 @@ public interface ProjectileSource {
*/
@NotNull
public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable org.bukkit.util.Consumer<T> function);
+
+ /**
+ * Launches a {@link Projectile} from the ProjectileSource with an
+ * initial velocity, with the initial speed supplied
+ *
+ * <br>
+ * Note that when the function is run, the entity will not be actually in
+ * the world. Any operation involving such as teleporting the entity is undefined
+ * until after this function returns.
+ *
+ * @param <T> a projectile subclass
+ * @param projectile class of the projectile to launch
+ * @param velocity the velocity with which to launch
+ * @param speed the speed at which the projectile is launched
+ * @return the launched projectile
+ */
+ @NotNull
+ public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, float speed);
+
+ /**
+ * Launches a {@link Projectile} from the ProjectileSource with an
+ * initial velocity, with the initial speed supplied, with the supplied function run before the
+ * entity is added to the world.
+ * <br>
+ * Note that when the function is run, the entity will not be actually in
+ * the world. Any operation involving such as teleporting the entity is undefined
+ * until after this function returns.
+ *
+ * @param <T> a projectile subclass
+ * @param projectile class of the projectile to launch
+ * @param velocity the velocity with which to launch
+ * @param speed the speed at which the projectile is launched
+ * @param function the function to be run before the entity is spawned
+ * @return the launched projectile
+ */
+ @NotNull
+ public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, float speed, @Nullable org.bukkit.util.Consumer<T> function);
// Paper end
}