1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-20 22:18:58 +01:00

Update launchProjectile API ()

This commit is contained in:
Lulu13022002 2024-09-21 21:19:02 +02:00 committed by GitHub
parent 593faf4fc3
commit 1ed64f8270
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
453 changed files with 280 additions and 136 deletions
patches/api
0053-Fix-upstream-javadocs.patch0338-More-Projectile-API.patch0361-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch0361-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch0362-Add-getDrops-to-BlockState.patch0363-Add-PlayerInventorySlotChangeEvent.patch0364-Elder-Guardian-appearance-API.patch0365-Add-EquipmentSlot-convenience-methods.patch0366-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch0367-Add-entity-knockback-API.patch0368-Added-EntityToggleSitEvent.patch0369-Add-Moving-Piston-API.patch0370-Add-PrePlayerAttackEntityEvent.patch0371-Add-Player-Warden-Warning-API.patch0372-More-vanilla-friendly-methods-to-update-trades.patch0373-Add-paper-dumplisteners-command.patch0374-ItemStack-damage-API.patch0375-Add-Tick-TemporalUnit.patch0376-Friction-API.patch0377-Player-Entity-Tracking-Events.patch0378-Add-missing-Fluid-type.patch0379-fix-Instruments.patch0380-Add-BlockLockCheckEvent.patch0381-Add-Sneaking-API-for-Entities.patch0382-Improve-PortalEvents.patch0383-Flying-Fall-Damage-API.patch0384-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch0385-Win-Screen-API.patch0386-Add-Entity-Body-Yaw-API.patch0387-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch0388-Add-EntityFertilizeEggEvent.patch0389-Add-CompostItemEvent-and-EntityCompostItemEvent.patch0390-Add-Shearable-API.patch0391-Fix-SpawnEggMeta-get-setSpawnedType.patch0392-Add-Mob-Experience-reward-API.patch0393-Expand-PlayerItemMendEvent.patch0394-Add-method-to-remove-all-active-potion-effects.patch0395-Folia-scheduler-and-owned-region-API.patch0396-Add-event-for-player-editing-sign.patch0397-More-Sign-Block-API.patch0398-Fix-BanList-API.patch0399-Add-whitelist-events.patch0400-API-for-updating-recipes-on-clients.patch0401-Add-PlayerFailMoveEvent.patch0402-Fix-custom-statistic-criteria-creation.patch0403-SculkCatalyst-bloom-API.patch0404-API-for-an-entity-s-scoreboard-name.patch0405-Deprecate-and-replace-methods-with-old-StructureType.patch0406-Add-Listing-API-for-Player.patch0407-Expose-clicked-BlockFace-during-BlockDamageEvent.patch0408-Fix-NPE-on-Boat-getStatus.patch0409-Expand-Pose-API.patch0410-MerchantRecipe-add-copy-constructor.patch0411-More-DragonBattle-API.patch0412-Add-PlayerPickItemEvent.patch0413-Allow-trident-custom-damage.patch0414-Expose-hand-during-BlockCanBuildEvent.patch0415-Limit-setBurnTime-to-valid-short-values.patch0416-Add-OfflinePlayer-isConnected.patch0417-Add-titleOverride-to-InventoryOpenEvent.patch0418-Allow-proper-checking-of-empty-item-stacks.patch0419-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch0420-Add-player-idle-duration-API.patch0421-Add-API-to-get-the-collision-shape-of-a-block-before.patch0422-Add-predicate-for-blocks-when-raytracing.patch0423-Add-hand-to-fish-event-for-all-player-interactions.patch0424-Attribute-Modifier-API-improvements.patch0425-Expand-LingeringPotion-API.patch0426-Remove-unnecessary-durability-check-in-ItemStack-isS.patch0427-Add-Structure-check-API.patch0428-Experimental-annotations-change.patch0429-Add-more-scoreboard-API.patch0430-Improve-Registry.patch0431-Add-experience-points-API.patch0432-Add-missing-InventoryType.patch0433-Add-drops-to-shear-events.patch0434-Add-HiddenPotionEffect-API.patch0435-Add-PlayerShieldDisableEvent.patch0436-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch0437-Add-BlockStateMeta-clearBlockState.patch0438-Expose-LootTable-of-DecoratedPot.patch0439-Add-ShulkerDuplicateEvent.patch0440-Add-api-for-spawn-egg-texture-colors.patch0441-Add-Lifecycle-Event-system.patch0442-ItemStack-Tooltip-API.patch0443-Add-getChunkSnapshot-includeLightData-parameter.patch0444-Add-FluidState-API.patch0445-add-number-format-api.patch0446-improve-BanList-types.patch0447-Suspicious-Effect-Entry-API.patch0448-Fix-DamageSource-API.patch0449-Expanded-Hopper-API.patch0450-Clone-mutables-to-prevent-unexpected-issues.patch0451-Add-BlockBreakProgressUpdateEvent.patch0452-Deprecate-ItemStack-setType.patch0453-Item-Mutation-Fixes.patch0454-API-for-checking-sent-chunks.patch0455-Add-CartographyItemEvent.patch0456-More-Raid-API.patch0457-Fix-SpawnerEntry-Equipment-API.patch

