Interface AbstractArrow

All Superinterfaces:
CommandSender, Entity, Metadatable, Nameable, Permissible, PersistentDataHolder, Projectile, ServerOperator
All Known Subinterfaces:
Arrow, SpectralArrow, TippedArrow, Trident

public interface AbstractArrow extends Projectile
Represents an arrow.
  • Method Details

    • getKnockbackStrength

      @Deprecated int getKnockbackStrength()
      Deprecated.
      a function of the firing weapon
      Gets the knockback strength for an arrow, which is the KnockBack level of the bow that shot it.
      Returns:
      the knockback strength value
      See Also:
    • setKnockbackStrength

      @Deprecated void setKnockbackStrength(int knockbackStrength)
      Deprecated.
      a function of the firing weapon
      Sets the knockback strength for an arrow.
      Parameters:
      knockbackStrength - the knockback strength value
      See Also:
    • getDamage

      double getDamage()
      Gets the base amount of damage this arrow will do. Defaults to 2.0 for a normal arrow with 0.5 * (1 + power level) added for arrows fired from enchanted bows.
      Returns:
      base damage amount
    • setDamage

      void setDamage(double damage)
      Sets the base amount of damage this arrow will do.
      Parameters:
      damage - new damage amount
    • getPierceLevel

      int getPierceLevel()
      Gets the number of times this arrow can pierce through an entity.
      Returns:
      pierce level
    • setPierceLevel

      void setPierceLevel(int pierceLevel)
      Sets the number of times this arrow can pierce through an entity. Must be between 0 and 127 times.
      Parameters:
      pierceLevel - new pierce level
    • isCritical

      boolean isCritical()
      Gets whether this arrow is critical.

      Critical arrows have increased damage and cause particle effects.

      Critical arrows generally occur when a player fully draws a bow before firing.

      Returns:
      true if it is critical
    • setCritical

      void setCritical(boolean critical)
      Sets whether or not this arrow should be critical.
      Parameters:
      critical - whether or not it should be critical
    • isInBlock

      boolean isInBlock()
      Gets whether this arrow is in a block or not.

      Arrows in a block are motionless and may be picked up by players.

      Returns:
      true if in a block
    • getAttachedBlock

      @Nullable Block getAttachedBlock()
      Gets the block to which this arrow is attached.
      Returns:
      the attached block or null if not attached
    • getPickupStatus

      @NotNull AbstractArrow.PickupStatus getPickupStatus()
      Gets the current pickup status of this arrow.
      Returns:
      the pickup status of this arrow.
    • setPickupStatus

      void setPickupStatus(@NotNull AbstractArrow.PickupStatus status)
      Sets the current pickup status of this arrow.
      Parameters:
      status - new pickup status of this arrow.
    • isShotFromCrossbow

      boolean isShotFromCrossbow()
      Gets if this arrow was shot from a crossbow.
      Returns:
      if shot from a crossbow
    • setShotFromCrossbow

      @Deprecated void setShotFromCrossbow(boolean shotFromCrossbow)
      Deprecated.
      a function of the firing weapon instead
      Sets if this arrow was shot from a crossbow.
      Parameters:
      shotFromCrossbow - if shot from a crossbow
      See Also:
    • getItem

      @NotNull @Experimental ItemStack getItem()
      Gets the ItemStack which will be picked up from this arrow.
      Returns:
      The picked up ItemStack
    • setItem

      @Experimental void setItem(@NotNull ItemStack item)
      Sets the ItemStack which will be picked up from this arrow.
      Parameters:
      item - ItemStack set to be picked up
    • getWeapon

      @NotNull @Experimental ItemStack getWeapon()
      Gets the ItemStack which fired this arrow.
      Returns:
      The firing ItemStack
    • setWeapon

      @Experimental void setWeapon(@NotNull ItemStack item)
      Sets the ItemStack which fired this arrow.
      Parameters:
      item - The firing ItemStack