Interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>
- All Superinterfaces:
AbstractBuilder<T>,Builder<T,,B> CopyableBuilder<T,,B> ResettableBuilder<T,B>
- All Known Subinterfaces:
BlockDamageSource.Builder,DamageSource.Builder,EntityDamageSource.Builder,EntityDamageSource.EntityDamageSourceBuilder<T,,B> FallingBlockDamageSource.Builder,IndirectEntityDamageSource.AbstractBuilder<T,,B> IndirectEntityDamageSource.Builder
- All Known Implementing Classes:
AbstractDamageSourceBuilder,AbstractEntityDamageSource.AbstractEntityDamageSourceBuilder,AbstractIndirectEntityDamageSource.AbstractIndirectEntityDamageSourceBuilder
- Enclosing interface:
- DamageSource
public static interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>
extends Builder<T,B>, CopyableBuilder<T,B>
-
Method Summary
Modifier and TypeMethodDescriptionabsolute()Sets whether thisDamageSource's damage is absolute and will ignore potion effects and enchantments.build()Builds an instance of this damage source, based on the values you inputted into the builder.Sets thisDamageSourceas dealing damage that bypasses armor modifiers.creative()Sets thisDamageSourceas considered to damage creative, or otherwise "normally unharmable" players.exhaustion(double exhaustion) Sets the amount of exhaustion thisDamageSourcewill add to the entity, generally only to players.Sets thisDamageSourceas an explosion.fire()Sets thisDamageSource's damage to be considered "fire" damage.magical()Sets thisDamageSourceas considered to be magical damage.Sets thisDamageSource's damage to be scaled byDifficulty.default Btype(Supplier<? extends DamageType> damageType) Sets theDamageTypeof this source.type(DamageType damageType) Sets theDamageTypeof this source.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Method Details
-
fire
B fire()Sets thisDamageSource's damage to be considered "fire" damage.- Returns:
- This builder
-
scalesWithDifficulty
B scalesWithDifficulty()Sets thisDamageSource's damage to be scaled byDifficulty.- Returns:
- This builder
-
bypassesArmor
B bypassesArmor()Sets thisDamageSourceas dealing damage that bypasses armor modifiers.This sets the exhaustion increase caused by this source to 0. You can override this with
exhaustion(double).- Returns:
- This builder
-
explosion
B explosion()Sets thisDamageSourceas an explosion.- Returns:
- This builder
-
absolute
B absolute()Sets whether thisDamageSource's damage is absolute and will ignore potion effects and enchantments.This sets the exhaustion increase caused by this source to 0. You can override this with
exhaustion(double).- Returns:
- This builder
-
magical
B magical()Sets thisDamageSourceas considered to be magical damage. An example is potions.- Returns:
- This builder
-
creative
B creative()Sets thisDamageSourceas considered to damage creative, or otherwise "normally unharmable" players.- Returns:
- This builder
-
exhaustion
Sets the amount of exhaustion thisDamageSourcewill add to the entity, generally only to players.In vanilla gameplay, the default is 0.1, unless if the damage is absolute or bypasses armor, where the exhaustion gets set to 0. This builder follows this mechanic, but if you set the exhaustion through this method that will be overridden.
If you don't set this exhaustion manually, calling
absolute()orbypassesArmor()will set this 0 and if you don't this will default to 0.1.- Parameters:
exhaustion- The amount of exhaustion to add to the entity- Returns:
- This builder
-
type
Sets theDamageTypeof this source.This is required to be set.
- Parameters:
damageType- The desired damage type- Returns:
- This builder
-
type
Sets theDamageTypeof this source.This is required to be set.
- Parameters:
damageType- The desired damage type- Returns:
- This builder
-
build
Builds an instance of this damage source, based on the values you inputted into the builder.- Specified by:
buildin interfaceAbstractBuilder<T extends DamageSource>- Returns:
- The resulting damage source
- Throws:
IllegalStateException- If a value required to be set is not set
-