Class ArrayPalette<T>

java.lang.Object
net.minecraft.world.chunk.ArrayPalette<T>
All Implemented Interfaces:
Palette<T>

public class ArrayPalette<T> extends Object implements Palette<T>
A palette that stores the possible entries in an array and maps them to their indices in the array.
Mappings:
Namespace Name
official cqe
intermediary net/minecraft/class_2834
named net/minecraft/world/chunk/ArrayPalette
  • Field Details

    • idList

      private final IndexedIterable<T> idList
      Mappings:
      Namespace Name Mixin selector
      official a Lcqe;a:Lgq;
      intermediary field_12900 Lnet/minecraft/class_2834;field_12900:Lnet/minecraft/class_2359;
      named idList Lnet/minecraft/world/chunk/ArrayPalette;idList:Lnet/minecraft/util/collection/IndexedIterable;
    • array

      private final T[] array
      Mappings:
      Namespace Name Mixin selector
      official b Lcqe;b:[Ljava/lang/Object;
      intermediary field_12904 Lnet/minecraft/class_2834;field_12904:[Ljava/lang/Object;
      named array Lnet/minecraft/world/chunk/ArrayPalette;array:[Ljava/lang/Object;
    • listener

      private final PaletteResizeListener<T> listener
      Mappings:
      Namespace Name Mixin selector
      official c Lcqe;c:Lcqh;
      intermediary field_12905 Lnet/minecraft/class_2834;field_12905:Lnet/minecraft/class_2835;
      named listener Lnet/minecraft/world/chunk/ArrayPalette;listener:Lnet/minecraft/world/chunk/PaletteResizeListener;
    • indexBits

      private final int indexBits
      Mappings:
      Namespace Name Mixin selector
      official d Lcqe;d:I
      intermediary field_12903 Lnet/minecraft/class_2834;field_12903:I
      named indexBits Lnet/minecraft/world/chunk/ArrayPalette;indexBits:I
    • size

      private int size
      Mappings:
      Namespace Name Mixin selector
      official e Lcqe;e:I
      intermediary field_12901 Lnet/minecraft/class_2834;field_12901:I
      named size Lnet/minecraft/world/chunk/ArrayPalette;size:I
  • Constructor Details

    • ArrayPalette

      public ArrayPalette(IndexedIterable<T> idList, int bits, PaletteResizeListener<T> listener, List<T> list)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcqe;<init>(Lgq;ILcqh;Ljava/util/List;)V
      intermediary <init> Lnet/minecraft/class_2834;<init>(Lnet/minecraft/class_2359;ILnet/minecraft/class_2835;Ljava/util/List;)V
      named <init> Lnet/minecraft/world/chunk/ArrayPalette;<init>(Lnet/minecraft/util/collection/IndexedIterable;ILnet/minecraft/world/chunk/PaletteResizeListener;Ljava/util/List;)V
  • Method Details

    • create

      public static <A> Palette<A> create(int bits, IndexedIterable<A> idList, PaletteResizeListener<A> listener, List<A> list)
      Mappings:
      Namespace Name Mixin selector
      official a Lcqe;a(ILgq;Lcqh;Ljava/util/List;)Lcqg;
      intermediary method_38295 Lnet/minecraft/class_2834;method_38295(ILnet/minecraft/class_2359;Lnet/minecraft/class_2835;Ljava/util/List;)Lnet/minecraft/class_2837;
      named create Lnet/minecraft/world/chunk/ArrayPalette;create(ILnet/minecraft/util/collection/IndexedIterable;Lnet/minecraft/world/chunk/PaletteResizeListener;Ljava/util/List;)Lnet/minecraft/world/chunk/Palette;
    • index

      public int index(T object)
      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.

      Specified by:
      index in interface Palette<T>
      Parameters:
      object - the object to look up
      Returns:
      the ID of an object in this palette
      Mappings:
      Namespace Name Mixin selector
      official a Lcqg;a(Ljava/lang/Object;)I
      intermediary method_12291 Lnet/minecraft/class_2837;method_12291(Ljava/lang/Object;)I
      named index Lnet/minecraft/world/chunk/Palette;index(Ljava/lang/Object;)I
    • hasAny

      public boolean hasAny(Predicate<T> predicate)
      Returns true if any entry in this palette passes the predicate.
      Specified by:
      hasAny in interface Palette<T>
      Returns:
      true if any entry in this palette passes the predicate
      Mappings:
      Namespace Name Mixin selector
      official a Lcqg;a(Ljava/util/function/Predicate;)Z
      intermediary method_19525 Lnet/minecraft/class_2837;method_19525(Ljava/util/function/Predicate;)Z
      named hasAny Lnet/minecraft/world/chunk/Palette;hasAny(Ljava/util/function/Predicate;)Z
    • get

      public T get(int id)
      Returns the object associated with the given id.
      Specified by:
      get in interface Palette<T>
      Parameters:
      id - the ID to look up
      Returns:
      the object associated with the given id
      Mappings:
      Namespace Name Mixin selector
      official a Lcqg;a(I)Ljava/lang/Object;
      intermediary method_12288 Lnet/minecraft/class_2837;method_12288(I)Ljava/lang/Object;
      named get Lnet/minecraft/world/chunk/Palette;get(I)Ljava/lang/Object;
    • readPacket

      public void readPacket(PacketByteBuf buf)
      Initializes this palette from the buf. Clears the preexisting data in this palette.
      Specified by:
      readPacket in interface Palette<T>
      Parameters:
      buf - the packet byte buffer
      Mappings:
      Namespace Name Mixin selector
      official a Lcqg;a(Lph;)V
      intermediary method_12289 Lnet/minecraft/class_2837;method_12289(Lnet/minecraft/class_2540;)V
      named readPacket Lnet/minecraft/world/chunk/Palette;readPacket(Lnet/minecraft/network/PacketByteBuf;)V
    • writePacket

      public void writePacket(PacketByteBuf buf)
      Writes this palette to the buf.
      Specified by:
      writePacket in interface Palette<T>
      Parameters:
      buf - the packet byte buffer
      Mappings:
      Namespace Name Mixin selector
      official b Lcqg;b(Lph;)V
      intermediary method_12287 Lnet/minecraft/class_2837;method_12287(Lnet/minecraft/class_2540;)V
      named writePacket Lnet/minecraft/world/chunk/Palette;writePacket(Lnet/minecraft/network/PacketByteBuf;)V
    • getPacketSize

      public int getPacketSize()
      Returns the serialized size of this palette in a byte buf, in bytes.
      Specified by:
      getPacketSize in interface Palette<T>
      Returns:
      the serialized size of this palette in a byte buf, in bytes
      Mappings:
      Namespace Name Mixin selector
      official a Lcqg;a()I
      intermediary method_12290 Lnet/minecraft/class_2837;method_12290()I
      named getPacketSize Lnet/minecraft/world/chunk/Palette;getPacketSize()I
    • getSize

      public int getSize()
      Returns the size of the palette.
      Specified by:
      getSize in interface Palette<T>
      Returns:
      the size of the palette
      Mappings:
      Namespace Name Mixin selector
      official b Lcqg;b()I
      intermediary method_12197 Lnet/minecraft/class_2837;method_12197()I
      named getSize Lnet/minecraft/world/chunk/Palette;getSize()I