Class DataPaletteImpl
java.lang.Object
com.viaversion.viaversion.api.minecraft.chunks.DataPaletteImpl
- All Implemented Interfaces:
DataPalette
-
Constructor Summary
ConstructorDescriptionDataPaletteImpl
(int valuesLength) DataPaletteImpl
(int valuesLength, int initialSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addId
(int id) Adds a new id to the palette.void
clear()
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
size()
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 interfaceDataPalette
- Parameters:
x
- xy
- yz
- 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 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:DataPalette
Set a value in the chunk section. This method does not update non-air blocks count.- Specified by:
setIdAt
in interfaceDataPalette
- Parameters:
sectionCoordinate
- section index within the sectionid
- 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 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:DataPalette
Sets the index of the given section coordinate.- Specified by:
setPaletteIndexAt
in interfaceDataPalette
- Parameters:
sectionCoordinate
- section indexindex
- palette index
-
size
public int size()Description copied from interface:DataPalette
Returns the size of the palette.- Specified by:
size
in interfaceDataPalette
- 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 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:DataPalette
Assigns an id assigned to the given palette index.- Specified by:
setIdByIndex
in interfaceDataPalette
- Parameters:
index
- palette indexid
- 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 interfaceDataPalette
- Parameters:
oldId
- old idnewId
- new id
-
addId
public void addId(int id) Description copied from interface:DataPalette
Adds a new id to the palette.- Specified by:
addId
in interfaceDataPalette
- Parameters:
id
- id value
-
clear
public void clear()Description copied from interface:DataPalette
Clears the palette.- Specified by:
clear
in interfaceDataPalette
-