public static int GetChunkDataLength <TPalette>(TPalette palette) where TPalette : IBlockPalette { int length = 0; length += sizeof(short); length += sizeof(byte); length += palette.GetEncodedSize(); int longCount = GetUnderlyingDataLength(UnderlyingDataSize, palette.BitsPerBlock); length += VarInt.GetEncodedSize(longCount); length += longCount * sizeof(ulong); return(length); }
public static int GetChunkSectionDataLength(ChunkSection section) { if (section == null) { throw new ArgumentNullException(nameof(section)); } IBlockPalette palette = section.BlockPalette; int length = 0; length += sizeof(short); length += sizeof(byte); length += palette.GetEncodedSize(); int longCount = GetUnderlyingDataLength(UnderlyingDataSize, palette.BitsPerBlock); length += VarInt.GetEncodedSize(longCount); length += longCount * sizeof(ulong); return(length); }