Skip to content

Commit

Permalink
Update resourcePack.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 7, 2024
1 parent 836b172 commit c4eb126
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/resourcePack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const downloadAndUseResourcePack = async (url: string): Promise<void> => {
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!
Expand All @@ -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, () => {
Expand Down

0 comments on commit c4eb126

Please sign in to comment.