Interface WorldBorder.Builder

All Superinterfaces:
AbstractBuilder<WorldBorder>, Builder<WorldBorder,WorldBorder.Builder>, CopyableBuilder<WorldBorder,WorldBorder.Builder>, ResettableBuilder<WorldBorder,WorldBorder.Builder>
Enclosing interface:
WorldBorder

public static interface WorldBorder.Builder extends CopyableBuilder<WorldBorder,WorldBorder.Builder>, Builder<WorldBorder,WorldBorder.Builder>
  • Method Details

    • from

      Copies the required data from the passed WorldBorder.
      Specified by:
      from in interface CopyableBuilder<WorldBorder,WorldBorder.Builder>
      Parameters:
      border - The world border whose data is to be copied
      Returns:
      The builder, for chaining
    • overworldDefaults

      WorldBorder.Builder overworldDefaults()
      Sets all values in this builder to the default border for a standard Minecraft overworld.

      This is not the same as calling Builder.reset(), which unsets all values, requiring at a targetDiameter(double) to be set befor this can be built.

      Returns:
      This builder, for chaining.
    • center

      WorldBorder.Builder center(double x, double z)
      Sets the center of this world border.
      Parameters:
      x - The x-coordinate of the new centre
      z - The z-coordinate of the new centre
      Returns:
      The builder, for chaining
    • initialDiameter

      WorldBorder.Builder initialDiameter(double size)
      Sets the initial diameter of this world border.

      If this differs from the the value supplied to targetDiameter(double), then the border size starts at the diameter specified here, growing or shrinking at a constant speed for the time provided in timeToTargetDiameter(Duration) where it will stop at the supplied target. If the supplied time is zero or not given, then this value is ignored and the target diameter is used.

      If this is set but targetDiameter(double) has not, then this also sets that target diameter.

      Parameters:
      size - The diameter that this border will have when this WorldBorder is set.
      Returns:
      The builder, for chaining.
    • targetDiameter

      WorldBorder.Builder targetDiameter(double size)
      Sets the final diameter of this world border.

      If no timeToTargetDiameter(Duration) is set, or it is set to Duration.ZERO, then the initialDiameter(double) is ignored and this is the only diameter used.

      If this is set but initialDiameter(double) has not, then this also sets that initial diameter.

      Parameters:
      size - The diameter that this border will have.
      Returns:
      The builder, for chaining.
    • timeToTargetDiameter

      WorldBorder.Builder timeToTargetDiameter(Duration time)
      Sets how long this border will take to contract or expand from the initial diameter to its target diameter.
      Parameters:
      time - The time, as a Duration
      Returns:
      The builder, for chaining.
    • safeZone

      WorldBorder.Builder safeZone(double safeZone)
      Sets the distance beyond this world border that an entity may travel before incurring damage.
      Parameters:
      safeZone - The distance in blocks
      Returns:
      The builder, for chaining.
    • damagePerBlock

      WorldBorder.Builder damagePerBlock(double damagePerBlock)
      Sets the damage caused by being out of the world border.
      Parameters:
      damagePerBlock - The damage amount
      Returns:
      The builder, for chaining
    • warningTime

      WorldBorder.Builder warningTime(Duration warningTime)
      Sets the warning time of this world border.
      Parameters:
      warningTime - The warning time
      Returns:
      The builder, for chaining
    • warningDistance

      WorldBorder.Builder warningDistance(double warningDistance)
      Sets the warning distance of this world border.
      Parameters:
      warningDistance - The warning distance
      Returns:
      The builder, for chaining
    • build

      WorldBorder build()
      Builds the world border from the information given.
      Specified by:
      build in interface AbstractBuilder<WorldBorder>
      Returns:
      The built world border