View file

@ -1719,6 +1719,32 @@ index b84b37fe27d84574dc5897285f1d9a1437bd322c..281ae60a6be7e39aab4f27b4c7de3d49
*
* @return Set containing all the channels that this client may accept.
*/
diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
index eabd8b926ec1c934cd7e77b7cc6adfae16771021..8557bfefaf02538dec95adb29734ae2cf50f3f8c 100644
--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java
+++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
@@ -12,6 +12,10 @@ public interface ProjectileSource {
/**
* Launches a {@link Projectile} from the ProjectileSource.
+ * <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
@@ -23,6 +27,10 @@ public interface ProjectileSource {
/**
* Launches a {@link Projectile} from the ProjectileSource with an
* initial velocity.
+ * <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
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
index 22b1dc5fd4d453161a5ee520072f8e8f955b3a80..a625bcab8e77b05b3341a52c708fae1542b7e3d5 100644
--- a/src/main/java/org/bukkit/scoreboard/Objective.java

View file

@ -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
}

View file

@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MelnCat <melncatuwu@gmail.com>
Date: Mon, 19 Sep 2022 14:04:13 -0700
Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile
diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
index eabd8b926ec1c934cd7e77b7cc6adfae16771021..96ebd30d339060758e726e9e1e7428d1d0813c17 100644
--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java
+++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java
@@ -31,4 +31,23 @@ 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.
+ *
+ * @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
}

View file

@ -59,7 +59,7 @@ index ced419f8655bff72f0257b639d5f7d73afe3c2e2..bcc6ba95bd21c7972865838c636a03f5
/**
* Gets the item stack associated with this item drop.
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index c9c3b926c5bb408d964ed5acc9f95c8527837a25..7c027d7bbd6b8a1543fa92d44e99674925f093b3 100644
index 9f3e2903c955f2a5d1b25825c49188df62d20cef..016529563381a674db8050cb328f9e8f16e72e93 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add method to remove all active potion effects
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index f5149d54d6cb5019f398718b9aa52bc3ab34a5ae..ad3717d963f28751d410e6688ae64a4c1175871d 100644
index c610731928ac9b01b111a7ccf0340ad59fcfb867..4aab0144601788a7902c9fdabb68744d9e33a345 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -657,6 +657,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View file

@ -499,7 +499,7 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 556e8c6cf90af9c90ded18be013167fa440d6505..9265ee60edfb3df797e425e854c7d3c9c034a85c 100644
index adc95cd1486791787950533ef8e4baaf5d3827cc..50efe16bb80c618c3dfae03b70c8c165183af8ec 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2672,6 +2672,141 @@ public final class Bukkit {
@ -645,7 +645,7 @@ index 556e8c6cf90af9c90ded18be013167fa440d6505..9265ee60edfb3df797e425e854c7d3c9
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a859d7bc870e5ef16793c2da453c84685b78ee47..968a5e18a023c92158a753f6d8fce4b2d0f0de48 100644
index 0648130a6ce2e08d96b05fde1cfd58c2bb24ae07..1b8d6a3333a4fa9155b79644e683e2343c134e12 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2333,4 +2333,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View file

@ -5,7 +5,7 @@ Subject: [PATCH] API for updating recipes on clients
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9265ee60edfb3df797e425e854c7d3c9c034a85c..f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15 100644
index 50efe16bb80c618c3dfae03b70c8c165183af8ec..52c601328bbf5c1642aa620c8bb466a9d2d231be 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1004,6 +1004,26 @@ public final class Bukkit {
@ -82,7 +82,7 @@ index 9265ee60edfb3df797e425e854c7d3c9c034a85c..f2753ef7d53ff3ff3531eaea89e816d7
* Gets a list of command aliases defined in the server properties.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 968a5e18a023c92158a753f6d8fce4b2d0f0de48..b93359e86db14e3a680bcdd8d935e2692c8b64e0 100644
index 1b8d6a3333a4fa9155b79644e683e2343c134e12..8ba2fbaab7428a42b506fd000fbc162f68ddaed1 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -853,6 +853,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15..7e70b9b34b170b1c00dd920fabc0e14ed4a14955 100644
index 52c601328bbf5c1642aa620c8bb466a9d2d231be..c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -949,9 +949,6 @@ public final class Bukkit {
@ -84,7 +84,7 @@ index f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15..7e70b9b34b170b1c00dd920fabc0e14e
/**
* Reloads the server, refreshing settings and plugin information.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index b93359e86db14e3a680bcdd8d935e2692c8b64e0..f2be9647e015761ef7f56331be932a39cb6a5e8b 100644
index 8ba2fbaab7428a42b506fd000fbc162f68ddaed1..50ffca9bccfb582d58ccb13f0decf66e5d91aef3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View file

@ -49,7 +49,7 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..98fdfc8978fea1937e31a7427433a192
@Override
public @NotNull String translationKey() {
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 7870a796e719148a42d18f1497b56c0d8f651a43..ff82bf3ea959c78e71ec7b0972a2d472f20aaf04 100644
index 04dfab3fb9a9a3bc7e69cb0c1f5346f3c7d87d72..82381ea98af1c9216a2989ea83ba4aa90ba69741 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -367,6 +367,79 @@ public interface Registry<T extends Keyed> extends Iterable<T> {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add HiddenPotionEffect API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index ad3717d963f28751d410e6688ae64a4c1175871d..8369da45206d2606f0715f3d803163dd8028251e 100644
index 4aab0144601788a7902c9fdabb68744d9e33a345..51a428473e702be3ab79bd1e579d1114f747791b 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -591,6 +591,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource

View file

@ -68,7 +68,7 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce
/**
* Banned player names
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7e70b9b34b170b1c00dd920fabc0e14ed4a14955..419c056faf0d49d9b0435feb01252e87e227b9a9 100644
index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d5e42f73c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1663,11 +1663,27 @@ public final class Bukkit {
@ -100,7 +100,7 @@ index 7e70b9b34b170b1c00dd920fabc0e14ed4a14955..419c056faf0d49d9b0435feb01252e87
/**
* Gets a set containing all player operators.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f2be9647e015761ef7f56331be932a39cb6a5e8b..5aa64ea39ebd92e5067c53cea49a8685c0b9eee4 100644
index 50ffca9bccfb582d58ccb13f0decf66e5d91aef3..6246251caf2c6f025c824b8e7a944b8d48751fa1 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

Some files were not shown because too many files have changed in this diff Show more