Class DataPaletteImpl
java.lang.Object
com.viaversion.viaversion.api.minecraft.chunks.DataPaletteImpl
- All Implemented Interfaces:
DataPalette
-
Constructor Summary
ConstructorsConstructorDescriptionDataPaletteImpl(int valuesLength) DataPaletteImpl(int valuesLength, int initialSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddId(int id) Adds a new id to the palette.voidclear()Clears the palette.intidAt(int sectionCoordinate) Returns the value of the given chunk coordinate.intidByIndex(int index) Returns the id assigned to the given palette index.intindex(int x, int y, int z) Returns the packet section index of the given coordinates.intpaletteIndexAt(int packedCoordinate) Returns the palette index of the given section index.voidreplaceId(int oldId, int newId) Replaces an id in the palette.voidsetIdAt(int sectionCoordinate, int id) Set a value in the chunk section.voidsetIdByIndex(int index, int id) Assigns an id assigned to the given palette index.voidsetPaletteIndexAt(int sectionCoordinate, int index) Sets the index of the given section coordinate.intsize()Returns the size of the palette.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:DataPaletteReturns the packet section index of the given coordinates.- Specified by:
indexin interfaceDataPalette- Parameters:
x- xy- yz- z- Returns:
- packed section index of the given coordinates
-
idAt
public int idAt(int sectionCoordinate) Description copied from interface:DataPaletteReturns the value of the given chunk coordinate.- Specified by:
idAtin interfaceDataPalette- 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:DataPaletteSet a value in the chunk section. This method does not update non-air blocks count.- Specified by:
setIdAtin interfaceDataPalette- Parameters:
sectionCoordinate- section index within the sectionid- id value
-
paletteIndexAt
public int paletteIndexAt(int packedCoordinate) Description copied from interface:DataPaletteReturns the palette index of the given section index.- Specified by:
paletteIndexAtin interfaceDataPalette- Parameters:
packedCoordinate- section index- Returns:
- palette index of the given section index
-
setPaletteIndexAt
public void setPaletteIndexAt(int sectionCoordinate, int index) Description copied from interface:DataPaletteSets the index of the given section coordinate.- Specified by:
setPaletteIndexAtin interfaceDataPalette- Parameters:
sectionCoordinate- section indexindex- palette index
-
size
public int size()Description copied from interface:DataPaletteReturns the size of the palette.- Specified by:
sizein interfaceDataPalette- Returns:
- palette size
-
idByIndex
public int idByIndex(int index) Description copied from interface:DataPaletteReturns the id assigned to the given palette index.- Specified by:
idByIndexin interfaceDataPalette- Parameters:
index- palette index- Returns:
- id assigned to the given palette index
-
setIdByIndex
public void setIdByIndex(int index, int id) Description copied from interface:DataPaletteAssigns an id assigned to the given palette index.- Specified by:
setIdByIndexin interfaceDataPalette- Parameters:
index- palette indexid- id value
-
replaceId
public void replaceId(int oldId, int newId) Description copied from interface:DataPaletteReplaces an id in the palette.- Specified by:
replaceIdin interfaceDataPalette- Parameters:
oldId- old idnewId- new id
-
addId
public void addId(int id) Description copied from interface:DataPaletteAdds a new id to the palette.- Specified by:
addIdin interfaceDataPalette- Parameters:
id- id value
-
clear
public void clear()Description copied from interface:DataPaletteClears the palette.- Specified by:
clearin interfaceDataPalette
-