Interface WorldBorder
-
public interface WorldBorderA 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 interfaceWorldBorder.Builder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static WorldBorder.Builderbuilder()Creates a newWorldBorder.Builderinstance for makingWorldBorders.Vector2dcenter()Gets the center of the world border.doubledamagePerBlock()Gets the damage done to a player per block per tick when outside the buffer.static WorldBorderdefaultBorder()Gets aWorldBorderthat represents the default border values for a newly created overworld.doublediameter()Gets the current diameter of this world border.doublesafeZone()Gets the distance a player may be outside the world border before taking damage.doubletargetDiameter()Gets the target diameter the world border is expanding or contracting to.java.time.DurationtimeUntilTargetDiameter()Gets the time remaining until the world border stops expanding or contracting to thetargetDiameter().default WorldBorder.BuildertoBuilder()Creates a newWorldBorder.Builderinstance for makingWorldBorders, pre-populated with the values of this border.intwarningDistance()Gets the distance when a contracting world border will warn a player for whom the world border isdistanceaway.java.time.DurationwarningTime()Gets the time when a contracting world border will warn a player for whom the world border will reach intimeseconds.
-
-
-
Method Detail
-
builder
static WorldBorder.Builder builder()
Creates a newWorldBorder.Builderinstance for makingWorldBorders.- Returns:
- The builder
-
defaultBorder
static WorldBorder defaultBorder()
Gets aWorldBorderthat represents the default border values for a newly created overworld.- Returns:
- A
WorldBorderthat represents the default values
-
toBuilder
default WorldBorder.Builder toBuilder()
Creates a newWorldBorder.Builderinstance for makingWorldBorders, 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
java.time.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
java.time.Duration warningTime()
Gets the time when a contracting world border will warn a player for whom the world border will reach intimeseconds.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 isdistanceaway.In Minecraft, the warning is displayed in the form of a reddish tint.
- Returns:
- The distance
-
-