Class AbstractDamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>
- All Implemented Interfaces:
AbstractBuilder<T>
,DamageSource.DamageSourceBuilder<T,
,B> Builder<T,
,B> CopyableBuilder<T,
,B> ResettableBuilder<T,
B>
- Direct Known Subclasses:
AbstractEntityDamageSource.AbstractEntityDamageSourceBuilder
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected boolean
protected boolean
protected DamageType
protected @Nullable Double
protected boolean
protected boolean
protected boolean
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabsolute()
Sets whether thisDamageSource
's damage is absolute and will ignore potion effects and enchantments.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.Resets this builder to the values of the given built object.magical()
Sets thisDamageSource
as considered to be magical damage.reset()
Resets this builder to a "default" state such that there is no remaining data to set.Sets thisDamageSource
's damage to be scaled byDifficulty
.type
(DamageType damageType) Sets theDamageType
of this source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.spongepowered.api.event.cause.entity.damage.source.DamageSource.DamageSourceBuilder
build, type
-
Field Details
-
scales
protected boolean scales -
bypasses
protected boolean bypasses -
explosion
protected boolean explosion -
absolute
protected boolean absolute -
magical
protected boolean magical -
creative
protected boolean creative -
fire
protected boolean fire -
exhaustion
-
damageType
-
-
Constructor Details
-
AbstractDamageSourceBuilder
public AbstractDamageSourceBuilder()
-
-
Method Details
-
fire
Description copied from interface:DamageSource.DamageSourceBuilder
Sets thisDamageSource
's damage to be considered "fire" damage.- Specified by:
fire
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
scalesWithDifficulty
Description copied from interface:DamageSource.DamageSourceBuilder
Sets thisDamageSource
's damage to be scaled byDifficulty
.- Specified by:
scalesWithDifficulty
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
bypassesArmor
Description copied from interface:DamageSource.DamageSourceBuilder
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
DamageSource.DamageSourceBuilder.exhaustion(double)
.- Specified by:
bypassesArmor
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
explosion
Description copied from interface:DamageSource.DamageSourceBuilder
Sets thisDamageSource
as an explosion.- Specified by:
explosion
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
absolute
Description copied from interface:DamageSource.DamageSourceBuilder
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
DamageSource.DamageSourceBuilder.exhaustion(double)
.- Specified by:
absolute
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
magical
Description copied from interface:DamageSource.DamageSourceBuilder
Sets thisDamageSource
as considered to be magical damage. An example is potions.- Specified by:
magical
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
creative
Description copied from interface:DamageSource.DamageSourceBuilder
Sets thisDamageSource
as considered to damage creative, or otherwise "normally unharmable" players.- Specified by:
creative
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder
-
exhaustion
Description copied from interface:DamageSource.DamageSourceBuilder
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
DamageSource.DamageSourceBuilder.absolute()
orDamageSource.DamageSourceBuilder.bypassesArmor()
will set this 0 and if you don't this will default to 0.1.- Specified by:
exhaustion
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Parameters:
exhaustion
- The amount of exhaustion to add to the entity- Returns:
- This builder
-
type
Description copied from interface:DamageSource.DamageSourceBuilder
Sets theDamageType
of this source.This is required to be set.
- Specified by:
type
in interfaceDamageSource.DamageSourceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Parameters:
damageType
- The desired damage type- Returns:
- This builder
-
from
Description copied from interface:CopyableBuilder
Resets this builder to the values of the given built object.- Specified by:
from
in interfaceCopyableBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Parameters:
value
- The built object- Returns:
- This builder, for chaining
-
reset
Description copied from interface:Builder
Resets this builder to a "default" state such that there is no remaining data to set. This is to be the presumed "default" state.- Specified by:
reset
in interfaceBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Specified by:
reset
in interfaceResettableBuilder<T extends DamageSource,
B extends DamageSource.DamageSourceBuilder<T, B>> - Returns:
- This builder, for chaining
-