Skip to content

API reference / @jsprismarine/loot / LootSequences

Class: LootSequences ​

Defined in: loot/src/random.ts:215

One stream per sequence id for one world, which is what Java's RandomSequences holds and saves with the world.

Rolling the same table twice must not replay the same draws, so a sequence is created once and then advances. Tables that name no sequence share one unkeyed stream, standing in for Java's level random.

Constructors ​

Constructor ​

new LootSequences(worldSeed): LootSequences

Defined in: loot/src/random.ts:219

Parameters ​

worldSeed ​

bigint

Returns ​

LootSequences

Properties ​

worldSeed ​

readonly worldSeed: bigint

Defined in: loot/src/random.ts:219

Methods ​

forSequence() ​

forSequence(sequence): RandomSource

Defined in: loot/src/random.ts:224

Returns the stream for a random_sequence id, creating it on first use.

Parameters ​

sequence ​

string | undefined

Returns ​

RandomSource


restoreState() ​

restoreState(state): void

Defined in: loot/src/random.ts:248

Restores streams from a JSON-parsed state after checking its seed and every sequence.

Parameters ​

state ​

unknown

Returns ​

void


saveState() ​

saveState(): LootSequencesState

Defined in: loot/src/random.ts:236

Captures every advanced sequence, including the shared unkeyed stream.

Returns ​

LootSequencesState