Package net.minecraft.world.chunk
Interface Palette<T>
- All Known Implementing Classes:
ArrayPalette,BiMapPalette,IdListPalette,SingularPalette
public interface Palette<T>
A palette maps objects from and to small integer IDs that uses less
number of bits to make storage smaller.
While the objects palettes handle are already represented by integer IDs, shrinking IDs in cases where only a few appear can further reduce storage space and network traffic volume.
- See Also:
- Mappings:
Namespace Name named net/minecraft/world/chunk/Paletteintermediary net/minecraft/class_2837official dvo
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn interface for easy creation of palettes. -
Method Summary
Modifier and TypeMethodDescriptioncopy()get(int id) Returns the object associated with the givenid.intReturns the serialized size of this palette in a byte buf, in bytes.intgetSize()Returns the size of the palette.booleanReturnstrueif any entry in this palette passes thepredicate.intReturns the ID of an object in this palette.voidreadPacket(PacketByteBuf buf) Initializes this palette from thebuf.voidwritePacket(PacketByteBuf buf) Writes this palette to thebuf.
-
Method Details
-
index
Returns the ID of an object in this palette.If the object does not yet exist in this palette, this palette will register the object. If the palette is too small to include this object, a resize listener will be called and this palette may be discarded.
- Parameters:
object- the object to look up- Returns:
- the ID of an object in this palette
- Mappings:
Namespace Name Mixin selector named indexLnet/minecraft/world/chunk/Palette;index(Ljava/lang/Object;)Iintermediary method_12291Lnet/minecraft/class_2837;method_12291(Ljava/lang/Object;)Iofficial aLdvo;a(Ljava/lang/Object;)I
-
hasAny
Returnstrueif any entry in this palette passes thepredicate.- Returns:
trueif any entry in this palette passes thepredicate- Mappings:
Namespace Name Mixin selector named hasAnyLnet/minecraft/world/chunk/Palette;hasAny(Ljava/util/function/Predicate;)Zintermediary method_19525Lnet/minecraft/class_2837;method_19525(Ljava/util/function/Predicate;)Zofficial aLdvo;a(Ljava/util/function/Predicate;)Z
-
get
Returns the object associated with the givenid.- Parameters:
id- the ID to look up- Returns:
- the object associated with the given
id - Throws:
EntryMissingException- if this ID does not exist in this palette- Mappings:
Namespace Name Mixin selector named getLnet/minecraft/world/chunk/Palette;get(I)Ljava/lang/Object;intermediary method_12288Lnet/minecraft/class_2837;method_12288(I)Ljava/lang/Object;official aLdvo;a(I)Ljava/lang/Object;
-
readPacket
Initializes this palette from thebuf. Clears the preexisting data in this palette.- Parameters:
buf- the packet byte buffer- Mappings:
Namespace Name Mixin selector named readPacketLnet/minecraft/world/chunk/Palette;readPacket(Lnet/minecraft/network/PacketByteBuf;)Vintermediary method_12289Lnet/minecraft/class_2837;method_12289(Lnet/minecraft/class_2540;)Vofficial aLdvo;a(Lvw;)V
-
writePacket
Writes this palette to thebuf.- Parameters:
buf- the packet byte buffer- Mappings:
Namespace Name Mixin selector named writePacketLnet/minecraft/world/chunk/Palette;writePacket(Lnet/minecraft/network/PacketByteBuf;)Vintermediary method_12287Lnet/minecraft/class_2837;method_12287(Lnet/minecraft/class_2540;)Vofficial bLdvo;b(Lvw;)V
-
getPacketSize
int getPacketSize()Returns the serialized size of this palette in a byte buf, in bytes.- Returns:
- the serialized size of this palette in a byte buf, in bytes
- Mappings:
Namespace Name Mixin selector named getPacketSizeLnet/minecraft/world/chunk/Palette;getPacketSize()Iintermediary method_12290Lnet/minecraft/class_2837;method_12290()Iofficial aLdvo;a()I
-
getSize
int getSize()Returns the size of the palette.- Returns:
- the size of the palette
- Mappings:
Namespace Name Mixin selector named getSizeLnet/minecraft/world/chunk/Palette;getSize()Iintermediary method_12197Lnet/minecraft/class_2837;method_12197()Iofficial bLdvo;b()I
-
copy
- Mappings:
Namespace Name Mixin selector named copyLnet/minecraft/world/chunk/Palette;copy()Lnet/minecraft/world/chunk/Palette;intermediary method_39956Lnet/minecraft/class_2837;method_39956()Lnet/minecraft/class_2837;official cLdvo;c()Ldvo;
-