Interface Palette
public sealed interface Palette
Represents a palette used to store blocks and biomes.
0 is the default value.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
static interface
static interface
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final NetworkBuffer.Type
<Palette> -
Method Summary
Modifier and TypeMethodDescriptionstatic Palette
biomes()
static Palette
biomes
(int bitsPerEntry) static NetworkBuffer.Type
<Palette> biomeSerializer
(int biomeCount) int
Returns the number of bits used per entry.static Palette
blocks()
static Palette
blocks
(int bitsPerEntry) @NotNull Palette
clone()
boolean
Compare palettes content independently of their storage format.int
count()
Returns the number of entries in this palette.int
static Palette
empty
(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits) void
fill
(int value) int
get
(int x, int y, int z) void
getAll
(@NotNull Palette.EntryConsumer consumer) void
getAllPresent
(@NotNull Palette.EntryConsumer consumer) long @Nullable []
Gets the value array if it has one, otherwise returns null (i.e.default int
maxSize()
Returns the maximum number of entries in this palette.void
optimize
(Palette.Optimization focus) int
paletteIndexToValue
(int value) void
replace
(int x, int y, int z, @NotNull IntUnaryOperator operator) void
replaceAll
(@NotNull Palette.EntryFunction function) static NetworkBuffer.Type
<Palette> serializer
(int dimension, int minIndirect, int maxIndirect, int directBits) void
set
(int x, int y, int z, int value) void
setAll
(@NotNull Palette.EntrySupplier supplier) int
Gets the single value of this palette if it is a single value palette, otherwise returns -1.static Palette
sized
(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits, int bitsPerEntry) int
valueToPaletteIndex
(int value)
-
Field Details
-
BLOCK_DIMENSION
static final int BLOCK_DIMENSION- See Also:
-
BLOCK_PALETTE_MIN_BITS
static final int BLOCK_PALETTE_MIN_BITS- See Also:
-
BLOCK_PALETTE_MAX_BITS
static final int BLOCK_PALETTE_MAX_BITS- See Also:
-
BLOCK_PALETTE_DIRECT_BITS
static final int BLOCK_PALETTE_DIRECT_BITS- See Also:
-
BIOME_DIMENSION
static final int BIOME_DIMENSION- See Also:
-
BIOME_PALETTE_MIN_BITS
static final int BIOME_PALETTE_MIN_BITS- See Also:
-
BIOME_PALETTE_MAX_BITS
static final int BIOME_PALETTE_MAX_BITS- See Also:
-
BIOME_PALETTE_DIRECT_BITS
@Internal static final int BIOME_PALETTE_DIRECT_BITS- See Also:
-
BLOCK_SERIALIZER
-
-
Method Details
-
blocks
-
biomes
-
blocks
-
biomes
-
empty
-
sized
static Palette sized(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits, int bitsPerEntry) -
get
int get(int x, int y, int z) -
getAll
-
getAllPresent
-
set
void set(int x, int y, int z, int value) -
fill
void fill(int value) -
setAll
-
replace
-
replaceAll
-
count
int count()Returns the number of entries in this palette. -
bitsPerEntry
int bitsPerEntry()Returns the number of bits used per entry. -
dimension
int dimension() -
maxSize
default int maxSize()Returns the maximum number of entries in this palette. -
optimize
-
compare
Compare palettes content independently of their storage format.- Parameters:
palette
- the palette to compare with- Returns:
- true if the palettes are equivalent, false otherwise
-
clone
-
paletteIndexToValue
@Internal int paletteIndexToValue(int value) -
valueToPaletteIndex
@Internal int valueToPaletteIndex(int value) -
singleValue
@Internal int singleValue()Gets the single value of this palette if it is a single value palette, otherwise returns -1. -
indexedValues
@Internal long @Nullable [] indexedValues()Gets the value array if it has one, otherwise returns null (i.e. single value palette). -
biomeSerializer
-
serializer
static NetworkBuffer.Type<Palette> serializer(int dimension, int minIndirect, int maxIndirect, int directBits)
-