fix: fix more starfield issues, make disableable
This commit is contained in:
parent
1de6ae8f2c
commit
8fdcbdfc60
5 changed files with 44 additions and 18 deletions
|
|
@ -277,11 +277,23 @@ export class WorldRendererThree extends WorldRendererCommon {
|
|||
|
||||
class StarField {
|
||||
points?: THREE.Points
|
||||
private _enabled = true
|
||||
get enabled () {
|
||||
return this._enabled
|
||||
}
|
||||
set enabled (value) {
|
||||
this._enabled = value
|
||||
if (this.points) {
|
||||
this.points.visible = value
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private scene: THREE.Scene) {
|
||||
}
|
||||
|
||||
addToScene () {
|
||||
if (this.points || !this.enabled) return
|
||||
|
||||
const radius = 80
|
||||
const depth = 50
|
||||
const count = 7000
|
||||
|
|
@ -332,6 +344,7 @@ class StarField {
|
|||
if (this.points) {
|
||||
this.points.geometry.dispose();
|
||||
(this.points.material as THREE.Material).dispose();
|
||||
this.scene.remove(this.points)
|
||||
|
||||
this.points = undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ const updateAutoJump = () => {
|
|||
jumpOnAllEdges: options.autoParkour,
|
||||
// strictBlockCollision: true,
|
||||
})
|
||||
if (autoJump === bot.autoJumper.enabled) return
|
||||
if (autoJump) {
|
||||
bot.autoJumper.enable()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ export const guiOptionsScheme: {
|
|||
enableWarning: 'Enabling it will make chunks load ~4x slower',
|
||||
disabledDuringGame: true
|
||||
},
|
||||
starfieldRendering: {}
|
||||
},
|
||||
],
|
||||
main: [
|
||||
|
|
|
|||
|
|
@ -30,24 +30,7 @@ const defaultOptions = {
|
|||
touchButtonsSize: 40,
|
||||
touchButtonsOpacity: 80,
|
||||
touchButtonsPosition: 12,
|
||||
touchControlsPositions: {
|
||||
action: [
|
||||
70,
|
||||
85
|
||||
],
|
||||
sneak: [
|
||||
90,
|
||||
85
|
||||
],
|
||||
break: [
|
||||
70,
|
||||
65
|
||||
],
|
||||
jump: [
|
||||
90,
|
||||
65
|
||||
],
|
||||
} as Record<string, [number, number]>,
|
||||
touchControlsPositions: getDefaultTouchControlsPositions(),
|
||||
touchControlsType: 'classic' as 'classic' | 'joystick-buttons',
|
||||
gpuPreference: 'default' as 'default' | 'high-performance' | 'low-power',
|
||||
backgroundRendering: '20fps' as 'full' | '20fps' | '5fps',
|
||||
|
|
@ -59,6 +42,7 @@ const defaultOptions = {
|
|||
dayCycleAndLighting: true,
|
||||
loadPlayerSkins: true,
|
||||
lowMemoryMode: false,
|
||||
starfieldRendering: true,
|
||||
// antiAliasing: false,
|
||||
|
||||
showChunkBorders: false, // todo rename option
|
||||
|
|
@ -73,6 +57,7 @@ const defaultOptions = {
|
|||
disableLoadPrompts: false,
|
||||
guestUsername: 'guest',
|
||||
askGuestName: true,
|
||||
errorReporting: true,
|
||||
/** Actually might be useful */
|
||||
showCursorBlockInSpectator: false,
|
||||
renderEntities: true,
|
||||
|
|
@ -91,6 +76,27 @@ const defaultOptions = {
|
|||
wysiwygSignEditor: 'auto' as 'auto' | 'always' | 'never',
|
||||
}
|
||||
|
||||
function getDefaultTouchControlsPositions () {
|
||||
return {
|
||||
action: [
|
||||
70,
|
||||
85
|
||||
],
|
||||
sneak: [
|
||||
90,
|
||||
85
|
||||
],
|
||||
break: [
|
||||
70,
|
||||
65
|
||||
],
|
||||
jump: [
|
||||
90,
|
||||
65
|
||||
],
|
||||
} as Record<string, [number, number]>
|
||||
}
|
||||
|
||||
const qsOptionsRaw = new URLSearchParams(location.search).getAll('setting')
|
||||
export const qsOptions = Object.fromEntries(qsOptionsRaw.map(o => {
|
||||
const [key, value] = o.split(':')
|
||||
|
|
|
|||
|
|
@ -57,4 +57,9 @@ export const watchOptionsAfterViewerInit = () => {
|
|||
customEvents.on('gameLoaded', () => {
|
||||
viewer.world.mesherConfig.enableLighting = !bot.supportFeature('blockStateId') || options.newVersionsLighting
|
||||
})
|
||||
|
||||
watchValue(options, o => {
|
||||
if (!(viewer.world instanceof WorldRendererThree)) return
|
||||
viewer.world.starField.enabled = o.starfieldRendering
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue