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
readonlydrops:RecordedDrop[] =[]
Defined in: block-behaviors/src/voxelWorld.ts:75
Every item stack dropped, in order.
entities
readonlyentities:RecordedEntity[] =[]
Defined in: block-behaviors/src/voxelWorld.ts:83
Every entity spawned, in order, including removed ones.
hasBlockTag?
optionalhasBlockTag?: (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
tag
string
Returns
boolean | undefined
Implementation of
name
readonlyname:string
Defined in: block-behaviors/src/voxelWorld.ts:103
The dimension identifier blocks in it report.
notified
readonlynotified:BlockPosition[] =[]
Defined in: block-behaviors/src/voxelWorld.ts:85
Every position whose neighbors were notified, in order.
particles
readonlyparticles:RecordedEffect[] =[]
Defined in: block-behaviors/src/voxelWorld.ts:79
Every particle emitted, in order.
scheduled
readonlyscheduled:RecordedTick[] =[]
Defined in: block-behaviors/src/voxelWorld.ts:81
Every tick requested, in order.
sounds
readonlysounds: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
data?
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
Returns
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
drop
Returns
void
Implementation of
entitiesAt()
entitiesAt(
position): readonlyWorldEntity[]
Defined in: block-behaviors/src/voxelWorld.ts:270
Every entity still in the world whose position floors to this block.
Parameters
position
Returns
readonly WorldEntity[]
Implementation of
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
to
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
Returns
HookBlock | undefined
Implementation of
getBlockData()
getBlockData(
position):BlockEntityData|undefined
Defined in: block-behaviors/src/voxelWorld.ts:298
The block entity data at a position.
Parameters
position
Returns
BlockEntityData | undefined
Implementation of
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
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
Returns
number
Implementation of
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
Returns
number
Implementation of
notifyNeighbors()
notifyNeighbors(
position):void
Defined in: block-behaviors/src/voxelWorld.ts:308
Records a neighbor notice.
Parameters
position
Returns
void
Implementation of
playSound()
playSound(
position,sound):void
Defined in: block-behaviors/src/voxelWorld.ts:283
Records a sound.
Parameters
position
sound
string
Returns
void
Implementation of
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
Implementation of
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
redstoneConductor()
redstoneConductor(
position):boolean
Defined in: block-behaviors/src/voxelWorld.ts:336
Whether a test marked a position as conducting redstone.
Parameters
position
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
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
Returns
number
Implementation of
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
directionToSource
"down" | "up" | "north" | "south" | "west" | "east"
Returns
number
Implementation of
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
scheduleTick()
scheduleTick(
position,delay):void
Defined in: block-behaviors/src/voxelWorld.ts:293
Records a tick request.
Parameters
position
delay
number
Returns
void
Implementation of
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
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
identifier
string
states?
BlockStates = {}
Returns
void
Implementation of
setBlockData()
setBlockData(
position,data):void
Defined in: block-behaviors/src/voxelWorld.ts:303
Replaces the block entity data at a position.
Parameters
position
data
Returns
void
Implementation of
setDirectSignal()
setDirectSignal(
position,directionToSource,level):void
Defined in: block-behaviors/src/voxelWorld.ts:172
Sets the directional strong signal WorldActions.redstoneDirectSignal reports.
Parameters
position
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
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
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
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
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
identifier
string
data?
Returns
number
Implementation of
spawnParticle()
spawnParticle(
position,particle):void
Defined in: block-behaviors/src/voxelWorld.ts:288
Records a particle.
Parameters
position
particle
string
Returns
void
Implementation of
stateAt()
stateAt(
position,name):BlockStateValue|undefined
Defined in: block-behaviors/src/voxelWorld.ts:139
One state value at a position.
Parameters
position
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
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
Returns
boolean