@@ -23,7 +23,7 @@ import { MessageFormatPart } from './chatUtils'
23
23
import { GeneralInputItem , getItemMetadata , getItemModelName , getItemNameRaw , RenderItem } from './mineflayer/items'
24
24
import { playerState } from './mineflayer/playerState'
25
25
26
- const loadedImagesCache = new Map < string , HTMLImageElement > ( )
26
+ const loadedImagesCache = new Map < string , HTMLImageElement | ImageBitmap > ( )
27
27
const cleanLoadedImagesCache = ( ) => {
28
28
loadedImagesCache . delete ( 'blocks' )
29
29
loadedImagesCache . delete ( 'items' )
@@ -132,11 +132,12 @@ export const onGameLoad = () => {
132
132
}
133
133
}
134
134
135
- const getImageSrc = ( path ) : string | HTMLImageElement => {
135
+ const getImageSrc = ( path ) : string | HTMLImageElement | ImageBitmap => {
136
136
switch ( path ) {
137
137
case 'gui/container/inventory' : return appReplacableResources . latest_gui_container_inventory . content
138
138
case 'blocks' : return appViewer . resourcesManager . blocksAtlasParser . latestImage
139
139
case 'items' : return appViewer . resourcesManager . itemsAtlasParser . latestImage
140
+ case 'gui' : return appViewer . resourcesManager . currentResources ! . guiAtlas ! . image
140
141
case 'gui/container/dispenser' : return appReplacableResources . latest_gui_container_dispenser . content
141
142
case 'gui/container/furnace' : return appReplacableResources . latest_gui_container_furnace . content
142
143
case 'gui/container/crafting_table' : return appReplacableResources . latest_gui_container_crafting_table . content
@@ -167,6 +168,12 @@ const getImage = ({ path = undefined as string | undefined, texture = undefined
167
168
onLoad ( )
168
169
} else {
169
170
const imageSrc = getImageSrc ( loadPath )
171
+ if ( imageSrc instanceof ImageBitmap ) {
172
+ onLoad ( )
173
+ loadedImagesCache . set ( loadPath , imageSrc )
174
+ return imageSrc
175
+ }
176
+
170
177
let image : HTMLImageElement
171
178
if ( imageSrc instanceof Image ) {
172
179
image = imageSrc
@@ -277,6 +284,7 @@ const implementedContainersGuiMap = {
277
284
'minecraft:generic_3x3' : 'DropDispenseWin' ,
278
285
'minecraft:furnace' : 'FurnaceWin' ,
279
286
'minecraft:smoker' : 'FurnaceWin' ,
287
+ 'minecraft:shulker_box' : 'ChestWin' ,
280
288
'minecraft:blast_furnace' : 'FurnaceWin' ,
281
289
'minecraft:crafting' : 'CraftingWin' ,
282
290
'minecraft:crafting3x3' : 'CraftingWin' , // todo different result slot
@@ -367,14 +375,15 @@ const openWindow = (type: string | undefined) => {
367
375
lastWindow . destroy ( )
368
376
lastWindow = null as any
369
377
lastWindowType = null
370
- window . lastWindow = lastWindow
378
+ window . inventory = null
371
379
miscUiState . displaySearchInput = false
372
380
destroyFn ( )
373
381
skipClosePacketSending = false
374
382
} )
375
383
cleanLoadedImagesCache ( )
376
384
const inv = openItemsCanvas ( type )
377
385
inv . canvasManager . children [ 0 ] . mobileHelpers = miscUiState . currentTouch
386
+ window . inventory = inv
378
387
const title = bot . currentWindow ?. title
379
388
const PrismarineChat = PrismarineChatLoader ( bot . version )
380
389
try {
0 commit comments