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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
WorldBorder.Builder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static WorldBorder.Builder
builder()
Creates a newWorldBorder.Builder
instance for makingWorldBorder
s.Vector2d
center()
Gets the center of the world border.double
damagePerBlock()
Gets the damage done to a player per block per tick when outside the buffer.static WorldBorder
defaultBorder()
Gets aWorldBorder
that represents the default border values for a newly created overworld.double
diameter()
Gets the current diameter of this world border.double
safeZone()
Gets the distance a player may be outside the world border before taking damage.double
targetDiameter()
Gets the target diameter the world border is expanding or contracting to.Duration
timeUntilTargetDiameter()
Gets the time remaining until the world border stops expanding or contracting to thetargetDiameter()
.default WorldBorder.Builder
toBuilder()
Creates a newWorldBorder.Builder
instance for makingWorldBorder
s, pre-populated with the values of this border.int
warningDistance()
Gets the distance when a contracting world border will warn a player for whom the world border isdistance
away.Duration
warningTime()
Gets the time when a contracting world border will warn a player for whom the world border will reach intime
seconds.
-
-
-
Method Detail
-
builder
static WorldBorder.Builder builder()
Creates a newWorldBorder.Builder
instance for makingWorldBorder
s.- Returns:
- The builder
-
defaultBorder
static WorldBorder defaultBorder()
Gets aWorldBorder
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 newWorldBorder.Builder
instance for makingWorldBorder
s, 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 throughVector2d.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()
unlesstimeUntilTargetDiameter()
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 thetargetDiameter()
.If
diameter()
andtargetDiameter()
are the same, this will beDuration.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 intime
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 isdistance
away.In Minecraft, the warning is displayed in the form of a reddish tint.
- Returns:
- The distance
-
-