Skip to content

Commit b2f2d85

Browse files
committed
feat(setting): add a way to specify default perspective view
1 parent 7a83a2a commit b2f2d85

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/defaultOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const defaultOptions = {
1919
enableMusic: false,
2020
// fov: 70,
2121
fov: 75,
22+
defaultPerspective: 'first_person' as 'first_person' | 'third_person_back' | 'third_person_front',
2223
guiScale: 3,
2324
autoRequestCompletions: true,
2425
touchButtonsSize: 40,

src/mineflayer/playerState.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getInitialPlayerState, getPlayerStateUtils, PlayerStateReactive, Player
33
import { subscribe } from 'valtio'
44
import { subscribeKey } from 'valtio/utils'
55
import { gameAdditionalState } from '../globalState'
6+
import { options } from '../optionsStorage'
67

78
/**
89
* can be used only in main thread. Mainly for more convenient reactive state updates.
@@ -42,6 +43,7 @@ export class PlayerStateControllerMain {
4243
private botCreated () {
4344
console.log('bot created & plugins injected')
4445
this.reactive = getInitialPlayerState()
46+
this.reactive.perspective = options.defaultPerspective
4547
this.utils = getPlayerStateUtils(this.reactive)
4648
this.onBotCreatedOrGameJoined()
4749

0 commit comments

Comments
 (0)