Update launchProjectile API (#11300)
This commit is contained in:
parent
593faf4fc3
commit
1ed64f8270
453 changed files with 280 additions and 136 deletions
|
@ -5,6 +5,7 @@ Subject: [PATCH] More Projectile API
|
|||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
|
||||
Co-authored-by: MelnCat <melncatuwu@gmail.com>
|
||||
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue