public abstract class AbstractDamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>> extends Object implements DamageSource.DamageSourceBuilder<T,B>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
absolute |
protected boolean |
bypasses |
protected boolean |
creative |
protected DamageType |
damageType |
protected Double |
exhaustion |
protected boolean |
explosion |
protected boolean |
magical |
protected boolean |
scales |
| Constructor and Description |
|---|
AbstractDamageSourceBuilder() |
| Modifier and Type | Method and Description |
|---|---|
B |
absolute()
Sets whether this
DamageSource's damage is absolute and
will ignore potion effects and enchantments. |
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 |
from(T value)
Resets this builder to the values of the given built object.
|
B |
magical()
Sets this
DamageSource as considered to be magical
damage. |
B |
reset()
Resets this builder to a "default" state such that there is no
remaining data to set.
|
B |
scalesWithDifficulty()
Sets this
DamageSource's damage to be scaled
by Difficulty. |
B |
type(DamageType damageType)
Sets the
DamageType of this source. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildprotected boolean scales
protected boolean bypasses
protected boolean explosion
protected boolean absolute
protected boolean magical
protected boolean creative
protected DamageType damageType
public B scalesWithDifficulty()
DamageSource.DamageSourceBuilderDamageSource's damage to be scaled
by Difficulty.scalesWithDifficulty in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B bypassesArmor()
DamageSource.DamageSourceBuilderDamageSource 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).
bypassesArmor in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B explosion()
DamageSource.DamageSourceBuilderDamageSource as an explosion.explosion in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B absolute()
DamageSource.DamageSourceBuilderDamageSource'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).
absolute in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B magical()
DamageSource.DamageSourceBuilderDamageSource as considered to be magical
damage. An example is potions.magical in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B creative()
DamageSource.DamageSourceBuilderDamageSource as considered to damage creative, or
otherwise "normally unharmable" players.creative in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>public B exhaustion(double exhaustion)
DamageSource.DamageSourceBuilderDamageSource 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() or DamageSource.DamageSourceBuilder.bypassesArmor() will
set this 0 and if you don't this will default to 0.1.
exhaustion in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>exhaustion - The amount of exhaustion to add to the entitypublic B type(DamageType damageType)
DamageSource.DamageSourceBuilderDamageType of this source.
This is required to be set.
type in interface DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>damageType - The desired damage typepublic B from(T value)
ResettableBuilderfrom in interface ResettableBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>value - The built objectpublic B reset()
ResettableBuilderreset in interface ResettableBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>