Interface DamageSource.DamageSourceBuilder<T extends DamageSource,​B extends DamageSource.DamageSourceBuilder<T,​B>>

    • Method Detail

      • fire

        B fire()
        Sets this DamageSource's damage to be considered "fire" damage.
        Returns:
        This builder
      • scalesWithDifficulty

        B scalesWithDifficulty()
        Sets this DamageSource's damage to be scaled by Difficulty.
        Returns:
        This builder
      • bypassesArmor

        B bypassesArmor()
        Sets this 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).

        Returns:
        This builder
      • explosion

        B explosion()
        Sets this DamageSource as an explosion.
        Returns:
        This builder
      • absolute

        B absolute()
        Sets whether this 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).

        Returns:
        This builder
      • magical

        B magical()
        Sets this DamageSource as considered to be magical damage. An example is potions.
        Returns:
        This builder
      • creative

        B creative()
        Sets this DamageSource as considered to damage creative, or otherwise "normally unharmable" players.
        Returns:
        This builder
      • exhaustion

        B exhaustion​(double exhaustion)
        Sets the amount of exhaustion this 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.

        Parameters:
        exhaustion - The amount of exhaustion to add to the entity
        Returns:
        This builder
      • type

        default B type​(java.util.function.Supplier<? extends DamageType> damageType)
        Sets the DamageType of this source.

        This is required to be set.

        Parameters:
        damageType - The desired damage type
        Returns:
        This builder
      • type

        B type​(DamageType damageType)
        Sets the DamageType of this source.

        This is required to be set.

        Parameters:
        damageType - The desired damage type
        Returns:
        This builder
      • build

        T build()
         throws java.lang.IllegalStateException
        Builds an instance of this damage source, based on the values you inputted into the builder.
        Specified by:
        build in interface AbstractBuilder<T extends DamageSource>
        Specified by:
        build in interface Buildable.Builder<T extends DamageSource>
        Returns:
        The resulting damage source
        Throws:
        java.lang.IllegalStateException - If a value required to be set is not set