fix sometimes inventory player should not be rendered
This commit is contained in:
parent
852dd737ae
commit
c930365e32
2 changed files with 13 additions and 0 deletions
|
|
@ -470,6 +470,7 @@ const openWindow = (type: string | undefined, title: string | any = undefined) =
|
|||
const isRightClick = type === 'rightclick'
|
||||
const isLeftClick = type === 'leftclick'
|
||||
if (isLeftClick || isRightClick) {
|
||||
modelViewerState.model = undefined
|
||||
inv.canvasManager.children[0].showRecipesOrUsages(isLeftClick, item)
|
||||
}
|
||||
} else {
|
||||
|
|
@ -501,6 +502,7 @@ const openWindow = (type: string | undefined, title: string | any = undefined) =
|
|||
if (freeSlot === null) return
|
||||
void bot.creative.setInventorySlot(freeSlot, item)
|
||||
} else {
|
||||
modelViewerState.model = undefined
|
||||
inv.canvasManager.children[0].showRecipesOrUsages(!isRightclick, mapSlots([item], true)[0])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
|||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
|
||||
import { applySkinToPlayerObject, createPlayerObject, PlayerObjectType } from '../../renderer/viewer/lib/createPlayerObject'
|
||||
import { currentScaling } from '../scaleInterface'
|
||||
import { activeModalStack } from '../globalState'
|
||||
|
||||
THREE.ColorManagement.enabled = false
|
||||
|
||||
|
|
@ -29,6 +30,7 @@ export const modelViewerState = proxy({
|
|||
modelCustomization?: { [modelUrl: string]: { color?: string, opacity?: number, metalness?: number, roughness?: number } }
|
||||
resetRotationOnReleae?: boolean
|
||||
continiousRender?: boolean
|
||||
alwaysRender?: boolean
|
||||
}
|
||||
})
|
||||
globalThis.modelViewerState = modelViewerState
|
||||
|
|
@ -75,6 +77,15 @@ globalThis.getModelViewerValues = () => {
|
|||
}
|
||||
}
|
||||
|
||||
subscribe(activeModalStack, () => {
|
||||
if (!modelViewerState.model || !modelViewerState.model?.alwaysRender) {
|
||||
return
|
||||
}
|
||||
if (activeModalStack.length === 0) {
|
||||
modelViewerState.model = undefined
|
||||
}
|
||||
})
|
||||
|
||||
export default () => {
|
||||
const { model } = useSnapshot(modelViewerState)
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue