@minecraft/server-editor 0.1.0-beta.1.20.80-preview.20 → 0.1.0-beta.1.20.80-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 +95 -149
  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.20.80-preview.20"
17
+ * "version": "0.1.0-beta.1.20.80-preview.22"
18
18
  * }
19
19
  * ```
20
20
  *
@@ -31,6 +31,24 @@ export declare enum ActionTypes {
31
31
  NoArgsAction = 'NoArgsAction',
32
32
  }
33
33
 
34
+ export enum BlockPaletteItemType {
35
+ Simple = 0,
36
+ Probability = 1,
37
+ }
38
+
39
+ /**
40
+ * Predefined top level menus for core editor
41
+ */
42
+ export declare enum CoreMenuType {
43
+ Edit = 'editor:menu:edit',
44
+ Experimental = 'editor:menu:experimental',
45
+ Extensions = 'editor:menu:extensions',
46
+ File = 'editor:menu:file',
47
+ Help = 'editor:menu:help',
48
+ View = 'editor:menu:view',
49
+ WorldOptions = 'editor:menu:worldOptions',
50
+ }
51
+
34
52
  /**
35
53
  * An enumeration used by the 3D block cursor {@link
36
54
  * @minecraft/server-editor-bindings.Cursor}
@@ -438,11 +456,11 @@ export type IDropdownPropertyItem<
438
456
  * of the UI object.
439
457
  */
440
458
  export type IPlayerUISession<PerPlayerStorage = Record<string, never>> = {
441
- createMenu(props: IMenuCreationParams): IMenu;
442
459
  createStatusBarItem(alignment: EditorStatusBarAlignment, size: number): IStatusBarItem;
443
460
  createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
444
461
  readonly actionManager: ActionManager;
445
462
  readonly inputManager: IGlobalInputManager;
463
+ readonly menuBar: IMenuContainer;
446
464
  readonly toolRail: IModalToolContainer;
447
465
  readonly log: IPlayerLogger;
448
466
  readonly extensionContext: ExtensionContext;
@@ -965,108 +983,6 @@ export class CustomWidgetMoveEventData {
965
983
  readonly widget: CustomWidget;
966
984
  }
967
985
 
968
- export class DataStore {
969
- private constructor();
970
- readonly actionContainer: DataStoreActionContainer;
971
- readonly afterEvents: DataStoreAfterEvents;
972
- readonly menuContainer: DataStoreMenuContainer;
973
- }
974
-
975
- export class DataStoreActionContainer {
976
- private constructor();
977
- /**
978
- * @remarks
979
- * This function can't be called in read-only mode.
980
- *
981
- * @throws This function can throw errors.
982
- */
983
- bindActionToControl(controlId: string, actionPayload: string): void;
984
- /**
985
- * @remarks
986
- * This function can't be called in read-only mode.
987
- *
988
- * @throws This function can throw errors.
989
- */
990
- removeActionFromControl(controlId: string, actionPayload?: string): void;
991
- }
992
-
993
- export class DataStoreAfterEvents {
994
- private constructor();
995
- readonly payloadReceived: DataStorePayloadAfterEventSignal;
996
- }
997
-
998
- export class DataStoreMenuContainer {
999
- private constructor();
1000
- /**
1001
- * @remarks
1002
- * This function can't be called in read-only mode.
1003
- *
1004
- * @throws This function can throw errors.
1005
- */
1006
- createItem(id: string, payload: string): void;
1007
- /**
1008
- * @remarks
1009
- * This function can't be called in read-only mode.
1010
- *
1011
- * @throws This function can throw errors.
1012
- */
1013
- destroyItem(id: string): void;
1014
- /**
1015
- * @remarks
1016
- * This function can't be called in read-only mode.
1017
- *
1018
- */
1019
- getPayload(id: string): string;
1020
- /**
1021
- * @remarks
1022
- * This function can't be called in read-only mode.
1023
- *
1024
- */
1025
- getProperty(id: string, property: string): boolean | number | string | undefined;
1026
- /**
1027
- * @remarks
1028
- * This function can't be called in read-only mode.
1029
- *
1030
- */
1031
- hasPayload(id: string): boolean;
1032
- /**
1033
- * @remarks
1034
- * This function can't be called in read-only mode.
1035
- *
1036
- */
1037
- hasProperty(id: string, property: string): boolean;
1038
- /**
1039
- * @remarks
1040
- * This function can't be called in read-only mode.
1041
- *
1042
- * @throws This function can throw errors.
1043
- */
1044
- updateItem(id: string, payload: string): void;
1045
- }
1046
-
1047
- export class DataStorePayloadAfterEvent {
1048
- private constructor();
1049
- readonly dataTag: string;
1050
- readonly payload: string;
1051
- }
1052
-
1053
- export class DataStorePayloadAfterEventSignal {
1054
- private constructor();
1055
- /**
1056
- * @remarks
1057
- * This function can't be called in read-only mode.
1058
- *
1059
- */
1060
- subscribe(callback: (arg: DataStorePayloadAfterEvent) => void): (arg: DataStorePayloadAfterEvent) => void;
1061
- /**
1062
- * @remarks
1063
- * This function can't be called in read-only mode.
1064
- *
1065
- * @throws This function can throw errors.
1066
- */
1067
- unsubscribe(callback: (arg: DataStorePayloadAfterEvent) => void): void;
1068
- }
1069
-
1070
986
  /**
1071
987
  * Editor Extensions are the basis for all player specific,
1072
988
  * editor specific functionality within the game. Almost all
@@ -1258,6 +1174,22 @@ export class GraphicsSettings {
1258
1174
  setAll(properties: GraphicsSettingsPropertyTypeMap): void;
1259
1175
  }
1260
1176
 
1177
+ export class IBlockPaletteItem {
1178
+ private constructor();
1179
+ getBlock(): minecraftserver.BlockType | undefined;
1180
+ getDisplayName(): string;
1181
+ getType(): BlockPaletteItemType;
1182
+ /**
1183
+ * @remarks
1184
+ * This function can't be called in read-only mode.
1185
+ *
1186
+ * @throws This function can throw errors.
1187
+ *
1188
+ * {@link Error}
1189
+ */
1190
+ setBlock(block: minecraftserver.BlockPermutation | minecraftserver.BlockType | string): void;
1191
+ }
1192
+
1261
1193
  // @ts-ignore Class inheritance allowed for native defined classes
1262
1194
  export class LineWidget extends Widget {
1263
1195
  private constructor();
@@ -1358,50 +1290,6 @@ export class MinecraftEditor {
1358
1290
  *
1359
1291
  */
1360
1292
  readonly simulation: SimulationState;
1361
- /**
1362
- * @remarks
1363
- * This is an internal command which interfaces with the native
1364
- * C++ extension bindings and should not be used by creators.
1365
- * Using this command directly will not provide any of the
1366
- * additional functionality and wrappings that the TypeScript
1367
- * layer will provide.
1368
- * Creators should use the TypeScript binding
1369
- * `registerEditorExtension` instead
1370
- *
1371
- * This function can't be called in read-only mode.
1372
- *
1373
- * @param extensionName
1374
- * Unique name of the editor extension being registered
1375
- * @param activationFunction
1376
- * A code closure which is called during the activation process
1377
- * and is responsible for setting up all of the extension
1378
- * internal settings and UI definitions
1379
- * @param shutdownFunction
1380
- * A code closure which is called during the deactivation
1381
- * process (when the player disconnects) and is responsible for
1382
- * cleaning up any settings or allocations
1383
- * @param options
1384
- * [ExtensionOptionalParameters] describes an optional object
1385
- * which contains a number of optional parameters which is used
1386
- * to register an extension with additional information
1387
- */
1388
- registerExtension_Internal(
1389
- extensionName: string,
1390
- activationFunction: (arg: ExtensionContext) => void,
1391
- shutdownFunction: (arg: ExtensionContext) => void,
1392
- options?: ExtensionOptionalParameters,
1393
- ): Extension;
1394
- }
1395
-
1396
- export class MinecraftEditorInternal {
1397
- private constructor();
1398
- /**
1399
- * @remarks
1400
- * This function can't be called in read-only mode.
1401
- *
1402
- * @throws This function can throw errors.
1403
- */
1404
- getDataStore(player: minecraftserver.Player): DataStore;
1405
1293
  }
1406
1294
 
1407
1295
  /**
@@ -1485,6 +1373,31 @@ export class PrimarySelectionChangedEvent {
1485
1373
  readonly volume?: minecraftserver.CompoundBlockVolume;
1486
1374
  }
1487
1375
 
1376
+ // @ts-ignore Class inheritance allowed for native defined classes
1377
+ export class ProbabilityBlockPaletteItem extends IBlockPaletteItem {
1378
+ constructor(displayName?: string);
1379
+ /**
1380
+ * @remarks
1381
+ * This function can't be called in read-only mode.
1382
+ *
1383
+ * @throws This function can throw errors.
1384
+ *
1385
+ * {@link Error}
1386
+ */
1387
+ addBlock(block: minecraftserver.BlockPermutation | minecraftserver.BlockType | string, weight: number): void;
1388
+ /**
1389
+ * @remarks
1390
+ * This function can't be called in read-only mode.
1391
+ *
1392
+ * @throws This function can throw errors.
1393
+ *
1394
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
1395
+ *
1396
+ * {@link Error}
1397
+ */
1398
+ removeBlockAt(index: number): void;
1399
+ }
1400
+
1488
1401
  /**
1489
1402
  * The Selection represents a volume in space, which may
1490
1403
  * potentially be made up of one or more block locations.
@@ -1747,6 +1660,11 @@ export class SettingsManager {
1747
1660
  readonly graphics: GraphicsSettings;
1748
1661
  }
1749
1662
 
1663
+ // @ts-ignore Class inheritance allowed for native defined classes
1664
+ export class SimpleBlockPaletteItem extends IBlockPaletteItem {
1665
+ constructor(displayName?: string);
1666
+ }
1667
+
1750
1668
  /**
1751
1669
  * Responsible for querying and modifying various properties of
1752
1670
  * the simulation.
@@ -2511,6 +2429,29 @@ export interface IMenu {
2511
2429
  show(): void;
2512
2430
  }
2513
2431
 
2432
+ /**
2433
+ * Manager and container for IMenu objects
2434
+ */
2435
+ export interface IMenuContainer {
2436
+ /**
2437
+ * @remarks
2438
+ * Create a top level item in the container.
2439
+ *
2440
+ * @param props
2441
+ * Configuration for the menu to create
2442
+ */
2443
+ createMenu(props: IMenuCreationParams): IMenu;
2444
+ /**
2445
+ * @remarks
2446
+ * Search for a menu item, if it's not found defer it to next
2447
+ * tick.
2448
+ *
2449
+ * @param id
2450
+ * Menu identifier
2451
+ */
2452
+ getMenu(id: string): Promise<IMenu>;
2453
+ }
2454
+
2514
2455
  /**
2515
2456
  * Properties required to create a Menu
2516
2457
  */
@@ -2533,6 +2474,12 @@ export interface IMenuCreationParams {
2533
2474
  *
2534
2475
  */
2535
2476
  name: string;
2477
+ /**
2478
+ * @remarks
2479
+ * Custom unique identifier that will replace random id
2480
+ *
2481
+ */
2482
+ uniqueId?: string;
2536
2483
  }
2537
2484
 
2538
2485
  export interface IModalTool {
@@ -3269,4 +3216,3 @@ export declare function registerUserDefinedTransactionHandler<T>(
3269
3216
  */
3270
3217
  export declare function stringFromException(e: unknown): string;
3271
3218
  export const editor: MinecraftEditor;
3272
- export const editorInternal: MinecraftEditorInternal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.20.80-preview.20",
3
+ "version": "0.1.0-beta.1.20.80-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.11.0-beta.1.20.80-preview.20"
17
+ "@minecraft/server": "^1.11.0-beta.1.20.80-preview.22"
18
18
  },
19
19
  "license": "MIT"
20
20
  }