mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-13 19:51:27 +01:00
Less line
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
5e41b148a4
commit
379ca22903
@ -141,30 +141,24 @@ final class PaletteImpl implements Palette, Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fill(int value) {
|
public void fill(int value) {
|
||||||
final boolean placedAir = value == 0;
|
if (value == 0) {
|
||||||
if (!placedAir) value = getPaletteIndex(value);
|
this.values = new long[0];
|
||||||
|
this.count = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value = getPaletteIndex(value);
|
||||||
final int bitsPerEntry = this.bitsPerEntry;
|
final int bitsPerEntry = this.bitsPerEntry;
|
||||||
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
final int valuesPerLong = VALUES_PER_LONG[bitsPerEntry];
|
||||||
long[] values = this.values;
|
long[] values = this.values;
|
||||||
if (values.length == 0) {
|
if (values.length == 0) {
|
||||||
if (placedAir) {
|
|
||||||
// Section is empty and method is trying to place an air block, stop unnecessary computation
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Initialize the section
|
|
||||||
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
||||||
}
|
}
|
||||||
if (placedAir) {
|
|
||||||
this.values = new long[0];
|
|
||||||
this.count = 0;
|
|
||||||
} else {
|
|
||||||
long block = 0;
|
long block = 0;
|
||||||
for (int i = 0; i < valuesPerLong; i++)
|
for (int i = 0; i < valuesPerLong; i++)
|
||||||
block |= (long) value << i * bitsPerEntry;
|
block |= (long) value << i * bitsPerEntry;
|
||||||
Arrays.fill(values, block);
|
Arrays.fill(values, block);
|
||||||
this.count = maxSize();
|
this.count = maxSize();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAll(@NotNull EntrySupplier supplier) {
|
public void setAll(@NotNull EntrySupplier supplier) {
|
||||||
|
Loading…
Reference in New Issue
Block a user