Skip to content

Commit

Permalink
Added download and install for server resource packs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 4, 2024
1 parent bd180ef commit 7752398
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion prismarine-viewer/viewer/lib/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`}`
Expand Down
6 changes: 4 additions & 2 deletions src/resourcePack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,16 @@ const prepareBlockstatesAndModels = async () => {
}
}

const downloadAndUseResourcePack = async (url) => {
const downloadAndUseResourcePack = async (url : string) => {

Check failure on line 265 in src/resourcePack.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

Unexpected space before the ':'
console.log('downloadAndUseResourcePack', url)

Check failure on line 267 in src/resourcePack.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

Trailing spaces not allowed
installTexturePack(await fetch(url).then(response => response.arrayBuffer()))

Check failure on line 268 in src/resourcePack.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

Functions that return promises must be async
}

export const onAppLoad = () => {
customEvents.on('gameLoaded', () => {
// todo also handle resourcePack
bot._client.on('resource_pack_send', async (packet) => {
bot._client.on('add_resource_pack' as any, 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 Down

0 comments on commit 7752398

Please sign in to comment.