@minecraft/server-editor 0.1.0-beta.1.21.30-preview.21 → 0.1.0-beta.1.21.30-preview.23

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 +316 -62
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -31,6 +31,11 @@ export declare enum ActionTypes {
31
31
  NoArgsAction = 'NoArgsAction',
32
32
  }
33
33
 
34
+ export enum BlockMaskListType {
35
+ Mask = 'Mask',
36
+ Replace = 'Replace',
37
+ }
38
+
34
39
  export enum BlockPaletteItemType {
35
40
  Simple = 0,
36
41
  Probability = 1,
@@ -44,11 +49,6 @@ export declare enum BoolPropertyItemVariant {
44
49
  ToggleSwitch = 1,
45
50
  }
46
51
 
47
- export enum BrushPipelineOperationType {
48
- Include = 0,
49
- Exclude = 1,
50
- }
51
-
52
52
  /**
53
53
  * The possible variants of a Button property item.
54
54
  */
@@ -1078,7 +1078,7 @@ export type IObservableProp<T> = IObservable<T> | T;
1078
1078
  */
1079
1079
  export type IPlayerUISession<PerPlayerStorage = Record<string, never>> = {
1080
1080
  createStatusBarItem(alignment: EditorStatusBarAlignment, size: number): IStatusBarItem;
1081
- createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
1081
+ createPropertyPane(options: IRootPropertyPaneOptions): IRootPropertyPane;
1082
1082
  readonly actionManager: ActionManager;
1083
1083
  readonly inputManager: IGlobalInputManager;
1084
1084
  readonly menuBar: IMenuContainer;
@@ -1399,12 +1399,14 @@ export class BrushShapeManager {
1399
1399
  private constructor();
1400
1400
  readonly activeBrushShape?: BrushShape;
1401
1401
  readonly activeBrushVolume?: minecraftserver.CompoundBlockVolume;
1402
- readonly brushShapeNames: string[];
1402
+ readonly brushShapeList: BrushShape[];
1403
1403
  /**
1404
1404
  * @remarks
1405
1405
  * This function can't be called in read-only mode.
1406
1406
  *
1407
1407
  * @throws This function can throw errors.
1408
+ *
1409
+ * {@link minecraftserver.Error}
1408
1410
  */
1409
1411
  activateBrushShape(name: string): minecraftserver.CompoundBlockVolume;
1410
1412
  /**
@@ -1412,15 +1414,32 @@ export class BrushShapeManager {
1412
1414
  * This function can't be called in read-only mode.
1413
1415
  *
1414
1416
  */
1415
- getBrushVolume(
1416
- origin: minecraftserver.Vector3,
1417
- pipeline: BrushPipelineOperation[],
1418
- ): minecraftserver.CompoundBlockVolume | undefined;
1417
+ activateBrushTool(): void;
1418
+ /**
1419
+ * @remarks
1420
+ * This function can't be called in read-only mode.
1421
+ *
1422
+ */
1423
+ beginPainting(): void;
1424
+ /**
1425
+ * @remarks
1426
+ * This function can't be called in read-only mode.
1427
+ *
1428
+ */
1429
+ deactivateBrushTool(): void;
1430
+ /**
1431
+ * @remarks
1432
+ * This function can't be called in read-only mode.
1433
+ *
1434
+ */
1435
+ endPainting(): void;
1419
1436
  /**
1420
1437
  * @remarks
1421
1438
  * This function can't be called in read-only mode.
1422
1439
  *
1423
1440
  * @throws This function can throw errors.
1441
+ *
1442
+ * {@link Error}
1424
1443
  */
1425
1444
  getSettingsUIElements(brushName: string): SettingsUIElement[];
1426
1445
  /**
@@ -1428,6 +1447,8 @@ export class BrushShapeManager {
1428
1447
  * This function can't be called in read-only mode.
1429
1448
  *
1430
1449
  * @throws This function can throw errors.
1450
+ *
1451
+ * {@link Error}
1431
1452
  */
1432
1453
  registerBrushShape(
1433
1454
  name: string,
@@ -1440,6 +1461,34 @@ export class BrushShapeManager {
1440
1461
  * This function can't be called in read-only mode.
1441
1462
  *
1442
1463
  * @throws This function can throw errors.
1464
+ *
1465
+ * {@link Error}
1466
+ */
1467
+ setBlockPaletteOverride(
1468
+ overrideBlock?: minecraftserver.BlockPermutation | minecraftserver.BlockType | string,
1469
+ ): void;
1470
+ /**
1471
+ * @remarks
1472
+ * This function can't be called in read-only mode.
1473
+ *
1474
+ * @throws This function can throw errors.
1475
+ *
1476
+ * {@link Error}
1477
+ */
1478
+ setBrushMask(mask: BlockMaskList): void;
1479
+ /**
1480
+ * @remarks
1481
+ * This function can't be called in read-only mode.
1482
+ *
1483
+ */
1484
+ setBrushShape(shape: minecraftserver.Vector3[] | minecraftserver.CompoundBlockVolume): void;
1485
+ /**
1486
+ * @remarks
1487
+ * This function can't be called in read-only mode.
1488
+ *
1489
+ * @throws This function can throw errors.
1490
+ *
1491
+ * {@link Error}
1443
1492
  */
1444
1493
  uiSettingValueChanged(elementName: string, newValue: boolean | number | string | minecraftserver.Vector3): boolean;
1445
1494
  }
@@ -1565,6 +1614,15 @@ export class ClipboardItem {
1565
1614
  * @throws This function can throw errors.
1566
1615
  */
1567
1616
  readFromSelection(selection: Selection): void;
1617
+ /**
1618
+ * @remarks
1619
+ * This function can't be called in read-only mode.
1620
+ *
1621
+ * @throws This function can throw errors.
1622
+ *
1623
+ * {@link Error}
1624
+ */
1625
+ readFromStructure(structure: EditorStructure): void;
1568
1626
  /**
1569
1627
  * @remarks
1570
1628
  * Copy the contents of a rectangular volume into the Clipboard
@@ -1634,6 +1692,51 @@ export class ClipboardManager {
1634
1692
  create(): ClipboardItem;
1635
1693
  }
1636
1694
 
1695
+ export class CurrentThemeChangeAfterEvent {
1696
+ private constructor();
1697
+ readonly name: string;
1698
+ }
1699
+
1700
+ export class CurrentThemeChangeAfterEventSignal {
1701
+ private constructor();
1702
+ /**
1703
+ * @remarks
1704
+ * This function can't be called in read-only mode.
1705
+ *
1706
+ */
1707
+ subscribe(callback: (arg: CurrentThemeChangeAfterEvent) => void): (arg: CurrentThemeChangeAfterEvent) => void;
1708
+ /**
1709
+ * @remarks
1710
+ * This function can't be called in read-only mode.
1711
+ *
1712
+ */
1713
+ unsubscribe(callback: (arg: CurrentThemeChangeAfterEvent) => void): void;
1714
+ }
1715
+
1716
+ export class CurrentThemeColorChangeAfterEvent {
1717
+ private constructor();
1718
+ readonly color: minecraftserver.RGBA;
1719
+ readonly colorKey: ThemeSettingsColorKey;
1720
+ }
1721
+
1722
+ export class CurrentThemeColorChangeAfterEventSignal {
1723
+ private constructor();
1724
+ /**
1725
+ * @remarks
1726
+ * This function can't be called in read-only mode.
1727
+ *
1728
+ */
1729
+ subscribe(
1730
+ callback: (arg: CurrentThemeColorChangeAfterEvent) => void,
1731
+ ): (arg: CurrentThemeColorChangeAfterEvent) => void;
1732
+ /**
1733
+ * @remarks
1734
+ * This function can't be called in read-only mode.
1735
+ *
1736
+ */
1737
+ unsubscribe(callback: (arg: CurrentThemeColorChangeAfterEvent) => void): void;
1738
+ }
1739
+
1637
1740
  /**
1638
1741
  * The 3D block cursor is controlled through this read only
1639
1742
  * object and provides the Editor some control over the input
@@ -1831,6 +1934,45 @@ export class CursorPropertyChangeAfterEventSignal {
1831
1934
  unsubscribe(callback: (arg: CursorPropertiesChangeAfterEvent) => void): void;
1832
1935
  }
1833
1936
 
1937
+ export class EditorStructureManager {
1938
+ private constructor();
1939
+ /**
1940
+ * @remarks
1941
+ * This function can't be called in read-only mode.
1942
+ *
1943
+ * @throws This function can throw errors.
1944
+ */
1945
+ createFromClipboardItem(item: ClipboardItem, structureName: string): EditorStructure;
1946
+ /**
1947
+ * @remarks
1948
+ * This function can't be called in read-only mode.
1949
+ *
1950
+ * @throws This function can throw errors.
1951
+ */
1952
+ getExistingTags(): string[];
1953
+ /**
1954
+ * @remarks
1955
+ * This function can't be called in read-only mode.
1956
+ *
1957
+ * @throws This function can throw errors.
1958
+ */
1959
+ loadStructure(location: string, id: string): EditorStructure;
1960
+ /**
1961
+ * @remarks
1962
+ * This function can't be called in read-only mode.
1963
+ *
1964
+ * @throws This function can throw errors.
1965
+ */
1966
+ saveStructure(structure: EditorStructure): void;
1967
+ /**
1968
+ * @remarks
1969
+ * This function can't be called in read-only mode.
1970
+ *
1971
+ * @throws This function can throw errors.
1972
+ */
1973
+ searchStructures(options?: EditorStructureSearchOptions): EditorStructure[];
1974
+ }
1975
+
1834
1976
  /**
1835
1977
  * Validates observable objects that support string as
1836
1978
  * EntityType
@@ -2003,6 +2145,7 @@ export class ExtensionContext {
2003
2145
  *
2004
2146
  */
2005
2147
  readonly settings: SettingsManager;
2148
+ readonly structureManager: EditorStructureManager;
2006
2149
  /**
2007
2150
  * @remarks
2008
2151
  * The instance of the players Transaction Manager and the main
@@ -2021,6 +2164,8 @@ export class ExtensionContext {
2021
2164
  export class ExtensionContextAfterEvents {
2022
2165
  private constructor();
2023
2166
  readonly clipboardChange: ClipboardChangeAfterEventSignal;
2167
+ readonly currentThemeChange: CurrentThemeChangeAfterEventSignal;
2168
+ readonly currentThemeColorChange: CurrentThemeColorChangeAfterEventSignal;
2024
2169
  readonly cursorAttachmentPropertyChange: CursorAttachmentPropertyChangeAfterEventSignal;
2025
2170
  readonly cursorPropertyChange: CursorPropertyChangeAfterEventSignal;
2026
2171
  /**
@@ -2697,6 +2842,7 @@ export class ThemeSettings {
2697
2842
  * {@link Error}
2698
2843
  */
2699
2844
  addNewTheme(name: string): void;
2845
+ canThemeBeModified(name: string): boolean;
2700
2846
  /**
2701
2847
  * @remarks
2702
2848
  * This function can't be called in read-only mode.
@@ -2708,7 +2854,7 @@ export class ThemeSettings {
2708
2854
  deleteTheme(name: string): void;
2709
2855
  getCurrentTheme(): string;
2710
2856
  getThemeList(): string[];
2711
- resolveColorKey(key: ThemeSettingsColorKey): minecraftserver.RGBA | undefined;
2857
+ resolveColorKey(key: ThemeSettingsColorKey): minecraftserver.RGBA;
2712
2858
  /**
2713
2859
  * @remarks
2714
2860
  * This function can't be called in read-only mode.
@@ -3571,9 +3717,9 @@ export class WidgetStateChangeEventData {
3571
3717
  readonly widget: Widget;
3572
3718
  }
3573
3719
 
3574
- export interface BrushPipelineOperation {
3575
- blockTypes: minecraftserver.BlockType[];
3576
- operation: BrushPipelineOperationType;
3720
+ export interface BlockMaskList {
3721
+ blockList: (minecraftserver.BlockPermutation | minecraftserver.BlockType | string)[];
3722
+ maskType: BlockMaskListType;
3577
3723
  }
3578
3724
 
3579
3725
  export interface BrushShape {
@@ -3709,6 +3855,19 @@ export interface CursorProperties {
3709
3855
  visible?: boolean;
3710
3856
  }
3711
3857
 
3858
+ export interface EditorStructure {
3859
+ storageLocation: string;
3860
+ structure: minecraftserver.Structure;
3861
+ tags: string[];
3862
+ }
3863
+
3864
+ export interface EditorStructureSearchOptions {
3865
+ excludeTags?: string[];
3866
+ idPattern?: string;
3867
+ includeLocation?: string[];
3868
+ includeTags?: string[];
3869
+ }
3870
+
3712
3871
  /**
3713
3872
  * An interface which defines the set of optional parameters
3714
3873
  * which can be used when calling the `registerEditorExtension`
@@ -3764,6 +3923,7 @@ export interface GameOptions {
3764
3923
  fireSpreads?: boolean;
3765
3924
  friendlyFire?: boolean;
3766
3925
  gameMode?: minecraftserver.GameMode;
3926
+ hardcore?: boolean;
3767
3927
  immediateRespawn?: boolean;
3768
3928
  keepInventory?: boolean;
3769
3929
  lanVisibility?: boolean;
@@ -3869,6 +4029,15 @@ export interface WidgetComponentTextOptions extends WidgetComponentBaseOptions {
3869
4029
  color?: minecraftserver.RGBA;
3870
4030
  }
3871
4031
 
4032
+ export interface WidgetCreateOptions {
4033
+ collisionOffset?: minecraftserver.Vector3;
4034
+ collisionRadius?: number;
4035
+ selectable?: boolean;
4036
+ snapToBlockLocation?: boolean;
4037
+ stateChangeEvent?: (arg: WidgetStateChangeEventData) => void;
4038
+ visible?: boolean;
4039
+ }
4040
+
3872
4041
  export interface WidgetGroupCreateOptions {
3873
4042
  groupSelectionMode?: WidgetGroupSelectionMode;
3874
4043
  showBounds?: boolean;
@@ -3881,12 +4050,6 @@ export interface WidgetGroupCreateOptions {
3881
4050
  * client side UI is per player.
3882
4051
  */
3883
4052
  export interface ActionManager {
3884
- /**
3885
- * @remarks
3886
- * The active tool ID
3887
- *
3888
- */
3889
- activeToolId: string | undefined;
3890
4053
  /**
3891
4054
  * @remarks
3892
4055
  * Creates an action and registers it on the client
@@ -4730,18 +4893,10 @@ export interface IModalToolContainer {
4730
4893
  *
4731
4894
  */
4732
4895
  readonly currentTools: IModalTool[];
4733
- /**
4734
- * @remarks
4735
- * The id of the selected tool in container.
4736
- *
4737
- */
4738
- readonly selectedOptionId?: string;
4739
4896
  addTool(params: ModalToolCreationParameters, action?: RegisteredAction<NoArgsAction>): IModalTool;
4740
- dispose(): void;
4741
- hide(): void;
4897
+ getSelectedToolId(): string | undefined;
4742
4898
  removeTool(id: string): void;
4743
- setSelectedOptionId(value: string | undefined, update?: boolean): void;
4744
- show(): void;
4899
+ setSelectedToolId(id: string | undefined): void;
4745
4900
  }
4746
4901
 
4747
4902
  /**
@@ -5157,30 +5312,12 @@ export interface IPropertyPane {
5157
5312
  *
5158
5313
  */
5159
5314
  onPropertyPaneVisibilityUpdated: EventSink<PropertyPaneVisibilityUpdate>;
5160
- /**
5161
- * @remarks
5162
- * In case of sub pane this is the id of the parent pane.
5163
- *
5164
- */
5165
- readonly parentPaneId?: string;
5166
- /**
5167
- * @remarks
5168
- * Localized title of the property pane
5169
- *
5170
- */
5171
- title: string;
5172
5315
  /**
5173
5316
  * @remarks
5174
5317
  * Check visibility of the pane
5175
5318
  *
5176
5319
  */
5177
5320
  visible: boolean;
5178
- /**
5179
- * @remarks
5180
- * Width of the panel in rem.
5181
- *
5182
- */
5183
- width?: number;
5184
5321
  /**
5185
5322
  * @remarks
5186
5323
  * Adds a block list to the pane.
@@ -5351,17 +5488,22 @@ export interface IPropertyPane {
5351
5488
  collapse(): void;
5352
5489
  /**
5353
5490
  * @remarks
5354
- * Creates an internal sub panel that is presented inside a
5355
- * extender control.
5491
+ * Creates an sub pane that can store property items.
5356
5492
  *
5357
5493
  */
5358
- createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
5494
+ createSubPane(options: ISubPanePropertyItemOptions): ISubPanePropertyItem;
5359
5495
  /**
5360
5496
  * @remarks
5361
5497
  * Expand the pane.
5362
5498
  *
5363
5499
  */
5364
5500
  expand(): void;
5501
+ /**
5502
+ * @remarks
5503
+ * Returns property pane title.
5504
+ *
5505
+ */
5506
+ getTitle(): LocalizedString | undefined;
5365
5507
  /**
5366
5508
  * @remarks
5367
5509
  * Hide the pane.
@@ -5370,10 +5512,18 @@ export interface IPropertyPane {
5370
5512
  hide(): void;
5371
5513
  /**
5372
5514
  * @remarks
5373
- * Removes a child property pane from the parent pane.
5515
+ * Removes an existing sub pane.
5374
5516
  *
5375
5517
  */
5376
- removePropertyPane(paneToRemove: IPropertyPane): boolean;
5518
+ removeSubPane(paneToRemove: IPropertyPane): boolean;
5519
+ /**
5520
+ * @remarks
5521
+ * Updates title of property pane.
5522
+ *
5523
+ * @param newTitle
5524
+ * New title
5525
+ */
5526
+ setTitle(newTitle: LocalizedString | undefined): void;
5377
5527
  /**
5378
5528
  * @remarks
5379
5529
  * Show the pane and all of its property items.
@@ -5383,21 +5533,16 @@ export interface IPropertyPane {
5383
5533
  }
5384
5534
 
5385
5535
  /**
5386
- * The options to create a pane.
5536
+ * Common optional properties used for constructing a property
5537
+ * pane.
5387
5538
  */
5388
5539
  export interface IPropertyPaneOptions {
5389
- /**
5390
- * @remarks
5391
- * Layout direction for sub panes
5392
- *
5393
- */
5394
- direction?: LayoutDirection;
5395
5540
  /**
5396
5541
  * @remarks
5397
5542
  * Localized title of the property pane
5398
5543
  *
5399
5544
  */
5400
- title: string;
5545
+ title?: LocalizedString;
5401
5546
  }
5402
5547
 
5403
5548
  export interface IPropertyTableCellItem {
@@ -5434,6 +5579,50 @@ export interface IRegisterExtensionOptionalParameters {
5434
5579
  toolGroupId?: string;
5435
5580
  }
5436
5581
 
5582
+ /**
5583
+ * A root pane that can store property items.
5584
+ */
5585
+ // @ts-ignore Class inheritance allowed for native defined classes
5586
+ export interface IRootPropertyPane extends IPropertyPane {
5587
+ /**
5588
+ * @remarks
5589
+ * @returns
5590
+ * Current visibility state of header action
5591
+ */
5592
+ isHeaderActionVisible(): boolean;
5593
+ /**
5594
+ * @remarks
5595
+ * If a header action exists, updates visibility of the button.
5596
+ *
5597
+ * @param visible
5598
+ * New visibility state of the action button.
5599
+ */
5600
+ setHeaderActionVisibility(visible: boolean): void;
5601
+ }
5602
+
5603
+ /**
5604
+ * Represents the data to display an action button on a root
5605
+ * property pane header.
5606
+ */
5607
+ export interface IRootPropertyPaneHeaderAction {
5608
+ action?: () => void;
5609
+ icon: string;
5610
+ tooltip?: LocalizedString;
5611
+ }
5612
+
5613
+ /**
5614
+ * The options to create a root pane.
5615
+ */
5616
+ // @ts-ignore Class inheritance allowed for native defined classes
5617
+ export interface IRootPropertyPaneOptions extends IPropertyPaneOptions {
5618
+ /**
5619
+ * @remarks
5620
+ * Optional action button to be displayed on the header.
5621
+ *
5622
+ */
5623
+ headerAction?: IRootPropertyPaneHeaderAction;
5624
+ }
5625
+
5437
5626
  /**
5438
5627
  * The simple tool wrapper will create, bind and manage the
5439
5628
  * lifecycle of all the desired components. The wrapper is
@@ -6004,6 +6193,71 @@ export interface IStringPropertyItemOptions extends IPropertyItemOptionsBase {
6004
6193
  tooltip?: LocalizedString;
6005
6194
  }
6006
6195
 
6196
+ /**
6197
+ * A property item which supports Sub Pane properties
6198
+ */
6199
+ // @ts-ignore Class inheritance allowed for native defined classes
6200
+ export interface ISubPanePropertyItem extends IPropertyItemBase, IPropertyPane {
6201
+ /**
6202
+ * @remarks
6203
+ * Updates layout alignment of the sub pane.
6204
+ *
6205
+ * @param alignment
6206
+ * New layout alignment.
6207
+ */
6208
+ setAlignment(alignment: LayoutAlignment): void;
6209
+ /**
6210
+ * @remarks
6211
+ * Updates layout direction of the sub pane.
6212
+ *
6213
+ * @param direction
6214
+ * New layout direction.
6215
+ */
6216
+ setDirection(direction: LayoutDirection): void;
6217
+ }
6218
+
6219
+ /**
6220
+ * Optional properties for Sub Pane property item
6221
+ */
6222
+ // @ts-ignore Class inheritance allowed for native defined classes
6223
+ export interface ISubPanePropertyItemOptions extends IPropertyPaneOptions {
6224
+ /**
6225
+ * @remarks
6226
+ * Alignment of property items within the pane of the property
6227
+ * pane. If undefined, it will default to Left.
6228
+ *
6229
+ */
6230
+ alignment?: LayoutAlignment;
6231
+ /**
6232
+ * @remarks
6233
+ * Initial expander state of sub pane. If undefined, it will
6234
+ * default to false.
6235
+ *
6236
+ */
6237
+ collapsed?: boolean;
6238
+ /**
6239
+ * @remarks
6240
+ * Determines layout direction of sub pane property items. If
6241
+ * undefined, it will default to Vertical.
6242
+ *
6243
+ */
6244
+ direction?: LayoutDirection;
6245
+ /**
6246
+ * @remarks
6247
+ * Determines if sub pane should have an expander. If
6248
+ * undefined, it will default to true.
6249
+ *
6250
+ */
6251
+ hasExpander?: boolean;
6252
+ /**
6253
+ * @remarks
6254
+ * Adds additional margins to sub pane. If undefined, it will
6255
+ * default to true.
6256
+ *
6257
+ */
6258
+ hasMargins?: boolean;
6259
+ }
6260
+
6007
6261
  /**
6008
6262
  * A property item which supports Vector3 properties
6009
6263
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.30-preview.21",
3
+ "version": "0.1.0-beta.1.21.30-preview.23",
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.15.0-beta.1.21.30-preview.21"
17
+ "@minecraft/server": "^1.15.0-beta.1.21.30-preview.23"
18
18
  },
19
19
  "license": "MIT"
20
20
  }