Interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>
-
- All Superinterfaces:
Buildable.Builder<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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description B
absolute()
Sets whether thisDamageSource
's damage is absolute and will ignore potion effects and enchantments.T
build()
Builds an instance of this damage source, based on the values you inputted into the builder.B
bypassesArmor()
Sets thisDamageSource
as dealing damage that bypasses armor modifiers.B
creative()
Sets thisDamageSource
as considered to damage creative, or otherwise "normally unharmable" players.B
exhaustion(double exhaustion)
Sets the amount of exhaustion thisDamageSource
will add to the entity, generally only to players.B
explosion()
Sets thisDamageSource
as an explosion.B
fire()
Sets thisDamageSource
's damage to be considered "fire" damage.B
magical()
Sets thisDamageSource
as considered to be magical damage.B
scalesWithDifficulty()
Sets thisDamageSource
's damage to be scaled byDifficulty
.default B
type(Supplier<? extends DamageType> damageType)
Sets theDamageType
of this source.B
type(DamageType damageType)
Sets theDamageType
of this source.-
Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
-
-
-
Method Detail
-
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
B exhaustion(double 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
default B type(Supplier<? extends DamageType> damageType)
Sets theDamageType
of this source.This is required to be set.
- Parameters:
damageType
- The desired damage type- Returns:
- This builder
-
type
B type(DamageType damageType)
Sets theDamageType
of this source.This is required to be set.
- Parameters:
damageType
- The desired damage type- Returns:
- This builder
-
build
T build() throws IllegalStateException
Builds an instance of this damage source, based on the values you inputted into the builder.- Specified by:
build
in interfaceBuildable.Builder<T extends DamageSource>
- Returns:
- The resulting damage source
- Throws:
IllegalStateException
- If a value required to be set is not set
-
-