@minecraft/server-editor 0.1.0-beta.1.20.80-preview.21 → 0.1.0-beta.1.20.80-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 +102 -158
  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.21"
17
+ * "version": "0.1.0-beta.1.20.80-preview.23"
18
18
  * }
19
19
  * ```
20
20
  *
@@ -31,9 +31,26 @@ 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
- * An enumeration used by the 3D block cursor {@link
36
- * @minecraft/server-editor-bindings.Cursor}
53
+ * An enumeration used by the 3D block cursor {@link Cursor}
37
54
  */
38
55
  export enum CursorControlMode {
39
56
  /**
@@ -438,11 +455,11 @@ export type IDropdownPropertyItem<
438
455
  * of the UI object.
439
456
  */
440
457
  export type IPlayerUISession<PerPlayerStorage = Record<string, never>> = {
441
- createMenu(props: IMenuCreationParams): IMenu;
442
458
  createStatusBarItem(alignment: EditorStatusBarAlignment, size: number): IStatusBarItem;
443
459
  createPropertyPane(options: IPropertyPaneOptions): IPropertyPane;
444
460
  readonly actionManager: ActionManager;
445
461
  readonly inputManager: IGlobalInputManager;
462
+ readonly menuBar: IMenuContainer;
446
463
  readonly toolRail: IModalToolContainer;
447
464
  readonly log: IPlayerLogger;
448
465
  readonly extensionContext: ExtensionContext;
@@ -861,8 +878,8 @@ export class Cursor {
861
878
  /**
862
879
  * @remarks
863
880
  * Hide the 3D block cursor from view until the corresponding
864
- * {@link @minecraft-server-editor-bindings.Cursor.show}
865
- * function is called
881
+ * {@link @minecraft-server-editor.Cursor.show} function is
882
+ * called
866
883
  *
867
884
  * This function can't be called in read-only mode.
868
885
  *
@@ -873,7 +890,7 @@ export class Cursor {
873
890
  * @remarks
874
891
  * Manually offset the 3D block cursor by given amount.
875
892
  * Depending on the {@link
876
- * @minecraft-server-editor-bindings.CursorProperties.CursorControlMode}
893
+ * @minecraft-server-editor.CursorProperties.CursorControlMode}
877
894
  * - this function may have no effect
878
895
  *
879
896
  * This function can't be called in read-only mode.
@@ -965,108 +982,6 @@ export class CustomWidgetMoveEventData {
965
982
  readonly widget: CustomWidget;
966
983
  }
967
984
 
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
985
  /**
1071
986
  * Editor Extensions are the basis for all player specific,
1072
987
  * editor specific functionality within the game. Almost all
@@ -1258,6 +1173,22 @@ export class GraphicsSettings {
1258
1173
  setAll(properties: GraphicsSettingsPropertyTypeMap): void;
1259
1174
  }
1260
1175
 
1176
+ export class IBlockPaletteItem {
1177
+ private constructor();
1178
+ getBlock(): minecraftserver.BlockType | undefined;
1179
+ getDisplayName(): string;
1180
+ getType(): BlockPaletteItemType;
1181
+ /**
1182
+ * @remarks
1183
+ * This function can't be called in read-only mode.
1184
+ *
1185
+ * @throws This function can throw errors.
1186
+ *
1187
+ * {@link Error}
1188
+ */
1189
+ setBlock(block: minecraftserver.BlockPermutation | minecraftserver.BlockType | string): void;
1190
+ }
1191
+
1261
1192
  // @ts-ignore Class inheritance allowed for native defined classes
1262
1193
  export class LineWidget extends Widget {
1263
1194
  private constructor();
@@ -1358,50 +1289,6 @@ export class MinecraftEditor {
1358
1289
  *
1359
1290
  */
1360
1291
  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
1292
  }
1406
1293
 
1407
1294
  /**
@@ -1485,6 +1372,31 @@ export class PrimarySelectionChangedEvent {
1485
1372
  readonly volume?: minecraftserver.CompoundBlockVolume;
1486
1373
  }
1487
1374
 
1375
+ // @ts-ignore Class inheritance allowed for native defined classes
1376
+ export class ProbabilityBlockPaletteItem extends IBlockPaletteItem {
1377
+ constructor(displayName?: string);
1378
+ /**
1379
+ * @remarks
1380
+ * This function can't be called in read-only mode.
1381
+ *
1382
+ * @throws This function can throw errors.
1383
+ *
1384
+ * {@link Error}
1385
+ */
1386
+ addBlock(block: minecraftserver.BlockPermutation | minecraftserver.BlockType | string, weight: number): void;
1387
+ /**
1388
+ * @remarks
1389
+ * This function can't be called in read-only mode.
1390
+ *
1391
+ * @throws This function can throw errors.
1392
+ *
1393
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
1394
+ *
1395
+ * {@link Error}
1396
+ */
1397
+ removeBlockAt(index: number): void;
1398
+ }
1399
+
1488
1400
  /**
1489
1401
  * The Selection represents a volume in space, which may
1490
1402
  * potentially be made up of one or more block locations.
@@ -1747,6 +1659,11 @@ export class SettingsManager {
1747
1659
  readonly graphics: GraphicsSettings;
1748
1660
  }
1749
1661
 
1662
+ // @ts-ignore Class inheritance allowed for native defined classes
1663
+ export class SimpleBlockPaletteItem extends IBlockPaletteItem {
1664
+ constructor(displayName?: string);
1665
+ }
1666
+
1750
1667
  /**
1751
1668
  * Responsible for querying and modifying various properties of
1752
1669
  * the simulation.
@@ -2289,10 +2206,9 @@ export interface ExtensionOptionalParameters {
2289
2206
  * A properties class for the global instance of the logger
2290
2207
  * object.
2291
2208
  * While the logger object is available through the {@link
2292
- * @minecraft/server-editor-bindings.ExtensionContext} - using
2293
- * the global instance allows the creator to use this
2294
- * properties class to perform direct server->client messaging
2295
- * and broadcasts.
2209
+ * ExtensionContext} - using the global instance allows the
2210
+ * creator to use this properties class to perform direct
2211
+ * server->client messaging and broadcasts.
2296
2212
  */
2297
2213
  export interface LogProperties {
2298
2214
  /**
@@ -2511,6 +2427,29 @@ export interface IMenu {
2511
2427
  show(): void;
2512
2428
  }
2513
2429
 
2430
+ /**
2431
+ * Manager and container for IMenu objects
2432
+ */
2433
+ export interface IMenuContainer {
2434
+ /**
2435
+ * @remarks
2436
+ * Create a top level item in the container.
2437
+ *
2438
+ * @param props
2439
+ * Configuration for the menu to create
2440
+ */
2441
+ createMenu(props: IMenuCreationParams): IMenu;
2442
+ /**
2443
+ * @remarks
2444
+ * Search for a menu item, if it's not found defer it to next
2445
+ * tick.
2446
+ *
2447
+ * @param id
2448
+ * Menu identifier
2449
+ */
2450
+ getMenu(id: string): Promise<IMenu>;
2451
+ }
2452
+
2514
2453
  /**
2515
2454
  * Properties required to create a Menu
2516
2455
  */
@@ -2533,6 +2472,12 @@ export interface IMenuCreationParams {
2533
2472
  *
2534
2473
  */
2535
2474
  name: string;
2475
+ /**
2476
+ * @remarks
2477
+ * Custom unique identifier that will replace random id
2478
+ *
2479
+ */
2480
+ uniqueId?: string;
2536
2481
  }
2537
2482
 
2538
2483
  export interface IModalTool {
@@ -3269,4 +3214,3 @@ export declare function registerUserDefinedTransactionHandler<T>(
3269
3214
  */
3270
3215
  export declare function stringFromException(e: unknown): string;
3271
3216
  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.21",
3
+ "version": "0.1.0-beta.1.20.80-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.11.0-beta.1.20.80-preview.21"
17
+ "@minecraft/server": "^1.11.0-beta.1.20.80-preview.23"
18
18
  },
19
19
  "license": "MIT"
20
20
  }