New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a function to stop packs from being downloaded #155
Conversation
minecraft/dial.go
Outdated
// DownloadResourcePack is called individually for every texture and behaviour pack sent by the connection when | ||
// using Dialer.Dial(), and can be used to stop the pack from being downloaded. The function is called with the UUID | ||
// and version of the resource pack, and the boolean returned determines if the pack will be downloaded or not. | ||
DownloadResourcePack func(packUUID uuid.UUID, version string) bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would rename packUUID
as id
but otherwise this is ready to go I think.
@@ -835,6 +841,9 @@ func (conn *Conn) handleResourcePacksInfo(pk *packet.ResourcePacksInfo) error { | |||
conn.packQueue.packAmount-- | |||
continue | |||
} | |||
if conn.downloadResourcePack != nil && !conn.downloadResourcePack(uuid.MustParse(pack.UUID), pack.Version) { | |||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you decrement packAmount here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm yeah this seems to be an issue. I think currently this will break if some of the packs are ignored, but not all of them.
No description provided.