SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot
2022-09-12 19:04:19 +10:00
parent 38ba2e3273
commit 8891e2079c
2 changed files with 85 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MainHand;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -586,4 +587,20 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* @param location where to set the last death player location
*/
public void setLastDeathLocation(@Nullable Location location);
/**
* Perform a firework boost.
* <p>
* This method will only work such that {@link #isGliding()} is true and
* the entity is actively gliding with an elytra. Additionally, the supplied
* {@code fireworkItemStack} must be a firework rocket. The power of the boost
* will directly correlate to {@link FireworkMeta#getPower()}.
*
* @param fireworkItemStack the firework item stack to use to glide
* @return the attached {@link Firework}, or null if the entity could not
* be boosted
* @throws IllegalArgumentException if the fireworkItemStack is not a firework
*/
@Nullable
public Firework fireworkBoost(@NotNull ItemStack fireworkItemStack);
}