Skip to content

API reference / @jsprismarine/prismarine / world/dynamicProperties

world/dynamicProperties ​

Classes ​

Type Aliases ​

DynamicProperties ​

DynamicProperties = ReadonlyMap<string, PackProperties>

Defined in: packages/prismarine/src/world/dynamicProperties.ts:22

Every pack's properties of one owner, by pack UUID.


DynamicPropertyValue ​

DynamicPropertyValue = number | boolean | string | { x: number; y: number; z: number; }

Defined in: packages/prismarine/src/world/dynamicProperties.ts:15

A property's value: a double, a boolean, a string, or a vector of 32-bit floats.


PackProperties ​

PackProperties = ReadonlyMap<string, DynamicPropertyValue>

Defined in: packages/prismarine/src/world/dynamicProperties.ts:19

One pack's properties, by id, in the order they were first set.

Variables ​

DYNAMIC_PROPERTIES_TAG ​

const DYNAMIC_PROPERTIES_TAG: "DynamicProperties" = 'DynamicProperties'

Defined in: packages/prismarine/src/world/dynamicProperties.ts:25

The tag BDS names an actor's or an item's properties by.

Functions ​

dynamicPropertiesFromNbt() ​

dynamicPropertiesFromNbt(root): Map<string, Map<string, DynamicPropertyValue>>

Defined in: packages/prismarine/src/world/dynamicProperties.ts:75

Reads properties BDS or this server wrote, skipping an entry of a type no property has.

Parameters ​

root ​

NBTTagCompound

Returns ​

Map<string, Map<string, DynamicPropertyValue>>


dynamicPropertiesToNbt() ​

dynamicPropertiesToNbt(properties, name?): NBTTagCompound

Defined in: packages/prismarine/src/world/dynamicProperties.ts:62

Writes properties as BDS writes them: a compound per pack, and every entry in byte order of its name. A pack with no properties is left out.

Parameters ​

properties ​

DynamicProperties

name? ​

string = ''

The compound's own name: empty for the LevelDB record, the tag's name inside an actor or an item.

Returns ​

NBTTagCompound


withPropertyWrites() ​

withPropertyWrites(current, writes): Map<string, DynamicPropertyValue> | undefined

Defined in: packages/prismarine/src/world/dynamicProperties.ts:94

Applies writes to one pack's properties: each value replaces the property's and undefined deletes it.

Parameters ​

current ​

PackProperties | undefined

writes ​

ReadonlyMap<string, DynamicPropertyValue | undefined>

Returns ​

Map<string, DynamicPropertyValue> | undefined

The pack's properties after, or undefined when it has none left.