@@ -23,7 +23,7 @@ import { MessageFormatPart } from './chatUtils'
2323import { GeneralInputItem , getItemMetadata , getItemModelName , getItemNameRaw , RenderItem } from './mineflayer/items'
2424import { playerState } from './mineflayer/playerState'
2525
26- const loadedImagesCache = new Map < string , HTMLImageElement > ( )
26+ const loadedImagesCache = new Map < string , HTMLImageElement | ImageBitmap > ( )
2727const cleanLoadedImagesCache = ( ) => {
2828 loadedImagesCache . delete ( 'blocks' )
2929 loadedImagesCache . delete ( 'items' )
@@ -132,11 +132,12 @@ export const onGameLoad = () => {
132132 }
133133}
134134
135- const getImageSrc = ( path ) : string | HTMLImageElement => {
135+ const getImageSrc = ( path ) : string | HTMLImageElement | ImageBitmap => {
136136 switch ( path ) {
137137 case 'gui/container/inventory' : return appReplacableResources . latest_gui_container_inventory . content
138138 case 'blocks' : return appViewer . resourcesManager . blocksAtlasParser . latestImage
139139 case 'items' : return appViewer . resourcesManager . itemsAtlasParser . latestImage
140+ case 'gui' : return appViewer . resourcesManager . currentResources ! . guiAtlas ! . image
140141 case 'gui/container/dispenser' : return appReplacableResources . latest_gui_container_dispenser . content
141142 case 'gui/container/furnace' : return appReplacableResources . latest_gui_container_furnace . content
142143 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
167168 onLoad ( )
168169 } else {
169170 const imageSrc = getImageSrc ( loadPath )
171+ if ( imageSrc instanceof ImageBitmap ) {
172+ onLoad ( )
173+ loadedImagesCache . set ( loadPath , imageSrc )
174+ return imageSrc
175+ }
176+
170177 let image : HTMLImageElement
171178 if ( imageSrc instanceof Image ) {
172179 image = imageSrc
@@ -277,6 +284,7 @@ const implementedContainersGuiMap = {
277284 'minecraft:generic_3x3' : 'DropDispenseWin' ,
278285 'minecraft:furnace' : 'FurnaceWin' ,
279286 'minecraft:smoker' : 'FurnaceWin' ,
287+ 'minecraft:shulker_box' : 'ChestWin' ,
280288 'minecraft:blast_furnace' : 'FurnaceWin' ,
281289 'minecraft:crafting' : 'CraftingWin' ,
282290 'minecraft:crafting3x3' : 'CraftingWin' , // todo different result slot
@@ -367,14 +375,15 @@ const openWindow = (type: string | undefined) => {
367375 lastWindow . destroy ( )
368376 lastWindow = null as any
369377 lastWindowType = null
370- window . lastWindow = lastWindow
378+ window . inventory = null
371379 miscUiState . displaySearchInput = false
372380 destroyFn ( )
373381 skipClosePacketSending = false
374382 } )
375383 cleanLoadedImagesCache ( )
376384 const inv = openItemsCanvas ( type )
377385 inv . canvasManager . children [ 0 ] . mobileHelpers = miscUiState . currentTouch
386+ window . inventory = inv
378387 const title = bot . currentWindow ?. title
379388 const PrismarineChat = PrismarineChatLoader ( bot . version )
380389 try {
0 commit comments