mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-03 22:12:20 +01:00
Free memory when clearing palette
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
42dc264c93
commit
5e41b148a4
@ -49,8 +49,8 @@ public final class Section implements Writeable {
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.blockPalette = Palette.blocks();
|
||||
this.biomePalette = Palette.biomes();
|
||||
this.blockPalette.fill(0);
|
||||
this.biomePalette.fill(0);
|
||||
this.skyLight = new byte[0];
|
||||
this.blockLight = new byte[0];
|
||||
}
|
||||
|
@ -154,15 +154,13 @@ final class PaletteImpl implements Palette, Cloneable {
|
||||
// Initialize the section
|
||||
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
||||
}
|
||||
|
||||
if (placedAir) {
|
||||
Arrays.fill(values, 0);
|
||||
this.values = new long[0];
|
||||
this.count = 0;
|
||||
} else {
|
||||
long block = 0;
|
||||
for (int i = 0; i < valuesPerLong; i++) {
|
||||
for (int i = 0; i < valuesPerLong; i++)
|
||||
block |= (long) value << i * bitsPerEntry;
|
||||
}
|
||||
Arrays.fill(values, block);
|
||||
this.count = maxSize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user