Skip to content

API reference / @jsprismarine/block-behaviors / VoxelDimension

Class: VoxelDimension ​

Defined in: block-behaviors/src/voxelWorld.ts:73

One dimension of a VoxelWorld.

The seeding methods (set, fill, addEntity, setPower, setLight, defineProperties, queueRandom) are the test's half of the interface; the rest is WorldActions as a behavior sees it.

Implements ​

Constructors ​

Constructor ​

new VoxelDimension(name): VoxelDimension

Defined in: block-behaviors/src/voxelWorld.ts:103

Parameters ​

name ​

string

The dimension identifier blocks in it report.

Returns ​

VoxelDimension

Properties ​

drops ​

readonly drops: RecordedDrop[] = []

Defined in: block-behaviors/src/voxelWorld.ts:75

Every item stack dropped, in order.


entities ​

readonly entities: RecordedEntity[] = []

Defined in: block-behaviors/src/voxelWorld.ts:83

Every entity spawned, in order, including removed ones.


hasBlockTag? ​

optional hasBlockTag?: (block, tag) => boolean | undefined

Defined in: block-behaviors/src/voxelWorld.ts:246

Whether a block is in a Java tag, installed by VoxelDimension.tag and absent until a test calls it.

A property rather than a method on purpose: a family reads the member being missing as "this host cannot answer tags" and takes its fallback, so a method that always existed and always answered no would take every family down the tag path with an empty stack.

Parameters ​

block ​

HookBlock

tag ​

string

Returns ​

boolean | undefined

Implementation of ​

WorldActions.hasBlockTag


name ​

readonly name: string

Defined in: block-behaviors/src/voxelWorld.ts:103

The dimension identifier blocks in it report.


notified ​

readonly notified: BlockPosition[] = []

Defined in: block-behaviors/src/voxelWorld.ts:85

Every position whose neighbors were notified, in order.


particles ​

readonly particles: RecordedEffect[] = []

Defined in: block-behaviors/src/voxelWorld.ts:79

Every particle emitted, in order.


scheduled ​

readonly scheduled: RecordedTick[] = []

Defined in: block-behaviors/src/voxelWorld.ts:81

Every tick requested, in order.


sounds ​

readonly sounds: RecordedEffect[] = []

Defined in: block-behaviors/src/voxelWorld.ts:77

Every sound played, in order.

Methods ​

addEntity() ​

addEntity(identifier, position, data?): number

Defined in: block-behaviors/src/voxelWorld.ts:155

Puts an entity in the world without spawning it through a behavior.

Parameters ​

identifier ​

string

position ​

BlockPosition

data? ​

BlockEntityData

Returns ​

number


block() ​

block(position): HookBlock

Defined in: block-behaviors/src/voxelWorld.ts:123

The block at a position, with air for a position nothing wrote.

Parameters ​

position ​

BlockPosition

Returns ​

HookBlock


defineLightDampening() ​

defineLightDampening(identifier, value): void

Defined in: block-behaviors/src/voxelWorld.ts:188

Sets the minecraft:light_dampening value a block type reports.

Parameters ​

identifier ​

string

value ​

number

Returns ​

void


defineProperties() ​

defineProperties(identifier, properties): void

Defined in: block-behaviors/src/voxelWorld.ts:193

Gives a block type the jsprismarine:block_properties the world reports for it.

Parameters ​

identifier ​

string

properties ​

Partial<BlockProperties>

Returns ​

void


dropItem() ​

dropItem(position, drop): void

Defined in: block-behaviors/src/voxelWorld.ts:254

Records a drop.

Parameters ​

position ​

BlockPosition

drop ​

ItemDrop

Returns ​

void

Implementation of ​

WorldActions.dropItem


entitiesAt() ​

entitiesAt(position): readonly WorldEntity[]

Defined in: block-behaviors/src/voxelWorld.ts:270

Every entity still in the world whose position floors to this block.

Parameters ​

position ​

BlockPosition

Returns ​

readonly WorldEntity[]

Implementation of ​

WorldActions.entitiesAt


fill() ​

fill(from, to, identifier, states?): void

Defined in: block-behaviors/src/voxelWorld.ts:112

Puts the same block in every position of an inclusive box.

Parameters ​

from ​

BlockPosition

to ​

BlockPosition

identifier ​

string

states? ​

BlockStates = {}

Returns ​

void


getBlock() ​

getBlock(position): HookBlock | undefined

Defined in: block-behaviors/src/voxelWorld.ts:223

The block at a position, with air for an unwritten one and undefined for an unloaded one.

