Package net.minecraft.world.chunk
Class PalettedContainer<T>
java.lang.Object
net.minecraft.world.chunk.PalettedContainer<T>
- All Implemented Interfaces:
PaletteResizeListener<T>,ReadableContainer<T>
public class PalettedContainer<T>
extends Object
implements PaletteResizeListener<T>, ReadableContainer<T>
A paletted container stores objects in 3D voxels as small integer indices,
governed by "palettes" that map between these objects and indices.
- See Also:
- Mappings:
Namespace Name named net/minecraft/world/chunk/PalettedContainerintermediary net/minecraft/class_2841official eoy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA counter that receives a palette entry and its number of occurrences in the container.private static final recordRuntime representation of data in a paletted container.Nested classes/interfaces inherited from interface net.minecraft.world.chunk.ReadableContainer
ReadableContainer.Reader<T,C extends ReadableContainer<T>>, ReadableContainer.Serialized<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PalettedContainer.Data<T> private static final intprivate final LockHelperprivate final PaletteProvider<T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePalettedContainer(PalettedContainer<T> container) privatePalettedContainer(PaletteProvider<T> paletteProvider, PaletteType type, PaletteStorage storage, Palette<T> palette) PalettedContainer(T defaultValue, PaletteProvider<T> paletteProvider) -
Method Summary
Modifier and TypeMethodDescriptioncopy()voidcount(PalettedContainer.Counter<T> counter) private static <T,C extends ReadableContainer<T>>
com.mojang.serialization.Codec<C> createCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue, ReadableContainer.Reader<T, C> reader) Creates a codec for a paletted container with a specific palette provider.static <T> com.mojang.serialization.Codec<PalettedContainer<T>> createPalettedContainerCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue) static <T> com.mojang.serialization.Codec<ReadableContainer<T>> createReadableContainerCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue) voidforEachValue(Consumer<T> action) protected Tget(int index) get(int x, int y, int z) private PalettedContainer.Data<T> getCompatibleData(@Nullable PalettedContainer.Data<T> previousData, int bits) Returns a compatible data object for the given entrybitssize.intintbooleanReturnstrueif any object in this container's palette matches this predicate.voidlock()Acquires the semaphore on this container, and crashes if it cannot be acquired.intCallback for a palette's request to resize to at leastnewBitsfor each entry and to update the storage correspondingly in order to accommodate the new object.static <T> com.mojang.serialization.DataResult<PalettedContainer<T>> read(PaletteProvider<T> provider, ReadableContainer.Serialized<T> serialized) voidreadPacket(PacketByteBuf buf) Reads data from the packet byte buffer into this container.private static <T> int[]repack(PaletteStorage storage, Palette<T> oldPalette, Palette<T> newPalette) serialize(PaletteProvider<T> provider) voidprivate voidslice()private TswapUnsafe(int x, int y, int z, T value) voidunlock()Releases the semaphore on this container.voidwritePacket(PacketByteBuf buf) Writes this container to the packet byte buffer.
-
Field Details
-
field_34557
private static final int field_34557- See Also:
- Mappings:
Namespace Name Mixin selector named field_34557Lnet/minecraft/world/chunk/PalettedContainer;field_34557:Iintermediary field_34557Lnet/minecraft/class_2841;field_34557:Iofficial aLeoy;a:I
-
data
- Mappings:
Namespace Name Mixin selector named dataLnet/minecraft/world/chunk/PalettedContainer;data:Lnet/minecraft/world/chunk/PalettedContainer$Data;intermediary field_34560Lnet/minecraft/class_2841;field_34560:Lnet/minecraft/class_2841$class_6561;official bLeoy;b:Leoy$b;
-
paletteProvider
- Mappings:
Namespace Name Mixin selector named paletteProviderLnet/minecraft/world/chunk/PalettedContainer;paletteProvider:Lnet/minecraft/world/chunk/PaletteProvider;intermediary field_34561Lnet/minecraft/class_2841;field_34561:Lnet/minecraft/class_6563;official cLeoy;c:Lepd;
-
lockHelper
- Mappings:
Namespace Name Mixin selector named lockHelperLnet/minecraft/world/chunk/PalettedContainer;lockHelper:Lnet/minecraft/util/thread/LockHelper;intermediary field_36300Lnet/minecraft/class_2841;field_36300:Lnet/minecraft/class_5798;official dLeoy;d:Lbhj;
-
-
Constructor Details
-
PalettedContainer
private PalettedContainer(PaletteProvider<T> paletteProvider, PaletteType type, PaletteStorage storage, Palette<T> palette) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/world/chunk/PalettedContainer;<init>(Lnet/minecraft/world/chunk/PaletteProvider;Lnet/minecraft/world/chunk/PaletteType;Lnet/minecraft/util/collection/PaletteStorage;Lnet/minecraft/world/chunk/Palette;)Vintermediary <init>Lnet/minecraft/class_2841;<init>(Lnet/minecraft/class_6563;Lnet/minecraft/class_11895;Lnet/minecraft/class_6490;Lnet/minecraft/class_2837;)Vofficial <init>Leoy;<init>(Lepd;Leok;Lbet;Leow;)V
-
PalettedContainer
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/world/chunk/PalettedContainer;<init>(Lnet/minecraft/world/chunk/PalettedContainer;)Vintermediary <init>Lnet/minecraft/class_2841;<init>(Lnet/minecraft/class_2841;)Vofficial <init>Leoy;<init>(Leoy;)V
-
PalettedContainer
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/world/chunk/PalettedContainer;<init>(Ljava/lang/Object;Lnet/minecraft/world/chunk/PaletteProvider;)Vintermediary <init>Lnet/minecraft/class_2841;<init>(Ljava/lang/Object;Lnet/minecraft/class_6563;)Vofficial <init>Leoy;<init>(Ljava/lang/Object;Lepd;)V
-
-
Method Details
-
lock
public void lock()Acquires the semaphore on this container, and crashes if it cannot be acquired.- Mappings:
Namespace Name Mixin selector named lockLnet/minecraft/world/chunk/PalettedContainer;lock()Vintermediary method_12334Lnet/minecraft/class_2841;method_12334()Vofficial bLeoy;b()V
-
unlock
public void unlock()Releases the semaphore on this container.- Mappings:
Namespace Name Mixin selector named unlockLnet/minecraft/world/chunk/PalettedContainer;unlock()Vintermediary method_12335Lnet/minecraft/class_2841;method_12335()Vofficial cLeoy;c()V
-
createPalettedContainerCodec
public static <T> com.mojang.serialization.Codec<PalettedContainer<T>> createPalettedContainerCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue) - Mappings:
Namespace Name Mixin selector named createPalettedContainerCodecLnet/minecraft/world/chunk/PalettedContainer;createPalettedContainerCodec(Lcom/mojang/serialization/Codec;Lnet/minecraft/world/chunk/PaletteProvider;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;intermediary method_44343Lnet/minecraft/class_2841;method_44343(Lcom/mojang/serialization/Codec;Lnet/minecraft/class_6563;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;official aLeoy;a(Lcom/mojang/serialization/Codec;Lepd;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;
-
createReadableContainerCodec
public static <T> com.mojang.serialization.Codec<ReadableContainer<T>> createReadableContainerCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue) - Mappings:
Namespace Name Mixin selector named createReadableContainerCodecLnet/minecraft/world/chunk/PalettedContainer;createReadableContainerCodec(Lcom/mojang/serialization/Codec;Lnet/minecraft/world/chunk/PaletteProvider;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;intermediary method_44347Lnet/minecraft/class_2841;method_44347(Lcom/mojang/serialization/Codec;Lnet/minecraft/class_6563;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;official bLeoy;b(Lcom/mojang/serialization/Codec;Lepd;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;
-
createCodec
private static <T,C extends ReadableContainer<T>> com.mojang.serialization.Codec<C> createCodec(com.mojang.serialization.Codec<T> entryCodec, PaletteProvider<T> provider, T defaultValue, ReadableContainer.Reader<T, C> reader) Creates a codec for a paletted container with a specific palette provider.- Returns:
- the created codec
- Mappings:
Namespace Name Mixin selector named createCodecLnet/minecraft/world/chunk/PalettedContainer;createCodec(Lcom/mojang/serialization/Codec;Lnet/minecraft/world/chunk/PaletteProvider;Ljava/lang/Object;Lnet/minecraft/world/chunk/ReadableContainer$Reader;)Lcom/mojang/serialization/Codec;intermediary method_38298Lnet/minecraft/class_2841;method_38298(Lcom/mojang/serialization/Codec;Lnet/minecraft/class_6563;Ljava/lang/Object;Lnet/minecraft/class_7522$class_7523;)Lcom/mojang/serialization/Codec;official aLeoy;a(Lcom/mojang/serialization/Codec;Lepd;Ljava/lang/Object;Lepa$b;)Lcom/mojang/serialization/Codec;
-
getCompatibleData
private PalettedContainer.Data<T> getCompatibleData(@Nullable @Nullable PalettedContainer.Data<T> previousData, int bits) Returns a compatible data object for the given entrybitssize. This may return a new data object or returnpreviousDataif it can be reused.- Parameters:
previousData- the previous data, may be reused if suitablebits- the number of bits each entry uses- Returns:
- a compatible data object for the given entry
bitssize - Mappings:
Namespace Name Mixin selector named getCompatibleDataLnet/minecraft/world/chunk/PalettedContainer;getCompatibleData(Lnet/minecraft/world/chunk/PalettedContainer$Data;I)Lnet/minecraft/world/chunk/PalettedContainer$Data;intermediary method_38297Lnet/minecraft/class_2841;method_38297(Lnet/minecraft/class_2841$class_6561;I)Lnet/minecraft/class_2841$class_6561;official aLeoy;a(Leoy$b;I)Leoy$b;
-
onResize
Callback for a palette's request to resize to at leastnewBitsfor each entry and to update the storage correspondingly in order to accommodate the new object. After the resize is completed in this method, returns the ID assigned to theobjectin the updated palette.- Specified by:
onResizein interfacePaletteResizeListener<T>- Returns:
- the ID for the
objectin the (possibly new) palette - Mappings:
Namespace Name Mixin selector named onResizeLnet/minecraft/world/chunk/PaletteResizeListener;onResize(ILjava/lang/Object;)Iintermediary onResizeLnet/minecraft/class_2835;onResize(ILjava/lang/Object;)Iofficial onResizeLeox;onResize(ILjava/lang/Object;)I
-
swap
- Mappings:
Namespace Name Mixin selector named swapLnet/minecraft/world/chunk/PalettedContainer;swap(IIILjava/lang/Object;)Ljava/lang/Object;intermediary method_12328Lnet/minecraft/class_2841;method_12328(IIILjava/lang/Object;)Ljava/lang/Object;official aLeoy;a(IIILjava/lang/Object;)Ljava/lang/Object;
-
swapUnsafe
- Mappings:
Namespace Name Mixin selector named swapUnsafeLnet/minecraft/world/chunk/PalettedContainer;swapUnsafe(IIILjava/lang/Object;)Ljava/lang/Object;intermediary method_16678Lnet/minecraft/class_2841;method_16678(IIILjava/lang/Object;)Ljava/lang/Object;official bLeoy;b(IIILjava/lang/Object;)Ljava/lang/Object;
-
swap
- Mappings:
Namespace Name Mixin selector named swapLnet/minecraft/world/chunk/PalettedContainer;swap(ILjava/lang/Object;)Ljava/lang/Object;intermediary method_12336Lnet/minecraft/class_2841;method_12336(ILjava/lang/Object;)Ljava/lang/Object;official aLeoy;a(ILjava/lang/Object;)Ljava/lang/Object;
-
set
- Mappings:
Namespace Name Mixin selector named setLnet/minecraft/world/chunk/PalettedContainer;set(IIILjava/lang/Object;)Vintermediary method_35321Lnet/minecraft/class_2841;method_35321(IIILjava/lang/Object;)Vofficial cLeoy;c(IIILjava/lang/Object;)V
-
set
- Mappings:
Namespace Name Mixin selector named setLnet/minecraft/world/chunk/PalettedContainer;set(ILjava/lang/Object;)Vintermediary method_12322Lnet/minecraft/class_2841;method_12322(ILjava/lang/Object;)Vofficial bLeoy;b(ILjava/lang/Object;)V
-
get
- Specified by:
getin interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/world/chunk/ReadableContainer;get(III)Ljava/lang/Object;intermediary method_12321Lnet/minecraft/class_7522;method_12321(III)Ljava/lang/Object;official aLepa;a(III)Ljava/lang/Object;
-
get
- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/world/chunk/PalettedContainer;get(I)Ljava/lang/Object;intermediary method_12331Lnet/minecraft/class_2841;method_12331(I)Ljava/lang/Object;official aLeoy;a(I)Ljava/lang/Object;
-
forEachValue
- Specified by:
forEachValuein interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named forEachValueLnet/minecraft/world/chunk/ReadableContainer;forEachValue(Ljava/util/function/Consumer;)Vintermediary method_39793Lnet/minecraft/class_7522;method_39793(Ljava/util/function/Consumer;)Vofficial aLepa;a(Ljava/util/function/Consumer;)V
-
readPacket
Reads data from the packet byte buffer into this container. Previous data in this container is discarded.- Parameters:
buf- the packet byte buffer- Mappings:
Namespace Name Mixin selector named readPacketLnet/minecraft/world/chunk/PalettedContainer;readPacket(Lnet/minecraft/network/PacketByteBuf;)Vintermediary method_12326Lnet/minecraft/class_2841;method_12326(Lnet/minecraft/class_2540;)Vofficial aLeoy;a(Lxc;)V
-
writePacket
Writes this container to the packet byte buffer.- Specified by:
writePacketin interfaceReadableContainer<T>- Parameters:
buf- the packet byte buffer- Mappings:
Namespace Name Mixin selector named writePacketLnet/minecraft/world/chunk/ReadableContainer;writePacket(Lnet/minecraft/network/PacketByteBuf;)Vintermediary method_12325Lnet/minecraft/class_7522;method_12325(Lnet/minecraft/class_2540;)Vofficial bLepa;b(Lxc;)V
-
read
public static <T> com.mojang.serialization.DataResult<PalettedContainer<T>> read(PaletteProvider<T> provider, ReadableContainer.Serialized<T> serialized) - Mappings:
Namespace Name Mixin selector named readLnet/minecraft/world/chunk/PalettedContainer;read(Lnet/minecraft/world/chunk/PaletteProvider;Lnet/minecraft/world/chunk/ReadableContainer$Serialized;)Lcom/mojang/serialization/DataResult;intermediary method_44346Lnet/minecraft/class_2841;method_44346(Lnet/minecraft/class_6563;Lnet/minecraft/class_7522$class_6562;)Lcom/mojang/serialization/DataResult;official aLeoy;a(Lepd;Lepa$a;)Lcom/mojang/serialization/DataResult;
-
serialize
- Specified by:
serializein interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named serializeLnet/minecraft/world/chunk/ReadableContainer;serialize(Lnet/minecraft/world/chunk/PaletteProvider;)Lnet/minecraft/world/chunk/ReadableContainer$Serialized;intermediary method_44345Lnet/minecraft/class_7522;method_44345(Lnet/minecraft/class_6563;)Lnet/minecraft/class_7522$class_6562;official aLepa;a(Lepd;)Lepa$a;
-
repack
private static <T> int[] repack(PaletteStorage storage, Palette<T> oldPalette, Palette<T> newPalette) - Mappings:
Namespace Name Mixin selector named repackLnet/minecraft/world/chunk/PalettedContainer;repack(Lnet/minecraft/util/collection/PaletteStorage;Lnet/minecraft/world/chunk/Palette;Lnet/minecraft/world/chunk/Palette;)[Iintermediary method_74156Lnet/minecraft/class_2841;method_74156(Lnet/minecraft/class_6490;Lnet/minecraft/class_2837;Lnet/minecraft/class_2837;)[Iofficial aLeoy;a(Lbet;Leow;Leow;)[I
-
getPacketSize
public int getPacketSize()- Specified by:
getPacketSizein interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named getPacketSizeLnet/minecraft/world/chunk/ReadableContainer;getPacketSize()Iintermediary method_12327Lnet/minecraft/class_7522;method_12327()Iofficial dLepa;d()I
-
getElementBits
public int getElementBits()- Specified by:
getElementBitsin interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named getElementBitsLnet/minecraft/world/chunk/ReadableContainer;getElementBits()Iintermediary method_74157Lnet/minecraft/class_7522;method_74157()Iofficial eLepa;e()I
-
hasAny
Returnstrueif any object in this container's palette matches this predicate.- Specified by:
hasAnyin interfaceReadableContainer<T>- Returns:
trueif any object in this container's palette matches this predicate- Mappings:
Namespace Name Mixin selector named hasAnyLnet/minecraft/world/chunk/ReadableContainer;hasAny(Ljava/util/function/Predicate;)Zintermediary method_19526Lnet/minecraft/class_7522;method_19526(Ljava/util/function/Predicate;)Zofficial aLepa;a(Ljava/util/function/Predicate;)Z
-
copy
- Specified by:
copyin interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named copyLnet/minecraft/world/chunk/ReadableContainer;copy()Lnet/minecraft/world/chunk/PalettedContainer;intermediary method_39957Lnet/minecraft/class_7522;method_39957()Lnet/minecraft/class_2841;official fLepa;f()Leoy;
-
slice
- Specified by:
slicein interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named sliceLnet/minecraft/world/chunk/ReadableContainer;slice()Lnet/minecraft/world/chunk/PalettedContainer;intermediary method_44350Lnet/minecraft/class_7522;method_44350()Lnet/minecraft/class_2841;official gLepa;g()Leoy;
-
count
- Specified by:
countin interfaceReadableContainer<T>- Mappings:
Namespace Name Mixin selector named countLnet/minecraft/world/chunk/ReadableContainer;count(Lnet/minecraft/world/chunk/PalettedContainer$Counter;)Vintermediary method_21732Lnet/minecraft/class_7522;method_21732(Lnet/minecraft/class_2841$class_4464;)Vofficial aLepa;a(Leoy$a;)V
-