Skip to content

border

WorldBorder

Python
WorldBorder(
    center: Vector2D,
    current_diameter: float,
    target_diameter: float,
    speed: int,
    portal_teleport_boundary: int,
    warning_time: int = 15,
    warning_blocks: int = 5,
)

Minecraft World Border representation and packet parser.

ATTRIBUTE DESCRIPTION
center

Center position of the world border

TYPE: Vector2D

current_diameter

Current diameter of the world border in blocks

TYPE: float

target_diameter

Target diameter when lerping/resizing

TYPE: float

speed

Time in milliseconds to reach target diameter

TYPE: int

portal_teleport_boundary

Portal teleport boundary limit (usually 29999984)

TYPE: int

warning_time

Warning time in seconds

TYPE: int

warning_blocks

Warning distance in blocks

TYPE: int

from_coordinates classmethod

Python
from_coordinates(
    center_x: float,
    center_z: float,
    current_diameter: float,
    target_diameter: float,
    speed: int,
    portal_teleport_boundary: int,
    warning_time: int = 15,
    warning_blocks: int = 5,
) -> "WorldBorder"

Create WorldBorder from separate x and z coordinates.

PARAMETER DESCRIPTION
center_x

X coordinate of border center

TYPE: float

center_z

Z coordinate of border center

TYPE: float

current_diameter

Current diameter of the world border in blocks

TYPE: float

target_diameter

Target diameter when lerping/resizing

TYPE: float

speed

Time in milliseconds to reach target diameter

TYPE: int

portal_teleport_boundary

Portal teleport boundary limit (usually 29999984)

TYPE: int

warning_time

Warning time in seconds (default: 15)

TYPE: int DEFAULT: 15

warning_blocks

Warning distance in blocks (default: 5)

TYPE: int DEFAULT: 5

RETURNS DESCRIPTION
WorldBorder

New WorldBorder instance

current_radius

Python
current_radius() -> float

Get current radius of the border.

RETURNS DESCRIPTION
float

Current radius in blocks

target_radius

Python
target_radius() -> float

Get target radius of the border.

RETURNS DESCRIPTION
float

Target radius in blocks

is_resizing

Python
is_resizing() -> bool

Check if border is currently resizing.

RETURNS DESCRIPTION
bool

True if current diameter differs from target diameter

is_shrinking

Python
is_shrinking() -> bool

Check if border is shrinking.

RETURNS DESCRIPTION
bool

True if target diameter is smaller than current diameter

is_expanding

Python
is_expanding() -> bool

Check if border is expanding.

RETURNS DESCRIPTION
bool

True if target diameter is larger than current diameter

distance_to_border

Python
distance_to_border(position: Vector2D) -> float

Calculate distance from a position to the border edge.

PARAMETER DESCRIPTION
position

Position to check

TYPE: Vector2D

RETURNS DESCRIPTION
float

Distance to border edge (positive = inside, negative = outside)

distance_to_border_coords

Python
distance_to_border_coords(coords: Vector2D) -> float

Calculate distance from coordinates to the border edge.

PARAMETER DESCRIPTION
coords

Position coordinates to check

TYPE: Vector2D

RETURNS DESCRIPTION
float

Distance to border edge (positive = inside, negative = outside)

is_inside_border

Python
is_inside_border(position: Vector2D) -> bool

Check if a position is inside the border.

PARAMETER DESCRIPTION
position

Position to check

TYPE: Vector2D

RETURNS DESCRIPTION
bool

True if position is inside the border

is_inside_border_coords

Python
is_inside_border_coords(coords: Vector2D) -> bool

Check if coordinates are inside the border.

PARAMETER DESCRIPTION
coords

Position coordinates to check

TYPE: Vector2D

RETURNS DESCRIPTION
bool

True if position is inside the border

is_in_warning_zone

Python
is_in_warning_zone(position: Vector2D) -> bool

Check if a position is in the warning zone.

PARAMETER DESCRIPTION
position

Position to check

TYPE: Vector2D

RETURNS DESCRIPTION
bool

True if position is within warning distance of border

is_in_warning_zone_coords

Python
is_in_warning_zone_coords(coords: Vector2D) -> bool

Check if coordinates are in the warning zone.

PARAMETER DESCRIPTION
coords

Position coordinates to check

TYPE: Vector2D

RETURNS DESCRIPTION
bool

True if position is within warning distance of border

get_warning_level

Python
get_warning_level(position: Vector2D) -> float

Get warning level for a position (0.0 to 1.0). Based on Notchian client warning calculation.

PARAMETER DESCRIPTION
position

Position to check

TYPE: Vector2D

RETURNS DESCRIPTION
float

Warning level from 0.0 (no warning) to 1.0 (maximum warning)

get_warning_level_coords

Python
get_warning_level_coords(coords: Vector2D) -> float

Get warning level for coordinates (0.0 to 1.0). Based on Notchian client warning calculation.

PARAMETER DESCRIPTION
coords

Position coordinates to check

TYPE: Vector2D

RETURNS DESCRIPTION
float

Warning level from 0.0 (no warning) to 1.0 (maximum warning)

set_center

Python
set_center(center: Vector2D) -> None

Set border center position.

PARAMETER DESCRIPTION
center

New center position

TYPE: Vector2D

set_center_coords

Python
set_center_coords(coords: Vector2D) -> None

Set border center position from coordinates.

PARAMETER DESCRIPTION
coords

New center position coordinates

TYPE: Vector2D

set_size

Python
set_size(diameter: float) -> None

Set border size immediately.

PARAMETER DESCRIPTION
diameter

New diameter in blocks

TYPE: float

lerp_size

Python
lerp_size(
    old_diameter: float, new_diameter: float, speed: int
) -> None

Start border size interpolation.

PARAMETER DESCRIPTION
old_diameter

Starting diameter

TYPE: float

new_diameter

Target diameter

TYPE: float

speed

Time in milliseconds to reach target

TYPE: int

set_warning_time

Python
set_warning_time(warning_time: int) -> None

Set warning time.

PARAMETER DESCRIPTION
warning_time

Warning time in seconds

TYPE: int

set_warning_blocks

Python
set_warning_blocks(warning_blocks: int) -> None

Set warning distance.

PARAMETER DESCRIPTION
warning_blocks

Warning distance in blocks

TYPE: int