@minecraft/server-editor 0.1.0-beta.1.21.40-preview.25 → 0.1.0-beta.1.21.50-preview.20

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 +257 -13
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -889,6 +889,17 @@ export declare enum NumberPropertyItemVariant {
889
889
  InputFieldAndSlider = 1,
890
890
  }
891
891
 
892
+ export enum PaintCompletionState {
893
+ Success = 0,
894
+ Canceled = 1,
895
+ Failed = 2,
896
+ }
897
+
898
+ export enum PaintMode {
899
+ BlockPaint = 0,
900
+ FreehandSelect = 1,
901
+ }
902
+
892
903
  export enum Plane {
893
904
  XY = 'XY',
894
905
  XZ = 'XZ',
@@ -948,6 +959,7 @@ export declare enum PropertyItemType {
948
959
  SubPane = 'editorUI:SubPane',
949
960
  Table = 'editorUI:Table',
950
961
  Text = 'editorUI:Text',
962
+ ToggleGroup = 'editorUI:ToggleGroup',
951
963
  Vector3 = 'editorUI:Vector3',
952
964
  }
953
965
 
@@ -1054,6 +1066,12 @@ export enum WidgetGroupSelectionMode {
1054
1066
  Single = 'Single',
1055
1067
  }
1056
1068
 
1069
+ export enum WidgetMouseButtonActionType {
1070
+ Pressed = 0,
1071
+ Released = 1,
1072
+ Drag = 2,
1073
+ }
1074
+
1057
1075
  /**
1058
1076
  * Defines type information for graphics settings properties.
1059
1077
  */
@@ -1301,6 +1319,27 @@ export type SupportedKeyboardActionTypes = RegisteredAction<NoArgsAction>;
1301
1319
  */
1302
1320
  export type SupportedMouseActionTypes = RegisteredAction<MouseRayCastAction>;
1303
1321
 
1322
+ /**
1323
+ * Content properties to display interactive tooltips
1324
+ */
1325
+ export declare type TooltipInteractiveContent = {
1326
+ title?: LocalizedString;
1327
+ description?: TooltipInteractiveContentDescription[];
1328
+ };
1329
+
1330
+ /**
1331
+ * Possible tooltip description items
1332
+ */
1333
+ export declare type TooltipInteractiveContentDescription = LocalizedString | TooltipLink;
1334
+
1335
+ /**
1336
+ * Tooltip link description
1337
+ */
1338
+ export declare type TooltipLink = {
1339
+ text: LocalizedString;
1340
+ link: string;
1341
+ };
1342
+
1304
1343
  export type UnregisterInputBindingCallback = () => void;
1305
1344
 
1306
1345
  /**
@@ -1458,35 +1497,38 @@ export class BrushShapeManager {
1458
1497
  * @remarks
1459
1498
  * This function can't be called in read-only mode.
1460
1499
  *
1461
- * @throws This function can throw errors.
1462
- *
1463
- * {@link minecraftserver.Error}
1464
1500
  */
1465
- activateBrushShape(name: string): minecraftserver.CompoundBlockVolume;
1501
+ activateBrushTool(): void;
1466
1502
  /**
1467
1503
  * @remarks
1468
1504
  * This function can't be called in read-only mode.
1469
1505
  *
1506
+ * @throws This function can throw errors.
1507
+ *
1508
+ * {@link Error}
1470
1509
  */
1471
- activateBrushTool(): void;
1510
+ beginPainting(onComplete: (arg: PaintCompletionState) => void): void;
1472
1511
  /**
1473
1512
  * @remarks
1474
1513
  * This function can't be called in read-only mode.
1475
1514
  *
1476
1515
  */
1477
- beginPainting(): void;
1516
+ deactivateBrushTool(): void;
1478
1517
  /**
1479
1518
  * @remarks
1480
1519
  * This function can't be called in read-only mode.
1481
1520
  *
1521
+ * @throws This function can throw errors.
1522
+ *
1523
+ * {@link Error}
1482
1524
  */
1483
- deactivateBrushTool(): void;
1525
+ endPainting(cancelled: boolean): void;
1484
1526
  /**
1485
1527
  * @remarks
1486
1528
  * This function can't be called in read-only mode.
1487
1529
  *
1488
1530
  */
1489
- endPainting(): void;
1531
+ getBrushShapeOffset(): minecraftserver.Vector3;
1490
1532
  /**
1491
1533
  * @remarks
1492
1534
  * This function can't be called in read-only mode.
@@ -1518,9 +1560,19 @@ export class BrushShapeManager {
1518
1560
  *
1519
1561
  * {@link Error}
1520
1562
  */
1521
- setBlockPaletteOverride(
1522
- overrideBlock?: minecraftserver.BlockPermutation | minecraftserver.BlockType | string,
1523
- ): void;
1563
+ setBrushMask(mask: BlockMaskList): void;
1564
+ /**
1565
+ * @remarks
1566
+ * This function can't be called in read-only mode.
1567
+ *
1568
+ */
1569
+ setBrushShape(shape: minecraftserver.Vector3[] | minecraftserver.CompoundBlockVolume): void;
1570
+ /**
1571
+ * @remarks
1572
+ * This function can't be called in read-only mode.
1573
+ *
1574
+ */
1575
+ setBrushShapeOffset(offset: minecraftserver.Vector3): void;
1524
1576
  /**
1525
1577
  * @remarks
1526
1578
  * This function can't be called in read-only mode.
@@ -1529,13 +1581,22 @@ export class BrushShapeManager {
1529
1581
  *
1530
1582
  * {@link Error}
1531
1583
  */
1532
- setBrushMask(mask: BlockMaskList): void;
1584
+ singlePaint(onComplete: (arg: PaintCompletionState) => void): void;
1533
1585
  /**
1534
1586
  * @remarks
1535
1587
  * This function can't be called in read-only mode.
1536
1588
  *
1537
1589
  */
1538
- setBrushShape(shape: minecraftserver.Vector3[] | minecraftserver.CompoundBlockVolume): void;
1590
+ switchBrushPaintMode(paintMode: PaintMode): void;
1591
+ /**
1592
+ * @remarks
1593
+ * This function can't be called in read-only mode.
1594
+ *
1595
+ * @throws This function can throw errors.
1596
+ *
1597
+ * {@link minecraftserver.Error}
1598
+ */
1599
+ switchBrushShape(name: string): minecraftserver.CompoundBlockVolume;
1539
1600
  /**
1540
1601
  * @remarks
1541
1602
  * This function can't be called in read-only mode.
@@ -2935,6 +2996,7 @@ export class ThemeSettings {
2935
2996
  */
2936
2997
  deleteTheme(id: string): void;
2937
2998
  getCurrentTheme(): string;
2999
+ getThemeColors(id: string): Record<string, minecraftserver.RGBA> | undefined;
2938
3000
  getThemeList(): string[];
2939
3001
  resolveColorKey(key: ThemeSettingsColorKey): minecraftserver.RGBA;
2940
3002
  /**
@@ -3790,10 +3852,19 @@ export class WidgetManager {
3790
3852
  deleteGroup(groupToDelete: WidgetGroup): void;
3791
3853
  }
3792
3854
 
3855
+ export class WidgetMouseButtonEventData {
3856
+ private constructor();
3857
+ readonly action: WidgetMouseButtonActionType;
3858
+ readonly altPressed: boolean;
3859
+ readonly controlPressed: boolean;
3860
+ readonly shiftPressed: boolean;
3861
+ }
3862
+
3793
3863
  export class WidgetStateChangeEventData {
3794
3864
  private constructor();
3795
3865
  readonly group: WidgetGroup;
3796
3866
  readonly location?: minecraftserver.Vector3;
3867
+ readonly mouseEvent?: WidgetMouseButtonEventData;
3797
3868
  readonly selected?: boolean;
3798
3869
  readonly visible?: boolean;
3799
3870
  readonly widget: Widget;
@@ -5543,6 +5614,12 @@ export interface IPropertyPane {
5543
5614
  *
5544
5615
  */
5545
5616
  addText(value: IObservableProp<LocalizedString>, options?: ITextPropertyItemOptions): ITextPropertyItem;
5617
+ /**
5618
+ * @remarks
5619
+ * Adds a toggle button group to the pane.
5620
+ *
5621
+ */
5622
+ addToggleGroup(value: IObservableProp<number>, options?: IToggleGroupPropertyItemOptions): IToggleGroupPropertyItem;
5546
5623
  /**
5547
5624
  * @remarks
5548
5625
  * Adds a Vec3 item to the pane.
@@ -5703,6 +5780,13 @@ export interface IRootPropertyPaneOptions extends IPropertyPaneOptions {
5703
5780
  *
5704
5781
  */
5705
5782
  headerAction?: IRootPropertyPaneHeaderAction;
5783
+ /**
5784
+ * @remarks
5785
+ * Optional information tooltip for the pane to be displayed on
5786
+ * the header.
5787
+ *
5788
+ */
5789
+ infoTooltip?: TooltipInteractiveContent;
5706
5790
  }
