Package net.minecraft.world.chunk
Class PalettedContainer<T>
java.lang.Object
net.minecraft.world.chunk.PalettedContainer<T>
- All Implemented Interfaces:
PaletteResizeListener<T>
public class PalettedContainer<T> extends Object implements PaletteResizeListener<T>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PalettedContainer.CountConsumer<T>
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description PalettedContainer(Palette<T> fallbackPalette, IdList<T> idList, Function<CompoundTag,T> elementDeserializer, Function<T,CompoundTag> elementSerializer, T defaultElement)
-
Method Summary
Modifier and Type Method 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)
-
Field Details
-
fallbackPalette
-
noOpPaletteResizeHandler
-
idList
-
elementDeserializer
-
elementSerializer
-
defaultValue
-
data
-
palette
-
paletteSize
private int paletteSize -
writeLock
-
-
Constructor Details
-
PalettedContainer
-
-
Method Details
-
lock
public void lock() -
unlock
public void unlock() -
toIndex
private static int toIndex(int x, int y, int z) -
setPaletteSize
private void setPaletteSize(int size) -
onResize
- Specified by:
onResize
in interfacePaletteResizeListener<T>
-
setSync
-
set
-
setAndGetOldValue
-
set
-
get
-
get
-
fromPacket
-
toPacket
-
read
-
write
-
getPacketSize
public int getPacketSize() -
hasAny
-
count
-