Skip to content
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

Merged
merged 5 commits into from Oct 4, 2022

Conversation

TwistedAsylumMC
Copy link
Collaborator

No description provided.

// 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
Copy link
Owner

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
Copy link
Collaborator

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?

Copy link
Owner

@Sandertv Sandertv Oct 4, 2022

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.

@TwistedAsylumMC TwistedAsylumMC merged commit 020513b into master Oct 4, 2022
@Sandertv Sandertv deleted the feature/downloadfunc branch October 9, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants