Improve FilledPalette serialization

This commit is contained in:
themode 2022-02-25 03:00:53 +01:00
parent 2627c1702e
commit 58b103afd6

View File

@ -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);
}
}