public class WeightedList<U> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WeightedList.Entry<T> |
Modifier and Type | Field and Description |
---|---|
protected List<WeightedList.Entry<U>> |
entries |
private Random |
random |
Modifier | Constructor and Description |
---|---|
|
WeightedList() |
private |
WeightedList(List<WeightedList.Entry<U>> list) |
Modifier and Type | Method and Description |
---|---|
WeightedList<U> |
add(U item,
int weight) |
boolean |
isEmpty() |
static <U> com.mojang.serialization.Codec<WeightedList<U>> |
method_28338(com.mojang.serialization.Codec<U> codec) |
U |
pickRandom(Random random) |
WeightedList<U> |
shuffle() |
WeightedList<U> |
shuffle(Random random) |
Stream<U> |
stream() |
String |
toString() |
protected final List<WeightedList.Entry<U>> entries
private final Random random
public WeightedList()
private WeightedList(List<WeightedList.Entry<U>> list)
public static <U> com.mojang.serialization.Codec<WeightedList<U>> method_28338(com.mojang.serialization.Codec<U> codec)
public WeightedList<U> add(U item, int weight)
public WeightedList<U> shuffle()
public WeightedList<U> shuffle(Random random)
public boolean isEmpty()