hide hand in spectator

This commit is contained in:
Vitaly Turovsky 2025-03-15 02:18:51 +03:00
commit 847314d50f
3 changed files with 6 additions and 1 deletions

View file

@ -24,6 +24,7 @@ export interface IPlayerState {
getItemUsageTicks?(): number
// isUsingItem?(): boolean
getHeldItem?(isLeftHand: boolean): HandItemBlock | undefined
gameMode?: string
username?: string
onlineMode?: boolean

View file

@ -241,7 +241,7 @@ export class WorldRendererThree extends WorldRendererCommon {
// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
const cam = this.camera instanceof THREE.Group ? this.camera.children.find(child => child instanceof THREE.PerspectiveCamera) as THREE.PerspectiveCamera : this.camera
this.renderer.render(this.scene, cam)
if (this.config.showHand && !this.freeFlyMode) {
if (this.config.showHand && !this.freeFlyMode && this.playerState.gameMode !== 'spectator') {
this.holdingBlock.render(this.camera, this.renderer, viewer.ambientLight, viewer.directionalLight)
this.holdingBlockLeft.render(this.camera, this.renderer, viewer.ambientLight, viewer.directionalLight)
}

View file

@ -29,6 +29,10 @@ export class PlayerStateManager implements IPlayerState {
return bot.player?.username ?? ''
}
get gameMode () {
return bot.game?.gameMode
}
reactive = proxy({
playerSkin: undefined as string | undefined,
})