diff options
Diffstat (limited to 'patches/api/0338-More-Projectile-API.patch')
-rw-r--r-- | patches/api/0338-More-Projectile-API.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/patches/api/0338-More-Projectile-API.patch b/patches/api/0338-More-Projectile-API.patch index ddb5200413..b94c7cf17a 100644 --- a/patches/api/0338-More-Projectile-API.patch +++ b/patches/api/0338-More-Projectile-API.patch @@ -5,6 +5,7 @@ Subject: [PATCH] More Projectile API Co-authored-by: Nassim Jahnke <[email protected]> Co-authored-by: SoSeDiK <[email protected]> +Co-authored-by: MelnCat <[email protected]> diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java index 8bf9bf7940d2911486e9d3a4f688cfae3f6173f2..9bf4b86e730f3d066f6ebfd4e516caf78145479e 100644 @@ -486,3 +487,34 @@ index c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7..02584eced96944a551140f8150c65a7c + void setHasDealtDamage(boolean hasDealtDamage); } // Paper end +diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java +index 8557bfefaf02538dec95adb29734ae2cf50f3f8c..03faf9a142f494e255258099a6b8831a0d4a879b 100644 +--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java ++++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java +@@ -39,4 +39,26 @@ public interface ProjectileSource { + */ + @NotNull + public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity); ++ ++ // Paper start - add consumer to launchProjectile ++ /** ++ * Launches a {@link Projectile} from the ProjectileSource with an ++ * initial velocity, 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. ++ * <p> ++ * The family of launchProjectile methods only promise the ability to launch projectile types ++ * that the {@link ProjectileSource} is capable of firing in vanilla. ++ * Any other types of projectiles *may* be implemented but are not part of the method contract. ++ * @param <T> a projectile subclass ++ * @param projectile class of the projectile to launch ++ * @param velocity the velocity with which to launch ++ * @param function the function to be run before the entity is spawned ++ * @return the launched projectile ++ */ ++ <T extends Projectile> @NotNull T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer<? super T> function); ++ // Paper end - add consumer to launchProjectile + } |