LootTable class

What a chest, a mob or a fishing line gives: every entry rolled once, in order, or one of them (LootTable.oneOf).

Constructors

LootTable(List<LootEntry> entries)
A table of entries, each rolled by its own chance.
const
LootTable.oneOf(List<LootEntry> entries)
A table that gives one of its entries or nothing: each entry's LootEntry.chance is its slice of one roll, in table order, and what the slices leave (1 less their sum) gives nothing. The slices sum to 1 at most (check).
const

Properties

entries → List<LootEntry>
The rows.
final
hashCode → int
The hash code for this object.
no setterinherited
oneOf → bool
Whether a roll gives one entry at most (LootTable.oneOf) rather than each by its own chance.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

check() → void
Throws ArgumentError for a oneOf table whose slices sum over 1. A table of entries rolled each by its own chance has nothing to check.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
roll(Random rng) → List<({int count, String id})>
The stacks of one roll with rng, in table order: of a oneOf table, one stack or none (and it checks first).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

seedFor(IVec3 at, int worldSeed) → int
A seed for the loot at at in a world of worldSeed: an explicit hash, the same in every process and on every peer (Dart's hashCode is seeded per run), so the same chest holds the same things for everyone.