mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-25 18:47:40 +01:00
palette inlining
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
920bf62699
commit
09aea3c8d4
@ -51,8 +51,7 @@ final class AdaptivePalette implements Palette {
|
||||
if (x < 0 || y < 0 || z < 0) {
|
||||
throw new IllegalArgumentException("Coordinates must be positive");
|
||||
}
|
||||
Palette palette = switchFlexible();
|
||||
palette.set(x, y, z, value);
|
||||
flexiblePalette().set(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,14 +71,12 @@ final class AdaptivePalette implements Palette {
|
||||
if (x < 0 || y < 0 || z < 0) {
|
||||
throw new IllegalArgumentException("Coordinates must be positive");
|
||||
}
|
||||
Palette palette = switchFlexible();
|
||||
palette.replace(x, y, z, operator);
|
||||
flexiblePalette().replace(x, y, z, operator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceAll(@NotNull EntryFunction function) {
|
||||
Palette palette = switchFlexible();
|
||||
palette.replaceAll(function);
|
||||
flexiblePalette().replaceAll(function);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,8 +132,8 @@ final class AdaptivePalette implements Palette {
|
||||
return currentPalette;
|
||||
}
|
||||
|
||||
Palette switchFlexible() {
|
||||
var currentPalette = this.palette;
|
||||
Palette flexiblePalette() {
|
||||
SpecializedPalette currentPalette = this.palette;
|
||||
if (currentPalette instanceof FilledPalette filledPalette) {
|
||||
currentPalette = new FlexiblePalette(this);
|
||||
currentPalette.fill(filledPalette.value());
|
||||
|
Loading…
Reference in New Issue
Block a user