public class PalettedContainer<T> extends Object implements PaletteResizeListener<T>
Modifier and Type | Class and Description |
---|---|
static interface |
PalettedContainer.CountConsumer<T> |
Modifier and Type | Field and Description |
---|---|
protected PackedIntegerArray |
data |
private T |
defaultValue |
private Function<CompoundTag,T> |
elementDeserializer |
private Function<T,CompoundTag> |
elementSerializer |
private Palette<T> |
fallbackPalette |
private IdList<T> |
idList |
private PaletteResizeListener<T> |
noOpPaletteResizeHandler |
private Palette<T> |
palette |
private int |
paletteSize |
private ReentrantLock |
writeLock |
Constructor and Description |
---|
PalettedContainer(Palette<T> fallbackPalette,
IdList<T> idList,
Function<CompoundTag,T> elementDeserializer,
Function<T,CompoundTag> elementSerializer,
T defaultElement) |
Modifier and Type | Method and Description |
---|---|
void |
count(PalettedContainer.CountConsumer<T> consumer) |
void |
fromPacket(PacketByteBuf buf) |
protected T |
get(int index) |
T |
get(int x,
int y,
int z) |
int |
getPacketSize() |
boolean |
hasAny(Predicate<T> predicate) |
void |
lock() |
int |
onResize(int newSize,
T objectAdded) |
void |
read(ListTag paletteTag,
long[] data) |
T |
set(int x,
int y,
int z,
T value) |
protected void |
set(int int2,
T t) |
protected T |
setAndGetOldValue(int index,
T value) |
private void |
setPaletteSize(int size) |
T |
setSync(int x,
int y,
int z,
T value) |
private static int |
toIndex(int x,
int y,
int z) |
void |
toPacket(PacketByteBuf buf) |
void |
unlock() |
void |
write(CompoundTag compoundTag,
String string,
String string2) |
private final PaletteResizeListener<T> noOpPaletteResizeHandler
private final Function<CompoundTag,T> elementDeserializer
private final Function<T,CompoundTag> elementSerializer
private final T defaultValue
protected PackedIntegerArray data
private int paletteSize
private final ReentrantLock writeLock
public void lock()
public void unlock()
private static int toIndex(int x, int y, int z)
private void setPaletteSize(int size)
public int onResize(int newSize, T objectAdded)
onResize
in interface PaletteResizeListener<T>
protected void set(int int2, T t)
public T get(int x, int y, int z)
protected T get(int index)
@Environment(value=CLIENT) public void fromPacket(PacketByteBuf buf)
public void toPacket(PacketByteBuf buf)
public void read(ListTag paletteTag, long[] data)
public void write(CompoundTag compoundTag, String string, String string2)
public int getPacketSize()
public void count(PalettedContainer.CountConsumer<T> consumer)