@minecraft/server-editor 0.1.0-beta.1.21.0-preview.20 → 0.1.0-beta.1.21.0-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.
Files changed (2) hide show
  1. package/index.d.ts +300 -20
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ```json
15
15
  * {
16
16
  * "module_name": "@minecraft/server-editor",
17
- * "version": "0.1.0-beta.1.21.0-preview.20"
17
+ * "version": "0.1.0-beta.1.21.0-preview.22"
18
18
  * }
19
19
  * ```
20
20
  *
@@ -165,6 +165,17 @@ export declare enum EditorStatusBarAlignment {
165
165
  Left = 1,
166
166
  }
167
167
 
168
+ export enum ExportResult {
169
+ ValidWorldExport = 0,
170
+ LevelFetchFailed = 1,
171
+ FileArchiverFetchFailed = 2,
172
+ ProjectConverterFetchFailed = 3,
173
+ PlayerNotFound = 4,
174
+ WorldExportFailed = 5,
175
+ WorldExportBusy = 6,
176
+ EditorSystemFailure = 7,
177
+ }
178
+
168
179
  /**
169
180
  * Enumeration representing identifiers for graphics settings
170
181
  * properties.
@@ -377,6 +388,22 @@ export enum PlaytestSessionResult {
377
388
  UnspecifiedError = 11,
378
389
  }
379
390
 
391
+ export enum ProjectExportType {
392
+ PlayableWorld = 0,
393
+ ProjectBackup = 1,
394
+ WorldTemplate = 2,
395
+ }
396
+
397
+ /**
398
+ * Define the visibility of the status bar item If the tool
399
+ * does not have an `ISimpleToolPropertyPane` component, then
400
+ * this option is ignored
401
+ */
402
+ export declare enum SimpleToolStatusBarVisibility {
403
+ AlwaysVisible = 0,
404
+ VisibleWhenActive = 1,
405
+ }
406
+
380
407
  export enum WidgetGroupSelectionMode {
381
408
  Multiple = 'Multiple',
382
409
  None = 'None',
@@ -675,19 +702,6 @@ export class BlockPaletteManager {
675
702
  setSelectedBlockType(block: minecraftserver.BlockType): void;
676
703
  }
677
704
 
678
- export class BrushShape {
679
- readonly getSettingsUIElements: () => SettingsUIElement[];
680
- readonly icon: string;
681
- readonly name: string;
682
- readonly rebuild: () => minecraftserver.CompoundBlockVolume;
683
- constructor(
684
- name: string,
685
- icon: string,
686
- rebuild: () => minecraftserver.CompoundBlockVolume,
687
- getSettingsUI: () => SettingsUIElement[],
688
- );
689
- }
690
-
691
705
  export class BrushShapeManager {
692
706
  private constructor();
693
707
  readonly activeBrushShape?: BrushShape;
@@ -713,14 +727,19 @@ export class BrushShapeManager {
713
727
  *
714
728
  * @throws This function can throw errors.
715
729
  */
716
- registerBrushShape(brushShape: BrushShape): void;
730
+ registerBrushShape(
731
+ name: string,
732
+ icon: string,
733
+ rebuild: () => minecraftserver.CompoundBlockVolume,
734
+ getSettingsUIElements: () => SettingsUIElement[],
735
+ ): void;
717
736
  /**
718
737
  * @remarks
719
738
  * This function can't be called in read-only mode.
720
739
  *
721
740
  * @throws This function can throw errors.
722
741
  */
723
- uiSettingValueChanged(elementName: string, newValue: boolean | number): void;
742
+ uiSettingValueChanged(elementName: string, newValue: boolean | number | string | minecraftserver.Vector3): boolean;
724
743
  }
725
744
 
726
745
  /**
@@ -1068,6 +1087,24 @@ export class CustomWidgetMoveEventData {
1068
1087
  readonly widget: CustomWidget;
1069
1088
  }
1070
1089
 
1090
+ export class ExportManager {
1091
+ private constructor();
1092
+ /**
1093
+ * @remarks
1094
+ * This function can't be called in read-only mode.
1095
+ *
1096
+ * @throws This function can throw errors.
1097
+ */
1098
+ beginExportProject(options: ProjectExportOptions): Promise<ExportResult>;
1099
+ /**
1100
+ * @remarks
1101
+ * This function can't be called in read-only mode.
1102
+ *
1103
+ * @throws This function can throw errors.
1104
+ */
1105
+ canExportProject(): boolean;
1106
+ }
1107
+
1071
1108
  /**
1072
1109
  * Editor Extensions are the basis for all player specific,
1073
1110
  * editor specific functionality within the game. Almost all
@@ -1153,6 +1190,7 @@ export class ExtensionContext {
1153
1190
  *
1154
1191
  */
1155
1192
  readonly cursor: Cursor;
1193
+ readonly exportManager: ExportManager;
1156
1194
  /**
1157
1195
  * @remarks
1158
1196
  * Contains information about the registered extension
@@ -1745,17 +1783,19 @@ export class SettingsManager {
1745
1783
  }
1746
1784
 
1747
1785
  export class SettingsUIElement {
1748
- readonly initialValue: boolean | number;
1786
+ readonly initialValue: boolean | number | string | minecraftserver.Vector3;
1749
1787
  readonly max?: number;
1750
1788
  readonly min?: number;
1751
1789
  readonly name: string;
1752
- readonly valueChanged?: (arg: variant) => void;
1790
+ readonly onChange: (arg: boolean | number | string | minecraftserver.Vector3) => boolean;
1791
+ readonly options?: string[];
1753
1792
  constructor(
1754
1793
  name: string,
1755
- initialValue: boolean | number,
1794
+ initialValue: boolean | number | string | minecraftserver.Vector3,
1795
+ onChange: (arg: boolean | number | string | minecraftserver.Vector3) => boolean,
1756
1796
  min?: number,
1757
1797
  max?: number,
1758
- valueChanged?: (arg: variant) => void,
1798
+ options?: string[],
1759
1799
  );
1760
1800
  }
1761
1801
 
@@ -1764,6 +1804,19 @@ export class SimpleBlockPaletteItem extends IBlockPaletteItem {
1764
1804
  constructor(displayName?: string);
1765
1805
  }
1766
1806
 
1807
+ /**
1808
+ * A simple class wrapper to inherit in your tool which
1809
+ * contains the initialization and storage of the simple tool
1810
+ * component utility. See one of the `Simple` samples to see
1811
+ * how to use this class and the wrapper framework
1812
+ */
1813
+ export declare class SimpleToolWrapper implements IDisposable {
1814
+ get session(): IPlayerUISession;
1815
+ get simpleTool(): ISimpleTool;
1816
+ setupSimpleTool(session: IPlayerUISession, options: ISimpleToolOptions): void;
1817
+ teardown(): void;
1818
+ }
1819
+
1767
1820
  /**
1768
1821
  * Responsible for querying and modifying various properties of
1769
1822
  * the simulation.
@@ -2175,6 +2228,11 @@ export class WidgetStateChangeEventData {
2175
2228
  readonly widget: Widget;
2176
2229
  }
2177
2230
 
2231
+ export interface BrushShape {
2232
+ icon: string;
2233
+ name: string;
2234
+ }
2235
+
2178
2236
  /**
2179
2237
  * Interface used to specify the options when a clipboard item
2180
2238
  * is being written to the world
@@ -2367,6 +2425,7 @@ export interface LogProperties {
2367
2425
  export interface PlaytestGameOptions {
2368
2426
  alwaysDay?: boolean;
2369
2427
  difficulty?: minecraftserver.Difficulty;
2428
+ dimensionId?: string;
2370
2429
  disableWeather?: boolean;
2371
2430
  gameMode?: minecraftserver.GameMode;
2372
2431
  showCoordinates?: boolean;
@@ -2375,6 +2434,16 @@ export interface PlaytestGameOptions {
2375
2434
  weather?: number;
2376
2435
  }
2377
2436
 
2437
+ export interface ProjectExportOptions {
2438
+ alwaysDay?: boolean;
2439
+ difficulty?: minecraftserver.Difficulty;
2440
+ disableWeather?: boolean;
2441
+ exportName?: string;
2442
+ exportType: ProjectExportType;
2443
+ gameMode?: minecraftserver.GameMode;
2444
+ initialTimOfDay?: number;
2445
+ }
2446
+
2378
2447
  export interface WidgetCreateOptions {
2379
2448
  initialVisibility?: boolean;
2380
2449
  isSelectable?: boolean;
@@ -2962,6 +3031,12 @@ export interface IPropertyPane {
2962
3031
  *
2963
3032
  */
2964
3033
  titleStringId: string;
3034
+ /**
3035
+ * @remarks
3036
+ * Check visibility of the pane
3037
+ *
3038
+ */
3039
+ visible: boolean;
2965
3040
  /**
2966
3041
  * @remarks
2967
3042
  * Width of the panel in rem.
@@ -3180,6 +3255,211 @@ export interface IRegisterExtensionOptionalParameters {
3180
3255
  toolGroupId?: string;
3181
3256
  }
3182
3257
 
3258
+ /**
3259
+ * The simple tool wrapper will create, bind and manage the
3260
+ * lifecycle of all the desired components. The wrapper is
3261
+ * designed to obfuscate and simplify the process of creating a
3262
+ * simple editor tool so that a creator can get on with the job
3263
+ * of just creating the tool functionality without getting
3264
+ * mired in the irrelevant details of component lifecycle and
3265
+ * visibility management. The wrapper will also attempt to
3266
+ * codify particular implementation patterns and requirements
3267
+ * that are common to all editor tools, and enforce them in a
3268
+ * consistent way. It should also go some way to insulating the
3269
+ * creator from underlying system and implementation changes as
3270
+ * the editor evolves.
3271
+ */
3272
+ export interface ISimpleTool {
3273
+ get menu(): IMenu | undefined;
3274
+ get name(): string;
3275
+ get pane(): ISimpleToolPaneComponent;
3276
+ get session(): IPlayerUISession;
3277
+ get statusBar(): ISimpleToolStatusBarComponent;
3278
+ get toolRail(): ISimpleToolRailComponent;
3279
+ /**
3280
+ * @remarks
3281
+ */
3282
+ findPane(idString: string): ISimpleToolPaneComponent | undefined;
3283
+ /**
3284
+ * @remarks
3285
+ */
3286
+ hidePane(idString?: string): void;
3287
+ /**
3288
+ * @remarks
3289
+ */
3290
+ logDebug(message: string): void;
3291
+ /**
3292
+ * @remarks
3293
+ */
3294
+ logError(message: string): void;
3295
+ /**
3296
+ * @remarks
3297
+ */
3298
+ logInfo(message: string): void;
3299
+ /**
3300
+ * @remarks
3301
+ */
3302
+ logWarn(message: string): void;
3303
+ /**
3304
+ * @remarks
3305
+ */
3306
+ showPane(idString?: string): void;
3307
+ /**
3308
+ * @remarks
3309
+ */
3310
+ showPaneExclusively(idString: string): void;
3311
+ /**
3312
+ * @remarks
3313
+ */
3314
+ teardown(): void;
3315
+ }
3316
+
3317
+ /**
3318
+ * Define a (key & modifier) pair for the simple tool
3319
+ * activation key binding
3320
+ */
3321
+ export interface ISimpleToolKeyPair {
3322
+ button: KeyboardKey;
3323
+ buttonModifier: InputModifier;
3324
+ }
3325
+
3326
+ /**
3327
+ * A set of options which define the basic properties of a
3328
+ * simple tool, and the optional components that are desired.
3329
+ */
3330
+ export interface ISimpleToolOptions {
3331
+ activationKeyBinding?: ISimpleToolKeyPair;
3332
+ name: string;
3333
+ onFinalize?: (tool: ISimpleTool) => void;
3334
+ onTeardown?: (tool: ISimpleTool) => void;
3335
+ propertyPaneOptions?: ISimpleToolPaneOptions;
3336
+ statusBarOptions?: ISimpleToolStatusBarOptions;
3337
+ toolRailOptions?: ISimpleToolRailOptions;
3338
+ }
3339
+
3340
+ /**
3341
+ * The Simple Tool pane component represents the main window
3342
+ * (or sub-window) for an editor tool. The pane components are
3343
+ * stored as a hierarchy (see the `ISimpleToolPaneOptions`
3344
+ * interface for more details) and are the main containers for
3345
+ * all of the UI controls used by the editor tool. Panes are
3346
+ * optional (a tool doesn't necessarily need to have a pane),
3347
+ * but if a pane is present, then it is one of two type - Modal
3348
+ * Pane (appears on the left side of the display; visibility is
3349
+ * tied to the `ISimpleToolRail` component) (Note that there
3350
+ * can be only one modal pane visible at a time) - Global Pane
3351
+ * (appears on the right side of the display; visibility is up
3352
+ * to the creator/user)
3353
+ */
3354
+ export interface ISimpleToolPaneComponent {
3355
+ get childPaneList(): string[];
3356
+ get id(): string;
3357
+ get isVisible(): boolean;
3358
+ get pane(): IPropertyPane;
3359
+ get session(): IPlayerUISession;
3360
+ get simpleTool(): ISimpleTool;
3361
+ /**
3362
+ * @remarks
3363
+ */
3364
+ findPane(idString: string): ISimpleToolPaneComponent | undefined;
3365
+ /**
3366
+ * @remarks
3367
+ */
3368
+ hidePane(): void;
3369
+ /**
3370
+ * @remarks
3371
+ */
3372
+ reconstructPane(): void;
3373
+ /**
3374
+ * @remarks
3375
+ */
3376
+ showPane(): void;
3377
+ }
3378
+
3379
+ /**
3380
+ * A set of options which define the basic properties of a
3381
+ * window pane (or sub-pane) for a simple tool. This pane can
3382
+ * be a top level pane, or a child pane of the top level pane,
3383
+ * and is the content container for all of the UI controls used
3384
+ * by the editor tool. Each pane is uniquely identified by the
3385
+ * `id` property, and has a number of optional function
3386
+ * closures which are called at various points in the pane's
3387
+ * lifecycle. Note that instead of having a single `onFinalize`
3388
+ * function, panes implement a pair of `onBeginFinalize` and
3389
+ * `onEndFinalize` functions. This is to allow for the pane to
3390
+ * be partially constructed BEFORE any child panes are
3391
+ * constructed. Once all child panes have been fully finalized,
3392
+ * then the `onEndFinalize` function is called to allow the
3393
+ * pane to finalize itself.
3394
+ */
3395
+ export interface ISimpleToolPaneOptions {
3396
+ childPaneInitiallyVisible?: string;
3397
+ childPanes?: ISimpleToolPaneOptions[];
3398
+ childPanesMutuallyExclusive?: boolean;
3399
+ id: string;
3400
+ onBeginFinalize?: (pane: ISimpleToolPaneComponent) => void;
3401
+ onEndFinalize?: (pane: ISimpleToolPaneComponent) => void;
3402
+ onHide?: (pane: ISimpleToolPaneComponent) => void;
3403
+ onShow?: (pane: ISimpleToolPaneComponent) => void;
3404
+ onTeardown?: (pane: ISimpleToolPaneComponent) => void;
3405
+ titleAltText: string;
3406
+ titleStringId?: string;
3407
+ }
3408
+
3409
+ export interface ISimpleToolRailComponent {
3410
+ get session(): IPlayerUISession;
3411
+ get simpleTool(): ISimpleTool;
3412
+ get toolRail(): IModalTool;
3413
+ }
3414
+
3415
+ /**
3416
+ * The tool rail component allows the tool to register an icon
3417
+ * and button (and dynamic tooltip) in the tool rail on the
3418
+ * left side of the display. Adding a tool rail component to a
3419
+ * tool will cause the tool to be considered a `modal tool`,
3420
+ * and only one single modal tool can be active at any one
3421
+ * time. Modal tools are generally tools which take focus and
3422
+ * control of the cursor (e.g. selection, clipboards, entity
3423
+ * selection, etc) Global tools (tools which do not have a tool
3424
+ * rail) are generally things like property pages, settings,
3425
+ * etc - things that do not require an active cursor or
3426
+ * gameplay interaction
3427
+ */
3428
+ export interface ISimpleToolRailOptions {
3429
+ displayAltText: string;
3430
+ displayStringId?: string;
3431
+ icon: string;
3432
+ onActivate?: (component: ISimpleToolRailComponent) => void;
3433
+ onDeactivate?: (component: ISimpleToolRailComponent) => void;
3434
+ onFinalize?: (component: ISimpleToolRailComponent) => void;
3435
+ onTeardown?: (component: ISimpleToolRailComponent) => void;
3436
+ tooltipAltText: string;
3437
+ tooltipStringId?: string;
3438
+ }
3439
+
3440
+ export interface ISimpleToolStatusBarComponent {
3441
+ get session(): IPlayerUISession;
3442
+ get simpleTool(): ISimpleTool;
3443
+ get statusBarItem(): IStatusBarItem;
3444
+ hide(): void;
3445
+ show(): void;
3446
+ }
3447
+
3448
+ /**
3449
+ * A set of options which define the basic properties of a
3450
+ * status bar item for a simple tool.
3451
+ */
3452
+ export interface ISimpleToolStatusBarOptions {
3453
+ alignment: EditorStatusBarAlignment;
3454
+ displayAltText: string;
3455
+ onFinalize?: (statusBar: ISimpleToolStatusBarComponent) => void;
3456
+ onHide?: (statusBar: ISimpleToolStatusBarComponent) => void;
3457
+ onShow?: (statusBar: ISimpleToolStatusBarComponent) => void;
3458
+ onTeardown?: (statusBar: ISimpleToolStatusBarComponent) => void;
3459
+ size: number;
3460
+ visibility?: SimpleToolStatusBarVisibility;
3461
+ }
3462
+
3183
3463
  export interface IStatusBarItem {
3184
3464
  /**
3185
3465
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.0-preview.20",
3
+ "version": "0.1.0-beta.1.21.0-preview.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "@minecraft/common": "^1.0.0",
17
- "@minecraft/server": "^1.12.0-beta.1.21.0-preview.20"
17
+ "@minecraft/server": "^1.12.0-beta.1.21.0-preview.22"
18
18
  },
19
19
  "license": "MIT"
20
20
  }