Interface BlocksAttacksComponent

All Superinterfaces:
ConfigurationSerializable

@Experimental public interface BlocksAttacksComponent extends ConfigurationSerializable
Represents a component which can turn any item into a shield-like item which blocks attack damage.
  • Method Details Link icon

    • getBlockDelaySeconds Link icon

      float getBlockDelaySeconds()
      Gets the delay on equip before this item will block attacks.
      Returns:
      the delay in seconds
    • setBlockDelaySeconds Link icon

      void setBlockDelaySeconds(float seconds)
      Sets the delay on equip before this item will block attacks.
      Parameters:
      seconds - the delay in seconds to set
    • getDisableCooldownScale Link icon

      float getDisableCooldownScale()
      Gets the multiplier applied to the item cooldown when attacked by a disabling attack.
      Returns:
      the scale
    • setDisableCooldownScale Link icon

      void setDisableCooldownScale(float scale)
      Sets the multiplier applied to the item cooldown when attacked by a disabling attack.
      Parameters:
      scale - the scale to set. Must be 0 or a positive integer
    • getDamageReductions Link icon

      @NotNull List<BlocksAttacksComponent.DamageReduction> getDamageReductions()
      Get the list of DamageReductions that apply to this item.
      Returns:
      all damage reductions. The mutability of the returned list cannot be guaranteed, but its contents are mutable and can have their values changed
    • setDamageReductions Link icon

      void setDamageReductions(@NotNull List<BlocksAttacksComponent.DamageReduction> reductions)
      Set the list of DamageReductions to apply to this item. This will remove any existing damage reductions.
      Parameters:
      reductions - the reductions to set
    • addDamageReduction Link icon

      @NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull DamageType type, float base, float factor, float horizontalBlockingAngle)
      Add a new damage reduction to this component, which blocks specific types of attacks.
      Parameters:
      type - the type of attack
      base - the constant amount of damage to be blocked
      factor - the proportion of damage to be blocked
      horizontalBlockingAngle - the maximum angle at which attacks will be blocked
      Returns:
      the BlocksAttacksComponent.DamageReduction instance that was added to this item
    • addDamageReduction Link icon

      @NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull Collection<DamageType> types, float base, float factor, float horizontalBlockingAngle)
      Add a new damage reduction to this component, which blocks specific types of attacks.
      Parameters:
      types - the types of attack
      base - the constant amount of damage to be blocked
      factor - the proportion of damage to be blocked
      horizontalBlockingAngle - the maximum angle at which attacks will be blocked
      Returns:
      the BlocksAttacksComponent.DamageReduction instance that was added to this item
    • addDamageReduction Link icon

      @NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull Tag<DamageType> tag, float base, float factor, float horizontalBlockingAngle)
      Add a new damage reduction to this component, which blocks specific types of attacks.
      Parameters:
      tag - the type of attacks
      base - the constant amount of damage to be blocked
      factor - the proportion of damage to be blocked
      horizontalBlockingAngle - the maximum angle at which attacks will be blocked
      Returns:
      the BlocksAttacksComponent.DamageReduction instance that was added to this item
    • removeDamageReduction Link icon

      boolean removeDamageReduction(@NotNull BlocksAttacksComponent.DamageReduction reduction)
      Remove the given BlocksAttacksComponent.DamageReduction from this item.
      Parameters:
      reduction - the reduction to remove
      Returns:
      true if the reduction was removed, false if this component did not contain a matching reduction
    • getItemDamageThreshold Link icon

      float getItemDamageThreshold()
      Gets the amount of damage required to be dealt before damage is also applied to the item.
      Returns:
      threshold damage amount
    • setItemDamageThreshold Link icon

      void setItemDamageThreshold(float threshold)
      Sets the amount of damage required to be dealt before damage is also applied to the item.
      Parameters:
      threshold - new threshold damage amount
    • getItemDamageBase Link icon

      float getItemDamageBase()
      Gets the constant amount of damage applied to the item if the threshold is reached.
      Returns:
      base item damage
    • setItemDamageBase Link icon

      void setItemDamageBase(float base)
      Sets the constant amount of damage applied to the item if the threshold is reached.
      Parameters:
      base - new base item damage
    • getItemDamageFactor Link icon

      float getItemDamageFactor()
      Gets the proportion of damage applied to the item if the threshold is reached.
      Returns:
      item damage factor
    • setItemDamageFactor Link icon

      void setItemDamageFactor(float factor)
      Sets the proportion of damage applied to the item if the threshold is reached.
      Parameters:
      factor - new item damage factor
    • getBlockSound Link icon

      @Nullable Sound getBlockSound()
      Gets the sound to play when the item blocks an attack.
      Returns:
      the sound
    • setBlockSound Link icon

      void setBlockSound(@Nullable Sound sound)
      Sets the sound to play when the item blocks an attack.
      Parameters:
      sound - sound or null for current default
    • getDisableSound Link icon

      @Nullable Sound getDisableSound()
      Gets the sound to play when the item is disabled.
      Returns:
      the sound
    • setDisableSound Link icon

      void setDisableSound(@Nullable Sound sound)
      Sets the sound to play when the item is disabled.
      Parameters:
      sound - sound or null for current default
    • getBypassedBy Link icon

      @Nullable Tag<DamageType> getBypassedBy()
      Gets the type of damage that will bypass blocking by this item.
      Returns:
      damage type
    • setBypassedBy Link icon

      void setBypassedBy(@Nullable Tag<DamageType> tag)
      Sets the type of damage that will bypass blocking by this item.
      Parameters:
      tag - the tag, or null to clear