Fix item versions
This commit is contained in:
parent
79e769530f
commit
8cd2b5ddf7
2 changed files with 5 additions and 5 deletions
8
index.js
8
index.js
|
|
@ -36,13 +36,13 @@ async function reloadHotbar (bot) {
|
|||
for (let i = 0; i < 9; i++) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const http = new XMLHttpRequest()
|
||||
let url = bot.inventory.slots[bot.inventory.hotbarStart + i] ? window.location.href + 'textures/' + bot.version + '/items/' + bot.inventory.slots[bot.inventory.hotbarStart + i].name + '.png' : ''
|
||||
let url = bot.inventory.slots[bot.inventory.hotbarStart + i] ? window.location.href + 'textures/' + viewer.version + '/items/' + bot.inventory.slots[bot.inventory.hotbarStart + i].name + '.png' : ''
|
||||
http.open('HEAD', url)
|
||||
|
||||
http.onreadystatechange = function () {
|
||||
if (this.readyState === this.DONE) {
|
||||
if (this.status === 404) {
|
||||
url = bot.inventory.slots[bot.inventory.hotbarStart + i] ? window.location.href + 'textures/' + bot.version + '/blocks/' + bot.inventory.slots[bot.inventory.hotbarStart + i].name + '.png' : ''
|
||||
url = bot.inventory.slots[bot.inventory.hotbarStart + i] ? window.location.href + 'textures/' + viewer.version + '/blocks/' + bot.inventory.slots[bot.inventory.hotbarStart + i].name + '.png' : ''
|
||||
}
|
||||
document.getElementById('hotbar-' + i).src = url
|
||||
}
|
||||
|
|
@ -268,13 +268,13 @@ async function main () {
|
|||
|
||||
// eslint-disable-next-line no-undef
|
||||
const http = new XMLHttpRequest()
|
||||
let url = newItem ? window.location.href + 'textures/' + bot.version + '/items/' + newItem.name + '.png' : ''
|
||||
let url = newItem ? window.location.href + 'textures/' + viewer.version + '/items/' + newItem.name + '.png' : ''
|
||||
http.open('HEAD', url)
|
||||
|
||||
http.onreadystatechange = function () {
|
||||
if (this.readyState === this.DONE) {
|
||||
if (this.status === 404) {
|
||||
url = newItem ? window.location.href + 'textures/' + bot.version + '/blocks/' + newItem.name + '.png' : ''
|
||||
url = newItem ? window.location.href + 'textures/' + viewer.version + '/blocks/' + newItem.name + '.png' : ''
|
||||
}
|
||||
document.getElementById('hotbar-' + (slot - bot.inventory.hotbarStart)).src = url
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
"mocha": "^8.3.0",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prismarine-viewer": "^1.16.2",
|
||||
"prismarine-viewer": "^1.17.0",
|
||||
"process": "PrismarineJS/node-process",
|
||||
"standard": "^16.0.3",
|
||||
"stream-browserify": "^3.0.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue