Package net.minecraft.util.random
Class WeightedList<E>
java.lang.Object
net.minecraft.util.random.WeightedList<E>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class(package private) static class(package private) static class(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final WeightedList.Selector<E> private final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> WeightedList.Builder<E> builder()static <E> com.mojang.serialization.Codec<WeightedList<E>> codec(com.mojang.serialization.Codec<E> pElementCodec) static <E> com.mojang.serialization.Codec<WeightedList<E>> codec(com.mojang.serialization.MapCodec<E> pElementCodec) booleanbooleangetRandom(RandomSource pRandom) getRandomOrThrow(RandomSource pRandom) inthashCode()booleanisEmpty()<T> WeightedList<T> static <E> com.mojang.serialization.Codec<WeightedList<E>> nonEmptyCodec(com.mojang.serialization.Codec<E> pElementCodec) static <E> com.mojang.serialization.Codec<WeightedList<E>> nonEmptyCodec(com.mojang.serialization.MapCodec<E> pElementCodec) static <E> WeightedList<E> of()static <E> WeightedList<E> of(E pElement) static <E> WeightedList<E> static <E> WeightedList<E> static <E,B extends io.netty.buffer.ByteBuf>
StreamCodec<B, WeightedList<E>> streamCodec(StreamCodec<B, E> pElementCodec) unwrap()
-
Field Details
-
FLAT_THRESHOLD
private static final int FLAT_THRESHOLD- See Also:
-
totalWeight
private final int totalWeight -
items
-
selector
-
-
Constructor Details
-
WeightedList
-
-
Method Details
-
of
-
of
-
of
-
of
-
builder
-
isEmpty
public boolean isEmpty() -
map
-
getRandom
-
getRandomOrThrow
-
unwrap
-
codec
public static <E> com.mojang.serialization.Codec<WeightedList<E>> codec(com.mojang.serialization.Codec<E> pElementCodec) -
codec
public static <E> com.mojang.serialization.Codec<WeightedList<E>> codec(com.mojang.serialization.MapCodec<E> pElementCodec) -
nonEmptyCodec
public static <E> com.mojang.serialization.Codec<WeightedList<E>> nonEmptyCodec(com.mojang.serialization.Codec<E> pElementCodec) -
nonEmptyCodec
public static <E> com.mojang.serialization.Codec<WeightedList<E>> nonEmptyCodec(com.mojang.serialization.MapCodec<E> pElementCodec) -
streamCodec
public static <E,B extends io.netty.buffer.ByteBuf> StreamCodec<B,WeightedList<E>> streamCodec(StreamCodec<B, E> pElementCodec) -
contains
-
equals
-
hashCode
public int hashCode()
-