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 thisDamageSource
as dealing damage that bypasses armor modifiers.creative()
Sets thisDamageSource
as considered to damage creative, or otherwise "normally unharmable" players.exhaustion
(double exhaustion) Sets the amount of exhaustion thisDamageSource
will add to the entity, generally only to players.Sets thisDamageSource
as an explosion.fire()
Sets thisDamageSource
's damage to be considered "fire" damage.magical()
Sets thisDamageSource
as considered to be magical damage.Sets thisDamageSource
's damage to be scaled byDifficulty
.default B
type
(Supplier<? extends DamageType> damageType) Sets theDamageType
of this source.type
(DamageType damageType) Sets theDamageType
of 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 thisDamageSource
as 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 thisDamageSource
as 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 thisDamageSource
as considered to be magical damage. An example is potions.- Returns:
- This builder
-
creative
B creative()Sets thisDamageSource
as considered to damage creative, or otherwise "normally unharmable" players.- Returns:
- This builder
-
exhaustion
Sets the amount of exhaustion thisDamageSource
will 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 theDamageType
of this source.This is required to be set.
- Parameters:
damageType
- The desired damage type- Returns:
- This builder
-
type
Sets theDamageType
of 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:
build
in interfaceAbstractBuilder<T extends DamageSource>
- Returns:
- The resulting damage source
- Throws:
IllegalStateException
- If a value required to be set is not set
-