java.lang.Object
com.github.retrooper.packetevents.protocol.world.chunk.palette.MapPalette
All Implemented Interfaces:
Palette

public class MapPalette extends Object implements Palette
A palette backed by a map.
  • Constructor Details

    • MapPalette

      public MapPalette(int bitsPerEntry)
    • MapPalette

      public MapPalette(int bitsPerEntry, NetStreamInput in)
  • Method Details

    • size

      public int size()
      Description copied from interface: Palette
      Gets the number of block states known by this palette.
      Specified by:
      size in interface Palette
      Returns:
      The palette's size.
    • stateToId

      public int stateToId(int state)
      Description copied from interface: Palette
      Converts a block state to a storage ID. If the state has not been mapped, the palette will attempt to map it, returning -1 if it cannot.
      Specified by:
      stateToId in interface Palette
      Parameters:
      state - Block state to convert.
      Returns:
      The resulting storage ID.
    • idToState

      public int idToState(int id)
      Description copied from interface: Palette
      Converts a storage ID to a block state. If the storage ID has no mapping, it will return a block state of 0.
      Specified by:
      idToState in interface Palette
      Parameters:
      id - Storage ID to convert.
      Returns:
      The resulting block state.