> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/newgen/api/net/minecraft/world/level/border/worldborder.md).

# WorldBorder

The border limiting the playable area of a world.

### Properties

#### centerX

> `readonly` **centerX**: `number`

The X coordinate of the border center.

***

#### centerZ

> `readonly` **centerZ**: `number`

The Z coordinate of the border center.

***

#### damagePerBlock

> `readonly` **damagePerBlock**: `number`

Damage per second for each block a player is beyond the safe zone.

***

#### maxX

> `readonly` **maxX**: `number`

The largest X inside the border.

***

#### maxZ

> `readonly` **maxZ**: `number`

The largest Z inside the border.

***

#### minX

> `readonly` **minX**: `number`

The smallest X inside the border.

***

#### minZ

> `readonly` **minZ**: `number`

The smallest Z inside the border.

***

#### safeZone

> `readonly` **safeZone**: `number`

How many blocks beyond the border a player takes no damage.

***

#### size

> `readonly` **size**: `number`

The current side length of the border in blocks.

***

#### targetSize

> `readonly` **targetSize**: `number`

The side length the border is shrinking or growing to, in blocks.

### Methods

#### clampToBounds()

> **clampToBounds**(`pos`): [`Vec3`](/newgen/api/net/minecraft/world/phys/vec3.md)

The closest point inside the border to a position.

**Parameters**

**pos**

[`Vec3`](/newgen/api/net/minecraft/world/phys/vec3.md)

The position.

**Returns**

[`Vec3`](/newgen/api/net/minecraft/world/phys/vec3.md)

***

#### getDistanceToBorder()

> **getDistanceToBorder**(`x`, `z`): `number`

The distance in blocks from a horizontal point to the nearest border edge; negative outside.

**Parameters**

**x**

`number`

X coordinate.

**z**

`number`

Z coordinate.

**Returns**

`number`

***

#### isPointWithinBounds()

> **isPointWithinBounds**(`x`, `z`): `boolean`

Whether a horizontal point is inside the border.

**Parameters**

**x**

`number`

X coordinate.

**z**

`number`

Z coordinate.

**Returns**

`boolean`

***

#### isWithinBounds()

> **isWithinBounds**(`pos`): `boolean`

Whether a block position is inside the border.

**Parameters**

**pos**

[`BlockPos`](/newgen/api/net/minecraft/core/blockpos.md)

The position.

**Returns**

`boolean`