5707
5791
 
5708
5792
  /**
@@ -6450,6 +6534,138 @@ export interface ITextPropertyItemOptions extends IPropertyItemOptionsBase {
6450
6534
  title?: LocalizedString;
6451
6535
  }
6452
6536
 
6537
+ /**
6538
+ * A property item which supports toggle button properties
6539
+ */
6540
+ // @ts-ignore Class inheritance allowed for native defined classes
6541
+ export interface IToggleGroupPropertyItem extends IPropertyItemBase {
6542
+ /**
6543
+ * @remarks
6544
+ * Current selected entry value.
6545
+ *
6546
+ */
6547
+ readonly value: number;
6548
+ /**
6549
+ * @remarks
6550
+ * Find a toggle entry at an index in the group.
6551
+ *
6552
+ * @param index
6553
+ * Index of the toggle entry in the list.
6554
+ */
6555
+ getEntryByIndex(index: number): IToggleGroupPropertyItemEntry | undefined;
6556
+ /**
6557
+ * @remarks
6558
+ * Find a toggle entry with a specific value associated with
6559
+ * property item.
6560
+ *
6561
+ * @param value
6562
+ * Value of the toggle entry in the group.
6563
+ */
6564
+ getEntryByValue(value: number): IToggleGroupPropertyItemEntry | undefined;
6565
+ /**
6566
+ * @remarks
6567
+ * Updates title of the property item.
6568
+ *
6569
+ * @param title
6570
+ * New title.
6571
+ */
6572
+ setTitle(title: LocalizedString | undefined): void;
6573
+ /**
6574
+ * @remarks
6575
+ * Updates tooltip of the property item.
6576
+ *
6577
+ * @param tooltip
6578
+ * New tooltip.
6579
+ */
6580
+ setTooltip(tooltip: LocalizedString | undefined): void;
6581
+ /**
6582
+ * @remarks
6583
+ * Update list of toggle group entries.
6584
+ *
6585
+ * @param entries
6586
+ * New list of updated entries.
6587
+ * @param newValue
6588
+ * New value value to use for the selected toggle button.
6589
+ */
6590
+ updateEntries(entries: IToggleGroupPropertyItemEntry[], newValue?: number): void;
6591
+ }
6592
+
6593
+ /**
6594
+ * Properties of toggle group property item list entry
6595
+ */
6596
+ export interface IToggleGroupPropertyItemEntry {
6597
+ /**
6598
+ * @remarks
6599
+ * Optional icon of the dropdown entry.
6600
+ *
6601
+ */
6602
+ readonly icon?: string;
6603
+ /**
6604
+ * @remarks
6605
+ * Localized display text of the entry.
6606
+ *
6607
+ */
6608
+ readonly label?: LocalizedString;
6609
+ /**
6610
+ * @remarks
6611
+ * Optional tooltip description text of the entry.
6612
+ *
6613
+ */
6614
+ readonly tooltip?: LocalizedString;
6615
+ /**
6616
+ * @remarks
6617
+ * The selectable value of the entry.
6618
+ *
6619
+ */
6620
+ readonly value: number;
6621
+ }
6622
+
6623
+ /**
6624
+ * Optional properties for Toggle Group property item
6625
+ */
6626
+ // @ts-ignore Class inheritance allowed for native defined classes
6627
+ export interface IToggleGroupPropertyItemOptions extends IPropertyItemOptionsBase {
6628
+ /**
6629
+ * @remarks
6630
+ * List of toggle button entries associated with the property
6631
+ * item. If undefined, list will be empty.
6632
+ *
6633
+ */
6634
+ entries?: IToggleGroupPropertyItemEntry[];
6635
+ /**
6636
+ * @remarks
6637
+ * If true toggle buttons will be displayed vertically with
6638
+ * their labels. If undefined, labels will be hidden.
6639
+ *
6640
+ */
6641
+ hiddenEntryLabels?: boolean;
6642
+ /**
6643
+ * @remarks
6644
+ * If true label text will be hidden. It will be visible by
6645
+ * default.
6646
+ *
6647
+ */
6648
+ hiddenLabel?: boolean;
6649
+ /**
6650
+ * @remarks
6651
+ * This callback is called when UI control value is changed.
6652
+ *
6653
+ */
6654
+ onChange?: (newValue: number, oldValue: number, items: IToggleGroupPropertyItemEntry[]) => void;
6655
+ /**
6656
+ * @remarks
6657
+ * Localized title of the property item.
6658
+ *
6659
+ */
6660
+ title?: LocalizedString;
6661
+ /**
6662
+ * @remarks
6663
+ * Tooltip description of the property item.
6664
+ *
6665
+ */
6666
+ tooltip?: LocalizedString;
6667
+ }
6668
+
6453
6669
  /**
6454
6670
  * A property item which supports Vector3 properties
6455
6671
  */
