@minecraft/server-editor 0.1.0-beta.1.20.60-preview.22 → 0.1.0-beta.1.20.60-preview.24
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.
- package/index.d.ts +147 -9
- 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.60-preview.
|
|
17
|
+
* "version": "0.1.0-beta.1.20.60-preview.24"
|
|
18
18
|
* }
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
@@ -1636,6 +1636,17 @@ export class SimulationState {
|
|
|
1636
1636
|
*/
|
|
1637
1637
|
export class TransactionManager {
|
|
1638
1638
|
private constructor();
|
|
1639
|
+
/**
|
|
1640
|
+
* @remarks
|
|
1641
|
+
* This function can't be called in read-only mode.
|
|
1642
|
+
*
|
|
1643
|
+
* @throws This function can throw errors.
|
|
1644
|
+
*/
|
|
1645
|
+
addUserDefinedOperation(
|
|
1646
|
+
transactionHandlerId: UserDefinedTransactionHandlerId,
|
|
1647
|
+
operationData: string,
|
|
1648
|
+
operationName?: string,
|
|
1649
|
+
): void;
|
|
1639
1650
|
/**
|
|
1640
1651
|
* @remarks
|
|
1641
1652
|
* Commit all of the transaction operations currently attached
|
|
@@ -1667,6 +1678,16 @@ export class TransactionManager {
|
|
|
1667
1678
|
* @throws This function can throw errors.
|
|
1668
1679
|
*/
|
|
1669
1680
|
commitTrackedChanges(): number;
|
|
1681
|
+
/**
|
|
1682
|
+
* @remarks
|
|
1683
|
+
* This function can't be called in read-only mode.
|
|
1684
|
+
*
|
|
1685
|
+
* @throws This function can throw errors.
|
|
1686
|
+
*/
|
|
1687
|
+
createUserDefinedTransactionHandler(
|
|
1688
|
+
undoClosure: (arg: string) => void,
|
|
1689
|
+
redoClosure: (arg: string) => void,
|
|
1690
|
+
): UserDefinedTransactionHandlerId;
|
|
1670
1691
|
/**
|
|
1671
1692
|
* @remarks
|
|
1672
1693
|
* Discard the currently open transaction without committing it
|
|
@@ -1828,6 +1849,54 @@ export class TransactionManager {
|
|
|
1828
1849
|
undoSize(): number;
|
|
1829
1850
|
}
|
|
1830
1851
|
|
|
1852
|
+
/**
|
|
1853
|
+
* A strongly typed transaction handle to enforce type safety
|
|
1854
|
+
* when adding user defined transactions.<br> This transaction
|
|
1855
|
+
* handle becomes the context for adding the transaction to the
|
|
1856
|
+
* transaction manager.<br> You can obtain one of these handles
|
|
1857
|
+
* by calling {@link registerUserDefinedTransactionHandler}
|
|
1858
|
+
*/
|
|
1859
|
+
export declare class UserDefinedTransactionHandle<T> {
|
|
1860
|
+
/**
|
|
1861
|
+
* @remarks
|
|
1862
|
+
* Constructs a new instance of the
|
|
1863
|
+
* `UserDefinedTransactionHandle` class
|
|
1864
|
+
*
|
|
1865
|
+
*/
|
|
1866
|
+
constructor(nativeHandle: UserDefinedTransactionHandlerId, transactionManager: TransactionManager);
|
|
1867
|
+
/**
|
|
1868
|
+
* @remarks
|
|
1869
|
+
* Add a user defined transaction operation to the transaction
|
|
1870
|
+
* manager with a payload of the specified type. This allows
|
|
1871
|
+
* the extension to open a transaction, and insert custom data
|
|
1872
|
+
* objects into the transaction log which are stored until an
|
|
1873
|
+
* undo or redo event occurs. The payload data added here is
|
|
1874
|
+
* stored and then passed to the undo/redo handlers (registered
|
|
1875
|
+
* with {@link registerUserDefinedTransactionHandler}) when an
|
|
1876
|
+
* undo/redo event is requested. NOTE:<br> Transactions can
|
|
1877
|
+
* contain multiple operations - you can open a transaction and
|
|
1878
|
+
* add any (reasonable) number of operations to it (of the same
|
|
1879
|
+
* or differing types) before committing to the transaction
|
|
1880
|
+
* log. NOTE/WARNING:<br> The payload data is serialized to
|
|
1881
|
+
* JSON before being inserted into the transaction log and the
|
|
1882
|
+
* underlying implementation uses the JSON.stringify() function
|
|
1883
|
+
* to serialize the data. Any non-primitive data, such as
|
|
1884
|
+
* classes or minecraft native objects will not serialize to
|
|
1885
|
+
* JSON properly, so you should avoid using them as payload
|
|
1886
|
+
* data.
|
|
1887
|
+
*
|
|
1888
|
+
* @param payload
|
|
1889
|
+
* The data object to be inserted into the transaction log.
|
|
1890
|
+
* @param transactionName
|
|
1891
|
+
* A string name that will be associated with this operation
|
|
1892
|
+
*/
|
|
1893
|
+
addUserDefinedOperation(payload: T, transactionName: string): void;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
export class UserDefinedTransactionHandlerId {
|
|
1897
|
+
private constructor();
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1831
1900
|
/**
|
|
1832
1901
|
* Interface used to specify the options when a clipboard item
|
|
1833
1902
|
* is being written to the world
|
|
@@ -2018,6 +2087,7 @@ export interface PlaytestGameOptions {
|
|
|
2018
2087
|
showCoordinates?: boolean;
|
|
2019
2088
|
spawnPosition?: minecraftserver.Vector3;
|
|
2020
2089
|
timeOfDay?: number;
|
|
2090
|
+
weather?: number;
|
|
2021
2091
|
}
|
|
2022
2092
|
|
|
2023
2093
|
/**
|
|
@@ -2179,7 +2249,6 @@ export interface IMenu {
|
|
|
2179
2249
|
*/
|
|
2180
2250
|
readonly submenu: IMenu[];
|
|
2181
2251
|
addItem(params: IMenuCreationParams, action?: RegisteredAction<NoArgsAction>): IMenu;
|
|
2182
|
-
addSeparator(): IMenu;
|
|
2183
2252
|
dispose(): void;
|
|
2184
2253
|
hide(): void;
|
|
2185
2254
|
replaceAction(action: RegisteredAction<NoArgsAction>): void;
|
|
@@ -2379,23 +2448,23 @@ export interface IPropertyItemOptions {
|
|
|
2379
2448
|
}
|
|
2380
2449
|
|
|
2381
2450
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
2382
|
-
export interface
|
|
2451
|
+
export interface IPropertyItemOptionsButton extends IPropertyItemOptions {
|
|
2383
2452
|
/**
|
|
2384
2453
|
* @remarks
|
|
2385
|
-
* The
|
|
2454
|
+
* The variant for the button. By default it is "primary"
|
|
2386
2455
|
*
|
|
2387
2456
|
*/
|
|
2388
|
-
|
|
2457
|
+
variant?: ButtonVariant;
|
|
2389
2458
|
}
|
|
2390
2459
|
|
|
2391
2460
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
2392
|
-
export interface
|
|
2461
|
+
export interface IPropertyItemOptionsDataPicker extends IPropertyItemOptions {
|
|
2393
2462
|
/**
|
|
2394
2463
|
* @remarks
|
|
2395
|
-
*
|
|
2464
|
+
* Used to hold the entries allowed in the block/entity picker
|
|
2396
2465
|
*
|
|
2397
2466
|
*/
|
|
2398
|
-
|
|
2467
|
+
allowedEntries?: string[];
|
|
2399
2468
|
}
|
|
2400
2469
|
|
|
2401
2470
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -2539,7 +2608,7 @@ export interface IPropertyPane {
|
|
|
2539
2608
|
addBlockPicker<T extends PropertyBag, Prop extends keyof T & string>(
|
|
2540
2609
|
obj: T,
|
|
2541
2610
|
property: Prop,
|
|
2542
|
-
options?:
|
|
2611
|
+
options?: IPropertyItemOptionsDataPicker,
|
|
2543
2612
|
): IPropertyItem<T, Prop>;
|
|
2544
2613
|
/**
|
|
2545
2614
|
* @remarks
|
|
@@ -2582,6 +2651,16 @@ export interface IPropertyPane {
|
|
|
2582
2651
|
property: Prop,
|
|
2583
2652
|
options?: IPropertyItemOptionsDropdown,
|
|
2584
2653
|
): IPropertyItem<T, Prop>;
|
|
2654
|
+
/**
|
|
2655
|
+
* @remarks
|
|
2656
|
+
* Adds an EntityPicker item to the pane.
|
|
2657
|
+
*
|
|
2658
|
+
*/
|
|
2659
|
+
addEntityPicker<T extends PropertyBag, Prop extends keyof T & string>(
|
|
2660
|
+
obj: T,
|
|
2661
|
+
property: Prop,
|
|
2662
|
+
options?: IPropertyItemOptionsDataPicker,
|
|
2663
|
+
): IPropertyItem<T, Prop>;
|
|
2585
2664
|
/**
|
|
2586
2665
|
* @remarks
|
|
2587
2666
|
* Adds a number item to the pane.
|
|
@@ -2695,6 +2774,13 @@ export interface IRegisterExtensionOptionalParameters {
|
|
|
2695
2774
|
*
|
|
2696
2775
|
*/
|
|
2697
2776
|
notes?: string;
|
|
2777
|
+
/**
|
|
2778
|
+
* @remarks
|
|
2779
|
+
* An optional custom group identifier that will be used for
|
|
2780
|
+
* all Modal Tools created from the registered extension.
|
|
2781
|
+
*
|
|
2782
|
+
*/
|
|
2783
|
+
toolGroupId?: string;
|
|
2698
2784
|
}
|
|
2699
2785
|
|
|
2700
2786
|
export interface IStatusBarItem {
|
|
@@ -2815,4 +2901,56 @@ export declare function registerEditorExtension<PerPlayerStorageType = Record<st
|
|
|
2815
2901
|
shutdownFunction: ShutdownFunctionType<PerPlayerStorageType>,
|
|
2816
2902
|
options?: IRegisterExtensionOptionalParameters,
|
|
2817
2903
|
): Extension;
|
|
2904
|
+
/**
|
|
2905
|
+
* @remarks
|
|
2906
|
+
* Creates a strongly typed transaction handle to enforce type
|
|
2907
|
+
* safety when adding user defined transactions. This function
|
|
2908
|
+
* is a wrapper around the more generalized transaction manager
|
|
2909
|
+
* API for script based transactions. Any Editor Extension that
|
|
2910
|
+
* needs to insert data into the transaction log for undo/redo
|
|
2911
|
+
* should use this function to create a handler for the
|
|
2912
|
+
* specific type of data that needs to be inserted. When a
|
|
2913
|
+
* transaction is undone/redone, the associated handler
|
|
2914
|
+
* function will be invoked with a copy of the payload data
|
|
2915
|
+
* that was inserted into the log. As a general rule,
|
|
2916
|
+
* transaction data should contain 2 things:<br> 1. The data
|
|
2917
|
+
* that will be used to perform the operation we're trying to
|
|
2918
|
+
* record<br> 2. The data that will be used to restore the
|
|
2919
|
+
* state of the program to what it was before the
|
|
2920
|
+
* operation.<br> NOTE/WARNING:<br> The payload data is
|
|
2921
|
+
* serialized to JSON before being inserted into the
|
|
2922
|
+
* transaction log and the underlying implementation uses the
|
|
2923
|
+
* JSON.stringify() function to serialize the data. Any
|
|
2924
|
+
* non-primitive data, such as classes or minecraft native
|
|
2925
|
+
* objects will not serialize to JSON properly, so you should
|
|
2926
|
+
* avoid using them as payload data.
|
|
2927
|
+
*
|
|
2928
|
+
* @param transactionManager
|
|
2929
|
+
* A reference to the TransactionManager (from the extension
|
|
2930
|
+
* context for your extension)
|
|
2931
|
+
* @param undoHandler
|
|
2932
|
+
* A function that will be invoked when the transaction is
|
|
2933
|
+
* undone. The function will be passed a copy of the payload
|
|
2934
|
+
* data that was inserted into the transaction log.
|
|
2935
|
+
* @param redoHandler
|
|
2936
|
+
* A function that will be invoked when the transaction is
|
|
2937
|
+
* redone. The function will be passed a copy of the payload
|
|
2938
|
+
* data that was inserted into the transaction log.
|
|
2939
|
+
* @returns
|
|
2940
|
+
* - {@link UserDefinedTransactionHandle} - A strongly typed
|
|
2941
|
+
* transaction handle that can be used to add transactions to
|
|
2942
|
+
* the transaction manager.
|
|
2943
|
+
*/
|
|
2944
|
+
export declare function registerUserDefinedTransactionHandler<T>(
|
|
2945
|
+
transactionManager: TransactionManager,
|
|
2946
|
+
undoHandler: (payload: T) => void,
|
|
2947
|
+
redoHandler: (payload: T) => void,
|
|
2948
|
+
): UserDefinedTransactionHandle<T>;
|
|
2949
|
+
/**
|
|
2950
|
+
* @remarks
|
|
2951
|
+
* Small utility for getting a string from an unknown exception
|
|
2952
|
+
* type
|
|
2953
|
+
*
|
|
2954
|
+
*/
|
|
2955
|
+
export declare function stringFromException(e: unknown): string;
|
|
2818
2956
|
export const editor: MinecraftEditor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minecraft/server-editor",
|
|
3
|
-
"version": "0.1.0-beta.1.20.60-preview.
|
|
3
|
+
"version": "0.1.0-beta.1.20.60-preview.24",
|
|
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.9.0-beta.1.20.60-preview.
|
|
17
|
+
"@minecraft/server": "^1.9.0-beta.1.20.60-preview.24"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT"
|
|
20
20
|
}
|