Modifier and Type | Field and Description |
---|---|
private Function<CompoundTag,T> |
elementDeserializer |
private Function<T,CompoundTag> |
elementSerializer |
private IdList<T> |
idList |
private int |
indexBits |
private Int2ObjectBiMap<T> |
map |
private PaletteResizeListener<T> |
resizeHandler |
Constructor and Description |
---|
BiMapPalette(IdList<T> idList,
int indexBits,
PaletteResizeListener<T> resizeHandler,
Function<CompoundTag,T> elementDeserializer,
Function<T,CompoundTag> elementSerializer) |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(Predicate<T> predicate) |
void |
fromPacket(PacketByteBuf buf) |
void |
fromTag(ListTag tag) |
T |
getByIndex(int index) |
int |
getIndex(T object) |
int |
getIndexBits() |
int |
getPacketSize() |
void |
toPacket(PacketByteBuf buf) |
void |
toTag(ListTag tag) |
private final Int2ObjectBiMap<T> map
private final PaletteResizeListener<T> resizeHandler
private final Function<CompoundTag,T> elementDeserializer
private final Function<T,CompoundTag> elementSerializer
private final int indexBits
public BiMapPalette(IdList<T> idList, int indexBits, PaletteResizeListener<T> resizeHandler, Function<CompoundTag,T> elementDeserializer, Function<T,CompoundTag> elementSerializer)
@Nullable public T getByIndex(int index)
getByIndex
in interface Palette<T>
@Environment(value=CLIENT) public void fromPacket(PacketByteBuf buf)
fromPacket
in interface Palette<T>
public void toPacket(PacketByteBuf buf)
public int getPacketSize()
getPacketSize
in interface Palette<T>
public int getIndexBits()
public void toTag(ListTag tag)