Skip to content

minecraft/resource: Report a pack's full size from Len - #540

Open
HashimTheArab wants to merge 2 commits into
Sandertv:masterfrom
HashimTheArab:pack-len-uses-size
Open

HashimTheArab wants to merge 2 commits into
Sandertv:masterfrom
HashimTheArab:pack-len-uses-size

Conversation

@HashimTheArab

Copy link
Copy Markdown
Contributor

Pack.Len returned bytes.Reader.Len, which counts only the unread bytes of the archive, not its size. Len sets ResourcePackDataInfo.Size and the chunk count (DataChunkCount), and decides when the last chunk has been sent. So if the reader's position ever moves, a listener advertises a smaller pack and fewer chunks than it actually serves.

Today the content is only read with ReadAt, so the two happen to match. But the method should report the archive's full size regardless of position. It now returns bytes.Reader.Size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant