public static interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>> extends ResettableBuilder<T,B>
Modifier and Type | Method and Description |
---|---|
B |
absolute()
Sets whether this
DamageSource '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 this
DamageSource as dealing damage that
bypasses armor modifiers. |
B |
creative()
Sets this
DamageSource as considered to damage creative, or
otherwise "normally unharmable" players. |
B |
exhaustion(double exhaustion)
Sets the amount of exhaustion this
DamageSource will
add to the entity, generally only to players. |
B |
explosion()
Sets this
DamageSource as an explosion. |
B |
magical()
Sets this
DamageSource as considered to be magical
damage. |
B |
scalesWithDifficulty()
Sets this
DamageSource 's damage to be scaled
by Difficulty . |
B |
type(DamageType damageType)
Sets the
DamageType of this source. |
from, reset
B scalesWithDifficulty()
DamageSource
's damage to be scaled
by Difficulty
.B bypassesArmor()
DamageSource
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)
.
B explosion()
DamageSource
as an explosion.B absolute()
DamageSource
'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)
.
B magical()
DamageSource
as considered to be magical
damage. An example is potions.B creative()
DamageSource
as considered to damage creative, or
otherwise "normally unharmable" players.B exhaustion(double exhaustion)
DamageSource
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()
or bypassesArmor()
will
set this 0 and if you don't this will default to 0.1.
exhaustion
- The amount of exhaustion to add to the entityB type(DamageType damageType)
DamageType
of this source.
This is required to be set.
damageType
- The desired damage typeT build() throws IllegalStateException
IllegalStateException
- If a value required to be set
is not set