Interface Palette


public sealed interface Palette
Represents a palette used to store blocks and biomes.

0 is the default value.

  • Field Details

  • Method Details

    • blocks

      static Palette blocks(int bitsPerEntry)
    • biomes

      static Palette biomes(int bitsPerEntry)
    • blocks

      static Palette blocks()
    • biomes

      static Palette biomes()
    • empty

      static Palette empty(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits)
    • sized

      static Palette sized(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits, int bitsPerEntry)
    • get

      int get(int x, int y, int z)
    • getAll

      void getAll(@NotNull @NotNull Palette.EntryConsumer consumer)
    • getAllPresent

      void getAllPresent(@NotNull @NotNull Palette.EntryConsumer consumer)
    • set

      void set(int x, int y, int z, int value)
    • fill

      void fill(int value)
    • setAll

      void setAll(@NotNull @NotNull Palette.EntrySupplier supplier)
    • replace

      void replace(int x, int y, int z, @NotNull @NotNull IntUnaryOperator operator)
    • replaceAll

      void replaceAll(@NotNull @NotNull Palette.EntryFunction function)
    • count

      int count()
      Returns the number of entries in this palette.
    • bitsPerEntry

      int bitsPerEntry()
      Returns the number of bits used per entry.
    • dimension

      int dimension()
    • maxSize

      default int maxSize()
      Returns the maximum number of entries in this palette.
    • optimize

      void optimize(Palette.Optimization focus)
    • compare

      boolean compare(@NotNull @NotNull Palette palette)
      Compare palettes content independently of their storage format.
      Parameters:
      palette - the palette to compare with
      Returns:
      true if the palettes are equivalent, false otherwise
    • clone

      @NotNull @NotNull Palette clone()
    • paletteIndexToValue

      @Internal int paletteIndexToValue(int value)
    • valueToPaletteIndex

      @Internal int valueToPaletteIndex(int value)
    • singleValue

      @Internal int singleValue()
      Gets the single value of this palette if it is a single value palette, otherwise returns -1.
    • indexedValues

      @Internal long @Nullable [] indexedValues()
      Gets the value array if it has one, otherwise returns null (i.e. single value palette).
    • biomeSerializer

      static NetworkBuffer.Type<Palette> biomeSerializer(int biomeCount)
    • serializer

      static NetworkBuffer.Type<Palette> serializer(int dimension, int minIndirect, int maxIndirect, int directBits)