Skip to content

@minecraft/server


@minecraft/server / BlockVolume

Class: BlockVolume ​

Defined in: @minecraft/server/index.d.ts:5839

A BlockVolume is a simple interface to an object which represents a 3D rectangle of a given size (in blocks) at a world block location. Note that these are not analogous to "min" and "max" values, in that the vector components are not guaranteed to be in any order. In addition, these vector positions are not interchangeable with BlockLocation. If you want to get this volume represented as range of of BlockLocations, you can use the getBoundingBox utility function. This volume class will maintain the ordering of the corner indexes as initially set. imagine that each corner is assigned in Editor - as you move the corner around (potentially inverting the min/max relationship of the bounds) - what you had originally selected as the top/left corner would traditionally become the bottom/right. When manually editing these kinds of volumes, you need to maintain the identity of the corner as you edit - the BlockVolume utility functions do this.

Important to note that this measures block sizes (to/from) - a normal AABB (0,0,0) to (0,0,0) would traditionally be of size (0,0,0) However, because we're measuring blocks - the size or span of a BlockVolume would actually be (1,1,1)

Extends ​

Constructors ​

Constructor ​

new BlockVolume(from, to): BlockVolume

Defined in: @minecraft/server/index.d.ts:5854

Parameters ​

from ​

Vector3

to ​

Vector3

Returns ​

BlockVolume

Overrides ​

BlockVolumeBase.constructor

Properties ​

from ​

from: Vector3

Defined in: @minecraft/server/index.d.ts:5846

Remarks ​

A world block location that represents a corner in a 3D rectangle


to ​

to: Vector3

Defined in: @minecraft/server/index.d.ts:5853

Remarks ​

A world block location that represents the opposite corner in a 3D rectangle

Methods ​

doesLocationTouchFaces() ​

doesLocationTouchFaces(pos): boolean

Defined in: @minecraft/server/index.d.ts:5869

Parameters ​

pos ​

Vector3

The world block location to test

Returns ​

boolean

If the location is either inside or more than 0 blocks away, the function will return false. If the location is directly contacting the outer surface of the BlockVolume, the function will return true.

Remarks ​

Check to see if the given location is directly adjacent to the outer surface of a BlockVolume.


doesVolumeTouchFaces() ​

doesVolumeTouchFaces(other): boolean

Defined in: @minecraft/server/index.d.ts:5881

Parameters ​

other ​

BlockVolume

The volume to test

Returns ​

boolean

If the outer faces of both block volumes touch and are directly adjacent at any point, return true.

Remarks ​

Check to see if a two block volumes are directly adjacent and two faces touch.


getBlockLocationIterator() ​

getBlockLocationIterator(): BlockLocationIterator

Defined in: @minecraft/server/index.d.ts:5902

Returns ​

BlockLocationIterator

Remarks ​

Fetch a BlockLocationIterator that represents all of the block world locations within the specified volume

Inherited from ​

BlockVolumeBase.getBlockLocationIterator


getCapacity() ​

getCapacity(): number

Defined in: @minecraft/server/index.d.ts:5908

Returns ​

number

Remarks ​

Return the capacity (volume) of the BlockVolume (WDH)

Inherited from ​

BlockVolumeBase.getCapacity


getMax() ​

getMax(): Vector3

Defined in: @minecraft/server/index.d.ts:5916

Returns ​

Vector3

Remarks ​

Get the largest corner position of the volume (guaranteed to be >= min)

Throws ​

This function can throw errors.

Inherited from ​

BlockVolumeBase.getMax


getMin() ​

getMin(): Vector3

Defined in: @minecraft/server/index.d.ts:5924

Returns ​

Vector3

Remarks ​

Get the smallest corner position of the volume (guaranteed to be <= max)

Throws ​

This function can throw errors.

Inherited from ​

BlockVolumeBase.getMin


getSpan() ​

getSpan(): Vector3

Defined in: @minecraft/server/index.d.ts:5931

Returns ​

Vector3

Remarks ​

Get a Vector3 object where each component represents the number of blocks along that axis

Inherited from ​

BlockVolumeBase.getSpan


intersects() ​

intersects(other): BlockVolumeIntersection

Defined in: @minecraft/server/index.d.ts:5888

Parameters ​

other ​

BlockVolume

Returns ​

BlockVolumeIntersection

Remarks ​

Return an enumeration which represents the intersection between two BlockVolume objects


isInside() ​

isInside(location): boolean

Defined in: @minecraft/server/index.d.ts:5938

Parameters ​

location ​

Vector3

Returns ​

boolean

Remarks ​

Check to see if a given world block location is inside a BlockVolume

Inherited from ​

BlockVolumeBase.isInside


translate() ​

translate(delta): void

Defined in: @minecraft/server/index.d.ts:5946

Parameters ​

delta ​

Vector3

Amount of blocks to move by

Returns ​

void

Remarks ​

Move a BlockVolume by a specified amount

Inherited from ​

BlockVolumeBase.translate