public class PalettedContainer<T> extends java.lang.Object implements IResizeCallback<T>
Modifier and Type | Class and Description |
---|---|
static interface |
PalettedContainer.ICountConsumer<T> |
Modifier and Type | Field and Description |
---|---|
private int |
bits |
private T |
defaultState |
private java.util.function.Function<CompoundNBT,T> |
deserializer |
private IResizeCallback<T> |
dummyPaletteResize |
private java.util.concurrent.locks.ReentrantLock |
lock |
private IPalette<T> |
palette |
private ObjectIntIdentityMap<T> |
registry |
private IPalette<T> |
registryPalette |
private java.util.function.Function<T,CompoundNBT> |
serializer |
protected BitArray |
storage |
Constructor and Description |
---|
PalettedContainer(IPalette<T> globalPaletteIn,
ObjectIntIdentityMap<T> registryIn,
java.util.function.Function<CompoundNBT,T> deserializerIn,
java.util.function.Function<T,CompoundNBT> serializerIn,
T defaultStateIn) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(T value) |
void |
count(PalettedContainer.ICountConsumer<T> countConsumerIn) |
protected T |
doSwap(int index,
T state) |
protected T |
get(int index) |
T |
get(int x,
int y,
int z) |
private static int |
getIndex(int x,
int y,
int z) |
int |
getSerializedSize() |
void |
lock() |
T |
lockedSwap(int x,
int y,
int z,
T state) |
int |
onResize(int p_onResize_1_,
T p_onResize_2_) |
void |
read(PacketBuffer buf) |
void |
readChunkPalette(ListNBT paletteNbt,
long[] data) |
protected void |
set(int index,
T state) |
private void |
setBits(int bitsIn) |
private void |
setBits(int bitsIn,
boolean forceBits) |
T |
swap(int x,
int y,
int z,
T state) |
void |
unlock() |
void |
write(PacketBuffer buf) |
void |
writeChunkPalette(CompoundNBT compound,
java.lang.String paletteName,
java.lang.String paletteDataName) |
private final IResizeCallback<T> dummyPaletteResize
private final ObjectIntIdentityMap<T> registry
private final java.util.function.Function<CompoundNBT,T> deserializer
private final java.util.function.Function<T,CompoundNBT> serializer
private final T defaultState
protected BitArray storage
private int bits
private final java.util.concurrent.locks.ReentrantLock lock
public PalettedContainer(IPalette<T> globalPaletteIn, ObjectIntIdentityMap<T> registryIn, java.util.function.Function<CompoundNBT,T> deserializerIn, java.util.function.Function<T,CompoundNBT> serializerIn, T defaultStateIn)
public void lock()
public void unlock()
private static int getIndex(int x, int y, int z)
private void setBits(int bitsIn)
private void setBits(int bitsIn, boolean forceBits)
public int onResize(int p_onResize_1_, T p_onResize_2_)
onResize
in interface IResizeCallback<T>
protected void set(int index, T state)
public T get(int x, int y, int z)
protected T get(int index)
public void read(PacketBuffer buf)
public void write(PacketBuffer buf)
public void readChunkPalette(ListNBT paletteNbt, long[] data)
public void writeChunkPalette(CompoundNBT compound, java.lang.String paletteName, java.lang.String paletteDataName)
public int getSerializedSize()
public boolean contains(T value)
public void count(PalettedContainer.ICountConsumer<T> countConsumerIn)