Tell the server we loaded the resource pack (#4183)

* Tell the server we loaded the resource pack
* Decline resource packs if they are not required

---------

Co-authored-by: onebeastchris <github@onechris.mozmail.com>
This commit is contained in:
rtm516 2023-10-07 21:38:44 +01:00 committed by GitHub
parent e8eccc64be
commit 30cca70e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -38,6 +38,11 @@ public class JavaClientboundResourcePacksPacket extends PacketTranslator<Clientb
@Override
public void translate(GeyserSession session, ClientboundResourcePackPacket packet) {
// We need to "answer" this to avoid timeout issues related to resource packs
session.sendDownstreamPacket(new ServerboundResourcePackPacket(ResourcePackStatus.DECLINED));
// If packs are required, we need to lie to the server that we accepted them, as we get kicked otherwise.
if (packet.isRequired()) {
session.sendDownstreamPacket(new ServerboundResourcePackPacket(ResourcePackStatus.SUCCESSFULLY_LOADED));
} else {
session.sendDownstreamPacket(new ServerboundResourcePackPacket(ResourcePackStatus.DECLINED));
}
}
}