@@ -337,9 +337,10 @@ const implementedContainersGuiMap = {
337337 'minecraft:generic_3x3' : 'DropDispenseWin' ,
338338 'minecraft:furnace' : 'FurnaceWin' ,
339339 'minecraft:smoker' : 'FurnaceWin' ,
340- 'minecraft:shulker_box' : 'ChestWin' ,
341340 'minecraft:blast_furnace' : 'FurnaceWin' ,
341+ 'minecraft:shulker_box' : 'ChestWin' ,
342342 'minecraft:crafting' : 'CraftingWin' ,
343+ 'minecraft:smithing' : 'will_be_patched_in_openWindow' ,
343344 'minecraft:crafting3x3' : 'CraftingWin' , // todo different result slot
344345 'minecraft:anvil' : 'AnvilWin' ,
345346 // enchant
@@ -408,6 +409,9 @@ const upWindowItemsLocal = () => {
408409
409410let skipClosePacketSending = false
410411const openWindow = ( type : string | undefined , title : string | any = undefined ) => {
412+ // patch implementedContainersGuiMap
413+ implementedContainersGuiMap [ 'minecraft:smithing' ] = versionToNumber ( bot . version ) < versionToNumber ( '1.20' ) ? 'SmithingTableLegacyWin' : 'SmithingTableWin'
414+
411415 // if (activeModalStack.some(x => x.reactType?.includes?.('player_win:'))) {
412416 if ( activeModalStack . length && ! miscUiState . disconnectedCleanup ) { // game is not in foreground, don't close current modal
413417 if ( type ) {
@@ -422,19 +426,6 @@ const openWindow = (type: string | undefined, title: string | any = undefined) =
422426 showModal ( {
423427 reactType : `player_win:${ type } ` ,
424428 } )
425- onModalClose ( ( ) => {
426- // might be already closed (event fired)
427- if ( type !== undefined && bot . currentWindow && ! skipClosePacketSending ) bot . currentWindow [ 'close' ] ( )
428- lastWindow . destroy ( )
429- lastWindow = null as any
430- lastWindowType = undefined
431- window . inventory = null
432- miscUiState . displaySearchInput = false
433- destroyFn ( )
434- skipClosePacketSending = false
435-
436- modelViewerState . model = undefined
437- } )
438429 if ( type === undefined ) {
439430 showInventoryPlayer ( )
440431 }
@@ -471,6 +462,20 @@ const openWindow = (type: string | undefined, title: string | any = undefined) =
471462
472463 lastWindow = inv
473464
465+ onModalClose ( ( ) => {
466+ // might be already closed (event fired)
467+ if ( type !== undefined && bot . currentWindow && ! skipClosePacketSending ) bot . currentWindow [ 'close' ] ( )
468+ lastWindow . destroy ( )
469+ lastWindow = null as any
470+ lastWindowType = undefined
471+ window . inventory = null
472+ miscUiState . displaySearchInput = false
473+ destroyFn ( )
474+ skipClosePacketSending = false
475+
476+ modelViewerState . model = undefined
477+ } )
478+
474479 upWindowItemsLocal ( )
475480
476481 lastWindow . pwindow . touch = miscUiState . currentTouch ?? false
0 commit comments