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 interfacestatic interfacestatic interfacestatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final NetworkBuffer.Type<Palette> -
Method Summary
Modifier and TypeMethodDescriptionstatic Palettebiomes()static Palettebiomes(int bitsPerEntry) static NetworkBuffer.Type<Palette> biomeSerializer(int biomeCount) intReturns the number of bits used per entry.static Paletteblocks()static Paletteblocks(int bitsPerEntry) @NotNull Paletteclone()booleanCompare palettes content independently of their storage format.intcount()Returns the number of entries in this palette.intstatic Paletteempty(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits) voidfill(int value) intget(int x, int y, int z) voidgetAll(@NotNull Palette.EntryConsumer consumer) voidgetAllPresent(@NotNull Palette.EntryConsumer consumer) long @Nullable []Gets the value array if it has one, otherwise returns null (i.e.default intmaxSize()Returns the maximum number of entries in this palette.voidoptimize(Palette.Optimization focus) intpaletteIndexToValue(int value) voidreplace(int x, int y, int z, @NotNull IntUnaryOperator operator) voidreplaceAll(@NotNull Palette.EntryFunction function) static NetworkBuffer.Type<Palette> serializer(int dimension, int minIndirect, int maxIndirect, int directBits) voidset(int x, int y, int z, int value) voidsetAll(@NotNull Palette.EntrySupplier supplier) intGets the single value of this palette if it is a single value palette, otherwise returns -1.static Palettesized(int dimension, int minBitsPerEntry, int maxBitsPerEntry, int directBits, int bitsPerEntry) intvalueToPaletteIndex(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)
-