@@ -6605,6 +6821,14 @@ export declare function bindDataSource<T extends PropertyBag, Prop extends keyof
6605
6821
  propertyPane: IPropertyPane,
6606
6822
  target: T,
6607
6823
  ): T;
6824
+ /**
6825
+ * @remarks
6826
+ * Deserialize anything, defaults to the same behavior as
6827
+ * JSON.parse but will use custom deserializers passed into
6828
+ * {@link registerSerializationForType}.
6829
+ *
6830
+ */
6831
+ export declare function deserialize(s: string): unknown;
6608
6832
  /**
6609
6833
  * @remarks
6610
6834
  * Executes an operation over a selection via chunks to allow
@@ -6670,6 +6894,18 @@ export declare function registerEditorExtension<PerPlayerStorageType = Record<st
6670
6894
  shutdownFunction: ShutdownFunctionType<PerPlayerStorageType>,
6671
6895
  options?: IRegisterExtensionOptionalParameters,
6672
6896
  ): Extension;
6897
+ /**
6898
+ * @remarks
6899
+ * Register a type to have custom serialization/deserialization
6900
+ * when using {@link serialize} and {@link deserialize}.
6901
+ *
6902
+ */
6903
+ export declare function registerSerializationForType<T>(
6904
+ typeConstructor: Function,
6905
+ name: string,
6906
+ serializer: (obj: T) => Record<string, unknown>,
6907
+ deserializer: (vals: Record<string, unknown>) => T,
6908
+ ): void;
6673
6909
  /**
6674
6910
  * @remarks
6675
6911
  * Creates a strongly typed transaction handle to enforce type
@@ -6715,6 +6951,14 @@ export declare function registerUserDefinedTransactionHandler<T>(
6715
6951
  undoHandler: (payload: T) => void,
6716
6952
  redoHandler: (payload: T) => void,
6717
6953
  ): UserDefinedTransactionHandle<T>;
6954
+ /**
6955
+ * @remarks
6956
+ * Serialize anything, defaults to the same behavior as
6957
+ * JSON.stringify but will use custom serializers passed into
6958
+ * {@link registerSerializationForType}.
6959
+ *
6960
+ */
6961
+ export declare function serialize(obj: unknown): string;
6718
6962
  /**
6719
6963
  * @remarks
6720
6964
  * Small utility for getting a string from an unknown exception
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.40-preview.25",
3
+ "version": "0.1.0-beta.1.21.50-preview.20",
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.16.0-beta.1.21.40-preview.25"
17
+ "@minecraft/server": "^1.17.0-beta.1.21.50-preview.20"
18
18
  },
19
19
  "license": "MIT"
20
20
  }