Parameters ​

position ​

BlockPosition

Returns ​

HookBlock | undefined

Implementation of ​

WorldActions.getBlock


getBlockData() ​

getBlockData(position): BlockEntityData | undefined

Defined in: block-behaviors/src/voxelWorld.ts:298

The block entity data at a position.

Parameters ​

position ​

BlockPosition

Returns ​

BlockEntityData | undefined

Implementation of ​

WorldActions.getBlockData


identifierAt() ​

identifierAt(position): string

Defined in: block-behaviors/src/voxelWorld.ts:134

The identifier at a position, with AIR for an empty one.

Parameters ​

position ​

BlockPosition

Returns ​

string


lightDampeningOf() ​

lightDampeningOf(block): number

Defined in: block-behaviors/src/voxelWorld.ts:249

The light dampening a test gave a block type, or the vanilla default.

Parameters ​

block ​

HookBlock

Returns ​

number

Implementation of ​

WorldActions.lightDampeningOf


lightLevel() ​

lightLevel(position): number

Defined in: block-behaviors/src/voxelWorld.ts:341

The light a test set at a position, or full daylight.

Parameters ​

position ​

BlockPosition

Returns ​

number

Implementation of ​

WorldActions.lightLevel


notifyNeighbors() ​

notifyNeighbors(position): void

Defined in: block-behaviors/src/voxelWorld.ts:308

Records a neighbor notice.

Parameters ​

position ​

BlockPosition

Returns ​

void

Implementation of ​

WorldActions.notifyNeighbors


playSound() ​

playSound(position, sound): void

Defined in: block-behaviors/src/voxelWorld.ts:283

Records a sound.

Parameters ​

position ​

BlockPosition

sound ​

string

Returns ​

void

Implementation of ​

WorldActions.playSound


propertiesOf() ​

propertiesOf(identifier): BlockProperties

Defined in: block-behaviors/src/voxelWorld.ts:234

The properties a test gave a block type, or the component defaults.

Parameters ​

identifier ​

string

Returns ​

BlockProperties

Implementation of ​

WorldActions.propertiesOf


queueRandom() ​

queueRandom(...values): void

Defined in: block-behaviors/src/voxelWorld.ts:218

Queues the next values WorldActions.random returns, in order.

Parameters ​

values ​

...readonly number[]

Returns ​

void


random() ​

random(): number

Defined in: block-behaviors/src/voxelWorld.ts:346

The next queued chance value, then a repeatable sequence.

Returns ​

number

Implementation of ​

WorldActions.random


redstoneConductor() ​

redstoneConductor(position): boolean

Defined in: block-behaviors/src/voxelWorld.ts:336

Whether a test marked a position as conducting redstone.

Parameters ​

position ​

BlockPosition

Returns ​

boolean

Implementation of ​

WorldActions.redstoneConductor


redstoneDirectSignal() ​

redstoneDirectSignal(position, directionToSource): number

Defined in: block-behaviors/src/voxelWorld.ts:328

The directional strong signal a test set, or its weak signal.

Parameters ​

position ​

BlockPosition

directionToSource ​

"down" | "up" | "north" | "south" | "west" | "east"

Returns ​

number

Implementation of ​

WorldActions.redstoneDirectSignal


redstonePower() ​

redstonePower(position): number

Defined in: block-behaviors/src/voxelWorld.ts:313

The power a test set at a position, or none.

Parameters ​

position ​

BlockPosition

Returns ​

number

Implementation of ​

WorldActions.redstonePower


redstoneSignal() ​

redstoneSignal(position, directionToSource): number

Defined in: block-behaviors/src/voxelWorld.ts:323

The directional signal a test set, or the power reading for this position.

Parameters ​

position ​

BlockPosition

directionToSource ​

"down" | "up" | "north" | "south" | "west" | "east"

Returns ​

number

Implementation of ​

WorldActions.redstoneSignal


removeEntity() ​

removeEntity(entity): void

Defined in: block-behaviors/src/voxelWorld.ts:264

Marks an entity gone, keeping it in the recorded list.

Parameters ​

entity ​

number

Returns ​

void

Implementation of ​

WorldActions.removeEntity


scheduleTick() ​

scheduleTick(position, delay): void

Defined in: block-behaviors/src/voxelWorld.ts:293

Records a tick request.

Parameters ​

position ​

BlockPosition

delay ​

number

Returns ​

void

Implementation of ​

WorldActions.scheduleTick


set() ​

set(position, identifier, states?): void

