@minecraft/server-ui 2.1.0-beta.1.26.20-preview.20 → 2.1.0-beta.1.26.20-preview.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +164 -122
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -33,6 +33,36 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import * as minecraftcommon from '@minecraft/common';
|
|
35
35
|
import * as minecraftserver from '@minecraft/server';
|
|
36
|
+
/**
|
|
37
|
+
* @beta
|
|
38
|
+
* The reason why a data driven screen (i.e. MessageBox or
|
|
39
|
+
* CustomForm) was closed.
|
|
40
|
+
*/
|
|
41
|
+
export declare enum DataDrivenScreenClosedReason {
|
|
42
|
+
/**
|
|
43
|
+
* @remarks
|
|
44
|
+
* Closed because it was programmatically told by the server to
|
|
45
|
+
* close using `form.close()`.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
ServerClose = 'ServerClose',
|
|
49
|
+
/**
|
|
50
|
+
* @remarks
|
|
51
|
+
* Closed because the user was busy (i.e. other UI was open).
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
UserBusy = 'UserBusy',
|
|
55
|
+
/**
|
|
56
|
+
* @remarks
|
|
57
|
+
* Closed because the client closed the form. This can be with
|
|
58
|
+
* a close button on the form (i.e. the X in the corner of a
|
|
59
|
+
* message box, the 'Close' button on a custom form, or either
|
|
60
|
+
* button in the message box)
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
UserClose = 'UserClose',
|
|
64
|
+
}
|
|
65
|
+
|
|
36
66
|
export enum FormCancelationReason {
|
|
37
67
|
UserBusy = 'UserBusy',
|
|
38
68
|
UserClosed = 'UserClosed',
|
|
@@ -49,28 +79,28 @@ export enum FormRejectReason {
|
|
|
49
79
|
* take action.
|
|
50
80
|
* @example showActionForm.ts
|
|
51
81
|
* ```typescript
|
|
52
|
-
* import { world, DimensionLocation } from
|
|
53
|
-
* import { ActionFormData, ActionFormResponse } from
|
|
82
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
83
|
+
* import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';
|
|
54
84
|
*
|
|
55
85
|
* function showActionForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
56
86
|
* const playerList = world.getPlayers();
|
|
57
87
|
*
|
|
58
88
|
* if (playerList.length >= 1) {
|
|
59
89
|
* const form = new ActionFormData()
|
|
60
|
-
* .title(
|
|
61
|
-
* .body(
|
|
62
|
-
* .button(
|
|
63
|
-
* .button(
|
|
64
|
-
* .button(
|
|
65
|
-
* .button(
|
|
66
|
-
* .button(
|
|
90
|
+
* .title('Test Title')
|
|
91
|
+
* .body('Body text here!')
|
|
92
|
+
* .button('btn 1')
|
|
93
|
+
* .button('btn 2')
|
|
94
|
+
* .button('btn 3')
|
|
95
|
+
* .button('btn 4')
|
|
96
|
+
* .button('btn 5');
|
|
67
97
|
*
|
|
68
98
|
* form.show(playerList[0]).then((result: ActionFormResponse) => {
|
|
69
99
|
* if (result.canceled) {
|
|
70
|
-
* log(
|
|
100
|
+
* log('Player exited out of the dialog. Note that if the chat window is up, dialogs are automatically canceled.');
|
|
71
101
|
* return -1;
|
|
72
102
|
* } else {
|
|
73
|
-
* log(
|
|
103
|
+
* log('Your result was: ' + result.selection);
|
|
74
104
|
* }
|
|
75
105
|
* });
|
|
76
106
|
* }
|
|
@@ -78,25 +108,25 @@ export enum FormRejectReason {
|
|
|
78
108
|
* ```
|
|
79
109
|
* @example showFavoriteMonth.ts
|
|
80
110
|
* ```typescript
|
|
81
|
-
* import { world, DimensionLocation } from
|
|
82
|
-
* import { ActionFormData, ActionFormResponse } from
|
|
111
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
112
|
+
* import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';
|
|
83
113
|
*
|
|
84
114
|
* function showFavoriteMonth(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
85
115
|
* const players = world.getPlayers();
|
|
86
116
|
*
|
|
87
117
|
* if (players.length >= 1) {
|
|
88
118
|
* const form = new ActionFormData()
|
|
89
|
-
* .title(
|
|
90
|
-
* .body(
|
|
91
|
-
* .button(
|
|
92
|
-
* .button(
|
|
93
|
-
* .button(
|
|
94
|
-
* .button(
|
|
95
|
-
* .button(
|
|
119
|
+
* .title('Months')
|
|
120
|
+
* .body('Choose your favorite month!')
|
|
121
|
+
* .button('January')
|
|
122
|
+
* .button('February')
|
|
123
|
+
* .button('March')
|
|
124
|
+
* .button('April')
|
|
125
|
+
* .button('May');
|
|
96
126
|
*
|
|
97
127
|
* form.show(players[0]).then((response: ActionFormResponse) => {
|
|
98
128
|
* if (response.selection === 3) {
|
|
99
|
-
* log(
|
|
129
|
+
* log('I like April too!');
|
|
100
130
|
* return -1;
|
|
101
131
|
* }
|
|
102
132
|
* });
|
|
@@ -172,28 +202,28 @@ export class ActionFormData {
|
|
|
172
202
|
* form.
|
|
173
203
|
* @example showActionForm.ts
|
|
174
204
|
* ```typescript
|
|
175
|
-
* import { world, DimensionLocation } from
|
|
176
|
-
* import { ActionFormData, ActionFormResponse } from
|
|
205
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
206
|
+
* import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';
|
|
177
207
|
*
|
|
178
208
|
* function showActionForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
179
209
|
* const playerList = world.getPlayers();
|
|
180
210
|
*
|
|
181
211
|
* if (playerList.length >= 1) {
|
|
182
212
|
* const form = new ActionFormData()
|
|
183
|
-
* .title(
|
|
184
|
-
* .body(
|
|
185
|
-
* .button(
|
|
186
|
-
* .button(
|
|
187
|
-
* .button(
|
|
188
|
-
* .button(
|
|
189
|
-
* .button(
|
|
213
|
+
* .title('Test Title')
|
|
214
|
+
* .body('Body text here!')
|
|
215
|
+
* .button('btn 1')
|
|
216
|
+
* .button('btn 2')
|
|
217
|
+
* .button('btn 3')
|
|
218
|
+
* .button('btn 4')
|
|
219
|
+
* .button('btn 5');
|
|
190
220
|
*
|
|
191
221
|
* form.show(playerList[0]).then((result: ActionFormResponse) => {
|
|
192
222
|
* if (result.canceled) {
|
|
193
|
-
* log(
|
|
223
|
+
* log('Player exited out of the dialog. Note that if the chat window is up, dialogs are automatically canceled.');
|
|
194
224
|
* return -1;
|
|
195
225
|
* } else {
|
|
196
|
-
* log(
|
|
226
|
+
* log('Your result was: ' + result.selection);
|
|
197
227
|
* }
|
|
198
228
|
* });
|
|
199
229
|
* }
|
|
@@ -201,25 +231,25 @@ export class ActionFormData {
|
|
|
201
231
|
* ```
|
|
202
232
|
* @example showFavoriteMonth.ts
|
|
203
233
|
* ```typescript
|
|
204
|
-
* import { world, DimensionLocation } from
|
|
205
|
-
* import { ActionFormData, ActionFormResponse } from
|
|
234
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
235
|
+
* import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';
|
|
206
236
|
*
|
|
207
237
|
* function showFavoriteMonth(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
208
238
|
* const players = world.getPlayers();
|
|
209
239
|
*
|
|
210
240
|
* if (players.length >= 1) {
|
|
211
241
|
* const form = new ActionFormData()
|
|
212
|
-
* .title(
|
|
213
|
-
* .body(
|
|
214
|
-
* .button(
|
|
215
|
-
* .button(
|
|
216
|
-
* .button(
|
|
217
|
-
* .button(
|
|
218
|
-
* .button(
|
|
242
|
+
* .title('Months')
|
|
243
|
+
* .body('Choose your favorite month!')
|
|
244
|
+
* .button('January')
|
|
245
|
+
* .button('February')
|
|
246
|
+
* .button('March')
|
|
247
|
+
* .button('April')
|
|
248
|
+
* .button('May');
|
|
219
249
|
*
|
|
220
250
|
* form.show(players[0]).then((response: ActionFormResponse) => {
|
|
221
251
|
* if (response.selection === 3) {
|
|
222
|
-
* log(
|
|
252
|
+
* log('I like April too!');
|
|
223
253
|
* return -1;
|
|
224
254
|
* }
|
|
225
255
|
* });
|
|
@@ -324,7 +354,7 @@ export declare class CustomForm {
|
|
|
324
354
|
* @throws
|
|
325
355
|
* *
|
|
326
356
|
*/
|
|
327
|
-
show(): Promise<
|
|
357
|
+
show(): Promise<DataDrivenScreenClosedReason>;
|
|
328
358
|
/**
|
|
329
359
|
* @remarks
|
|
330
360
|
* Creates a slider that lets players pick a number between
|
|
@@ -378,6 +408,13 @@ export declare class CustomForm {
|
|
|
378
408
|
): CustomForm;
|
|
379
409
|
}
|
|
380
410
|
|
|
411
|
+
/**
|
|
412
|
+
* @beta
|
|
413
|
+
* Thrown when attempting to close a DDUI form that isn't open.
|
|
414
|
+
*/
|
|
415
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
416
|
+
export declare class FormCloseError extends Error {}
|
|
417
|
+
|
|
381
418
|
/**
|
|
382
419
|
* Base type for a form response.
|
|
383
420
|
*/
|
|
@@ -467,20 +504,17 @@ export declare class MessageBox {
|
|
|
467
504
|
* Builds a simple two-button modal dialog.
|
|
468
505
|
* @example showBasicMessageForm.ts
|
|
469
506
|
* ```typescript
|
|
470
|
-
* import { world, DimensionLocation } from
|
|
471
|
-
* import { MessageFormResponse, MessageFormData } from
|
|
507
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
508
|
+
* import { MessageFormResponse, MessageFormData } from '@minecraft/server-ui';
|
|
472
509
|
*
|
|
473
|
-
* function showBasicMessageForm(
|
|
474
|
-
* log: (message: string, status?: number) => void,
|
|
475
|
-
* targetLocation: DimensionLocation
|
|
476
|
-
* ) {
|
|
510
|
+
* function showBasicMessageForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
477
511
|
* const players = world.getPlayers();
|
|
478
512
|
*
|
|
479
513
|
* const messageForm = new MessageFormData()
|
|
480
|
-
* .title(
|
|
481
|
-
* .body(
|
|
482
|
-
* .button1(
|
|
483
|
-
* .button2(
|
|
514
|
+
* .title('Message Form Example')
|
|
515
|
+
* .body('This shows a simple example using §o§7MessageFormData§r.')
|
|
516
|
+
* .button1('Button 1')
|
|
517
|
+
* .button2('Button 2');
|
|
484
518
|
*
|
|
485
519
|
* messageForm
|
|
486
520
|
* .show(players[0])
|
|
@@ -490,30 +524,27 @@ export declare class MessageBox {
|
|
|
490
524
|
* return;
|
|
491
525
|
* }
|
|
492
526
|
*
|
|
493
|
-
* log(`You selected ${formData.selection === 0 ?
|
|
527
|
+
* log(`You selected ${formData.selection === 0 ? 'Button 1' : 'Button 2'}`);
|
|
494
528
|
* })
|
|
495
529
|
* .catch((error: Error) => {
|
|
496
|
-
* log(
|
|
530
|
+
* log('Failed to show form: ' + error);
|
|
497
531
|
* return -1;
|
|
498
532
|
* });
|
|
499
533
|
* }
|
|
500
534
|
* ```
|
|
501
535
|
* @example showTranslatedMessageForm.ts
|
|
502
536
|
* ```typescript
|
|
503
|
-
* import { world, DimensionLocation } from
|
|
504
|
-
* import { MessageFormResponse, MessageFormData } from
|
|
537
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
538
|
+
* import { MessageFormResponse, MessageFormData } from '@minecraft/server-ui';
|
|
505
539
|
*
|
|
506
|
-
* function showTranslatedMessageForm(
|
|
507
|
-
* log: (message: string, status?: number) => void,
|
|
508
|
-
* targetLocation: DimensionLocation
|
|
509
|
-
* ) {
|
|
540
|
+
* function showTranslatedMessageForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
510
541
|
* const players = world.getPlayers();
|
|
511
542
|
*
|
|
512
543
|
* const messageForm = new MessageFormData()
|
|
513
|
-
* .title({ translate:
|
|
514
|
-
* .body({ translate:
|
|
515
|
-
* .button1(
|
|
516
|
-
* .button2(
|
|
544
|
+
* .title({ translate: 'permissions.removeplayer' })
|
|
545
|
+
* .body({ translate: 'accessibility.list.or.two', with: ['Player 1', 'Player 2'] })
|
|
546
|
+
* .button1('Player 1')
|
|
547
|
+
* .button2('Player 2');
|
|
517
548
|
*
|
|
518
549
|
* messageForm
|
|
519
550
|
* .show(players[0])
|
|
@@ -523,10 +554,10 @@ export declare class MessageBox {
|
|
|
523
554
|
* return;
|
|
524
555
|
* }
|
|
525
556
|
*
|
|
526
|
-
* log(`You selected ${formData.selection === 0 ?
|
|
557
|
+
* log(`You selected ${formData.selection === 0 ? 'Player 1' : 'Player 2'}`);
|
|
527
558
|
* })
|
|
528
559
|
* .catch((error: Error) => {
|
|
529
|
-
* log(
|
|
560
|
+
* log('Failed to show form: ' + error);
|
|
530
561
|
* return -1;
|
|
531
562
|
* });
|
|
532
563
|
* }
|
|
@@ -585,20 +616,17 @@ export class MessageFormData {
|
|
|
585
616
|
* form.
|
|
586
617
|
* @example showBasicMessageForm.ts
|
|
587
618
|
* ```typescript
|
|
588
|
-
* import { world, DimensionLocation } from
|
|
589
|
-
* import { MessageFormResponse, MessageFormData } from
|
|
619
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
620
|
+
* import { MessageFormResponse, MessageFormData } from '@minecraft/server-ui';
|
|
590
621
|
*
|
|
591
|
-
* function showBasicMessageForm(
|
|
592
|
-
* log: (message: string, status?: number) => void,
|
|
593
|
-
* targetLocation: DimensionLocation
|
|
594
|
-
* ) {
|
|
622
|
+
* function showBasicMessageForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
595
623
|
* const players = world.getPlayers();
|
|
596
624
|
*
|
|
597
625
|
* const messageForm = new MessageFormData()
|
|
598
|
-
* .title(
|
|
599
|
-
* .body(
|
|
600
|
-
* .button1(
|
|
601
|
-
* .button2(
|
|
626
|
+
* .title('Message Form Example')
|
|
627
|
+
* .body('This shows a simple example using §o§7MessageFormData§r.')
|
|
628
|
+
* .button1('Button 1')
|
|
629
|
+
* .button2('Button 2');
|
|
602
630
|
*
|
|
603
631
|
* messageForm
|
|
604
632
|
* .show(players[0])
|
|
@@ -608,30 +636,27 @@ export class MessageFormData {
|
|
|
608
636
|
* return;
|
|
609
637
|
* }
|
|
610
638
|
*
|
|
611
|
-
* log(`You selected ${formData.selection === 0 ?
|
|
639
|
+
* log(`You selected ${formData.selection === 0 ? 'Button 1' : 'Button 2'}`);
|
|
612
640
|
* })
|
|
613
641
|
* .catch((error: Error) => {
|
|
614
|
-
* log(
|
|
642
|
+
* log('Failed to show form: ' + error);
|
|
615
643
|
* return -1;
|
|
616
644
|
* });
|
|
617
645
|
* }
|
|
618
646
|
* ```
|
|
619
647
|
* @example showTranslatedMessageForm.ts
|
|
620
648
|
* ```typescript
|
|
621
|
-
* import { world, DimensionLocation } from
|
|
622
|
-
* import { MessageFormResponse, MessageFormData } from
|
|
649
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
650
|
+
* import { MessageFormResponse, MessageFormData } from '@minecraft/server-ui';
|
|
623
651
|
*
|
|
624
|
-
* function showTranslatedMessageForm(
|
|
625
|
-
* log: (message: string, status?: number) => void,
|
|
626
|
-
* targetLocation: DimensionLocation
|
|
627
|
-
* ) {
|
|
652
|
+
* function showTranslatedMessageForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
628
653
|
* const players = world.getPlayers();
|
|
629
654
|
*
|
|
630
655
|
* const messageForm = new MessageFormData()
|
|
631
|
-
* .title({ translate:
|
|
632
|
-
* .body({ translate:
|
|
633
|
-
* .button1(
|
|
634
|
-
* .button2(
|
|
656
|
+
* .title({ translate: 'permissions.removeplayer' })
|
|
657
|
+
* .body({ translate: 'accessibility.list.or.two', with: ['Player 1', 'Player 2'] })
|
|
658
|
+
* .button1('Player 1')
|
|
659
|
+
* .button2('Player 2');
|
|
635
660
|
*
|
|
636
661
|
* messageForm
|
|
637
662
|
* .show(players[0])
|
|
@@ -641,10 +666,10 @@ export class MessageFormData {
|
|
|
641
666
|
* return;
|
|
642
667
|
* }
|
|
643
668
|
*
|
|
644
|
-
* log(`You selected ${formData.selection === 0 ?
|
|
669
|
+
* log(`You selected ${formData.selection === 0 ? 'Player 1' : 'Player 2'}`);
|
|
645
670
|
* })
|
|
646
671
|
* .catch((error: Error) => {
|
|
647
|
-
* log(
|
|
672
|
+
* log('Failed to show form: ' + error);
|
|
648
673
|
* return -1;
|
|
649
674
|
* });
|
|
650
675
|
* }
|
|
@@ -666,33 +691,33 @@ export class MessageFormResponse extends FormResponse {
|
|
|
666
691
|
* player.
|
|
667
692
|
* @example showBasicModalForm.ts
|
|
668
693
|
* ```typescript
|
|
669
|
-
* import { world, DimensionLocation } from
|
|
670
|
-
* import { ModalFormData } from
|
|
694
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
695
|
+
* import { ModalFormData } from '@minecraft/server-ui';
|
|
671
696
|
*
|
|
672
697
|
* function showBasicModalForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
673
698
|
* const players = world.getPlayers();
|
|
674
699
|
*
|
|
675
|
-
* const modalForm = new ModalFormData().title(
|
|
700
|
+
* const modalForm = new ModalFormData().title('Example Modal Controls for §o§7ModalFormData§r');
|
|
676
701
|
*
|
|
677
|
-
* modalForm.toggle(
|
|
678
|
-
* modalForm.toggle(
|
|
702
|
+
* modalForm.toggle('Toggle w/o default');
|
|
703
|
+
* modalForm.toggle('Toggle w/ default', true);
|
|
679
704
|
*
|
|
680
|
-
* modalForm.slider(
|
|
681
|
-
* modalForm.slider(
|
|
705
|
+
* modalForm.slider('Slider w/o default', 0, 50, 5);
|
|
706
|
+
* modalForm.slider('Slider w/ default', 0, 50, 5, 30);
|
|
682
707
|
*
|
|
683
|
-
* modalForm.dropdown(
|
|
684
|
-
* modalForm.dropdown(
|
|
708
|
+
* modalForm.dropdown('Dropdown w/o default', ['option 1', 'option 2', 'option 3']);
|
|
709
|
+
* modalForm.dropdown('Dropdown w/ default', ['option 1', 'option 2', 'option 3'], 2);
|
|
685
710
|
*
|
|
686
|
-
* modalForm.textField(
|
|
687
|
-
* modalForm.textField(
|
|
711
|
+
* modalForm.textField('Input w/o default', 'type text here');
|
|
712
|
+
* modalForm.textField('Input w/ default', 'type text here', 'this is default');
|
|
688
713
|
*
|
|
689
714
|
* modalForm
|
|
690
715
|
* .show(players[0])
|
|
691
|
-
* .then(
|
|
716
|
+
* .then(formData => {
|
|
692
717
|
* players[0].sendMessage(`Modal form results: ${JSON.stringify(formData.formValues, undefined, 2)}`);
|
|
693
718
|
* })
|
|
694
719
|
* .catch((error: Error) => {
|
|
695
|
-
* log(
|
|
720
|
+
* log('Failed to show form: ' + error);
|
|
696
721
|
* return -1;
|
|
697
722
|
* });
|
|
698
723
|
* }
|
|
@@ -814,33 +839,33 @@ export class ModalFormData {
|
|
|
814
839
|
* Returns data about player responses to a modal form.
|
|
815
840
|
* @example showBasicModalForm.ts
|
|
816
841
|
* ```typescript
|
|
817
|
-
* import { world, DimensionLocation } from
|
|
818
|
-
* import { ModalFormData } from
|
|
842
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
843
|
+
* import { ModalFormData } from '@minecraft/server-ui';
|
|
819
844
|
*
|
|
820
845
|
* function showBasicModalForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
821
846
|
* const players = world.getPlayers();
|
|
822
847
|
*
|
|
823
|
-
* const modalForm = new ModalFormData().title(
|
|
848
|
+
* const modalForm = new ModalFormData().title('Example Modal Controls for §o§7ModalFormData§r');
|
|
824
849
|
*
|
|
825
|
-
* modalForm.toggle(
|
|
826
|
-
* modalForm.toggle(
|
|
850
|
+
* modalForm.toggle('Toggle w/o default');
|
|
851
|
+
* modalForm.toggle('Toggle w/ default', true);
|
|
827
852
|
*
|
|
828
|
-
* modalForm.slider(
|
|
829
|
-
* modalForm.slider(
|
|
853
|
+
* modalForm.slider('Slider w/o default', 0, 50, 5);
|
|
854
|
+
* modalForm.slider('Slider w/ default', 0, 50, 5, 30);
|
|
830
855
|
*
|
|
831
|
-
* modalForm.dropdown(
|
|
832
|
-
* modalForm.dropdown(
|
|
856
|
+
* modalForm.dropdown('Dropdown w/o default', ['option 1', 'option 2', 'option 3']);
|
|
857
|
+
* modalForm.dropdown('Dropdown w/ default', ['option 1', 'option 2', 'option 3'], 2);
|
|
833
858
|
*
|
|
834
|
-
* modalForm.textField(
|
|
835
|
-
* modalForm.textField(
|
|
859
|
+
* modalForm.textField('Input w/o default', 'type text here');
|
|
860
|
+
* modalForm.textField('Input w/ default', 'type text here', 'this is default');
|
|
836
861
|
*
|
|
837
862
|
* modalForm
|
|
838
863
|
* .show(players[0])
|
|
839
|
-
* .then(
|
|
864
|
+
* .then(formData => {
|
|
840
865
|
* players[0].sendMessage(`Modal form results: ${JSON.stringify(formData.formValues, undefined, 2)}`);
|
|
841
866
|
* })
|
|
842
867
|
* .catch((error: Error) => {
|
|
843
|
-
* log(
|
|
868
|
+
* log('Failed to show form: ' + error);
|
|
844
869
|
* return -1;
|
|
845
870
|
* });
|
|
846
871
|
* }
|
|
@@ -885,6 +910,7 @@ export declare class Observable<T extends string | number | boolean | UIRawMessa
|
|
|
885
910
|
*
|
|
886
911
|
*/
|
|
887
912
|
subscribe(listener: (newValue: T) => void): (newValue: T) => void;
|
|
913
|
+
toJSON(): unknown;
|
|
888
914
|
/**
|
|
889
915
|
* @remarks
|
|
890
916
|
* Unsubscribe a callback from any changes that occur to the
|
|
@@ -904,6 +930,22 @@ export declare class Observable<T extends string | number | boolean | UIRawMessa
|
|
|
904
930
|
): Observable<T>;
|
|
905
931
|
}
|
|
906
932
|
|
|
933
|
+
/**
|
|
934
|
+
* @beta
|
|
935
|
+
* Thrown when a DDUI screen is rejected because the player
|
|
936
|
+
* left before responding.
|
|
937
|
+
*/
|
|
938
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
939
|
+
export declare class PlayerLeftError extends Error {}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* @beta
|
|
943
|
+
* Thrown when a DDUI screen is rejected because the server is
|
|
944
|
+
* shutting down.
|
|
945
|
+
*/
|
|
946
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
947
|
+
export declare class ServerShutdownError extends Error {}
|
|
948
|
+
|
|
907
949
|
export class UIManager {
|
|
908
950
|
private constructor();
|
|
909
951
|
/**
|
|
@@ -1012,17 +1054,17 @@ export interface DropdownOptions {
|
|
|
1012
1054
|
export interface MessageBoxResult {
|
|
1013
1055
|
/**
|
|
1014
1056
|
* @remarks
|
|
1015
|
-
* The
|
|
1016
|
-
* without pressing a button.
|
|
1057
|
+
* The reason the message box was closed.
|
|
1017
1058
|
*
|
|
1018
1059
|
*/
|
|
1019
|
-
|
|
1060
|
+
closeReason: DataDrivenScreenClosedReason;
|
|
1020
1061
|
/**
|
|
1021
1062
|
* @remarks
|
|
1022
|
-
*
|
|
1063
|
+
* The button that was selected, undefined if it was closed
|
|
1064
|
+
* without pressing a button.
|
|
1023
1065
|
*
|
|
1024
1066
|
*/
|
|
1025
|
-
|
|
1067
|
+
selection?: number;
|
|
1026
1068
|
}
|
|
1027
1069
|
|
|
1028
1070
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minecraft/server-ui",
|
|
3
|
-
"version": "2.1.0-beta.1.26.20-preview.
|
|
3
|
+
"version": "2.1.0-beta.1.26.20-preview.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@minecraft/common": "^1.0.0",
|
|
17
|
-
"@minecraft/server": "^2.0.0 || ^2.8.0-beta.1.26.20-preview.
|
|
17
|
+
"@minecraft/server": "^2.0.0 || ^2.8.0-beta.1.26.20-preview.22"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT"
|
|
20
20
|
}
|