From c4eb1263a332cca094e24055c7b2a3df87960524 Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Mon, 7 Oct 2024 19:34:00 +0200 Subject: [PATCH] Update resourcePack.ts --- src/resourcePack.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/resourcePack.ts b/src/resourcePack.ts index 7b5edb1ec..9631c4e23 100644 --- a/src/resourcePack.ts +++ b/src/resourcePack.ts @@ -272,7 +272,7 @@ const downloadAndUseResourcePack = async (url: string): Promise => { export const onAppLoad = () => { customEvents.on('gameLoaded', () => { // todo also handle resourcePack - bot._client.on('add_resource_pack' as any, async (packet) => { + const handleResourcePackRequest = async (packet) => { if (options.serverResourcePacks === 'never') return const promptMessage = 'promptMessage' in packet ? JSON.stringify(packet.promptMessage) : 'Do you want to use server resource pack?' // TODO! @@ -286,7 +286,9 @@ export const onAppLoad = () => { if (!choice) return await downloadAndUseResourcePack(packet.url) bot.acceptResourcePack() - }) + } + bot._client.on('resource_pack_send', handleResourcePackRequest) + bot._client.on('add_resource_pack' as any, handleResourcePackRequest) }) subscribe(resourcePackState, () => {