Defined in: block-behaviors/src/voxelWorld.ts:106

Puts a block in the world without running any behavior.

Parameters ​

position ​

BlockPosition

identifier ​

string

states? ​

BlockStates = {}

Returns ​

void


setBlock() ​

setBlock(position, identifier, states?): void

Defined in: block-behaviors/src/voxelWorld.ts:229

Writes a block, which is what a behavior does to the world.

Parameters ​

position ​

BlockPosition

identifier ​

string

states? ​

BlockStates = {}

Returns ​

void

Implementation of ​

WorldActions.setBlock


setBlockData() ​

setBlockData(position, data): void

Defined in: block-behaviors/src/voxelWorld.ts:303

Replaces the block entity data at a position.

Parameters ​

position ​

BlockPosition

data ​

BlockEntityData

Returns ​

void

Implementation of ​

WorldActions.setBlockData


setDirectSignal() ​

setDirectSignal(position, directionToSource, level): void

Defined in: block-behaviors/src/voxelWorld.ts:172

Sets the directional strong signal WorldActions.redstoneDirectSignal reports.

Parameters ​

position ​

BlockPosition

directionToSource ​

"down" | "up" | "north" | "south" | "west" | "east"

level ​

number

Returns ​

void


setLight() ​

setLight(position, level): void

Defined in: block-behaviors/src/voxelWorld.ts:183

Sets the light level WorldActions.lightLevel reports; unset positions read 15.

Parameters ​

position ​

BlockPosition

level ​

number

Returns ​

void


setPower() ​

setPower(position, level): void

Defined in: block-behaviors/src/voxelWorld.ts:162

Sets the redstone power WorldActions.redstonePower reports.

Parameters ​

position ​

BlockPosition

level ​

number

Returns ​

void


setRedstoneConductor() ​

setRedstoneConductor(position, conductor?): void

Defined in: block-behaviors/src/voxelWorld.ts:177

Sets whether a position carries redstone power through its direct signal.

Parameters ​

position ​

BlockPosition

conductor? ​

boolean = true

Returns ​

void


setSignal() ​

setSignal(position, directionToSource, level): void

Defined in: block-behaviors/src/voxelWorld.ts:167

Sets the directional weak redstone signal WorldActions.redstoneSignal reports.

Parameters ​

position ​

BlockPosition

directionToSource ​

"down" | "up" | "north" | "south" | "west" | "east"

level ​

number

Returns ​

void


spawnEntity() ​

spawnEntity(position, identifier, data?): number

Defined in: block-behaviors/src/voxelWorld.ts:259

Records a spawn and returns the id it can be removed by.

Parameters ​

position ​

BlockPosition

identifier ​

string

data? ​

BlockEntityData

Returns ​

number

Implementation of ​

WorldActions.spawnEntity


spawnParticle() ​

spawnParticle(position, particle): void

Defined in: block-behaviors/src/voxelWorld.ts:288

Records a particle.

Parameters ​

position ​

BlockPosition

particle ​

string

Returns ​

void

Implementation of ​

WorldActions.spawnParticle


stateAt() ​

stateAt(position, name): BlockStateValue | undefined

Defined in: block-behaviors/src/voxelWorld.ts:139

One state value at a position.

Parameters ​

position ​

BlockPosition

name ​

string

Returns ​

BlockStateValue | undefined


tag() ​

tag(tag, ...identifiers): void

Defined in: block-behaviors/src/voxelWorld.ts:206

Puts block identifiers in a Java tag, which is what WorldActions.hasBlockTag then answers for.

A world nobody tags answers no tag at all rather than answering no: the member is optional, and a family reads "the host cannot say" differently from "the host says no". Naming one tag is what turns that on, so a test that cares states its own membership and every other test keeps the tagless world the fallback paths are written for.

Parameters ​

tag ​

string

identifiers ​

...readonly string[]

Returns ​

void


unload() ​

unload(position): void

Defined in: block-behaviors/src/voxelWorld.ts:150

Makes a position read as unloaded, which is what the server reports past the edge of the chunks it holds.

A behavior that treats an unloaded position as air gives a different answer at a chunk border than it does in the middle of one, and this is how a test says so.

Parameters ​

position ​

BlockPosition

Returns ​

void


willTickThisTick() ​

willTickThisTick(_position): boolean

Defined in: block-behaviors/src/voxelWorld.ts:318

Whether this voxel fixture marks the tick as part of the current batch.

Parameters ​

_position ​

BlockPosition

Returns ​

boolean

Implementation of ​

WorldActions.willTickThisTick