Class DataPaletteImpl

java.lang.Object
com.viaversion.viaversion.api.minecraft.chunks.DataPaletteImpl
All Implemented Interfaces:
DataPalette

public final class DataPaletteImpl extends Object implements DataPalette
  • Constructor Summary

    Constructors
    Constructor
    Description
    DataPaletteImpl(int valuesLength)
     
    DataPaletteImpl(int valuesLength, int initialSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addId(int id)
    Adds a new id to the palette.
    void
    Clears the palette.
    int
    idAt(int sectionCoordinate)
    Returns the value of the given chunk coordinate.
    int
    idByIndex(int index)
    Returns the id assigned to the given palette index.
    int
    index(int x, int y, int z)
    Returns the packet section index of the given coordinates.
    int
    paletteIndexAt(int packedCoordinate)
    Returns the palette index of the given section index.
    void
    replaceId(int oldId, int newId)
    Replaces an id in the palette.
    void
    setIdAt(int sectionCoordinate, int id)
    Set a value in the chunk section.
    void
    setIdByIndex(int index, int id)
    Assigns an id assigned to the given palette index.
    void
    setPaletteIndexAt(int sectionCoordinate, int index)
    Sets the index of the given section coordinate.
    int
    Returns the size of the palette.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.viaversion.viaversion.api.minecraft.chunks.DataPalette

    idAt, setIdAt
  • Constructor Details

    • DataPaletteImpl

      public DataPaletteImpl(int valuesLength)
    • DataPaletteImpl

      public DataPaletteImpl(int valuesLength, int initialSize)
  • Method Details

    • index

      public int index(int x, int y, int z)
      Description copied from interface: DataPalette
      Returns the packet section index of the given coordinates.
      Specified by:
      index in interface DataPalette
      Parameters:
      x - x
      y - y
      z - z
      Returns:
      packed section index of the given coordinates
    • idAt

      public int idAt(int sectionCoordinate)
      Description copied from interface: DataPalette
      Returns the value of the given chunk coordinate.
      Specified by:
      idAt in interface DataPalette
      Parameters:
      sectionCoordinate - section index within the section
      Returns:
      section state of the given index
    • setIdAt

      public void setIdAt(int sectionCoordinate, int id)
      Description copied from interface: DataPalette
      Set a value in the chunk section. This method does not update non-air blocks count.
      Specified by:
      setIdAt in interface DataPalette
      Parameters:
      sectionCoordinate - section index within the section
      id - id value
    • paletteIndexAt

      public int paletteIndexAt(int packedCoordinate)
      Description copied from interface: DataPalette
      Returns the palette index of the given section index.
      Specified by:
      paletteIndexAt in interface DataPalette
      Parameters:
      packedCoordinate - section index
      Returns:
      palette index of the given section index
    • setPaletteIndexAt

      public void setPaletteIndexAt(int sectionCoordinate, int index)
      Description copied from interface: DataPalette
      Sets the index of the given section coordinate.
      Specified by:
      setPaletteIndexAt in interface DataPalette
      Parameters:
      sectionCoordinate - section index
      index - palette index
    • size

      public int size()
      Description copied from interface: DataPalette
      Returns the size of the palette.
      Specified by:
      size in interface DataPalette
      Returns:
      palette size
    • idByIndex

      public int idByIndex(int index)
      Description copied from interface: DataPalette
      Returns the id assigned to the given palette index.
      Specified by:
      idByIndex in interface DataPalette
      Parameters:
      index - palette index
      Returns:
      id assigned to the given palette index
    • setIdByIndex

      public void setIdByIndex(int index, int id)
      Description copied from interface: DataPalette
      Assigns an id assigned to the given palette index.
      Specified by:
      setIdByIndex in interface DataPalette
      Parameters:
      index - palette index
      id - id value
    • replaceId

      public void replaceId(int oldId, int newId)
      Description copied from interface: DataPalette
      Replaces an id in the palette.
      Specified by:
      replaceId in interface DataPalette
      Parameters:
      oldId - old id
      newId - new id
    • addId

      public void addId(int id)
      Description copied from interface: DataPalette
      Adds a new id to the palette.
      Specified by:
      addId in interface DataPalette
      Parameters:
      id - id value
    • clear

      public void clear()
      Description copied from interface: DataPalette
      Clears the palette.
      Specified by:
      clear in interface DataPalette