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

Accepting Forced Resource Packs #281

Open
HazeCore opened this issue Jul 12, 2024 · 2 comments
Open

Accepting Forced Resource Packs #281

HazeCore opened this issue Jul 12, 2024 · 2 comments

Comments

@HazeCore
Copy link

Hi there! o7

Thanks for your work on this Bot Framework.

I have a quick question regarding the use of resource packs on servers. I'm hosting a server that forces resource packs for its clients. If I try to connect via go-mc, the JoinServer() function hangs indefinitely. I've tested the behavior thoroughly, and the forced resource pack seems to be the problem here. I saw that the structures of the config have fields for the resource pack, but I haven't found a way to accept the resource pack and instantiate the player. I have to admit, I don't really know how the connection protocol of Minecraft is designed, so if the solution is easy, I apologize, but would take the hint ;)

Any message or help about this would be appreciated!

Greetings from Berlin
HC

@Tnze
Copy link
Owner

Tnze commented Jul 13, 2024

You must send a Resource Pack Response packet after received a ResourcePackPush here

go-mc/bot/configuration.go

Lines 200 to 224 in 300304e

case packetid.ClientboundConfigResourcePackPush:
var id pk.UUID
var Url, Hash pk.String
var Forced pk.Boolean
var PromptMessage pk.Option[chat.Message, *chat.Message]
err := p.Scan(
&id,
&Url,
&Hash,
&Forced,
&PromptMessage,
)
if err != nil {
return ConfigErr{"resource pack", err}
}
res := ResourcePack{
ID: id,
URL: string(Url),
Hash: string(Hash),
Forced: bool(Forced),
}
if PromptMessage.Has {
res.PromptMessage = &PromptMessage.Val
}
c.ConfigHandler.PushResourcePack(res)

Currently we didn't, so the bot hangs up.

@Tnze
Copy link
Owner

Tnze commented Jul 13, 2024

Maybe you can extend the DefaultConfigHandler and send the response. I'm not sure if I expose enough API to do so. Feel free to clone go-mc to modify related code.

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

No branches or pull requests

2 participants