java.lang.Object
org.geysermc.mcprotocollib.protocol.data.game.chunk.palette.MapPalette
All Implemented Interfaces:
Palette

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

    Constructors
    Constructor
    Description
    MapPalette(int bitsPerEntry)
     
    MapPalette(int bitsPerEntry, io.netty.buffer.ByteBuf in)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canEqual(@Nullable Object other)
     
    boolean
    contains(int state)
    Checks if this palette contains a given block state.
    Creates a copy of this palette.
    boolean
    equals(@Nullable Object o)
     
    int
     
    int
    idToState(int id)
    Converts a storage ID to a block state.
    int
    Gets the number of block states known by this palette.
    int
    stateToId(int state)
    Converts a block state to a storage ID.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MapPalette

      public MapPalette(int bitsPerEntry)
    • MapPalette

      public MapPalette(int bitsPerEntry, io.netty.buffer.ByteBuf 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.
    • contains

      public boolean contains(int state)
      Description copied from interface: Palette
      Checks if this palette contains a given block state.
      Specified by:
      contains in interface Palette
    • copy

      public MapPalette copy()
      Description copied from interface: Palette
      Creates a copy of this palette. This performs a deep copy of the palette's internal data.
      Specified by:
      copy in interface Palette
      Returns:
      The palette's copy.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object