Skip to content

API reference Obsidian.API.World.Features

WeightedEntry<T> class

An entry of a vanilla weighted list ({"data": ..., "weight": n}).

public sealed class WeightedEntry<T>

In Obsidian.API.

Constructors

public WeightedEntry();

Properties

public required T Data { get; init; }public required int Weight { get; init; }

Methods

Pick(ReadOnlySpan<WeightedEntry<T>>, IRandomSource)

public static T Pick(ReadOnlySpan<WeightedEntry<T>> entries, IRandomSource random);

Picks an entry like vanilla's WeightedList.getRandomOrThrow: one nextInt(totalWeight) draw, walking the cumulative weights in list order.

On this page