@minecraft/server-editor 0.1.0-beta.1.20.10-stable → 0.1.0-beta.1.20.20-preview.21

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.
Files changed (2) hide show
  1. package/index.d.ts +2341 -2
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -14,9 +14,2348 @@
14
14
  * ```json
15
15
  * {
16
16
  * "module_name": "@minecraft/server-editor",
17
- * "version": "0.1.0-beta.1.20.10-stable"
17
+ * "version": "0.1.0-beta.1.20.20-preview.21"
18
18
  * }
19
19
  * ```
20
20
  *
21
21
  */
22
- import * as minecraftservereditorbindings from '@minecraft/server-editor-bindings';
22
+ import * as minecraftserver from '@minecraft/server';
23
+ /**
24
+ * The types of actions that are supported. This type
25
+ * corresponds to the expected arguments passed by the
26
+ * onExecute handler of an action.
27
+ */
28
+ export declare enum ActionTypes {
29
+ MouseRayCastAction = 'MouseRayCastAction',
30
+ NoArgsAction = 'NoArgsAction',
31
+ }
32
+
33
+ /**
34
+ * An enumeration describing the axis on which to mirror
35
+ * clipboard contents when writing to the world
36
+ */
37
+ export enum ClipboardMirrorAxis {
38
+ /**
39
+ * @remarks
40
+ * No mirroring
41
+ *
42
+ */
43
+ None = 'None',
44
+ /**
45
+ * @remarks
46
+ * Mirror on the X axis
47
+ *
48
+ */
49
+ X = 'X',
50
+ /**
51
+ * @remarks
52
+ * Mirror on both X and Z axes
53
+ *
54
+ */
55
+ XZ = 'XZ',
56
+ /**
57
+ * @remarks
58
+ * Mirror on the Z axis
59
+ *
60
+ */
61
+ Z = 'Z',
62
+ }
63
+
64
+ /**
65
+ * An enumeration describing the amount of rotation to be
66
+ * applied around the Y axis when writing the clipboard to the
67
+ * world
68
+ */
69
+ export enum ClipboardRotation {
70
+ /**
71
+ * @remarks
72
+ * No rotation
73
+ *
74
+ */
75
+ None = 'None',
76
+ /**
77
+ * @remarks
78
+ * Rotate by 180 degrees clockwise around the Y axis
79
+ *
80
+ */
81
+ Rotate180 = 'Rotate180',
82
+ /**
83
+ * @remarks
84
+ * Rotate by 270 degrees clockwise around the Y axis
85
+ *
86
+ */
87
+ Rotate270 = 'Rotate270',
88
+ /**
89
+ * @remarks
90
+ * Rotate by 90 degrees clockwise around the Y axis
91
+ *
92
+ */
93
+ Rotate90 = 'Rotate90',
94
+ }
95
+
96
+ /**
97
+ * An enumeration used by the 3D block cursor {@link
98
+ * @minecraft/server-editor-bindings.Cursor}
99
+ */
100
+ export enum CursorControlMode {
101
+ /**
102
+ * @remarks
103
+ * Using Keyboard mode will remove the dependence of the 3D
104
+ * block cursor on the player mouse position. The 3D block
105
+ * cursor can be positioned using the keyboard (or the Cursor
106
+ * move methods on the cursor object) and the position will not
107
+ * be reset if the mouse is moved
108
+ *
109
+ */
110
+ Keyboard = 0,
111
+ /**
112
+ * @remarks
113
+ * The Mouse movement mode will disable keyboard or manual 3D
114
+ * block cursor movement and make the 3D block cursor only
115
+ * react to player mouse movement
116
+ *
117
+ */
118
+ Mouse = 1,
119
+ /**
120
+ * @remarks
121
+ * This is generally the default move mode for the 3D block
122
+ * cursor.
123
+ * The 3D block cursor can be positioned using the keyboard (or
124
+ * the Cursor move methods on the cursor object) but the
125
+ * position will be reset to the block location under the
126
+ * players mouse position if any mouse movement is detected.
127
+ *
128
+ */
129
+ KeyboardAndMouse = 2,
130
+ /**
131
+ * @remarks
132
+ * When in fixed mode, the 3D block cursor will remain in a
133
+ * fixed position directly in front of the players facing
134
+ * direction. It cannot be moved without moving the player (or
135
+ * adjusting the fixed block distance).
136
+ * This mode is useful for addressing block locations in the
137
+ * air (put the cursor into fixed mode, and fly the player
138
+ * until the desired air block is beneath the cursor, at which
139
+ * point it is selectable without being clickable)
140
+ *
141
+ */
142
+ Fixed = 3,
143
+ }
144
+
145
+ /**
146
+ * Describes how the cursor targets a point on the screen.
147
+ */
148
+ export enum CursorTargetMode {
149
+ /**
150
+ * @remarks
151
+ * Target a nearest block.
152
+ *
153
+ */
154
+ Block = 0,
155
+ /**
156
+ * @remarks
157
+ * Targets the face of a nearest block.
158
+ *
159
+ */
160
+ Face = 1,
161
+ }
162
+
163
+ /**
164
+ * Type of item that can be added to the property pane
165
+ */
166
+ export declare enum EDITOR_PANE_PROPERTY_ITEM_TYPE {
167
+ Action = 'editorUI:Action',
168
+ BlockPicker = 'editorUI:BlockPicker',
169
+ Boolean = 'editorUI:Boolean',
170
+ Divider = 'editorUI:Divider',
171
+ Dropdown = 'editorUI:Dropdown',
172
+ Number = 'editorUI:Number',
173
+ String = 'editorUI:String',
174
+ SubPane = 'editorUI:SubPane',
175
+ Vec3 = 'editorUI:Vec3',
176
+ }
177
+
178
+ /**
179
+ * Global editor input contexts
180
+ */
181
+ export declare enum EditorInputContext {
182
+ GlobalEditor = 'global.editor',
183
+ GlobalToolMode = 'global.toolMode',
184
+ Viewport = 'local.toolMode.viewport',
185
+ }
186
+
187
+ export declare enum EditorStatusBarAlignment {
188
+ Right = 0,
189
+ Left = 1,
190
+ }
191
+
192
+ /**
193
+ * Input modifier flags to create chorded bindings
194
+ */
195
+ export declare enum InputModifier {
196
+ Unused = 0,
197
+ None = 1,
198
+ Alt = 2,
199
+ Control = 4,
200
+ Shift = 8,
201
+ Any = 15,
202
+ }
203
+
204
+ /**
205
+ * Keyboard key
206
+ */
207
+ export declare enum KeyboardKey {
208
+ BACKSPACE = 8,
209
+ TAB = 9,
210
+ ENTER = 13,
211
+ SHIFT = 16,
212
+ CTRL = 17,
213
+ ALT = 18,
214
+ CAPS_LOCK = 20,
215
+ ESCAPE = 27,
216
+ SPACE = 32,
217
+ PAGE_UP = 33,
218
+ PAGE_DOWN = 34,
219
+ END = 35,
220
+ HOME = 36,
221
+ LEFT = 37,
222
+ UP = 38,
223
+ RIGHT = 39,
224
+ DOWN = 40,
225
+ PRINT_SCREEN = 44,
226
+ INSERT = 45,
227
+ DELETE = 46,
228
+ KEY_0 = 48,
229
+ KEY_1 = 49,
230
+ KEY_2 = 50,
231
+ KEY_3 = 51,
232
+ KEY_4 = 52,
233
+ KEY_5 = 53,
234
+ KEY_6 = 54,
235
+ KEY_7 = 55,
236
+ KEY_8 = 56,
237
+ KEY_9 = 57,
238
+ KEY_A = 65,
239
+ KEY_B = 66,
240
+ KEY_C = 67,
241
+ KEY_D = 68,
242
+ KEY_E = 69,
243
+ KEY_F = 70,
244
+ KEY_G = 71,
245
+ KEY_H = 72,
246
+ KEY_I = 73,
247
+ KEY_J = 74,
248
+ KEY_K = 75,
249
+ KEY_L = 76,
250
+ KEY_M = 77,
251
+ KEY_N = 78,
252
+ KEY_O = 79,
253
+ KEY_P = 80,
254
+ KEY_Q = 81,
255
+ KEY_R = 82,
256
+ KEY_S = 83,
257
+ KEY_T = 84,
258
+ KEY_U = 85,
259
+ KEY_V = 86,
260
+ KEY_W = 87,
261
+ KEY_X = 88,
262
+ KEY_Y = 89,
263
+ KEY_Z = 90,
264
+ NUMPAD_0 = 96,
265
+ NUMPAD_1 = 97,
266
+ NUMPAD_2 = 98,
267
+ NUMPAD_3 = 99,
268
+ NUMPAD_4 = 100,
269
+ NUMPAD_5 = 101,
270
+ NUMPAD_6 = 102,
271
+ NUMPAD_7 = 103,
272
+ NUMPAD_8 = 104,
273
+ NUMPAD_9 = 105,
274
+ NUMPAD_MULTIPLY = 106,
275
+ NUMPAD_ADD = 107,
276
+ NUMPAD_SEPARATOR = 108,
277
+ NUMPAD_SUBTRACT = 109,
278
+ NUMPAD_DECIMAL = 110,
279
+ NUMPAD_DIVIDE = 111,
280
+ F1 = 112,
281
+ F2 = 113,
282
+ F3 = 114,
283
+ F4 = 115,
284
+ F5 = 116,
285
+ F6 = 117,
286
+ F7 = 118,
287
+ F8 = 119,
288
+ F9 = 120,
289
+ F10 = 121,
290
+ F11 = 122,
291
+ F12 = 123,
292
+ COMMA = 188,
293
+ PERIOD = 190,
294
+ SLASH = 191,
295
+ BACK_QUOTE = 192,
296
+ BRACKET_OPEN = 219,
297
+ BACK_SLASH = 220,
298
+ BRACKET_CLOSE = 221,
299
+ QUOTE = 222,
300
+ }
301
+
302
+ /**
303
+ * Keyboard Key Actions
304
+ */
305
+ export declare enum KeyInputType {
306
+ Press = 1,
307
+ Release = 2,
308
+ }
309
+
310
+ /**
311
+ * Mouse device action categories
312
+ */
313
+ export declare enum MouseActionCategory {
314
+ Button = 1,
315
+ Wheel = 2,
316
+ Drag = 3,
317
+ }
318
+
319
+ /**
320
+ * Detailed mouse device actions
321
+ */
322
+ export declare enum MouseActionType {
323
+ LeftButton = 1,
324
+ MiddleButton = 2,
325
+ RightButton = 3,
326
+ Wheel = 4,
327
+ }
328
+
329
+ /**
330
+ * Input event information about mouse actions
331
+ */
332
+ export declare enum MouseInputType {
333
+ ButtonDown = 1,
334
+ ButtonUp = 2,
335
+ WheelIn = 3,
336
+ WheelOut = 4,
337
+ DragStart = 5,
338
+ Drag = 6,
339
+ DragEnd = 7,
340
+ }
341
+
342
+ /**
343
+ * Full set of all possible raw actions
344
+ */
345
+ export type Action = NoArgsAction | MouseRayCastAction;
346
+
347
+ /**
348
+ * All actions have a unique identifier. Identifiers are
349
+ * globally unique and often GUIDs
350
+ */
351
+ export type ActionID = {
352
+ id: string;
353
+ };
354
+
355
+ /**
356
+ * Callback type when an extension instance is activated for a
357
+ * given player. It is expected to return an array of
358
+ * disposables that will automatically be cleaned up on
359
+ * shutdown.
360
+ */
361
+ export type ActivationFunctionType<PerPlayerStorageType> = (
362
+ uiSession: IPlayerUISession<PerPlayerStorageType>,
363
+ ) => IDisposable[];
364
+
365
+ /**
366
+ * The possible variants of a button.
367
+ */
368
+ export declare type ButtonVariant = 'secondary' | 'primary' | 'destructive' | 'hero';
369
+
370
+ /**
371
+ * A generic handler for an event sink.
372
+ */
373
+ export declare type EventHandler<T> = (eventArg: T) => void;
374
+
375
+ /**
376
+ * A property item which supports bound actions and replacing
377
+ * the bound action
378
+ */
379
+ export type IActionPropertyItem<T extends PropertyBag, Prop extends keyof T & string> = IPropertyItem<T, Prop> & {
380
+ replaceBoundAction(action: RegisteredAction<NoArgsAction> | undefined): void;
381
+ };
382
+
383
+ /**
384
+ * The IPlayerUISession represents the editor user interface
385
+ * for a given player and given extension. Extensions
386
+ * registered with Minecraft are instantiated for each player
387
+ * which joins a server, and this interface provides the set of
388
+ * functionality needed to create and modify the editor UI for
389
+ * that player. The associated Editor Context for this session
390
+ * object is also player specific. From a given
391
+ * IPlayerUISession object, there is no way to interact with
392
+ * the UI of another player, that must be done from global
393
+ * extension scope registration and/or data sharing independent
394
+ * of the UI object.
395
+ */
396
+ export type IPlayerUISession<PerPlayerStorage = Record<string, never>> = {
397
+ createMenu(props: IMenuCreationParams): IMenu;
398
+ createStatusBarItem(alignment: EditorStatusBarAlignment, size: number): IStatusBarItem;
399
+ createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
400
+ readonly actionManager: ActionManager;
401
+ readonly inputManager: IGlobalInputManager;
402
+ readonly toolRail: IModalToolContainer;
403
+ readonly log: IPlayerLogger;
404
+ readonly extensionContext: ExtensionContext;
405
+ readonly builtInUIManager: BuiltInUIManager;
406
+ readonly eventSubscriptionCache: BedrockEventSubscriptionCache;
407
+ scratchStorage: PerPlayerStorage | undefined;
408
+ };
409
+
410
+ /**
411
+ * Modal tool lifecycle event payload
412
+ */
413
+ export type ModalToolLifecycleEventPayload = {
414
+ isActiveTool: boolean;
415
+ };
416
+
417
+ /**
418
+ * Input modifier states for mouse actions
419
+ */
420
+ export declare type MouseModifiers = {
421
+ alt: boolean;
422
+ ctrl: boolean;
423
+ shift: boolean;
424
+ };
425
+
426
+ /**
427
+ * Mouse properties that provide additional information from
428
+ * client event handling
429
+ */
430
+ export declare type MouseProps = {
431
+ mouseAction: MouseActionType;
432
+ modifiers: MouseModifiers;
433
+ inputType: MouseInputType;
434
+ };
435
+
436
+ /**
437
+ * An action which returns the ray corresponding to a vector
438
+ * from the users mouse click in the viewport.
439
+ */
440
+ export type MouseRayCastAction = {
441
+ actionType: ActionTypes.MouseRayCastAction;
442
+ readonly onExecute: (mouseRay: Ray, mouseProps: MouseProps) => void;
443
+ };
444
+
445
+ /**
446
+ * An action which needs no additional client side arguments on
447
+ * execute
448
+ */
449
+ export type NoArgsAction = {
450
+ actionType: ActionTypes.NoArgsAction;
451
+ readonly onExecute: () => void;
452
+ };
453
+
454
+ /**
455
+ * Callback to execute when a value of a property item is
456
+ * updated.
457
+ */
458
+ export type OnChangeCallback<T extends PropertyBag, Prop extends keyof T & string> = (
459
+ obj: T,
460
+ property: Prop,
461
+ oldValue: object,
462
+ newValue: object,
463
+ ) => void;
464
+
465
+ export type PropertyBag = Record<string, unknown>;
466
+
467
+ /**
468
+ * Callback to execute when a visibility of a property pane is
469
+ * updated.
470
+ */
471
+ export type PropertyPaneVisibilityUpdate = {
472
+ isVisible: boolean;
473
+ };
474
+
475
+ /**
476
+ * Ray representing a direction from a set location. This
477
+ * location typically corresponds to the location of a mouse
478
+ * click performed on the client.
479
+ */
480
+ export type Ray = {
481
+ location: minecraftserver.Vector3;
482
+ direction: minecraftserver.Vector3;
483
+ cursorBlockLocation: minecraftserver.Vector3;
484
+ rayHit: boolean;
485
+ };
486
+
487
+ /**
488
+ * A registered action is an action that has been registered
489
+ * with the action manager system and has a unique ID
490
+ * representing the action now. An action must be registered
491
+ * before it can be used in other systems.
492
+ */
493
+ export type RegisteredAction<T extends Action> = T & ActionID;
494
+
495
+ /**
496
+ * Callback type when an extension instance is shutdown for a
497
+ * given player. Used for performing any final work or clean up
498
+ * that can't be handled automatically via Disposables.
499
+ */
500
+ export type ShutdownFunctionType<PerPlayerStorageType> = (uiSession: IPlayerUISession<PerPlayerStorageType>) => void;
501
+
502
+ /**
503
+ * Full set of all possible keyboard actions
504
+ */
505
+ export type SupportedKeyboardActionTypes = RegisteredAction<NoArgsAction>;
506
+
507
+ /**
508
+ * Full set of all possible mouse actions
509
+ */
510
+ export type SupportedMouseActionTypes = RegisteredAction<MouseRayCastAction>;
511
+
512
+ export type UnregisterInputBindingCallback = () => void;
513
+
514
+ /**
515
+ * A cache for bedrock event subscriptions. Stores off a
516
+ * subscription by event key, and upon teardown unregisters all
517
+ * subscriptions.
518
+ */
519
+ export declare class BedrockEventSubscriptionCache {
520
+ /**
521
+ * @remarks
522
+ * Constructs a new instance of the
523
+ * `BedrockEventSubscriptionCache` class
524
+ *
525
+ */
526
+ constructor(mEvents: minecraftserver.WorldAfterEvents);
527
+ /**
528
+ * @remarks
529
+ * Subcribes to a bedrock event using the key of the desired
530
+ * event. When subscribed, the event handler is both returned,
531
+ * but also cached internally for unsubscription. This means
532
+ * the caller of the subscription does not need to worry about
533
+ * unsubscription since the cache will automatically
534
+ * unsubscribe handlers on overall teardown.
535
+ *
536
+ * @param event
537
+ * The event on the bedrock APIs to which to subscribe
538
+ * @param params
539
+ * The parameters to the subscription method for the event.
540
+ * Auto complete will display this for you
541
+ */
542
+ subscribeToBedrockEvent<T extends keyof minecraftserver.WorldAfterEvents>(
543
+ event: T,
544
+ ...params: Parameters<minecraftserver.WorldAfterEvents[T]['subscribe']>
545
+ ):
546
+ | ((arg: minecraftserver.BlockBreakAfterEvent) => void)
547
+ | ((arg: minecraftserver.BlockExplodeAfterEvent) => void)
548
+ | ((arg: minecraftserver.ChatSendAfterEvent) => void)
549
+ | ((arg: minecraftserver.DataDrivenEntityTriggerAfterEvent) => void)
550
+ | ((arg: minecraftserver.EffectAddAfterEvent) => void)
551
+ | ((arg: minecraftserver.EntityDieAfterEvent) => void)
552
+ | ((arg: minecraftserver.EntityHealthChangedAfterEvent) => void)
553
+ | ((arg: minecraftserver.EntityHitBlockAfterEvent) => void)
554
+ | ((arg: minecraftserver.EntityHitEntityAfterEvent) => void)
555
+ | ((arg: minecraftserver.EntityHurtAfterEvent) => void)
556
+ | ((arg: minecraftserver.EntityRemovedAfterEvent) => void)
557
+ | ((arg: minecraftserver.ExplosionAfterEvent) => void)
558
+ | ((arg: minecraftserver.ItemCompleteUseAfterEvent) => void)
559
+ | ((arg: minecraftserver.ItemDefinitionTriggeredAfterEvent) => void)
560
+ | ((arg: minecraftserver.ItemUseOnAfterEvent) => void)
561
+ | ((arg: minecraftserver.LeverActionAfterEvent) => void)
562
+ | ((arg: minecraftserver.MessageReceiveAfterEvent) => void)
563
+ | ((arg: minecraftserver.PistonActivateAfterEvent) => void)
564
+ | ((arg: minecraftserver.PlayerJoinAfterEvent) => void)
565
+ | ((arg: minecraftserver.PlayerSpawnAfterEvent) => void)
566
+ | ((arg: minecraftserver.ProjectileHitAfterEvent) => void)
567
+ | ((arg: minecraftserver.TargetBlockHitAfterEvent) => void)
568
+ | ((arg: minecraftserver.TripWireTripAfterEvent) => void)
569
+ | ((arg: minecraftserver.WeatherChangeAfterEvent) => void)
570
+ | ((arg: minecraftserver.WorldInitializeAfterEvent) => void);
571
+ teardown(): void;
572
+ }
573
+
574
+ /**
575
+ * A ClipboardItem is a handle to an object which represents a
576
+ * set of blocks in a contained bounding area (most likely
577
+ * copied from the world)
578
+ */
579
+ export class ClipboardItem {
580
+ private constructor();
581
+ /**
582
+ * @remarks
583
+ * Return whether there is any block content in the item
584
+ *
585
+ * @throws This property can throw when used.
586
+ */
587
+ readonly isEmpty: boolean;
588
+ /**
589
+ * @remarks
590
+ * Clear the contents of the item
591
+ *
592
+ * This function can't be called in read-only mode.
593
+ *
594
+ * @throws This function can throw errors.
595
+ */
596
+ clear(): void;
597
+ /**
598
+ * @remarks
599
+ * Create a {@link Selection} container which represents the
600
+ * occupied block volumes within the ClipboardItem.
601
+ * This function does not perform any write operations, and
602
+ * instead returns only a prediction of the volume area which
603
+ * would be affected as part of a write operation with a given
604
+ * set of write options.
605
+ *
606
+ * This function can't be called in read-only mode.
607
+ *
608
+ * @param location
609
+ * A world location to which the ClipboardItem may potentially
610
+ * be written (nothing is actually written as part of this
611
+ * operation)
612
+ * @param options
613
+ * An optional set of write parameters which govern how the
614
+ * ClipboardItem should be potentially applied to the world
615
+ * @returns
616
+ * A {@link Selection} which represents the occupied block
617
+ * volumes within the ClipboardItem as they would be written to
618
+ * the world with the specified {@link ClipboardWriteOptions}
619
+ * @throws This function can throw errors.
620
+ */
621
+ getPredictedWriteAsSelection(location: minecraftserver.Vector3, options?: ClipboardWriteOptions): Selection;
622
+ /**
623
+ * @remarks
624
+ * Get the bounding size of the ClipboardItem
625
+ *
626
+ * This function can't be called in read-only mode.
627
+ *
628
+ * @throws This function can throw errors.
629
+ */
630
+ getSize(): minecraftserver.Vector3;
631
+ /**
632
+ * @remarks
633
+ * Copy the contents of the area represented by a {@link
634
+ * Selection} volume into the ClipboardItem
635
+ *
636
+ * This function can't be called in read-only mode.
637
+ *
638
+ * @param selection
639
+ * A volume which represents the area to be copied
640
+ * @throws This function can throw errors.
641
+ */
642
+ readFromSelection(selection: Selection): void;
643
+ /**
644
+ * @remarks
645
+ * Copy the contents of a rectangular volume into the Clipboard
646
+ * Item
647
+ *
648
+ * This function can't be called in read-only mode.
649
+ *
650
+ * @param from
651
+ * The world location of one corner of a bounding volume
652
+ * @param to
653
+ * The world location of the opposite corner of a bounding
654
+ * volume
655
+ * @throws This function can throw errors.
656
+ */
657
+ readFromWorld(from: minecraftserver.Vector3, to: minecraftserver.Vector3): void;
658
+ /**
659
+ * @remarks
660
+ * Apply the contents of a ClipboardItem to the world at a
661
+ * given location using a set of write options
662
+ *
663
+ * This function can't be called in read-only mode.
664
+ *
665
+ * @param location
666
+ * The root point of the world location to which the
667
+ * ClipboardItem is written (this is modified by the various
668
+ * anchor, offset and rotation parameters of the {@link
669
+ * ClipboardWriteOptions}
670
+ * @param options
671
+ * An optional set of write parameters which modify the
672
+ * properties of the ClipboardItem as it is applied to the
673
+ * world
674
+ * @returns
675
+ * Success or Failure
676
+ * @throws This function can throw errors.
677
+ */
678
+ writeToWorld(location: minecraftserver.Vector3, options?: ClipboardWriteOptions): boolean;
679
+ }
680
+
681
+ /**
682
+ * The ClipboardManager (accessible from the {@link
683
+ * ExtensionContext}) is responsible for the management of all
684
+ * {@link ClipboardItem} objects, and provides the user the
685
+ * ability to create new {@link ClipboardItem} objects for use
686
+ * within an extension.
687
+ *
688
+ */
689
+ export class ClipboardManager {
690
+ private constructor();
691
+ /**
692
+ * @remarks
693
+ * The primary {@link ClipboardItem} object is always present
694
+ * (even if it's empty) and cannot be deleted. This object
695
+ * represents the main ClipboardItem object which is always
696
+ * accessible through the UI for cut/paste operations
697
+ *
698
+ * @throws This property can throw when used.
699
+ */
700
+ readonly clipboard: ClipboardItem;
701
+ /**
702
+ * @remarks
703
+ * Create a new {@link ClipboardItem} object
704
+ *
705
+ * This function can't be called in read-only mode.
706
+ *
707
+ * @throws This function can throw errors.
708
+ */
709
+ create(): ClipboardItem;
710
+ }
711
+
712
+ /**
713
+ * The 3D block cursor is controlled through this read only
714
+ * object and provides the Editor some control over the input
715
+ * methods, display properties and positioning of the 3D block
716
+ * cursor within the world.
717
+ * The 3D block cursor is a native object which is constantly
718
+ * calculating a screen/mouse -> world raycast, and recording
719
+ * the resultant block collision position and facing direction.
720
+ * Depending on the properties of the cursor state, this is not
721
+ * always true – the cursor can also be manually manipulated by
722
+ * keyboard input and moved around independently of mouse
723
+ * movement; when the mouse is moved, the block cursor will
724
+ * return to the mouse/world ray intersection point.
725
+ * The cursor can also be set to either block or face mode;
726
+ * block mode represents the block the mouse is pointing at,
727
+ * and face mode represents the adjacent block that the mouse
728
+ * is pointing at (i.e. the block attached to the face of the
729
+ * intersection point).
730
+ * In practical use, each tool when activated grabs the current
731
+ * cursor state object and stores it. The active tool then
732
+ * sets the current state to represent the functionality of the
733
+ * tool (color, input mode, etc). When the tool loses focus,
734
+ * it restores the cursor state using the stored state object
735
+ * that was grabbed during activation.
736
+ * The 3D block cursor can also be used to query the current
737
+ * block at which the mouse is pointing (or the current block
738
+ * to which the cursor has been manually moved by the user)
739
+ */
740
+ export class Cursor {
741
+ private constructor();
742
+ /**
743
+ * @remarks
744
+ * The face at of the block beneath the 3D block cursor which
745
+ * is intersected by the mouse raycast
746
+ *
747
+ * @throws This property can throw when used.
748
+ */
749
+ readonly faceDirection: number;
750
+ /**
751
+ * @remarks
752
+ * Query whether or not the 3D block cursor is visible or
753
+ * hidden
754
+ *
755
+ * @throws This property can throw when used.
756
+ */
757
+ readonly isVisible: boolean;
758
+ /**
759
+ * @remarks
760
+ * Get the world position of the 3D block cursor
761
+ *
762
+ * This function can't be called in read-only mode.
763
+ *
764
+ * @throws This function can throw errors.
765
+ */
766
+ getPosition(): minecraftserver.Vector3;
767
+ /**
768
+ * @remarks
769
+ * Get a property object which represents the current
770
+ * properties of the 3D block cursor.
771
+ *
772
+ * This function can't be called in read-only mode.
773
+ *
774
+ * @throws This function can throw errors.
775
+ */
776
+ getProperties(): CursorProperties;
777
+ /**
778
+ * @remarks
779
+ * Hide the 3D block cursor from view until the corresponding
780
+ * {@link @minecraft-server-editor-bindings.Cursor.show}
781
+ * function is called
782
+ *
783
+ * This function can't be called in read-only mode.
784
+ *
785
+ * @throws This function can throw errors.
786
+ */
787
+ hide(): void;
788
+ /**
789
+ * @remarks
790
+ * Manually offset the 3D block cursor by given amount.
791
+ * Depending on the {@link
792
+ * @minecraft-server-editor-bindings.CursorProperties.CursorControlMode}
793
+ * - this function may have no effect
794
+ *
795
+ * This function can't be called in read-only mode.
796
+ *
797
+ * @param offset
798
+ * Amount by which the 3D block cursor should be moved
799
+ * @returns
800
+ * Return the newly modified position (or previous position if
801
+ * movement was restricted)
802
+ * @throws This function can throw errors.
803
+ */
804
+ moveBy(offset: minecraftserver.Vector3): minecraftserver.Vector3;
805
+ /**
806
+ * @remarks
807
+ * Reset the 3D block cursor to the system default state
808
+ *
809
+ * This function can't be called in read-only mode.
810
+ *
811
+ * @throws This function can throw errors.
812
+ */
813
+ resetToDefaultState(): void;
814
+ /**
815
+ * @remarks
816
+ * Set the 3D block cursor properties to a given state
817
+ *
818
+ * This function can't be called in read-only mode.
819
+ *
820
+ * @param properties
821
+ * A set of optional parameters within a property state which
822
+ * represent the intended 3D block cursor state
823
+ * @throws This function can throw errors.
824
+ */
825
+ setProperties(properties: CursorProperties): void;
826
+ /**
827
+ * @remarks
828
+ * Make the 3D block cursor visible on screen
829
+ *
830
+ * This function can't be called in read-only mode.
831
+ *
832
+ * @throws This function can throw errors.
833
+ */
834
+ show(): void;
835
+ }
836
+
837
+ /**
838
+ * Editor Extensions are the basis for all player specific,
839
+ * editor specific functionality within the game. Almost all
840
+ * editor functionality is exported and available within the
841
+ * context of an {@link ExtensionContext}
842
+ * When the script manager initializes during level loading,
843
+ * the scripts are loaded from the behavior packs and executed.
844
+ * As part of the global execution context, the scripts are
845
+ * free to register any number of extensions.
846
+ * An Editor Extension is defined a name, an activation
847
+ * function and a shutdown function.
848
+ *
849
+ * It is not recommended to directly use this function as the
850
+ * contract is not guaranteed to be stable, instead prefer
851
+ * {@link registerEditorExtension} as it provides additional
852
+ * functionality and a stable contract.
853
+ */
854
+ export class Extension {
855
+ private constructor();
856
+ }
857
+
858
+ /**
859
+ * The extension context is a native (C++) object created for
860
+ * each registered Editor Extension, when a player connection
861
+ * is established with the server.
862
+ * A registered extension activation or deactivation closure is
863
+ * accompanied by an [ExtensionContext] object, which provides
864
+ * a player specific, editor extension specific context.
865
+ * The Extension Context is the main interface to all the bound
866
+ * Editor Services.
867
+ * As more player services are added to the editor, they will
868
+ * be exposed through this object
869
+ */
870
+ export class ExtensionContext {
871
+ private constructor();
872
+ /**
873
+ * @remarks
874
+ * This is used to access the players Clipboard Manager and the
875
+ * main interface through which the player can create, modify
876
+ * and apply clipboard items
877
+ *
878
+ */
879
+ readonly clipboardManager: ClipboardManager;
880
+ /**
881
+ * @remarks
882
+ * This is used to access the players 3D block cursor and it's
883
+ * properties
884
+ *
885
+ */
886
+ readonly cursor: Cursor;
887
+ /**
888
+ * @remarks
889
+ * The short unique name with which this extension was
890
+ * registered
891
+ *
892
+ */
893
+ readonly extensionName: string;
894
+ /**
895
+ * @remarks
896
+ * The current player which is the subject of the extension
897
+ * invocation
898
+ *
899
+ */
900
+ readonly player: minecraftserver.Player;
901
+ /**
902
+ * @remarks
903
+ * The instance of the players Selection Manager and the main
904
+ * interface through which the player can create/modify
905
+ * selections
906
+ *
907
+ */
908
+ readonly selectionManager: SelectionManager;
909
+ /**
910
+ * @remarks
911
+ * The instance of the players Transaction Manager and the main
912
+ * interface through which the creator can create transaction
913
+ * records, and undo/redo previous transactions
914
+ *
915
+ */
916
+ readonly transactionManager: TransactionManager;
917
+ }
918
+
919
+ /**
920
+ * The logger class is a utility class which allows editor
921
+ * extensions to communicate with the player from the server to
922
+ * the client log window.
923
+ * The logger class presents 4 different output channels which
924
+ * can be used to send information to the client/player,
925
+ * depending on the context of the information.
926
+ */
927
+ export class Logger {
928
+ private constructor();
929
+ /**
930
+ * @remarks
931
+ * A `debug` output channel generally used during the
932
+ * development process of editor extensions. This channel
933
+ * defaults to `hidden` in the log window (unless explicitly
934
+ * enabled).
935
+ * Once your editor extension development process is complete,
936
+ * and you're ready to ship/share your extension - we generally
937
+ * recommend that you remove any references to this log channel
938
+ * to avoid a noisy experience for other users
939
+ *
940
+ * This function can't be called in read-only mode.
941
+ *
942
+ * @param message
943
+ * The message string to send to the log window
944
+ * @throws This function can throw errors.
945
+ */
946
+ debug(message: string, properties?: LogProperties): void;
947
+ /**
948
+ * @remarks
949
+ * The error channel is generally used when the editor
950
+ * extension experiences an error (either a program error in
951
+ * executing logic unexpectedly, or an error in the input or
952
+ * output to/from a player). Use this channel sparingly - it's
953
+ * meant to communicate important problems to the player
954
+ *
955
+ * This function can't be called in read-only mode.
956
+ *
957
+ * @param message
958
+ * The message string to send to the log window
959
+ * @throws This function can throw errors.
960
+ */
961
+ error(message: string, properties?: LogProperties): void;
962
+ /**
963
+ * @remarks
964
+ * The info channel is intended to communicate general,
965
+ * non-fatal or non-erroneous information to the player that
966
+ * can generally be safely ignored if they choose to do so.
967
+ *
968
+ * This function can't be called in read-only mode.
969
+ *
970
+ * @param message
971
+ * The message string to send to the log window
972
+ * @throws This function can throw errors.
973
+ */
974
+ info(message: string, properties?: LogProperties): void;
975
+ /**
976
+ * @remarks
977
+ * The warning channel is intended to inform the user of
978
+ * "potential" issues (missing inputs, values out of range,
979
+ * things that cannot be found) but are not fatal and execution
980
+ * can still be completed.
981
+ *
982
+ * This function can't be called in read-only mode.
983
+ *
984
+ * @param message
985
+ * The message string to send to the log window
986
+ * @throws This function can throw errors.
987
+ */
988
+ warning(message: string, properties?: LogProperties): void;
989
+ }
990
+
991
+ /**
992
+ * The MinecraftEditor class is a namespace container for
993
+ * Editor functionality which does not have any player context.
994
+ */
995
+ export class MinecraftEditor {
996
+ private constructor();
997
+ /**
998
+ * @remarks
999
+ * A global instance of the log output class object. This is
1000
+ * not contextualized to any particular player, and any
1001
+ * messages sent to this instance will be broadcast to all
1002
+ * connected editor client sessions
1003
+ *
1004
+ */
1005
+ readonly log: Logger;
1006
+ /**
1007
+ * @remarks
1008
+ * This is an internal command which interfaces with the native
1009
+ * C++ extension bindings and should not be used by creators.
1010
+ * Using this command directly will not provide any of the
1011
+ * additional functionality and wrappings that the TypeScript
1012
+ * layer will provide.
1013
+ * Creators should use the TypeScript binding
1014
+ * `registerEditorExtension` instead
1015
+ *
1016
+ * This function can't be called in read-only mode.
1017
+ *
1018
+ * @param extensionName
1019
+ * Unique name of the editor extension being registered
1020
+ * @param activationFunction
1021
+ * A code closure which is called during the activation process
1022
+ * and is responsible for setting up all of the extension
1023
+ * internal settings and UI definitions
1024
+ * @param shutdownFunction
1025
+ * A code closure which is called during the deactivation
1026
+ * process (when the player disconnects) and is responsible for
1027
+ * cleaning up any settings or allocations
1028
+ * @param options
1029
+ * [ExtensionOptionalParameters] describes an optional object
1030
+ * which contains a number of optional parameters which is used
1031
+ * to register an extension with additional information
1032
+ */
1033
+ registerExtension_Internal(
1034
+ extensionName: string,
1035
+ activationFunction: (arg: ExtensionContext) => void,
1036
+ shutdownFunction: (arg: ExtensionContext) => void,
1037
+ options?: ExtensionOptionalParameters,
1038
+ ): Extension;
1039
+ }
1040
+
1041
+ /**
1042
+ * The Selection represents a volume in space, which may
1043
+ * potentially be made up of one or more block locations.
1044
+ * These block locations do not need to be contiguous, and a
1045
+ * Selection represent an irregular shape.
1046
+ * It's important to note that a Selection is only a
1047
+ * representation of the volume shape space - and does NOT
1048
+ * represent the actual contents of the space.
1049
+ */
1050
+ export class Selection {
1051
+ private constructor();
1052
+ /**
1053
+ * @remarks
1054
+ * Returns a boolean representing whether or not there are any
1055
+ * volumes pushed to the selection stack
1056
+ *
1057
+ * @throws This property can throw when used.
1058
+ */
1059
+ readonly isEmpty: boolean;
1060
+ /**
1061
+ * @remarks
1062
+ * Set whether or not the selection volume is visible to the
1063
+ * client user.
1064
+ * NOTE: Use this option carefully - Selection volumes are
1065
+ * generally server-only, but marking a volume as visible
1066
+ * causes the volume (and all volume operations) to be
1067
+ * synchronized with the client game which can potentially
1068
+ * generate excessive network traffic.
1069
+ *
1070
+ *
1071
+ * This property can't be edited in read-only mode.
1072
+ *
1073
+ */
1074
+ visible: boolean;
1075
+ /**
1076
+ * @remarks
1077
+ * Clear the contents of the Selection
1078
+ *
1079
+ * This function can't be called in read-only mode.
1080
+ *
1081
+ * @throws This function can throw errors.
1082
+ */
1083
+ clear(): void;
1084
+ /**
1085
+ * @remarks
1086
+ * Fetch a block iterator which can be used to step across the
1087
+ * Selection shape. Each call to the iterator will return the
1088
+ * next block location within the Selection bounds which is
1089
+ * actually selected.
1090
+ * Block iteration is not guaranteed to be contiguous - it is
1091
+ * possible to create irregular selection shapes by adding
1092
+ * volumes to a selection which may or may not be contiguous or
1093
+ * adjacent to other volumes within the selection.
1094
+ * The Block iterator will return only selected volume
1095
+ * locations
1096
+ *
1097
+ * This function can't be called in read-only mode.
1098
+ *
1099
+ */
1100
+ getBlockLocationIterator(): minecraftserver.BlockLocationIterator;
1101
+ /**
1102
+ * @remarks
1103
+ * Return a bounding rectangle that contains all of the volumes
1104
+ * within the selection (the bounding rectangle does NOT
1105
+ * represent the shape of the selection, only the largest
1106
+ * rectangle that will fit all of the volumes)
1107
+ *
1108
+ * This function can't be called in read-only mode.
1109
+ *
1110
+ * @throws This function can throw errors.
1111
+ */
1112
+ getBoundingBox(): minecraftserver.BoundingBox;
1113
+ /**
1114
+ * @remarks
1115
+ * Return the color of the on-screen selection container hull
1116
+ *
1117
+ * This function can't be called in read-only mode.
1118
+ *
1119
+ * @throws This function can throw errors.
1120
+ */
1121
+ getFillColor(): minecraftserver.Color;
1122
+ /**
1123
+ * @remarks
1124
+ * Return the color of the on-screen selection container
1125
+ * outline
1126
+ *
1127
+ * This function can't be called in read-only mode.
1128
+ *
1129
+ * @throws This function can throw errors.
1130
+ */
1131
+ getOutlineColor(): minecraftserver.Color;
1132
+ /**
1133
+ * @remarks
1134
+ * Translate a selection by a given amount (this causes all of
1135
+ * the volumes within the selection to be moved by the
1136
+ * specified offset)
1137
+ *
1138
+ * This function can't be called in read-only mode.
1139
+ *
1140
+ * @param delta
1141
+ * The amount by which to move
1142
+ * @returns
1143
+ * Return the newly moved position
1144
+ * @throws This function can throw errors.
1145
+ */
1146
+ moveBy(delta: minecraftserver.Vector3): minecraftserver.Vector3;
1147
+ /**
1148
+ * @remarks
1149
+ * Move the selection to an absolute world location (causing
1150
+ * all of the volumes within the selection to be moved to a
1151
+ * location relative to the world location)
1152
+ *
1153
+ * This function can't be called in read-only mode.
1154
+ *
1155
+ * @param location
1156
+ * The world location to which to relocate the selection
1157
+ * @returns
1158
+ * Return the newly moved position
1159
+ * @throws This function can throw errors.
1160
+ */
1161
+ moveTo(location: minecraftserver.Vector3): minecraftserver.Vector3;
1162
+ /**
1163
+ * @remarks
1164
+ * Fetch the volume information of the last compound volume
1165
+ * that was pushed to the volume stack without affecting the
1166
+ * stack itself
1167
+ *
1168
+ * This function can't be called in read-only mode.
1169
+ *
1170
+ * @returns
1171
+ * Returns undefined if the stack is empty
1172
+ */
1173
+ peekLastVolume(): minecraftserver.CompoundBlockVolumeItem | undefined;
1174
+ /**
1175
+ * @remarks
1176
+ * Remove the volume information that was last pushed to the
1177
+ * volume stack. This will reduce the stack item length by 1
1178
+ *
1179
+ * This function can't be called in read-only mode.
1180
+ *
1181
+ * @throws This function can throw errors.
1182
+ */
1183
+ popVolume(): void;
1184
+ /**
1185
+ * @remarks
1186
+ * Push a compound volume item (a volume and action pair) to
1187
+ * the volume stack.
1188
+ *
1189
+ * This function can't be called in read-only mode.
1190
+ *
1191
+ * @param item
1192
+ * Item to push to the stack
1193
+ * @throws This function can throw errors.
1194
+ */
1195
+ pushVolume(item: minecraftserver.CompoundBlockVolumeItem): void;
1196
+ /**
1197
+ * @remarks
1198
+ * Replace the contents of the current selection with a new
1199
+ * specified selection. This operation will delete the current
1200
+ * contents and copy the contents of the new selection to the
1201
+ * target selection - it does this by content, not by
1202
+ * reference.
1203
+ *
1204
+ * This function can't be called in read-only mode.
1205
+ *
1206
+ * @param newSelection
1207
+ * Selection object to copy
1208
+ * @throws This function can throw errors.
1209
+ */
1210
+ set(newSelection: Selection): void;
1211
+ /**
1212
+ * @remarks
1213
+ * Set the color of the hull of the selection object if it is
1214
+ * visible.
1215
+ *
1216
+ * This function can't be called in read-only mode.
1217
+ *
1218
+ * @throws This function can throw errors.
1219
+ */
1220
+ setFillColor(color: minecraftserver.Color): void;
1221
+ /**
1222
+ * @remarks
1223
+ * Set the color of the outline around the selection object if
1224
+ * it is visible
1225
+ *
1226
+ * This function can't be called in read-only mode.
1227
+ *
1228
+ * @throws This function can throw errors.
1229
+ */
1230
+ setOutlineColor(color: minecraftserver.Color): void;
1231
+ }
1232
+
1233
+ /**
1234
+ * The SelectionManager (accessible from the {@link
1235
+ * ExtensionContext}) is responsible for the management of all
1236
+ * {@link Selection} objects, and provides the user the ability
1237
+ * to create new {@link Selection} objects for use within an
1238
+ * extension.
1239
+ */
1240
+ export class SelectionManager {
1241
+ private constructor();
1242
+ /**
1243
+ * @remarks
1244
+ * The primary {@link Selection} object is always present (even
1245
+ * if it's empty) and cannot be deleted. This object
1246
+ * represents the main selection object which is always
1247
+ * accessible through the UI, and by default is synchronized
1248
+ * between the client and server.
1249
+ *
1250
+ * @throws This property can throw when used.
1251
+ */
1252
+ readonly selection: Selection;
1253
+ /**
1254
+ * @remarks
1255
+ * Create a new, empty {@link Selection} object
1256
+ *
1257
+ * This function can't be called in read-only mode.
1258
+ *
1259
+ * @throws This function can throw errors.
1260
+ */
1261
+ create(): Selection;
1262
+ }
1263
+
1264
+ /**
1265
+ * The Transaction Manager is responsible for tracking and
1266
+ * managing all of the registered transaction operations which
1267
+ * represent creator changes in the world.
1268
+ * Transaction Manager is the basis of the UNDO and REDO
1269
+ * operations, and allows a creator to store the changes made
1270
+ * to the world and the state of the world BEFORE those changes
1271
+ * were applied, making it possible to UNDO those changes and
1272
+ * restore the world state.
1273
+ * The transactions are stored as a stack, and can be undone in
1274
+ * stack order to restore the world to it's original state
1275
+ */
1276
+ export class TransactionManager {
1277
+ private constructor();
1278
+ /**
1279
+ * @remarks
1280
+ * Commit all of the transaction operations currently attached
1281
+ * to the open transaction record to the manager. These will
1282
+ * be added as a single transaction manager entry.
1283
+ * The open record will be closed and all tracking operations
1284
+ * will cease.
1285
+ *
1286
+ * This function can't be called in read-only mode.
1287
+ *
1288
+ * @throws This function can throw errors.
1289
+ */
1290
+ commitOpenTransaction(): boolean;
1291
+ /**
1292
+ * @remarks
1293
+ * This function will commit the pending changes caused by any
1294
+ * of the track changes variants. The changes will be
1295
+ * committed to the currently open transaction, but the
1296
+ * transaction will remain open for further records.
1297
+ * Pending block changes from tracking operations will be added
1298
+ * to the transaction record before submission to the
1299
+ * transaction manager
1300
+ *
1301
+ * This function can't be called in read-only mode.
1302
+ *
1303
+ * @returns
1304
+ * Returns the number of change requests that were being
1305
+ * tracked
1306
+ * @throws This function can throw errors.
1307
+ */
1308
+ commitTrackedChanges(): number;
1309
+ /**
1310
+ * @remarks
1311
+ * Discard the currently open transaction without committing it
1312
+ * to the transaction manager stack.
1313
+ * All records within the transaction will be discarded, and
1314
+ * any tracking requests currently active will be stopped
1315
+ *
1316
+ * This function can't be called in read-only mode.
1317
+ *
1318
+ * @throws This function can throw errors.
1319
+ */
1320
+ discardOpenTransaction(): boolean;
1321
+ /**
1322
+ * @remarks
1323
+ * Discard any pending tracked changes. This does not affect
1324
+ * the current open transaction contents, only the pending
1325
+ * tracked block operations
1326
+ *
1327
+ * This function can't be called in read-only mode.
1328
+ *
1329
+ * @returns
1330
+ * Returns the number of change requests that were discarded
1331
+ * @throws This function can throw errors.
1332
+ */
1333
+ discardTrackedChanges(): number;
1334
+ /**
1335
+ * @remarks
1336
+ * Open a transaction record which will be a container for any
1337
+ * number of transaction operations.
1338
+ * All transaction operations within a record are grouped and
1339
+ * treated as a single atomic unit
1340
+ *
1341
+ * This function can't be called in read-only mode.
1342
+ *
1343
+ * @param name
1344
+ * Give the transaction record a name
1345
+ * @throws This function can throw errors.
1346
+ */
1347
+ openTransaction(name: string): boolean;
1348
+ /**
1349
+ * @remarks
1350
+ * Perform an redo operation. This will take the last
1351
+ * transaction record on the redo stack and store the current
1352
+ * world state and then apply the changes in the record. This
1353
+ * will reduce the redo record stack by one.
1354
+ *
1355
+ * The transaction record affected by this operation will be
1356
+ * transferred to the undo stack in case the creator decides to
1357
+ * undo it
1358
+ *
1359
+ * This function can't be called in read-only mode.
1360
+ *
1361
+ * @throws This function can throw errors.
1362
+ */
1363
+ redo(): void;
1364
+ /**
1365
+ * @remarks
1366
+ * Return the number of transaction records on the redo stack.
1367
+ *
1368
+ * This function can't be called in read-only mode.
1369
+ *
1370
+ * @throws This function can throw errors.
1371
+ */
1372
+ redoSize(): number;
1373
+ /**
1374
+ * @remarks
1375
+ * Begin tracking block changes in a specified area. These
1376
+ * will be added to a pending changes list.
1377
+ * The pending list will be added to the open transaction
1378
+ * record when a commit has been issued.
1379
+ *
1380
+ * This function can't be called in read-only mode.
1381
+ *
1382
+ * @param from
1383
+ * Min block location of a bounding area
1384
+ * @param to
1385
+ * Max block location of a bounding area
1386
+ * @throws This function can throw errors.
1387
+ */
1388
+ trackBlockChangeArea(from: minecraftserver.Vector3, to: minecraftserver.Vector3): boolean;
1389
+ /**
1390
+ * @remarks
1391
+ * Begin tracking block changes in a list of specified block
1392
+ * locations.
1393
+ *
1394
+ * This function can't be called in read-only mode.
1395
+ *
1396
+ * @param locations
1397
+ * An array of block locations to monitor for changes
1398
+ * @throws This function can throw errors.
1399
+ */
1400
+ trackBlockChangeList(locations: minecraftserver.Vector3[]): boolean;
1401
+ /**
1402
+ * @remarks
1403
+ * Begin tracking block changes that may happen in a selection
1404
+ * volume.
1405
+ * The volume is copied, so tracking will not move if the
1406
+ * selection volume is translated after this instruction is
1407
+ * issued.
1408
+ * Selection Volumes can also represent irregular shapes with
1409
+ * non-contiguous blocks and this tracking call will honor the
1410
+ * actual selected areas in the volume (and not the negative
1411
+ * space) (see {@link @minecraft-server/CompoundBlockVolume}
1412
+ * for more details
1413
+ *
1414
+ * This function can't be called in read-only mode.
1415
+ *
1416
+ * @param selection
1417
+ * A collection of block location volumes represented by a
1418
+ * Selection volume to monitor for changes.
1419
+ * The Selection Volume is copied, so further changes to the
1420
+ * volume after this call will not be reflected in the tracking
1421
+ * list.
1422
+ * @throws This function can throw errors.
1423
+ */
1424
+ trackBlockChangeSelection(selection: Selection): boolean;
1425
+ /**
1426
+ * @remarks
1427
+ * Perform an undo operation. This will take the last
1428
+ * transaction record on the stack and apply the stored world
1429
+ * state from before the changes were made. This will reduce
1430
+ * the record stack by one.
1431
+ *
1432
+ * The transaction record affected by this operation will be
1433
+ * transferred to the redo stack in case the creator decides to
1434
+ * reapply it
1435
+ *
1436
+ * This function can't be called in read-only mode.
1437
+ *
1438
+ * @throws This function can throw errors.
1439
+ */
1440
+ undo(): void;
1441
+ /**
1442
+ * @remarks
1443
+ * Return how many transactions records currently exist on the
1444
+ * stack
1445
+ *
1446
+ * This function can't be called in read-only mode.
1447
+ *
1448
+ * @throws This function can throw errors.
1449
+ */
1450
+ undoSize(): number;
1451
+ }
1452
+
1453
+ /**
1454
+ * Interface used to specify the options when a clipboard item
1455
+ * is being written to the world
1456
+ */
1457
+ export interface ClipboardWriteOptions {
1458
+ /**
1459
+ * @remarks
1460
+ * The anchor is a unit vector representation of the side or
1461
+ * corner of the Clipboard Item to be written to the world.
1462
+ * `{0, 0, 0}` represents the center of the Clipboard item,
1463
+ * `{0, 1, 0}` represents the top, `{-1, -1, -1}` represents
1464
+ * the bottom/back/left corner, etc
1465
+ * The anchor is used in conjunction with the item size to
1466
+ * determine the object relative anchor point where the object
1467
+ * will be applied in the world.
1468
+ * Values for the X/Y/Z components should be within the range
1469
+ * `(-1 <= X/Y/Z <=1)`
1470
+ *
1471
+ */
1472
+ anchor?: minecraftserver.Vector3;
1473
+ /**
1474
+ * @remarks
1475
+ * An enum which represents the axis (or combination of axis')
1476
+ * along which the item should be mirrored
1477
+ * - X
1478
+ * - Z
1479
+ * - XZ
1480
+ *
1481
+ */
1482
+ mirror?: ClipboardMirrorAxis;
1483
+ /**
1484
+ * @remarks
1485
+ * A position offset which should be applied to the paste
1486
+ * location while the clipboard item is being written
1487
+ *
1488
+ */
1489
+ offset?: minecraftserver.Vector3;
1490
+ /**
1491
+ * @remarks
1492
+ * An enum representing the rotation around the Y-Axis which
1493
+ * should be applied while the clipboard item is being written
1494
+ *
1495
+ */
1496
+ rotation?: ClipboardRotation;
1497
+ }
1498
+
1499
+ /**
1500
+ * The CursorProperties interface is used to describe the
1501
+ * properties of the Editor 3D block cursor construct.
1502
+ * The 3D block cursor can be queried to retrieve the current
1503
+ * properties, and the same property class can be used to set
1504
+ * the current properties of the cursor.
1505
+ * This interface is generally used at the activation stage of
1506
+ * the active tool to set up the color, visibility and input
1507
+ * properties of the 3D block cursor
1508
+ */
1509
+ export interface CursorProperties {
1510
+ /**
1511
+ * @remarks
1512
+ * Enum representing the cursor control mode
1513
+ * - Fixed Mode locks the cursor to a position which is <X>
1514
+ * blocks offset from the current player position. The cursor
1515
+ * is camera relative, so it will always appear <X> blocks
1516
+ * ahead of the players feet
1517
+ * - Keyboard Mode puts the cursor under direct control of the
1518
+ * API, and ignores any mouse input. The cursor can only be
1519
+ * moved around using the moveBy method
1520
+ * - KeyboardAndMouse mode puts the cursor under a shared
1521
+ * control of onMouseMove and keyboard input. Any mouse
1522
+ * movement events will set the cursor to the position of the
1523
+ * mouse/world raycast. This can be modified using the moveBy
1524
+ * method, but any subsequent mouse events will reset the
1525
+ * position back to where the raycast intersection occurs
1526
+ * - Mouse mode puts the cursor under control of mouse move
1527
+ * events, and moveBy method will be ignored
1528
+ *
1529
+ *
1530
+ */
1531
+ controlMode?: CursorControlMode;
1532
+ /**
1533
+ * @remarks
1534
+ * The fixed distance from the players feet at which the cursor
1535
+ * is attached, relative to camera direction.
1536
+ * This is only used when [controlMode] is set to `Fixed`
1537
+ *
1538
+ */
1539
+ fixedModeDistance?: number;
1540
+ /**
1541
+ * @remarks
1542
+ * A [Color] Property representing the color of the block
1543
+ * cursor object outline
1544
+ *
1545
+ */
1546
+ outlineColor?: minecraftserver.Color;
1547
+ /**
1548
+ * @remarks
1549
+ * An enum representing the cursor target mode
1550
+ * - Block Mode records the block position of the mouse/world
1551
+ * raycast intersection
1552
+ * - Face Mode records the block position of the block adjacent
1553
+ * to the mouse/world raycast intersection, according to the
1554
+ * face of the collision point of the selected block
1555
+ *
1556
+ */
1557
+ targetMode?: CursorTargetMode;
1558
+ /**
1559
+ * @remarks
1560
+ * Boolean flag controlling the visibility of the 3D block
1561
+ * cursor
1562
+ *
1563
+ */
1564
+ visible?: boolean;
1565
+ }
1566
+
1567
+ /**
1568
+ * An interface which defines the set of optional parameters
1569
+ * which can be used when calling the `registerEditorExtension`
1570
+ * function
1571
+ */
1572
+ export interface ExtensionOptionalParameters {
1573
+ /**
1574
+ * @remarks
1575
+ * An optional text description of the extension being
1576
+ * registered.
1577
+ * This can be a straight textual description or a string
1578
+ * identifier key for a localized string in the extension's
1579
+ * resource pack text files.
1580
+ * The description is meant to be a very short snappy one-liner
1581
+ * which quickly and uniquely identifies the extension
1582
+ * The length of the string is capped to 256 characters
1583
+ *
1584
+ */
1585
+ description?: string;
1586
+ /**
1587
+ * @remarks
1588
+ * Optional notes for the extension being registered.
1589
+ * This can be a straight textual description or a string
1590
+ * identifier key for a localized string in the extension's
1591
+ * resource pack text files.
1592
+ * The notes section is meant to convey more detailed
1593
+ * information and notes (e.g. a link to the author's website)
1594
+ * The length of this string is capped to 1024 characters
1595
+ *
1596
+ */
1597
+ notes?: string;
1598
+ }
1599
+
1600
+ /**
1601
+ * A properties class for the global instance of the logger
1602
+ * object.
1603
+ * While the logger object is available through the {@link
1604
+ * @minecraft/server-editor-bindings.ExtensionContext} - using
1605
+ * the global instance allows the creator to use this
1606
+ * properties class to perform direct server->client messaging
1607
+ * and broadcasts.
1608
+ */
1609
+ export interface LogProperties {
1610
+ /**
1611
+ * @remarks
1612
+ * Direct a log message to a specific player. If no player is
1613
+ * specified, then all players will receive the message
1614
+ *
1615
+ */
1616
+ player?: minecraftserver.Player;
1617
+ /**
1618
+ * @remarks
1619
+ * Add additional tags to the log message which can be used by
1620
+ * the client session to filter/search in the log window
1621
+ *
1622
+ */
1623
+ tags?: string[];
1624
+ }
1625
+
1626
+ /**
1627
+ * Binds actions to the client and manages their lifetime.
1628
+ * Action managers are managed on a per player basis since
1629
+ * client side UI is per player.
1630
+ */
1631
+ export interface ActionManager {
1632
+ /**
1633
+ * @remarks
1634
+ * The active tool ID
1635
+ *
1636
+ */
1637
+ activeToolId: string | undefined;
1638
+ /**
1639
+ * @remarks
1640
+ * Creates an action and registers it on the client
1641
+ *
1642
+ * @param rawAction
1643
+ * The raw action to create. See ActionTypes for supported
1644
+ * parameters
1645
+ */
1646
+ createAction<T extends Action>(rawAction: T): RegisteredAction<T>;
1647
+ }
1648
+
1649
+ /**
1650
+ * Represents a UI session for a given player
1651
+ */
1652
+ export interface BuiltInUIManager {
1653
+ /**
1654
+ * @remarks
1655
+ * Navigates to the documentation site
1656
+ *
1657
+ */
1658
+ navigateToDocumentation(): void;
1659
+ /**
1660
+ * @remarks
1661
+ * Navigates to the feedback site
1662
+ *
1663
+ */
1664
+ navigateToFeedback(): void;
1665
+ /**
1666
+ * @remarks
1667
+ * Navigates to the pause screen
1668
+ *
1669
+ */
1670
+ navigateToPauseScreen(): void;
1671
+ /**
1672
+ * @remarks
1673
+ * Updates the visibility of the log panel
1674
+ *
1675
+ */
1676
+ updateLogPanelVisibility(visibility: boolean): void;
1677
+ /**
1678
+ * @remarks
1679
+ * Updates the visibility of the control demo
1680
+ *
1681
+ */
1682
+ updateUISettingsPanelVisibility(visibility: boolean): void;
1683
+ /**
1684
+ * @remarks
1685
+ * Updates the visibility of the welcome panel
1686
+ *
1687
+ */
1688
+ updateWelcomePanelVisibility(visibility: boolean): void;
1689
+ }
1690
+
1691
+ /**
1692
+ * An event that can be subscribed to. Leverage the token to
1693
+ * clean up handlers
1694
+ */
1695
+ export declare interface EventSink<T> {
1696
+ /**
1697
+ * @remarks
1698
+ */
1699
+ subscribe(handler: EventHandler<T>): IEventToken;
1700
+ }
1701
+
1702
+ /**
1703
+ * Simple abstraction for disposable objects.
1704
+ */
1705
+ export interface IDisposable {
1706
+ /**
1707
+ * @remarks
1708
+ */
1709
+ teardown(): void;
1710
+ }
1711
+
1712
+ export interface IDropdownItem {
1713
+ /**
1714
+ * @remarks
1715
+ * Fallback display text if no loc ID
1716
+ *
1717
+ */
1718
+ readonly displayAltText: string;
1719
+ /**
1720
+ * @remarks
1721
+ * Loc ID (resolved on client)
1722
+ *
1723
+ */
1724
+ readonly displayStringId: string;
1725
+ /**
1726
+ * @remarks
1727
+ * The selectable value of the DropDown item.
1728
+ *
1729
+ */
1730
+ readonly value: number;
1731
+ }
1732
+
1733
+ /**
1734
+ * Returned from an event subscription. Provides functionality
1735
+ * for cleaning up listeners
1736
+ */
1737
+ export declare interface IEventToken {
1738
+ /**
1739
+ * @remarks
1740
+ * Removes registered listener from an event
1741
+ *
1742
+ */
1743
+ unsubscribe(): void;
1744
+ }
1745
+
1746
+ export interface IGlobalInputManager {
1747
+ registerKeyBinding(
1748
+ inputContextId: EditorInputContext,
1749
+ action: SupportedKeyboardActionTypes,
1750
+ button: KeyboardKey,
1751
+ modifier?: InputModifier,
1752
+ ): void;
1753
+ }
1754
+
1755
+ export interface IMenu {
1756
+ /**
1757
+ * @remarks
1758
+ * Unique ID for the menu
1759
+ *
1760
+ */
1761
+ readonly id: string;
1762
+ /**
1763
+ * @remarks
1764
+ * Sub menus of this menu
1765
+ *
1766
+ */
1767
+ readonly submenu: IMenu[];
1768
+ addItem(params: IMenuCreationParams, action?: RegisteredAction<NoArgsAction>): IMenu;
1769
+ addSeparator(): IMenu;
1770
+ dispose(): void;
1771
+ hide(): void;
1772
+ replaceAction(action: RegisteredAction<NoArgsAction>): void;
1773
+ show(): void;
1774
+ }
1775
+
1776
+ /**
1777
+ * Properties required to create a Menu
1778
+ */
1779
+ export interface IMenuCreationParams {
1780
+ /**
1781
+ * @remarks
1782
+ * Loc ID (resolved on client)
1783
+ *
1784
+ */
1785
+ displayStringId?: string;
1786
+ /**
1787
+ * @remarks
1788
+ * The name of the menu
1789
+ *
1790
+ */
1791
+ name: string;
1792
+ }
1793
+
1794
+ export interface IModalTool {
1795
+ /**
1796
+ * @remarks
1797
+ * Unique ID for the tool
1798
+ *
1799
+ */
1800
+ readonly id: string;
1801
+ /**
1802
+ * @remarks
1803
+ * Provides lifecycle activation events for a modal tool
1804
+ *
1805
+ */
1806
+ onModalToolActivation: EventSink<ModalToolLifecycleEventPayload>;
1807
+ bindPropertyPane(pane: IPropertyPane): void;
1808
+ dispose(): void;
1809
+ hide(): void;
1810
+ registerKeyBinding(action: SupportedKeyboardActionTypes, button: KeyboardKey, modifier?: InputModifier): void;
1811
+ registerMouseButtonBinding(action: SupportedMouseActionTypes): void;
1812
+ registerMouseDragBinding(action: SupportedMouseActionTypes): void;
1813
+ registerMouseWheelBinding(action: SupportedMouseActionTypes): void;
1814
+ show(): void;
1815
+ unregisterInputBindings(): void;
1816
+ }
1817
+
1818
+ export interface IModalToolContainer {
1819
+ /**
1820
+ * @remarks
1821
+ * Tools within this container.
1822
+ *
1823
+ */
1824
+ readonly currentTools: IModalTool[];
1825
+ /**
1826
+ * @remarks
1827
+ * The id of the selected tool in container.
1828
+ *
1829
+ */
1830
+ readonly selectedOptionId?: string;
1831
+ addTool(params: ModalToolCreationParameters): IModalTool;
1832
+ dispose(): void;
1833
+ hide(): void;
1834
+ removeTool(id: string): void;
1835
+ setSelectedOptionId(value: string | undefined, update?: boolean): void;
1836
+ show(): void;
1837
+ }
1838
+
1839
+ /**
1840
+ * Log helper interface for Player.
1841
+ */
1842
+ export interface IPlayerLogger {
1843
+ /**
1844
+ * @remarks
1845
+ * Dispatch a player log message with Debug log level
1846
+ *
1847
+ * @param message
1848
+ * Message content
1849
+ */
1850
+ debug(message: string): void;
1851
+ /**
1852
+ * @remarks
1853
+ * Dispatch a player log message with Error log level
1854
+ *
1855
+ * @param message
1856
+ * Message content
1857
+ */
1858
+ error(message: string): void;
1859
+ /**
1860
+ * @remarks
1861
+ * Dispatch a player log message with Info log level
1862
+ *
1863
+ * @param message
1864
+ * Message content
1865
+ */
1866
+ info(message: string): void;
1867
+ /**
1868
+ * @remarks
1869
+ * Dispatch a player log message with Warning log level
1870
+ *
1871
+ * @param message
1872
+ * Message content
1873
+ */
1874
+ warning(message: string): void;
1875
+ }
1876
+
1877
+ export interface IPropertyItem<T extends PropertyBag, Prop extends keyof T & string> {
1878
+ /**
1879
+ * @remarks
1880
+ * If the item is enabled in the UI.
1881
+ *
1882
+ */
1883
+ enable: boolean;
1884
+ /**
1885
+ * @remarks
1886
+ * Unique ID for the property item.
1887
+ *
1888
+ */
1889
+ readonly id: string;
1890
+ /**
1891
+ * @remarks
1892
+ * The object associated.
1893
+ *
1894
+ */
1895
+ readonly obj: T;
1896
+ /**
1897
+ * @remarks
1898
+ * The parent pane id.
1899
+ *
1900
+ */
1901
+ readonly paneId: string;
1902
+ /**
1903
+ * @remarks
1904
+ * The target property of the object associated.
1905
+ *
1906
+ */
1907
+ readonly property: Prop;
1908
+ /**
1909
+ * @remarks
1910
+ * The type name of the target property.
1911
+ *
1912
+ */
1913
+ readonly typeName: EDITOR_PANE_PROPERTY_ITEM_TYPE;
1914
+ /**
1915
+ * @remarks
1916
+ * The value of the property.
1917
+ *
1918
+ */
1919
+ readonly value: T[Prop];
1920
+ /**
1921
+ * @remarks
1922
+ * If the item should be visible in the UI.
1923
+ *
1924
+ */
1925
+ visible: boolean;
1926
+ dispose(): void;
1927
+ }
1928
+
1929
+ export interface IPropertyItemOptions {
1930
+ /**
1931
+ * @remarks
1932
+ * If the item is enabled in the UI.
1933
+ *
1934
+ */
1935
+ enable?: boolean;
1936
+ /**
1937
+ * @remarks
1938
+ * Callback to execute when the value is updated.
1939
+ *
1940
+ */
1941
+ onChange?: OnChangeCallback<PropertyBag, string>;
1942
+ /**
1943
+ * @remarks
1944
+ * Fallback display text if no loc ID
1945
+ *
1946
+ */
1947
+ titleAltText?: string;
1948
+ /**
1949
+ * @remarks
1950
+ * Loc ID (resolved on client)
1951
+ *
1952
+ */
1953
+ titleStringId?: string;
1954
+ /**
1955
+ * @remarks
1956
+ * If the item should be visible in the UI.
1957
+ *
1958
+ */
1959
+ visible?: boolean;
1960
+ }
1961
+
1962
+ // @ts-ignore Class inheritance allowed for native defined classes
1963
+ export interface IPropertyItemOptionsBlocks extends IPropertyItemOptions {
1964
+ /**
1965
+ * @remarks
1966
+ * The allowed blocks for the Block Picker.
1967
+ *
1968
+ */
1969
+ allowedBlocks?: string[];
1970
+ }
1971
+
1972
+ // @ts-ignore Class inheritance allowed for native defined classes
1973
+ export interface IPropertyItemOptionsButton extends IPropertyItemOptions {
1974
+ /**
1975
+ * @remarks
1976
+ * The variant for the button. By default it is "primary"
1977
+ *
1978
+ */
1979
+ variant?: ButtonVariant;
1980
+ }
1981
+
1982
+ // @ts-ignore Class inheritance allowed for native defined classes
1983
+ export interface IPropertyItemOptionsDropdown extends IPropertyItemOptions {
1984
+ /**
1985
+ * @remarks
1986
+ * The possible options for the drop down control.
1987
+ *
1988
+ */
1989
+ dropdownItems: IDropdownItem[];
1990
+ }
1991
+
1992
+ // @ts-ignore Class inheritance allowed for native defined classes
1993
+ export interface IPropertyItemOptionsNumber extends IPropertyItemOptions {
1994
+ /**
1995
+ * @remarks
1996
+ * The min possible value for the number.
1997
+ *
1998
+ */
1999
+ max?: number;
2000
+ /**
2001
+ * @remarks
2002
+ * The max possible value for the number.
2003
+ *
2004
+ */
2005
+ min?: number;
2006
+ /**
2007
+ * @remarks
2008
+ * If UI should show slider control.
2009
+ *
2010
+ */
2011
+ showSlider?: boolean;
2012
+ }
2013
+
2014
+ // @ts-ignore Class inheritance allowed for native defined classes
2015
+ export interface IPropertyItemOptionsSubPane extends IPropertyItemOptions {
2016
+ /**
2017
+ * @remarks
2018
+ * The sub pane to render in UI.
2019
+ *
2020
+ */
2021
+ pane: IPropertyPane;
2022
+ }
2023
+
2024
+ // @ts-ignore Class inheritance allowed for native defined classes
2025
+ export interface IPropertyItemOptionsVector3 extends IPropertyItemOptions {
2026
+ /**
2027
+ * @remarks
2028
+ * The max possible value for the X axis. By default
2029
+ * Number.MAX_SAFE_INTEGER
2030
+ *
2031
+ */
2032
+ maxX?: number;
2033
+ /**
2034
+ * @remarks
2035
+ * The max possible value for the Y axis. By default
2036
+ * Number.MAX_SAFE_INTEGER
2037
+ *
2038
+ */
2039
+ maxY?: number;
2040
+ /**
2041
+ * @remarks
2042
+ * The max possible value for the z axis. By default
2043
+ * Number.MAX_SAFE_INTEGER
2044
+ *
2045
+ */
2046
+ maxZ?: number;
2047
+ /**
2048
+ * @remarks
2049
+ * The min possible value for the X axis. By default 0
2050
+ *
2051
+ */
2052
+ minX?: number;
2053
+ /**
2054
+ * @remarks
2055
+ * The min possible value for the Y axis. By default 0
2056
+ *
2057
+ */
2058
+ minY?: number;
2059
+ /**
2060
+ * @remarks
2061
+ * The min possible value for the Z axis. By default 0
2062
+ *
2063
+ */
2064
+ minZ?: number;
2065
+ }
2066
+
2067
+ /**
2068
+ * Property pane present dynamic content. It can be associated
2069
+ * with an object and presented with different kind of
2070
+ * controls.
2071
+ */
2072
+ export interface IPropertyPane {
2073
+ /**
2074
+ * @remarks
2075
+ * Unique ID for the property pane.
2076
+ *
2077
+ */
2078
+ readonly id: string;
2079
+ /**
2080
+ * @remarks
2081
+ * Provides visibility change events
2082
+ *
2083
+ */
2084
+ onPropertyPaneVisibilityUpdated: EventSink<PropertyPaneVisibilityUpdate>;
2085
+ /**
2086
+ * @remarks
2087
+ * In case of sub pane this is the id of the parent pane.
2088
+ *
2089
+ */
2090
+ readonly parentPaneId?: string;
2091
+ /**
2092
+ * @remarks
2093
+ * Fallback display text if no loc ID
2094
+ *
2095
+ */
2096
+ titleAltText: string;
2097
+ /**
2098
+ * @remarks
2099
+ * Loc ID (resolved on client)
2100
+ *
2101
+ */
2102
+ titleStringId: string;
2103
+ /**
2104
+ * @remarks
2105
+ * Width of the panel in rem.
2106
+ *
2107
+ */
2108
+ width?: number;
2109
+ /**
2110
+ * @remarks
2111
+ * Adds a BlockPicker item to the pane.
2112
+ *
2113
+ */
2114
+ addBlockPicker<T extends PropertyBag, Prop extends keyof T & string>(
2115
+ obj: T,
2116
+ property: Prop,
2117
+ options?: IPropertyItemOptionsBlocks,
2118
+ ): IPropertyItem<T, Prop>;
2119
+ /**
2120
+ * @remarks
2121
+ * Adds a boolean item to the pane.
2122
+ *
2123
+ */
2124
+ addBool<T extends PropertyBag, Prop extends keyof T & string>(
2125
+ obj: T,
2126
+ property: Prop,
2127
+ options?: IPropertyItemOptions,
2128
+ ): IPropertyItem<T, Prop>;
2129
+ /**
2130
+ * @remarks
2131
+ * Adds a button to the pane and binds the specified action to
2132
+ * the button activate.
2133
+ *
2134
+ */
2135
+ addButton(
2136
+ action: RegisteredAction<NoArgsAction>,
2137
+ options?: IPropertyItemOptionsButton,
2138
+ ): IActionPropertyItem<
2139
+ {
2140
+ EMPTY: undefined;
2141
+ },
2142
+ 'EMPTY'
2143
+ >;
2144
+ /**
2145
+ * @remarks
2146
+ * Adds an divider item to the pane.
2147
+ *
2148
+ */
2149
+ addDivider(): IPropertyItem<PropertyBag, string>;
2150
+ /**
2151
+ * @remarks
2152
+ * Adds an DropDown item to the pane.
2153
+ *
2154
+ */
2155
+ addDropdown<T extends PropertyBag, Prop extends keyof T & string>(
2156
+ obj: T,
2157
+ property: Prop,
2158
+ options?: IPropertyItemOptionsDropdown,
2159
+ ): IPropertyItem<T, Prop>;
2160
+ /**
2161
+ * @remarks
2162
+ * Adds a number item to the pane.
2163
+ *
2164
+ */
2165
+ addNumber<T extends PropertyBag, Prop extends keyof T & string>(
2166
+ obj: T,
2167
+ property: Prop,
2168
+ options?: IPropertyItemOptionsNumber,
2169
+ ): IPropertyItem<T, Prop>;
2170
+ /**
2171
+ * @remarks
2172
+ * Adds a string item to the pane
2173
+ *
2174
+ */
2175
+ addString<T extends PropertyBag, Prop extends keyof T & string>(
2176
+ obj: T,
2177
+ property: Prop,
2178
+ options?: IPropertyItemOptions,
2179
+ ): IPropertyItem<T, Prop>;
2180
+ /**
2181
+ * @remarks
2182
+ * Adds a Vec3 item to the pane.
2183
+ *
2184
+ */
2185
+ addVector3<T extends PropertyBag, Prop extends keyof T & string>(
2186
+ obj: T,
2187
+ property: Prop,
2188
+ options?: IPropertyItemOptionsVector3,
2189
+ ): IPropertyItem<T, Prop>;
2190
+ /**
2191
+ * @remarks
2192
+ * Creates an internal sub panel that is presented inside a
2193
+ * extender control.
2194
+ *
2195
+ */
2196
+ createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
2197
+ /**
2198
+ * @remarks
2199
+ * Hide the pane.
2200
+ *
2201
+ */
2202
+ hide(): void;
2203
+ /**
2204
+ * @remarks
2205
+ * Removes a child property pane from the parent pane.
2206
+ *
2207
+ */
2208
+ removePropertyPane(paneToRemove: IPropertyPane): boolean;
2209
+ /**
2210
+ * @remarks
2211
+ * Show the pane and all of its property items.
2212
+ *
2213
+ */
2214
+ show(): void;
2215
+ }
2216
+
2217
+ /**
2218
+ * The options to create a pane.
2219
+ */
2220
+ export interface IPropertyPaneOptions {
2221
+ /**
2222
+ * @remarks
2223
+ * Fallback display text if no loc ID
2224
+ *
2225
+ */
2226
+ titleAltText: string;
2227
+ /**
2228
+ * @remarks
2229
+ * Loc ID (resolved on client)
2230
+ *
2231
+ */
2232
+ titleStringId: string;
2233
+ /**
2234
+ * @remarks
2235
+ * Width of the panel in rem. This property is ignored in case
2236
+ * of sub panes
2237
+ *
2238
+ */
2239
+ width?: number;
2240
+ }
2241
+
2242
+ /**
2243
+ * Optional parameter definition for RegisterEditorExtension
2244
+ * function Allows the extension registrar to specify optional
2245
+ * textual description and notes which would be visible through
2246
+ * the extension manager
2247
+ */
2248
+ export interface IRegisterExtensionOptionalParameters {
2249
+ description?: string;
2250
+ notes?: string;
2251
+ }
2252
+
2253
+ export interface IStatusBarItem {
2254
+ /**
2255
+ * @remarks
2256
+ * Unique ID for the item.
2257
+ *
2258
+ */
2259
+ readonly id: string;
2260
+ /**
2261
+ * @remarks
2262
+ * Text to display.
2263
+ *
2264
+ */
2265
+ text: string;
2266
+ hide(): void;
2267
+ show(): void;
2268
+ }
2269
+
2270
+ /**
2271
+ * Parameters for creating a modal tool in the tool container
2272
+ */
2273
+ export interface ModalToolCreationParameters {
2274
+ /**
2275
+ * @remarks
2276
+ * The displayed string for the tool
2277
+ *
2278
+ */
2279
+ displayAltText: string;
2280
+ /**
2281
+ * @remarks
2282
+ * Loc ID (resolved on client)
2283
+ *
2284
+ */
2285
+ displayStringId?: string;
2286
+ /**
2287
+ * @remarks
2288
+ * Icon, if any (from resource pack on client)
2289
+ *
2290
+ */
2291
+ icon?: string;
2292
+ /**
2293
+ * @remarks
2294
+ * tooltipAltText alt text, if any
2295
+ *
2296
+ */
2297
+ tooltipAltText?: string;
2298
+ /**
2299
+ * @remarks
2300
+ * Tooltip localization string ID
2301
+ *
2302
+ */
2303
+ tooltipStringId?: string;
2304
+ }
2305
+
2306
+ /**
2307
+ * @remarks
2308
+ * Takes the input object (a property bag of values) and bind
2309
+ * it to the pane as a data source. UI child elements of the
2310
+ * pane will be updated when the values in the object change,
2311
+ * and vice versa.
2312
+ *
2313
+ * @param propertyPane
2314
+ * The property pane to bind the property bag to.
2315
+ * @param target
2316
+ * The property bag to bind to the pane.
2317
+ */
2318
+ export declare function bindDataSource<T extends PropertyBag, Prop extends keyof T & string>(
2319
+ propertyPane: IPropertyPane,
2320
+ target: T,
2321
+ ): T;
2322
+ /**
2323
+ * @remarks
2324
+ * Executes an operation over a selection via chunks to allow
2325
+ * splitting operation over multiple game ticks
2326
+ *
2327
+ * @param selection
2328
+ * the selection to iterator over
2329
+ * @param operation
2330
+ * the operation to apply over each block location
2331
+ */
2332
+ export declare function executeLargeOperation(
2333
+ selection: Selection,
2334
+ operation: (blockLocation: minecraftserver.Vector3) => void,
2335
+ ): Promise<void>;
2336
+ /**
2337
+ * @remarks
2338
+ * Adds the resource pack editor prefix and returns the full
2339
+ * localization ID
2340
+ *
2341
+ */
2342
+ export declare function getLocalizationId(locId: string): string;
2343
+ /**
2344
+ * @remarks
2345
+ * Registers an editor extension into Minecraft. This function
2346
+ * calls underlying functionality to register an extension but
2347
+ * provides helpful and contextual wrappers for individual
2348
+ * client lifetimes. The onActivation function is called
2349
+ * whenever a client joins a session, while the shutdown is
2350
+ * called when a client leaves. There may be other
2351
+ * circumstances in which these are called as well based on
2352
+ * client state that is an implementation detail of the system.
2353
+ *
2354
+ */
2355
+ export declare function registerEditorExtension<PerPlayerStorageType = Record<string, never>>(
2356
+ extensionName: string,
2357
+ activationFunction: ActivationFunctionType<PerPlayerStorageType>,
2358
+ shutdownFunction: ShutdownFunctionType<PerPlayerStorageType>,
2359
+ options?: IRegisterExtensionOptionalParameters,
2360
+ ): Extension;
2361
+ export const editor: MinecraftEditor;