diff --git a/prismarine-viewer/viewer/lib/entities.ts b/prismarine-viewer/viewer/lib/entities.ts index c7476f6c3..ee659263a 100644 --- a/prismarine-viewer/viewer/lib/entities.ts +++ b/prismarine-viewer/viewer/lib/entities.ts @@ -340,7 +340,6 @@ export class Entities extends EventEmitter { } update (entity: import('prismarine-entity').Entity & { delete?; pos }, overrides) { - console.log('entity', entity) const isPlayerModel = entity.name === 'player' if (entity.name === 'zombie' || entity.name === 'zombie_villager' || entity.name === 'husk') { overrides.texture = `textures/1.16.4/entity/${entity.name === 'zombie_villager' ? 'zombie_villager/zombie_villager.png' : `zombie/${entity.name}.png`}` diff --git a/src/resourcePack.ts b/src/resourcePack.ts index aac1c5bc4..9631c4e23 100644 --- a/src/resourcePack.ts +++ b/src/resourcePack.ts @@ -262,14 +262,17 @@ const prepareBlockstatesAndModels = async () => { } } -const downloadAndUseResourcePack = async (url) => { +const downloadAndUseResourcePack = async (url: string): Promise => { console.log('downloadAndUseResourcePack', url) + const response = await fetch(url) + const resourcePackData = await response.arrayBuffer() + installTexturePack(resourcePackData) } export const onAppLoad = () => { customEvents.on('gameLoaded', () => { // todo also handle resourcePack - bot._client.on('resource_pack_send', 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! @@ -283,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, () => {