Class ElementalDamageSource
java.lang.Object
net.minecraft.entity.damage.DamageSource
io.github.xrickastley.sevenelements.element.ElementalDamageSource
- All Implemented Interfaces:
IDamageSource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ElementalApplicationprivate booleanprivate booleanprivate final InternalCooldownContextprivate final @Nullable DamageSourceprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionElementalDamageSource(DamageSource source, ElementalApplication application, InternalCooldownContext icdContext) Creates anElementalDamageSourcefrom an already existingDamageSource.ElementalDamageSource(RegistryEntry<DamageType> type, ElementalApplication application, InternalCooldownContext icdContext) Creates anElementalDamageSource.ElementalDamageSource(RegistryEntry<DamageType> type, @Nullable Entity attacker, ElementalApplication application, InternalCooldownContext icdContext) Creates anElementalDamageSource.ElementalDamageSource(RegistryEntry<DamageType> type, @Nullable Entity source, @Nullable Entity attacker, ElementalApplication application, InternalCooldownContext icdContext) Creates anElementalDamageSource.ElementalDamageSource(RegistryEntry<DamageType> type, Vec3d position, ElementalApplication application, InternalCooldownContext icdContext) Creates anElementalDamageSource. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanapplyRES()@Nullable DamageSourceReturns theDamageSourcethat was used to create thisElementalDamageSource, ornullif aDamageSourcewasn't used.static ElementalDamageSourceof(DamageSource source, @Nullable LivingEntity target) Creates a standardElementalDamageSourcefrom the providedDamageSource.shouldApplyDMGBonus(boolean dmgBonus) Sets whether the Elemental DMG Bonus% should be included in the DMG calculation for thisElementalDamageSource.shouldApplyRES(boolean res) Sets whether the Elemental RES% should be included in the DMG calculation for thisElementalDamageSource.booleanshouldInfuse(boolean infusion) Sets whether thisElementalDamageSourceshould be infusable with another Element, given that its Element is of theElement.PHYSICALelement.Methods inherited from class net.minecraft.entity.damage.DamageSource
getAttacker, getDeathMessage, getExhaustion, getName, getPosition, getSource, getStoredPosition, getType, getTypeRegistryEntry, getWeaponStack, isDirect, isIn, isOf, isScaledWithDifficulty, isSourceCreativePlayer, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.xrickastley.sevenelements.interfaces.IDamageSource
sevenelements$displayDamage, sevenelements$shouldDisplayDamage
-
Field Details
-
original
-
application
-
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 anElementalDamageSourcefrom an already existingDamageSource.- Parameters:
source- TheDamageSourceto turn into anElementalDamageSource, using its source and attacker values. For positions, useElementalDamageSource(RegistryEntry, Vec3d, ElementalApplication, InternalCooldownContext)instead.application- The Elemental Application of thisElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.icdContext- TheInternalCooldownContextof thisElementalDamageSource. 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) Creates anElementalDamageSource.- Parameters:
type- The damage type of thisDamageSource.source- The source entity of thisDamageSource. This is the entity that dealt the DMG. (ex. arrow, fireball)attacker- The attacker thisDamageSourceoriginated from. This is the entity that attacked. (ex. Skeleton, Ghast)application- The Elemental Application of thisElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.icdContext- TheInternalCooldownContextof thisElementalDamageSource. 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) Creates anElementalDamageSource.- Parameters:
type- The damage type of thisDamageSource.position- The position thisDamageSourceoriginated from.application- The Elemental Application of thisElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.icdContext- TheInternalCooldownContextof thisElementalDamageSource. 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) Creates anElementalDamageSource.- Parameters:
type- The damage type of thisDamageSource.attacker- The attacker thisDamageSourceoriginated from. This is the entity that attacked. (ex. Zombie, Creeper)application- The Elemental Application of thisElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.icdContext- TheInternalCooldownContextof thisElementalDamageSource. 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) Creates anElementalDamageSource.- Parameters:
type- The damage type of thisDamageSource.application- The Elemental Application of thisElementalDamageSource. This is the Elemental Application that will be applied to the target entity, if possible.icdContext- TheInternalCooldownContextof thisElementalDamageSource. 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 standardElementalDamageSourcefrom the providedDamageSource.
The providedElementalDamageSourcewill be of theElement.PHYSICALelement with0.0gauge units with an Internal Cooldown tag and type ofInternalCooldownTag.NONEandInternalCooldownType.NONE, respectively.- Parameters:
source- TheDamageSourceto create a standardElementalDamageSourceout of.target- The target of theDamageSource.
-
shouldApplyDMGBonus
Sets whether the Elemental DMG Bonus% should be included in the DMG calculation for thisElementalDamageSource. -
shouldApplyRES
Sets whether the Elemental RES% should be included in the DMG calculation for thisElementalDamageSource. -
shouldInfuse
Sets whether thisElementalDamageSourceshould be infusable with another Element, given that its Element is of theElement.PHYSICALelement. -
getElementalApplication
-
getIcdContext
-
getOriginalSource
Returns theDamageSourcethat was used to create thisElementalDamageSource, ornullif aDamageSourcewasn't used. -
applyDMGBonus
public boolean applyDMGBonus() -
applyRES
public boolean applyRES() -
shouldInfuse
public boolean shouldInfuse()
-