Interface WorldBorder


public interface WorldBorder
A world border is a square boundary, extending through the entire y-axis.

It can gradually grow or shrink to a radius over a period of time. A warning is displayed when a contracting world border will reach the player in a certain amount of time, or when the player is a certain number of blocks away.

In Minecraft, a warning is displayed in the form of a reddish tint.

  • Method Details

    • builder

      static WorldBorder.Builder builder()
      Creates a new WorldBorder.Builder instance for making WorldBorders.
      Returns:
      The builder
    • defaultBorder

      static WorldBorder defaultBorder()
      Gets a WorldBorder that represents the default border values for a newly created overworld.
      Returns:
      A WorldBorder that represents the default values
    • toBuilder

      default WorldBorder.Builder toBuilder()
      Creates a new WorldBorder.Builder instance for making WorldBorders, pre-populated with the values of this border.
      Returns:
      The builder
    • center

      Vector2d center()
      Gets the center of the world border.

      The x coordinated can be retrieved through Vector2d.x(), while the z coordinated can be retrieved through Vector2d.y().

      Returns:
      The center
    • diameter

      double diameter()
      Gets the current diameter of this world border. If this is an immutable border, this is the initial diameter.

      The returned diameter applies to the x and z axis. The world border extends over the entire y-axis.

      Returns:
      The size
    • targetDiameter

      double targetDiameter()
      Gets the target diameter the world border is expanding or contracting to.

      This will return the same value as diameter() unless timeUntilTargetDiameter() is greater than 0.

      Returns:
      The diameter being changed to
    • timeUntilTargetDiameter

      Duration timeUntilTargetDiameter()
      Gets the time remaining until the world border stops expanding or contracting to the targetDiameter().

      If diameter() and targetDiameter() are the same, this will be Duration.ZERO.

      Returns:
      The time remaining
    • safeZone

      double safeZone()
      Gets the distance a player may be outside the world border before taking damage.
      Returns:
      The distance
    • damagePerBlock

      double damagePerBlock()
      Gets the damage done to a player per block per tick when outside the buffer.
      Returns:
      The damage amount
    • warningTime

      Duration warningTime()
      Gets the time when a contracting world border will warn a player for whom the world border will reach in time seconds.

      In Minecraft, the warning is displayed in the form of a reddish tint.

      Returns:
      The warning time
    • warningDistance

      int warningDistance()
      Gets the distance when a contracting world border will warn a player for whom the world border is distance away.

      In Minecraft, the warning is displayed in the form of a reddish tint.

      Returns:
      The distance