Class ElementalDamageSource

java.lang.Object
net.minecraft.entity.damage.DamageSource
io.github.xrickastley.sevenelements.element.ElementalDamageSource
All Implemented Interfaces:
IDamageSource

public final class ElementalDamageSource extends DamageSource
  • Field Details

    • original

      @Nullable private final @Nullable DamageSource original
    • application

      private final ElementalApplication application
    • icdContext

      private final InternalCooldownContext icdContext
    • applyDMGBonus

      private boolean applyDMGBonus
    • applyRES

      private boolean applyRES
    • shouldInfuse

      private boolean shouldInfuse
  • Constructor Details

    • ElementalDamageSource

      public ElementalDamageSource(DamageSource source, ElementalApplication application, InternalCooldownContext icdContext)
      Creates an ElementalDamageSource from an already existing DamageSource.
      Parameters:
      source - The DamageSource to turn into an ElementalDamageSource, using its source and attacker values. For positions, use ElementalDamageSource(RegistryEntry, Vec3d, ElementalApplication, InternalCooldownContext) instead.
      application - The Elemental Application of this ElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.
      icdContext - The InternalCooldownContext of this ElementalDamageSource. This controls the Internal Cooldown of specific attacks, as Internal Cooldowns are different between contexts.
    • ElementalDamageSource

      public ElementalDamageSource(RegistryEntry<DamageType> type, @Nullable @Nullable Entity source, @Nullable @Nullable Entity attacker, ElementalApplication application, InternalCooldownContext icdContext)
      Parameters:
      type - The damage type of this DamageSource.
      source - The source entity of this DamageSource. This is the entity that dealt the DMG. (ex. arrow, fireball)
      attacker - The attacker this DamageSource originated from. This is the entity that attacked. (ex. Skeleton, Ghast)
      application - The Elemental Application of this ElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.
      icdContext - The InternalCooldownContext of this ElementalDamageSource. This controls the Internal Cooldown of specific attacks, as Internal Cooldowns are different between contexts.
    • ElementalDamageSource

      public ElementalDamageSource(RegistryEntry<DamageType> type, Vec3d position, ElementalApplication application, InternalCooldownContext icdContext)
      Parameters:
      type - The damage type of this DamageSource.
      position - The position this DamageSource originated from.
      application - The Elemental Application of this ElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.
      icdContext - The InternalCooldownContext of this ElementalDamageSource. This controls the Internal Cooldown of specific attacks, as Internal Cooldowns are different between contexts.
    • ElementalDamageSource

      public ElementalDamageSource(RegistryEntry<DamageType> type, @Nullable @Nullable Entity attacker, ElementalApplication application, InternalCooldownContext icdContext)
      Parameters:
      type - The damage type of this DamageSource.
      attacker - The attacker this DamageSource originated from. This is the entity that attacked. (ex. Zombie, Creeper)
      application - The Elemental Application of this ElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.
      icdContext - The InternalCooldownContext of this ElementalDamageSource. This controls the Internal Cooldown of specific attacks, as Internal Cooldowns are different between contexts.
    • ElementalDamageSource

      public ElementalDamageSource(RegistryEntry<DamageType> type, ElementalApplication application, InternalCooldownContext icdContext)
      Parameters:
      type - The damage type of this DamageSource.
      application - The Elemental Application of this ElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.
      icdContext - The InternalCooldownContext of this ElementalDamageSource. This controls the Internal Cooldown of specific attacks, as Internal Cooldowns are different between contexts.
  • Method Details

    • of

      public static ElementalDamageSource of(DamageSource source, @Nullable @Nullable LivingEntity target)
      Creates a standard ElementalDamageSource from the provided DamageSource.

      The provided ElementalDamageSource will be of the Element.PHYSICAL element with 0.0 gauge units with an Internal Cooldown tag and type of InternalCooldownTag.NONE and InternalCooldownType.NONE, respectively.
      Parameters:
      source - The DamageSource to create a standard ElementalDamageSource out of.
      target - The target of the DamageSource.
    • shouldApplyDMGBonus

      public ElementalDamageSource shouldApplyDMGBonus(boolean dmgBonus)
      Sets whether the Elemental DMG Bonus% should be included in the DMG calculation for this ElementalDamageSource.
    • shouldApplyRES

      public ElementalDamageSource shouldApplyRES(boolean res)
      Sets whether the Elemental RES% should be included in the DMG calculation for this ElementalDamageSource.
    • shouldInfuse

      public ElementalDamageSource shouldInfuse(boolean infusion)
      Sets whether this ElementalDamageSource should be infusable with another Element, given that its Element is of the Element.PHYSICAL element.
    • getElementalApplication

      public ElementalApplication getElementalApplication()
    • getIcdContext

      public InternalCooldownContext getIcdContext()
    • getOriginalSource

      @Nullable public @Nullable DamageSource getOriginalSource()
      Returns the DamageSource that was used to create this ElementalDamageSource, or null if a DamageSource wasn't used.
    • applyDMGBonus

      public boolean applyDMGBonus()
    • applyRES

      public boolean applyRES()
    • shouldInfuse

      public boolean shouldInfuse()