add option to enable/disable jei even depending on gamemode

This commit is contained in:
Vitaly Turovsky 2025-03-13 20:46:48 +03:00
commit 214828df0c
2 changed files with 20 additions and 10 deletions

View file

@ -458,16 +458,25 @@ const openWindow = (type: string | undefined) => {
}
}
// if (bot.game.gameMode !== 'spectator') {
lastWindow.pwindow.win.jeiSlotsPage = 0
// todo workaround so inventory opens immediately (though it still lags)
setTimeout(() => {
upJei('')
})
miscUiState.displaySearchInput = true
// } else {
// lastWindow.pwindow.win.jeiSlots = []
// }
const isJeiEnabled = () => {
if (typeof options.jeiEnabled === 'boolean') return options.jeiEnabled
if (Array.isArray(options.jeiEnabled)) {
return options.jeiEnabled.includes(bot.game?.gameMode as any)
}
return false
}
if (isJeiEnabled()) {
lastWindow.pwindow.win.jeiSlotsPage = 0
// todo workaround so inventory opens immediately (though it still lags)
setTimeout(() => {
upJei('')
})
miscUiState.displaySearchInput = true
} else {
lastWindow.pwindow.win.jeiSlots = []
miscUiState.displaySearchInput = false
}
if (type === undefined) {
// player inventory

View file

@ -63,6 +63,7 @@ const defaultOptions = {
preciseMouseInput: false,
// todo ui setting, maybe enable by default?
waitForChunksRender: 'sp-only' as 'sp-only' | boolean,
jeiEnabled: true as boolean | Array<'creative' | 'survival' | 'adventure' | 'spectator'>,
// antiAliasing: false,