Skip to content

Commit 45de480

Browse files
committed
finish all settings editor: allow for string / enum changing, allow for quick & easy url copy for setttings locked into it
refactor settings meta
1 parent 88a03ce commit 45de480

File tree

5 files changed

+311
-77
lines changed

5 files changed

+311
-77
lines changed

src/defaultOptions.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,89 @@ export const serverSafeSettings: Partial<Record<keyof typeof defaultOptions, tru
202202
newVersionsLighting: true,
203203
showCursorBlockInSpectator: true,
204204
}
205+
export type OptionValueType = string | number | boolean | string[] | Record<string, any> | null
206+
207+
export type OptionPossibleValues =
208+
| string[]
209+
| Array<[string, string]> // [value, label] tuples
210+
211+
export type OptionMeta = {
212+
possibleValues?: OptionPossibleValues
213+
isCustomInput?: boolean // If true, use showInputsModal for string input
214+
min?: number
215+
max?: number
216+
unit?: string
217+
text?: string
218+
tooltip?: string
219+
}
220+
221+
export const optionsMeta: Partial<Record<keyof typeof defaultOptions, OptionMeta>> = {
222+
gpuPreference: {
223+
possibleValues: [['default', 'Auto'], ['high-performance', 'Dedicated'], ['low-power', 'Low Power']]
224+
},
225+
backgroundRendering: {
226+
possibleValues: [
227+
['full', 'NO'],
228+
['5fps', '5 FPS'],
229+
['20fps', '20 FPS'],
230+
]
231+
},
232+
activeRenderer: {
233+
possibleValues: [
234+
['threejs', 'Three.js (stable)'],
235+
]
236+
},
237+
renderDebug: {
238+
possibleValues: ['advanced', 'basic', 'none']
239+
},
240+
serverResourcePacks: {
241+
possibleValues: ['prompt', 'always', 'never']
242+
},
243+
showMinimap: {
244+
possibleValues: ['always', 'singleplayer', 'never']
245+
},
246+
highlightBlockColor: {
247+
possibleValues: [
248+
['auto', 'Auto'],
249+
['blue', 'Blue'],
250+
['classic', 'Classic']
251+
]
252+
},
253+
wysiwygSignEditor: {
254+
possibleValues: ['auto', 'always', 'never']
255+
},
256+
touchMovementType: {
257+
possibleValues: [['modern', 'Modern'], ['classic', 'Classic']]
258+
},
259+
touchInteractionType: {
260+
possibleValues: [['classic', 'Classic'], ['buttons', 'Buttons']]
261+
},
262+
autoJump: {
263+
possibleValues: ['always', 'auto', 'never']
264+
},
265+
saveLoginPassword: {
266+
possibleValues: ['prompt', 'always', 'never']
267+
},
268+
packetsLoggerPreset: {
269+
possibleValues: [
270+
['all', 'All'],
271+
['no-buffers', 'No Buffers']
272+
]
273+
},
274+
// Custom string inputs (will use showInputsModal)
275+
localUsername: {
276+
isCustomInput: true
277+
},
278+
guestUsername: {
279+
isCustomInput: true
280+
},
281+
language: {
282+
isCustomInput: true
283+
},
284+
enabledResourcepack: {
285+
isCustomInput: true
286+
},
287+
useVersionsTextures: {
288+
isCustomInput: true
289+
}
290+
}

src/optionsGuiScheme.tsx

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export const guiOptionsScheme: {
5656
gpuPreference: {
5757
text: 'GPU Preference',
5858
tooltip: 'You will need to reload the page for this to take effect.',
59-
values: [['default', 'Auto'], ['high-performance', 'Dedicated'], ['low-power', 'Low Power']]
6059
},
6160
},
6261
{
@@ -65,17 +64,9 @@ export const guiOptionsScheme: {
6564
},
6665
backgroundRendering: {
6766
text: 'Background FPS limit',
68-
values: [
69-
['full', 'NO'],
70-
['5fps', '5 FPS'],
71-
['20fps', '20 FPS'],
72-
],
7367
},
7468
activeRenderer: {
7569
text: 'Renderer',
76-
values: [
77-
['threejs', 'Three.js (stable)'],
78-
],
7970
},
8071
},
8172
{
@@ -104,11 +95,6 @@ export const guiOptionsScheme: {
10495
tooltip: 'Enable rendering Deadmau5 ears for all players if their skin contains textures for it',
10596
},
10697
renderDebug: {
107-
values: [
108-
'advanced',
109-
'basic',
110-
'none'
111-
],
11298
},
11399
rendererPerfDebugOverlay: {
114100
text: 'Performance Debug',
@@ -135,11 +121,6 @@ export const guiOptionsScheme: {
135121
},
136122
serverResourcePacks: {
137123
text: 'Download From Server',
138-
values: [
139-
'prompt',
140-
'always',
141-
'never'
142-
],
143124
}
144125
}
145126
],
@@ -302,11 +283,6 @@ export const guiOptionsScheme: {
302283
showMinimap: {
303284
text: 'Enable Minimap',
304285
enableWarning: 'App reload is required to apply this setting',
305-
values: [
306-
'always',
307-
'singleplayer',
308-
'never'
309-
],
310286
},
311287
},
312288
{
@@ -315,11 +291,6 @@ export const guiOptionsScheme: {
315291
},
316292
highlightBlockColor: {
317293
text: 'Block Highlight Color',
318-
values: [
319-
['auto', 'Auto'],
320-
['blue', 'Blue'],
321-
['classic', 'Classic']
322-
],
323294
},
324295
showHand: {
325296
text: 'Show Hand',
@@ -337,11 +308,6 @@ export const guiOptionsScheme: {
337308
},
338309
wysiwygSignEditor: {
339310
text: 'WYSIWG Editor',
340-
values: [
341-
'auto',
342-
'always',
343-
'never'
344-
],
345311
},
346312
},
347313
{
@@ -456,11 +422,9 @@ export const guiOptionsScheme: {
456422
},
457423
touchMovementType: {
458424
text: 'Movement Controls',
459-
values: [['modern', 'Modern'], ['classic', 'Classic']],
460425
},
461426
touchInteractionType: {
462427
text: 'Interaction Controls',
463-
values: [['classic', 'Classic'], ['buttons', 'Buttons']],
464428
},
465429
},
466430
{
@@ -474,11 +438,6 @@ export const guiOptionsScheme: {
474438
return <Category>Auto Jump</Category>
475439
},
476440
autoJump: {
477-
values: [
478-
'always',
479-
'auto',
480-
'never'
481-
],
482441
disableIf: [
483442
'autoParkour',
484443
true
@@ -580,11 +539,6 @@ export const guiOptionsScheme: {
580539
{
581540
saveLoginPassword: {
582541
tooltip: 'Controls whether to save login passwords for servers in this browser memory.',
583-
values: [
584-
'prompt',
585-
'always',
586-
'never'
587-
]
588542
},
589543
},
590544
{
@@ -656,10 +610,6 @@ export const guiOptionsScheme: {
656610
{
657611
packetsLoggerPreset: {
658612
text: 'Packets Logger Preset',
659-
values: [
660-
['all', 'All'],
661-
['no-buffers', 'No Buffers']
662-
],
663613
},
664614
},
665615
{

0 commit comments

Comments
 (0)