Package org.bukkit.entity

# Interface Firework

All Superinterfaces:
  `Audience`, `CommandSender`, `Entity`, `HoverEventSource<HoverEvent.ShowEntity>`, `Metadatable`, `Nameable`, `Permissible`, `PersistentDataHolder`, `Pointered`, `Projectile`, `ServerOperator`, `Sound.Emitter`

public interface Firework extends Projectile

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.bukkit.entity.Entity

`Entity.Spigot`

## Method Summary

Modifier and Type
Method
Description
`void`
`detonate()`
Cause this firework to explode at earliest opportunity, as if it has no remaining fuse.
`@Nullable LivingEntity`
`getAttachedTo()`
Get the `LivingEntity` to which this firework is attached.
`default @Nullable LivingEntity`
`getBoostedEntity()`
Deprecated.
use `getAttachedTo()`
`@NotNull FireworkMeta`
`getFireworkMeta()`
Get a copy of the fireworks meta
`ItemStack`
`getItem()`
Gets the item used in the firework.
`int`
`getLife()`
Deprecated, for removal: This API element is subject to removal in a future version.
use `getTicksFlown()`
`int`
`getMaxLife()`
Deprecated, for removal: This API element is subject to removal in a future version.
use `getTicksToDetonate()`
`UUID`
`getSpawningEntity()`
`int`
`getTicksFlown()`
Gets the number of ticks the firework has flown.
`int`
`getTicksToDetonate()`
Gets the number of ticks the firework will detonate on.
`boolean`
`isDetonated()`
Check whether or not this firework has detonated.
`boolean`
`isShotAtAngle()`
Gets if the firework was shot at an angle (i.e.
`boolean`
`setAttachedTo(@Nullable LivingEntity entity)`
Set the `LivingEntity` to which this firework is attached.
`void`
`setFireworkMeta(@NotNull FireworkMeta meta)`
Apply the provided meta to the fireworks
`void`
`setItem(ItemStack itemStack)`
Sets the item used in the firework.
`boolean`
`setLife(int ticks)`
Deprecated, for removal: This API element is subject to removal in a future version.
use `setTicksFlown(int)`
`boolean`
`setMaxLife(int ticks)`
Deprecated, for removal: This API element is subject to removal in a future version.
use `setTicksToDetonate(int)`
`void`
`setShotAtAngle(boolean shotAtAngle)`
Sets if the firework was shot at an angle (i.e.
`void`
`setTicksFlown(int ticks)`
Sets the number of ticks the firework has flown.
`void`
`setTicksToDetonate(int ticks)`
Set the amount of ticks the firework will detonate on.

### Methods inherited from interface net.kyori.adventure.audience.Audience

`clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, showTitle, stopSound, stopSound`

### Methods inherited from interface org.bukkit.command.CommandSender

`getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage`

### Methods inherited from interface org.bukkit.entity.Entity

`addPassenger, addScoreboardTag, asHoverEvent, collidesAt, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isInBubbleColumn, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isOnGround, isPersistent, isSilent, isTicking, isUnderWater, isValid, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, wouldCollideUsing`

### Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource

`asHoverEvent`

### Methods inherited from interface org.bukkit.metadata.Metadatable

`getMetadata, hasMetadata, removeMetadata, setMetadata`

### Methods inherited from interface org.bukkit.Nameable

`customName, customName, getCustomName, setCustomName`

### Methods inherited from interface org.bukkit.permissions.Permissible

`addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment`

### Methods inherited from interface org.bukkit.persistence.PersistentDataHolder

`getPersistentDataContainer`

### Methods inherited from interface net.kyori.adventure.pointer.Pointered

`get, getOrDefault, getOrDefaultFrom, pointers`

### Methods inherited from interface org.bukkit.entity.Projectile

`doesBounce, getShooter, hasBeenShot, hasLeftShooter, setBounce, setHasBeenShot, setHasLeftShooter, setShooter`

### Methods inherited from interface org.bukkit.permissions.ServerOperator

`isOp, setOp`

## Method Details

### getFireworkMeta

@NotNull @NotNull FireworkMeta getFireworkMeta()
Get a copy of the fireworks meta

Returns:
  A copy of the current Firework meta

### setFireworkMeta

void setFireworkMeta(@NotNull @NotNull FireworkMeta meta)
Apply the provided meta to the fireworks

Adjusts detonation ticks automatically.

Parameters:
  `meta` - The FireworkMeta to apply

### setAttachedTo

boolean setAttachedTo(@Nullable @Nullable LivingEntity entity)
Set the `LivingEntity` to which this firework is attached.

When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity `LivingEntity#isGliding() is gliding`, then the entity will receive a boost in the direction that they are looking.

Parameters:
  `entity` - the entity to which the firework should be attached, or null to remove the attached entity
Returns:
  true if the entity could be attached, false if the firework was already detonated

### getAttachedTo

@Nullable @Nullable LivingEntity getAttachedTo()
Get the `LivingEntity` to which this firework is attached.

When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity `LivingEntity#isGliding() is gliding`, then the entity will receive a boost in the direction that they are looking.

Returns:
  the attached entity, or null if none

### setLife

@Deprecated(forRemoval=true) boolean setLife(int ticks)
Deprecated, for removal: This API element is subject to removal in a future version.
use `setTicksFlown(int)`
Set the ticks that this firework has been alive. If this value exceeds `getMaxLife()`, the firework will detonate.

Parameters:
  `ticks` - the ticks to set. Must be greater than or equal to 0
Returns:
  true if the life was set, false if this firework has already detonated

### getLife

@Deprecated(forRemoval=true) int getLife()
Deprecated, for removal: This API element is subject to removal in a future version.
use `getTicksFlown()`
Get the ticks that this firework has been alive. When this value reaches `getMaxLife()`, the firework will detonate.

Returns:
  the life ticks

### setMaxLife

@Deprecated(forRemoval=true) boolean setMaxLife(int ticks)
Deprecated, for removal: This API element is subject to removal in a future version.
use `setTicksToDetonate(int)`
Set the time in ticks this firework will exist until it is detonated.

Parameters:
  `ticks` - the ticks to set. Must be greater than 0
Returns:
  true if the time was set, false if this firework has already detonated

### getMaxLife

@Deprecated(forRemoval=true) int getMaxLife()
Deprecated, for removal: This API element is subject to removal in a future version.
use `getTicksToDetonate()`
Get the time in ticks this firework will exist until it is detonated.

Returns:
  the maximum life in ticks

### detonate

void detonate()
Cause this firework to explode at earliest opportunity, as if it has no remaining fuse.

### isDetonated

boolean isDetonated()
Check whether or not this firework has detonated.

Returns:
  true if detonated, false if still in the world

### isShotAtAngle

boolean isShotAtAngle()
Gets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.

Returns:
  shot at angle status

### setShotAtAngle

void setShotAtAngle(boolean shotAtAngle)
Sets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.

Parameters:
  `shotAtAngle` - the new shotAtAngle

### getSpawningEntity

@Nullable UUID getSpawningEntity()

### getBoostedEntity

@Nullable @Deprecated default @Nullable LivingEntity getBoostedEntity()
Deprecated.
use `getAttachedTo()`
If this firework is boosting an entity, return it

Returns:
  The entity being boosted
See Also:
  - `setAttachedTo(LivingEntity)`

### getItem

@NotNull ItemStack getItem()
Gets the item used in the firework.

Returns:
  firework item

### setItem

void setItem(@Nullable ItemStack itemStack)
Sets the item used in the firework.

Firework explosion effects are used from this item.

Parameters:
  `itemStack` - item to set

### getTicksFlown

int getTicksFlown()
Gets the number of ticks the firework has flown.

Returns:
  ticks flown

### setTicksFlown

void setTicksFlown(int ticks)
Sets the number of ticks the firework has flown. Setting this greater than detonation ticks will cause the firework to explode.

Parameters:
  `ticks` - ticks flown

### getTicksToDetonate

int getTicksToDetonate()
Gets the number of ticks the firework will detonate on.

Returns:
  the tick to detonate on

### setTicksToDetonate

void setTicksToDetonate(int ticks)
Set the amount of ticks the firework will detonate on.

Parameters:
  `ticks` - ticks to detonate on