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>
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
official cqi
intermediary net/minecraft/class_2841
named net/minecraft/world/chunk/PalettedContainer
  • Field Details

    • field_34557

      private static final int field_34557
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a:I
      intermediary field_34557 Lnet/minecraft/class_2841;field_34557:I
      named field_34557 Lnet/minecraft/world/chunk/PalettedContainer;field_34557:I
    • dummyListener

      private final PaletteResizeListener<T> dummyListener
      Mappings:
      Namespace Name Mixin selector
      official b Lcqi;b:Lcqh;
      intermediary field_34558 Lnet/minecraft/class_2841;field_34558:Lnet/minecraft/class_2835;
      named dummyListener Lnet/minecraft/world/chunk/PalettedContainer;dummyListener:Lnet/minecraft/world/chunk/PaletteResizeListener;
    • idList

      private final IndexedIterable<T> idList
      Mappings:
      Namespace Name Mixin selector
      official c Lcqi;c:Lgq;
      intermediary field_34559 Lnet/minecraft/class_2841;field_34559:Lnet/minecraft/class_2359;
      named idList Lnet/minecraft/world/chunk/PalettedContainer;idList:Lnet/minecraft/util/collection/IndexedIterable;
    • data

      private volatile PalettedContainer.Data<T> data
      Mappings:
      Namespace Name Mixin selector
      official d Lcqi;d:Lcqi$c;
      intermediary field_34560 Lnet/minecraft/class_2841;field_34560:Lnet/minecraft/class_2841$class_6561;
      named data Lnet/minecraft/world/chunk/PalettedContainer;data:Lnet/minecraft/world/chunk/PalettedContainer$Data;
    • paletteProvider

      private final PalettedContainer.PaletteProvider paletteProvider
      Mappings:
      Namespace Name Mixin selector
      official e Lcqi;e:Lcqi$e;
      intermediary field_34561 Lnet/minecraft/class_2841;field_34561:Lnet/minecraft/class_2841$class_6563;
      named paletteProvider Lnet/minecraft/world/chunk/PalettedContainer;paletteProvider:Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;
    • semaphore

      private final Semaphore semaphore
      Mappings:
      Namespace Name Mixin selector
      official f Lcqi;f:Ljava/util/concurrent/Semaphore;
      intermediary field_34562 Lnet/minecraft/class_2841;field_34562:Ljava/util/concurrent/Semaphore;
      named semaphore Lnet/minecraft/world/chunk/PalettedContainer;semaphore:Ljava/util/concurrent/Semaphore;
    • lockStack

      @Nullable private final @Nullable AtomicStack<com.mojang.datafixers.util.Pair<Thread,StackTraceElement[]>> lockStack
      Mappings:
      Namespace Name Mixin selector
      official g Lcqi;g:Lahz;
      intermediary field_34563 Lnet/minecraft/class_2841;field_34563:Lnet/minecraft/class_5831;
      named lockStack Lnet/minecraft/world/chunk/PalettedContainer;lockStack:Lnet/minecraft/util/thread/AtomicStack;
  • Constructor Details

    • PalettedContainer

      public PalettedContainer(IndexedIterable<T> idList, PalettedContainer.PaletteProvider paletteProvider, PalettedContainer.DataProvider<T> dataProvider, PaletteStorage storage, List<T> list)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcqi;<init>(Lgq;Lcqi$e;Lcqi$a;Lahr;Ljava/util/List;)V
      intermediary <init> Lnet/minecraft/class_2841;<init>(Lnet/minecraft/class_2359;Lnet/minecraft/class_2841$class_6563;Lnet/minecraft/class_2841$class_6560;Lnet/minecraft/class_6490;Ljava/util/List;)V
      named <init> Lnet/minecraft/world/chunk/PalettedContainer;<init>(Lnet/minecraft/util/collection/IndexedIterable;Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;Lnet/minecraft/world/chunk/PalettedContainer$DataProvider;Lnet/minecraft/util/collection/PaletteStorage;Ljava/util/List;)V
    • PalettedContainer

      public PalettedContainer(IndexedIterable<T> idList, T object, PalettedContainer.PaletteProvider paletteProvider)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcqi;<init>(Lgq;Ljava/lang/Object;Lcqi$e;)V
      intermediary <init> Lnet/minecraft/class_2841;<init>(Lnet/minecraft/class_2359;Ljava/lang/Object;Lnet/minecraft/class_2841$class_6563;)V
      named <init> Lnet/minecraft/world/chunk/PalettedContainer;<init>(Lnet/minecraft/util/collection/IndexedIterable;Ljava/lang/Object;Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;)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
      official a Lcqi;a()V
      intermediary method_12334 Lnet/minecraft/class_2841;method_12334()V
      named lock Lnet/minecraft/world/chunk/PalettedContainer;lock()V
    • unlock

      public void unlock()
      Releases the semaphore on this container.
      Mappings:
      Namespace Name Mixin selector
      official b Lcqi;b()V
      intermediary method_12335 Lnet/minecraft/class_2841;method_12335()V
      named unlock Lnet/minecraft/world/chunk/PalettedContainer;unlock()V
    • createCodec

      public static <T> com.mojang.serialization.Codec<PalettedContainer<T>> createCodec(IndexedIterable<T> idList, com.mojang.serialization.Codec<T> entryCodec, PalettedContainer.PaletteProvider provider, T t)
      Creates a codec for a paletted container with a specific palette provider.
      Parameters:
      idList - the id list to map between objects and full integer IDs
      entryCodec - the codec for each entry in the palette
      provider - the palette provider that controls how the data are serialized and what types of palette are used for what entry bit sizes
      Returns:
      the created codec
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Lgq;Lcom/mojang/serialization/Codec;Lcqi$e;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;
      intermediary method_38298 Lnet/minecraft/class_2841;method_38298(Lnet/minecraft/class_2359;Lcom/mojang/serialization/Codec;Lnet/minecraft/class_2841$class_6563;Ljava/lang/Object;)Lcom/mojang/serialization/Codec;
      named createCodec Lnet/minecraft/world/chunk/PalettedContainer;createCodec(Lnet/minecraft/util/collection/IndexedIterable;Lcom/mojang/serialization/Codec;Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;Ljava/lang/Object;)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 entry bits size. This may return a new data object or return previousData if it can be reused.
      Parameters:
      previousData - the previous data, may be reused if suitable
      bits - the number of bits each entry uses
      Returns:
      a compatible data object for the given entry bits size
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Lcqi$c;I)Lcqi$c;
      intermediary method_38297 Lnet/minecraft/class_2841;method_38297(Lnet/minecraft/class_2841$class_6561;I)Lnet/minecraft/class_2841$class_6561;
      named getCompatibleData Lnet/minecraft/world/chunk/PalettedContainer;getCompatibleData(Lnet/minecraft/world/chunk/PalettedContainer$Data;I)Lnet/minecraft/world/chunk/PalettedContainer$Data;
    • onResize

      public int onResize(int newBits, T object)
      Callback for a palette's request to resize to at least newBits for each entry and to update the storage correspondingly in order to accomodate the new object. After the resize is completed in this method, returns the ID assigned to the object in the updated palette.
      Specified by:
      onResize in interface PaletteResizeListener<T>
      Returns:
      the ID for the object in the (possibly new) palette
      Mappings:
      Namespace Name Mixin selector
      official onResize Lcqh;onResize(ILjava/lang/Object;)I
      intermediary onResize Lnet/minecraft/class_2835;onResize(ILjava/lang/Object;)I
      named onResize Lnet/minecraft/world/chunk/PaletteResizeListener;onResize(ILjava/lang/Object;)I
    • swap

      public T swap(int x, int y, int z, T value)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(IIILjava/lang/Object;)Ljava/lang/Object;
      intermediary method_12328 Lnet/minecraft/class_2841;method_12328(IIILjava/lang/Object;)Ljava/lang/Object;
      named swap Lnet/minecraft/world/chunk/PalettedContainer;swap(IIILjava/lang/Object;)Ljava/lang/Object;
    • swapUnsafe

      public T swapUnsafe(int x, int y, int z, T value)
      Mappings:
      Namespace Name Mixin selector
      official b Lcqi;b(IIILjava/lang/Object;)Ljava/lang/Object;
      intermediary method_16678 Lnet/minecraft/class_2841;method_16678(IIILjava/lang/Object;)Ljava/lang/Object;
      named swapUnsafe Lnet/minecraft/world/chunk/PalettedContainer;swapUnsafe(IIILjava/lang/Object;)Ljava/lang/Object;
    • swap

      private T swap(int index, T value)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(ILjava/lang/Object;)Ljava/lang/Object;
      intermediary method_12336 Lnet/minecraft/class_2841;method_12336(ILjava/lang/Object;)Ljava/lang/Object;
      named swap Lnet/minecraft/world/chunk/PalettedContainer;swap(ILjava/lang/Object;)Ljava/lang/Object;
    • set

      public void set(int x, int y, int z, T value)
      Mappings:
      Namespace Name Mixin selector
      official c Lcqi;c(IIILjava/lang/Object;)V
      intermediary method_35321 Lnet/minecraft/class_2841;method_35321(IIILjava/lang/Object;)V
      named set Lnet/minecraft/world/chunk/PalettedContainer;set(IIILjava/lang/Object;)V
    • set

      private void set(int index, T value)
      Mappings:
      Namespace Name Mixin selector
      official b Lcqi;b(ILjava/lang/Object;)V
      intermediary method_12322 Lnet/minecraft/class_2841;method_12322(ILjava/lang/Object;)V
      named set Lnet/minecraft/world/chunk/PalettedContainer;set(ILjava/lang/Object;)V
    • get

      public T get(int x, int y, int z)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(III)Ljava/lang/Object;
      intermediary method_12321 Lnet/minecraft/class_2841;method_12321(III)Ljava/lang/Object;
      named get Lnet/minecraft/world/chunk/PalettedContainer;get(III)Ljava/lang/Object;
    • get

      protected T get(int index)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(I)Ljava/lang/Object;
      intermediary method_12331 Lnet/minecraft/class_2841;method_12331(I)Ljava/lang/Object;
      named get Lnet/minecraft/world/chunk/PalettedContainer;get(I)Ljava/lang/Object;
    • readPacket

      public void readPacket(PacketByteBuf buf)
      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
      official a Lcqi;a(Lph;)V
      intermediary method_12326 Lnet/minecraft/class_2841;method_12326(Lnet/minecraft/class_2540;)V
      named readPacket Lnet/minecraft/world/chunk/PalettedContainer;readPacket(Lnet/minecraft/network/PacketByteBuf;)V
    • writePacket

      public void writePacket(PacketByteBuf buf)
      Writes this container to the packet byte buffer.
      Parameters:
      buf - the packet byte buffer
      Mappings:
      Namespace Name Mixin selector
      official b Lcqi;b(Lph;)V
      intermediary method_12325 Lnet/minecraft/class_2841;method_12325(Lnet/minecraft/class_2540;)V
      named writePacket Lnet/minecraft/world/chunk/PalettedContainer;writePacket(Lnet/minecraft/network/PacketByteBuf;)V
    • read

      private static <T> com.mojang.serialization.DataResult<PalettedContainer<T>> read(IndexedIterable<T> idList, PalettedContainer.PaletteProvider provider, PalettedContainer.Serialized<T> serialized)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Lgq;Lcqi$e;Lcqi$d;)Lcom/mojang/serialization/DataResult;
      intermediary method_38301 Lnet/minecraft/class_2841;method_38301(Lnet/minecraft/class_2359;Lnet/minecraft/class_2841$class_6563;Lnet/minecraft/class_2841$class_6562;)Lcom/mojang/serialization/DataResult;
      named read Lnet/minecraft/world/chunk/PalettedContainer;read(Lnet/minecraft/util/collection/IndexedIterable;Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;Lnet/minecraft/world/chunk/PalettedContainer$Serialized;)Lcom/mojang/serialization/DataResult;
    • write

      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Lgq;Lcqi$e;)Lcqi$d;
      intermediary method_38300 Lnet/minecraft/class_2841;method_38300(Lnet/minecraft/class_2359;Lnet/minecraft/class_2841$class_6563;)Lnet/minecraft/class_2841$class_6562;
      named write Lnet/minecraft/world/chunk/PalettedContainer;write(Lnet/minecraft/util/collection/IndexedIterable;Lnet/minecraft/world/chunk/PalettedContainer$PaletteProvider;)Lnet/minecraft/world/chunk/PalettedContainer$Serialized;
    • getPacketSize

      public int getPacketSize()
      Mappings:
      Namespace Name Mixin selector
      official c Lcqi;c()I
      intermediary method_12327 Lnet/minecraft/class_2841;method_12327()I
      named getPacketSize Lnet/minecraft/world/chunk/PalettedContainer;getPacketSize()I
    • hasAny

      public boolean hasAny(Predicate<T> predicate)
      Returns true if any object in this container's palette matches this predicate.
      Returns:
      true if any object in this container's palette matches this predicate
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Ljava/util/function/Predicate;)Z
      intermediary method_19526 Lnet/minecraft/class_2841;method_19526(Ljava/util/function/Predicate;)Z
      named hasAny Lnet/minecraft/world/chunk/PalettedContainer;hasAny(Ljava/util/function/Predicate;)Z
    • count

      public void count(PalettedContainer.Counter<T> counter)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqi;a(Lcqi$b;)V
      intermediary method_21732 Lnet/minecraft/class_2841;method_21732(Lnet/minecraft/class_2841$class_4464;)V
      named count Lnet/minecraft/world/chunk/PalettedContainer;count(Lnet/minecraft/world/chunk/PalettedContainer$Counter;)V