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 interfacePalettedContainer.CountConsumer<T> -
Field Summary
Fields Modifier and Type Field Description protected PackedIntegerArraydataprivate TdefaultValueprivate Function<CompoundTag,T>elementDeserializerprivate Function<T,CompoundTag>elementSerializerprivate Palette<T>fallbackPaletteprivate IdList<T>idListprivate PaletteResizeListener<T>noOpPaletteResizeHandlerprivate Palette<T>paletteprivate intpaletteSizeprivate ReentrantLockwriteLock -
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 voidcount(PalettedContainer.CountConsumer<T> consumer)voidfromPacket(PacketByteBuf buf)protected Tget(int index)Tget(int x, int y, int z)intgetPacketSize()booleanhasAny(Predicate<T> predicate)voidlock()intonResize(int newSize, T objectAdded)voidread(ListTag paletteTag, long[] data)Tset(int x, int y, int z, T value)protected voidset(int int2, T t)protected TsetAndGetOldValue(int index, T value)private voidsetPaletteSize(int size)TsetSync(int x, int y, int z, T value)private static inttoIndex(int x, int y, int z)voidtoPacket(PacketByteBuf buf)voidunlock()voidwrite(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:
onResizein interfacePaletteResizeListener<T>
-
setSync
-
set
-
setAndGetOldValue
-
set
-
get
-
get
-
fromPacket
-
toPacket
-
read
-
write
-
getPacketSize
public int getPacketSize() -
hasAny
-
count
-