mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
Improve FilledPalette serialization
This commit is contained in:
parent
2627c1702e
commit
58b103afd6
@ -38,14 +38,8 @@ record FilledPalette(int dimension, int value) implements SpecializedPalette.Imm
|
||||
|
||||
@Override
|
||||
public void write(@NotNull BinaryWriter writer) {
|
||||
writer.writeByte((byte) 1); // bitsPerEntry
|
||||
// Palette
|
||||
writer.writeVarInt(1);
|
||||
writer.writeByte((byte) 0);
|
||||
writer.writeVarInt(value);
|
||||
// Data
|
||||
final int length = maxSize() / 64;
|
||||
writer.writeVarInt(length);
|
||||
// TODO: may be possible to write everything in one call instead of a loop
|
||||
for (int i = 0; i < length; i++) writer.writeLong(0);
|
||||
writer.writeVarInt(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user