@block_factory/lib 0.0.3 → 0.0.4
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/_module/BlockFactory.ts +18 -0
- package/_module/util/RawText.ts +75 -0
- package/_types/_module/BlockFactory.d.ts +16 -0
- package/_types/_module/BlockFactory.d.ts.map +1 -0
- package/_types/_module/sys/Threads.d.ts.map +1 -0
- package/_types/_module/util/Command.d.ts +92 -0
- package/_types/_module/util/Command.d.ts.map +1 -0
- package/{util → _types/_module/util}/Forms/Form.d.ts +12 -16
- package/_types/_module/util/Forms/Form.d.ts.map +1 -0
- package/_types/_module/util/Forms/FormAction.d.ts +73 -0
- package/_types/_module/util/Forms/FormAction.d.ts.map +1 -0
- package/{util → _types/_module/util}/Forms/FormMessage.d.ts +24 -30
- package/_types/_module/util/Forms/FormMessage.d.ts.map +1 -0
- package/{util → _types/_module/util}/Forms/FormModal.d.ts +66 -57
- package/_types/_module/util/Forms/FormModal.d.ts.map +1 -0
- package/_types/_module/util/Forms/FormRegistry.d.ts +12 -0
- package/_types/_module/util/Forms/FormRegistry.d.ts.map +1 -0
- package/{util → _types/_module/util}/Math.d.ts +8 -2
- package/_types/_module/util/Math.d.ts.map +1 -0
- package/_types/_module/util/RawText.d.ts +60 -0
- package/_types/_module/util/RawText.d.ts.map +1 -0
- package/{util → _types/_module/util}/Signal.d.ts +3 -5
- package/_types/_module/util/Signal.d.ts.map +1 -0
- package/_types/_module/util/System.d.ts.map +1 -0
- package/_types/_module/util/Vector.d.ts +212 -0
- package/_types/_module/util/Vector.d.ts.map +1 -0
- package/_types/_module/util/Wrapper/Container.d.ts.map +1 -0
- package/_types/_module/util/Wrapper/IEntity.d.ts.map +1 -0
- package/_types/_module/util/Wrapper/IPlayer.d.ts.map +1 -0
- package/_types/index.d.ts +3 -0
- package/_types/index.d.ts.map +1 -0
- package/index.js +128 -380
- package/index.ts +2 -48
- package/package.json +7 -6
- package/tsconfig.types.json +2 -2
- package/index.d.ts +0 -47
- package/util/Command.d.ts +0 -23
- package/util/Forms/FormAction.d.ts +0 -41
- package/util/Forms/FormRegistry.d.ts +0 -26
- package/util/RawText.d.ts +0 -33
- package/util/RawText.ts +0 -76
- package/util/Vector.d.ts +0 -60
- /package/{sys → _module/sys}/Threads.ts +0 -0
- /package/{util → _module/util}/Command.ts +0 -0
- /package/{util → _module/util}/Forms/Form.ts +0 -0
- /package/{util → _module/util}/Forms/FormAction.ts +0 -0
- /package/{util → _module/util}/Forms/FormMessage.ts +0 -0
- /package/{util → _module/util}/Forms/FormModal.ts +0 -0
- /package/{util → _module/util}/Forms/FormRegistry.ts +0 -0
- /package/{util → _module/util}/Math.ts +0 -0
- /package/{util → _module/util}/Signal.ts +0 -0
- /package/{util → _module/util}/System.ts +0 -0
- /package/{util → _module/util}/Vector.ts +0 -0
- /package/{util → _module/util}/Wrapper/Container.ts +0 -0
- /package/{util → _module/util}/Wrapper/IEntity.ts +0 -0
- /package/{util → _module/util}/Wrapper/IPlayer.ts +0 -0
- /package/{sys → _types/_module/sys}/Threads.d.ts +0 -0
- /package/{util → _types/_module/util}/System.d.ts +0 -0
- /package/{util → _types/_module/util}/Wrapper/Container.d.ts +0 -0
- /package/{util → _types/_module/util}/Wrapper/IEntity.d.ts +0 -0
- /package/{util → _types/_module/util}/Wrapper/IPlayer.d.ts +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { MathUtils } from "./util/Math";
|
|
2
|
+
export { Signal } from "./util/Signal";
|
|
3
|
+
export { Vec2, Vec3 } from "./util/Vector";
|
|
4
|
+
export { RawText } from "./util/RawText";
|
|
5
|
+
export { Command } from "./util/Command";
|
|
6
|
+
export { System } from "./util/System";
|
|
7
|
+
|
|
8
|
+
export { IForm, IFormValue } from "./util/Forms/Form";
|
|
9
|
+
export { ActionFormCtor, type IButtonOptions, type IActionFormResponse, type IActionFormData } from "./util/Forms/FormAction";
|
|
10
|
+
export { type IModalFormResponse, type ITextFieldOptions, type IDropdownOptions, type ISliderOptions, type IToggleOptions, type IModalFormData } from "./util/Forms/FormModal";
|
|
11
|
+
export { type IMessageFormData, type IMessageFormResponse } from "./util/Forms/FormMessage";
|
|
12
|
+
export { type IFormRegistration, RegisterForm } from "./util/Forms/FormRegistry";
|
|
13
|
+
|
|
14
|
+
export { Inventory, ContainerWrapper } from "./util/Wrapper/Container";
|
|
15
|
+
export { type IEntity, IEntityWrapper } from "./util/Wrapper/IEntity";
|
|
16
|
+
export { type IPlayer, IPlayerWrapper } from "./util/Wrapper/IPlayer";
|
|
17
|
+
|
|
18
|
+
export { _THREAD_ } from "./sys/Threads";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { RawMessage } from '@minecraft/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Utility helpers for building rawtext messages.
|
|
5
|
+
*/
|
|
6
|
+
export class RawText {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a simple text component.
|
|
9
|
+
* @param value - The text value.
|
|
10
|
+
* @returns Text component object.
|
|
11
|
+
*/
|
|
12
|
+
public static text(value: string): RawMessage {
|
|
13
|
+
return { text: value };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a translation component with optional 'with' parameters.
|
|
18
|
+
* @param key - The translation key.
|
|
19
|
+
* @param params - The optional parameters for translation.
|
|
20
|
+
* @returns Translation component object.
|
|
21
|
+
*/
|
|
22
|
+
public static translate(key: string, ...params: string[]): RawMessage {
|
|
23
|
+
return {
|
|
24
|
+
translate: key,
|
|
25
|
+
with: params.length ? params : undefined
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a score component.
|
|
31
|
+
* @param name - The entity's name whose score is being displayed.
|
|
32
|
+
* @param objective - The name of the score objective.
|
|
33
|
+
* @returns Score component object.
|
|
34
|
+
*/
|
|
35
|
+
public static score(name: string, objective: string): RawMessage {
|
|
36
|
+
return { score: { name, objective } };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Wraps various text components into a rawtext structure.
|
|
41
|
+
* @param rawText - The raw text components.
|
|
42
|
+
* @returns Raw text object.
|
|
43
|
+
*/
|
|
44
|
+
public static message(...rawText: RawMessage[]): RawMessage {
|
|
45
|
+
return { rawtext: rawText };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Common formatting and color codes.
|
|
50
|
+
*/
|
|
51
|
+
public static FORMAT = {
|
|
52
|
+
DarkRed: "§4",
|
|
53
|
+
Red: "§c",
|
|
54
|
+
Gold: "§6",
|
|
55
|
+
Yellow: "§e",
|
|
56
|
+
Green: "§2",
|
|
57
|
+
Lime: "§a",
|
|
58
|
+
Aqua: "§b",
|
|
59
|
+
Cyan: "§3",
|
|
60
|
+
DarkBlue: "§1",
|
|
61
|
+
Blue: "§9",
|
|
62
|
+
Magenta: "§d",
|
|
63
|
+
Purple: "§5",
|
|
64
|
+
White: "§f",
|
|
65
|
+
Gray: "§7",
|
|
66
|
+
DarkGray: "§8",
|
|
67
|
+
Black: "§0",
|
|
68
|
+
Obfuscated: "§k",
|
|
69
|
+
Bold: "§l",
|
|
70
|
+
StrikeThrough: "§m",
|
|
71
|
+
Italic: "§o",
|
|
72
|
+
Reset: "§r",
|
|
73
|
+
NewLine: "\n"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { MathUtils } from "./util/Math";
|
|
2
|
+
export { Signal } from "./util/Signal";
|
|
3
|
+
export { Vec2, Vec3 } from "./util/Vector";
|
|
4
|
+
export { RawText } from "./util/RawText";
|
|
5
|
+
export { Command } from "./util/Command";
|
|
6
|
+
export { System } from "./util/System";
|
|
7
|
+
export { IForm, IFormValue } from "./util/Forms/Form";
|
|
8
|
+
export { ActionFormCtor, type IButtonOptions, type IActionFormResponse, type IActionFormData } from "./util/Forms/FormAction";
|
|
9
|
+
export { type IModalFormResponse, type ITextFieldOptions, type IDropdownOptions, type ISliderOptions, type IToggleOptions, type IModalFormData } from "./util/Forms/FormModal";
|
|
10
|
+
export { type IMessageFormData, type IMessageFormResponse } from "./util/Forms/FormMessage";
|
|
11
|
+
export { type IFormRegistration, RegisterForm } from "./util/Forms/FormRegistry";
|
|
12
|
+
export { Inventory, ContainerWrapper } from "./util/Wrapper/Container";
|
|
13
|
+
export { type IEntity, IEntityWrapper } from "./util/Wrapper/IEntity";
|
|
14
|
+
export { type IPlayer, IPlayerWrapper } from "./util/Wrapper/IPlayer";
|
|
15
|
+
export { _THREAD_ } from "./sys/Threads";
|
|
16
|
+
//# sourceMappingURL=BlockFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockFactory.d.ts","sourceRoot":"","sources":["../../_module/BlockFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9H,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/K,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,KAAK,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Threads.d.ts","sourceRoot":"","sources":["../../../_module/sys/Threads.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,cAAM,OAAO;WACK,MAAM,IAAI,OAAO;IAC/B,SAAgB,IAAI,iBAAwB;IAC5C,SAAgB,IAAI,eAAgB;IAC7B,kBAAkB,EAAE,MAAM,CAAK;IAC/B,kBAAkB,EAAE,MAAM,CAAkB;IAEnD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAA2B;IAEzC,OAAO;IAgBP,OAAO,CAAC,gBAAgB;CAU3B;AAED,eAAO,MAAM,QAAQ,SAAmB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CustomCommand, CommandPermissionLevel, CustomCommandParameter, CustomCommandOrigin, CustomCommandResult } from "@minecraft/server";
|
|
2
|
+
/**
|
|
3
|
+
* Command utilities and base classes for defining and registering
|
|
4
|
+
* Minecraft Bedrock custom commands.
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - `ICustomCommand` base class
|
|
8
|
+
* - `RegisterCustomCommand` decorator/function
|
|
9
|
+
* - Internal command registry used during startup
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace Command {
|
|
12
|
+
/**
|
|
13
|
+
* Base class for all custom commands.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { Command } from "@block_factory/lib";
|
|
18
|
+
* import {
|
|
19
|
+
* world,
|
|
20
|
+
* system,
|
|
21
|
+
* CommandPermissionLevel,
|
|
22
|
+
* CustomCommandParameter,
|
|
23
|
+
* CustomCommandParamType,
|
|
24
|
+
* CustomCommandOrigin,
|
|
25
|
+
* CustomCommandResult,
|
|
26
|
+
* CustomCommandStatus
|
|
27
|
+
* } from "@minecraft/server";
|
|
28
|
+
*
|
|
29
|
+
* @Command.RegisterCustomCommand
|
|
30
|
+
* export default class TestCommand extends Command.ICustomCommand {
|
|
31
|
+
* public name = "bf_sd:test_cmd";
|
|
32
|
+
* public description = "Test command for debugging purposes.";
|
|
33
|
+
* public permissionLevel = CommandPermissionLevel.Admin;
|
|
34
|
+
*
|
|
35
|
+
* public optionalParameters: CustomCommandParameter[] = [
|
|
36
|
+
* { type: CustomCommandParamType.Integer, name: "size" }
|
|
37
|
+
* ];
|
|
38
|
+
*
|
|
39
|
+
* public execute(
|
|
40
|
+
* origin: CustomCommandOrigin,
|
|
41
|
+
* value: number
|
|
42
|
+
* ): CustomCommandResult | undefined {
|
|
43
|
+
* const entity = origin.sourceEntity;
|
|
44
|
+
* if (!entity)
|
|
45
|
+
* return {
|
|
46
|
+
* status: CustomCommandStatus.Failure,
|
|
47
|
+
* message: "Command fail"
|
|
48
|
+
* };
|
|
49
|
+
*
|
|
50
|
+
* system.run(() => {
|
|
51
|
+
* world.sendMessage(`Running Test: ${value}`);
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* return {
|
|
55
|
+
* status: CustomCommandStatus.Success,
|
|
56
|
+
* message: "Completed Test"
|
|
57
|
+
* };
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
abstract class ICustomCommand implements CustomCommand {
|
|
63
|
+
/** Command identifier (e.g. `bf_sd:test_cmd`) */
|
|
64
|
+
abstract name: string;
|
|
65
|
+
/** Short description shown in help */
|
|
66
|
+
abstract description: string;
|
|
67
|
+
/** Required permission level to execute */
|
|
68
|
+
abstract permissionLevel: CommandPermissionLevel;
|
|
69
|
+
/** Whether cheats must be enabled */
|
|
70
|
+
cheatsRequired?: boolean;
|
|
71
|
+
/** Required command parameters */
|
|
72
|
+
mandatoryParameters?: CustomCommandParameter[];
|
|
73
|
+
/** Optional command parameters */
|
|
74
|
+
optionalParameters?: CustomCommandParameter[];
|
|
75
|
+
/**
|
|
76
|
+
* Executes the command.
|
|
77
|
+
* @param origin Command execution context
|
|
78
|
+
* @param args Parsed command arguments
|
|
79
|
+
*/
|
|
80
|
+
abstract execute(origin: CustomCommandOrigin, ...args: any[]): CustomCommandResult | undefined;
|
|
81
|
+
}
|
|
82
|
+
/** Internal list of registered command instances */
|
|
83
|
+
const customCommands: ICustomCommand[];
|
|
84
|
+
/**
|
|
85
|
+
* Registers a command class.
|
|
86
|
+
* Can be used as a decorator: `@RegisterCustomCommand`.
|
|
87
|
+
*/
|
|
88
|
+
function RegisterCustomCommand<T extends {
|
|
89
|
+
new (): ICustomCommand;
|
|
90
|
+
}>(customCommand: T): void;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../../_module/util/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAGtB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;GAQG;AACH,yBAAiB,OAAO,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,eAAsB,cAAe,YAAW,aAAa;QAEzD,iDAAiD;QACjD,SAAgB,IAAI,EAAE,MAAM,CAAC;QAE7B,sCAAsC;QACtC,SAAgB,WAAW,EAAE,MAAM,CAAC;QAEpC,2CAA2C;QAC3C,SAAgB,eAAe,EAAE,sBAAsB,CAAC;QAExD,qCAAqC;QAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;QAEhC,kCAAkC;QAC3B,mBAAmB,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAEtD,kCAAkC;QAC3B,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAErD;;;;WAIG;iBACa,OAAO,CACnB,MAAM,EAAE,mBAAmB,EAC3B,GAAG,IAAI,EAAE,GAAG,EAAE,GACf,mBAAmB,GAAG,SAAS;KACrC;IAED,oDAAoD;IAC7C,MAAM,cAAc,EAAE,cAAc,EAAO,CAAC;IAEnD;;;OAGG;IACH,SAAgB,qBAAqB,CACjC,CAAC,SAAS;QAAE,QAAO,cAAc,CAAA;KAAE,EACrC,aAAa,EAAE,CAAC,GAAG,IAAI,CAGxB;CACJ"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { Player, RawMessage } from "@minecraft/server";
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static closeOccupiedForms(): void;
|
|
14
|
-
protected setOccupied(player: Player, occupied: boolean): void;
|
|
15
|
-
protected abstract build(player: Player): void;
|
|
16
|
-
}
|
|
1
|
+
import { Player, RawMessage } from "@minecraft/server";
|
|
2
|
+
export declare type IFormValue = string | boolean | number | undefined;
|
|
3
|
+
export declare abstract class IForm {
|
|
4
|
+
private static readonly occupiedPlayers;
|
|
5
|
+
static returnText: RawMessage | string;
|
|
6
|
+
static isOccupied(player: Player): boolean;
|
|
7
|
+
static closeForms(player: Player): void;
|
|
8
|
+
static closeOccupiedForms(): void;
|
|
9
|
+
protected setOccupied(player: Player, occupied: boolean): void;
|
|
10
|
+
protected abstract build(player: Player): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../_module/util/Forms/Form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAS,MAAM,mBAAmB,CAAC;AAG9D,MAAM,CAAC,OAAO,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE,8BAAsB,KAAK;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAA0B;IACjE,OAAc,UAAU,EAAE,UAAU,GAAG,MAAM,CAAU;WAEzC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;WAInC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;WAIhC,kBAAkB,IAAI,IAAI;IAOxC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAK9D,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CACjD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { IForm } from "./Form";
|
|
2
|
+
import { Player, RawMessage } from "@minecraft/server";
|
|
3
|
+
import { ActionFormData, FormCancelationReason } from "@minecraft/server-ui";
|
|
4
|
+
/**
|
|
5
|
+
* Constructor type for ActionForm classes.
|
|
6
|
+
* Used for sub-form navigation and chaining.
|
|
7
|
+
*/
|
|
8
|
+
export type ActionFormCtor<T extends IActionFormData = IActionFormData> = new () => T;
|
|
9
|
+
/**
|
|
10
|
+
* Options used when adding a button to an ActionForm.
|
|
11
|
+
*/
|
|
12
|
+
export interface IButtonOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Logical identifier returned in the form response.
|
|
15
|
+
* If omitted, the numeric button index is used.
|
|
16
|
+
*/
|
|
17
|
+
id?: string | number;
|
|
18
|
+
/**
|
|
19
|
+
* Optional icon path from a resource pack.
|
|
20
|
+
*/
|
|
21
|
+
iconPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Form class to open when this button is selected.
|
|
24
|
+
*/
|
|
25
|
+
subForm?: ActionFormCtor;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the sub-form is allowed to return to this form.
|
|
28
|
+
* Defaults to true.
|
|
29
|
+
*/
|
|
30
|
+
allowReturn?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Normalized response object returned by IActionFormData.
|
|
34
|
+
*/
|
|
35
|
+
export interface IActionFormResponse {
|
|
36
|
+
/**Reason the form was canceled, if applicable.*/
|
|
37
|
+
readonly cancelationReason?: FormCancelationReason;
|
|
38
|
+
/** Whether the form was canceled by the player.*/
|
|
39
|
+
readonly canceled: boolean;
|
|
40
|
+
/**Raw button index selected by the player.*/
|
|
41
|
+
readonly selection?: number;
|
|
42
|
+
/**Logical button id associated with the selection.*/
|
|
43
|
+
readonly id?: string | number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Abstract base class for ActionForm-based menus.
|
|
47
|
+
*
|
|
48
|
+
* Provides:
|
|
49
|
+
* - Button id mapping
|
|
50
|
+
* - Occupied player handling
|
|
51
|
+
* - Sub-form chaining with automatic Back navigation
|
|
52
|
+
* - Normalized response objects
|
|
53
|
+
*/
|
|
54
|
+
export declare abstract class IActionFormData extends IForm {
|
|
55
|
+
protected form: ActionFormData;
|
|
56
|
+
private _buttons;
|
|
57
|
+
private _nextButtonIndex;
|
|
58
|
+
private _id;
|
|
59
|
+
protected abstract build(player: Player): void;
|
|
60
|
+
protected abstract onSubmit(player: Player, response: IActionFormResponse): void;
|
|
61
|
+
protected onCancel?(player: Player, response: IActionFormResponse): void;
|
|
62
|
+
title(titleText: RawMessage | string): this;
|
|
63
|
+
body(bodyText: RawMessage | string): this;
|
|
64
|
+
divider(): this;
|
|
65
|
+
header(text: RawMessage | string): this;
|
|
66
|
+
label(text: RawMessage | string): this;
|
|
67
|
+
button(text: RawMessage | string, options?: IButtonOptions): this;
|
|
68
|
+
show(player: Player): Promise<IActionFormResponse>;
|
|
69
|
+
protected _showChained(player: Player, returnStack: ActionFormCtor[]): Promise<IActionFormResponse>;
|
|
70
|
+
private _wrapResponse;
|
|
71
|
+
private _showInternal;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=FormAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormAction.d.ts","sourceRoot":"","sources":["../../../../_module/util/Forms/FormAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAsB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIjG;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,UAAU,CAAC,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IACnD,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,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
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protected
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
): void;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
button1(text: RawMessage | string, id?: string | number): this;
|
|
26
|
-
|
|
27
|
-
show(player: Player): Promise<MessageFormResponse>;
|
|
28
|
-
|
|
29
|
-
private _showInternal(player: Player): Promise<MessageFormResponse>;
|
|
30
|
-
}
|
|
1
|
+
import { IForm } from "./Form";
|
|
2
|
+
import { Player, RawMessage } from "@minecraft/server";
|
|
3
|
+
import { MessageFormData, MessageFormResponse } from "@minecraft/server-ui";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for MessageFormData.
|
|
6
|
+
*
|
|
7
|
+
* Provides:
|
|
8
|
+
* - occupied player handling
|
|
9
|
+
*/
|
|
10
|
+
export type IMessageFormResponse = MessageFormResponse;
|
|
11
|
+
export declare abstract class IMessageFormData extends IForm {
|
|
12
|
+
protected form: MessageFormData;
|
|
13
|
+
private _id;
|
|
14
|
+
protected abstract build(player: Player): void;
|
|
15
|
+
protected abstract onSubmit(player: Player, response: IMessageFormResponse): void;
|
|
16
|
+
protected onCancel?(player: Player, response: IMessageFormResponse): void;
|
|
17
|
+
title(titleText: RawMessage | string): this;
|
|
18
|
+
body(bodyText: RawMessage | string): this;
|
|
19
|
+
button0(text: RawMessage | string, id?: string | number): this;
|
|
20
|
+
button1(text: RawMessage | string, id?: string | number): this;
|
|
21
|
+
show(player: Player): Promise<IMessageFormResponse>;
|
|
22
|
+
private _showInternal;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=FormMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormMessage.d.ts","sourceRoot":"","sources":["../../../../_module/util/Forms/FormMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACH,eAAe,EACf,mBAAmB,EACtB,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AAEH,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEvD,8BAAsB,gBAAiB,SAAQ,KAAK;IAChD,SAAS,CAAC,IAAI,EAAE,eAAe,CAAyB;IAExD,OAAO,CAAC,GAAG,CAAsB;IAEjC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAE9C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,oBAAoB,GAC/B,IAAI;IAEP,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAElE,KAAK,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAS3C,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAIzC,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAC,EAAE,GAAE,MAAM,GAAG,MAAU,GAAG,IAAI;IAKhE,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAC,EAAE,GAAE,MAAM,GAAG,MAAU,GAAG,IAAI;IAK1D,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;YAgBlD,aAAa;CAiB9B"}
|
|
@@ -1,57 +1,66 @@
|
|
|
1
|
-
import { IForm
|
|
2
|
-
import { Player, RawMessage } from "@minecraft/server";
|
|
3
|
-
import { ModalFormData, FormCancelationReason } from "@minecraft/server-ui";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
id
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import { IForm } from "./Form";
|
|
2
|
+
import { Player, RawMessage } from "@minecraft/server";
|
|
3
|
+
import { ModalFormData, FormCancelationReason } from "@minecraft/server-ui";
|
|
4
|
+
export type FormValue = string | boolean | number | undefined;
|
|
5
|
+
/** Normalized response for Modal forms */
|
|
6
|
+
export interface IModalFormResponse {
|
|
7
|
+
/**Reason the form was canceled, if applicable.*/
|
|
8
|
+
readonly cancelationReason?: FormCancelationReason;
|
|
9
|
+
/** Whether the form was canceled by the player.*/
|
|
10
|
+
readonly canceled: boolean;
|
|
11
|
+
/** Raw values array from the form */
|
|
12
|
+
readonly formValues?: FormValue[];
|
|
13
|
+
/** Mapped values by widget id */
|
|
14
|
+
readonly widget?: Map<string, FormValue>;
|
|
15
|
+
}
|
|
16
|
+
/** Options for each widget type */
|
|
17
|
+
export interface ITextFieldOptions {
|
|
18
|
+
id: string;
|
|
19
|
+
placeholder: string | RawMessage;
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IDropdownOptions {
|
|
23
|
+
id: string;
|
|
24
|
+
choices: string[];
|
|
25
|
+
defaultValueIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ISliderOptions {
|
|
28
|
+
id: string;
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
step: number;
|
|
32
|
+
defaultValue?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface IToggleOptions {
|
|
35
|
+
id: string;
|
|
36
|
+
defaultValue?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Abstract base class for ModalFormData-based menus.
|
|
40
|
+
*
|
|
41
|
+
* Provides:
|
|
42
|
+
* - Occupied player handling
|
|
43
|
+
* - Widget id mapping into a Map<string, FormValue>
|
|
44
|
+
* - Normalized response object
|
|
45
|
+
*/
|
|
46
|
+
export declare abstract class IModalFormData extends IForm {
|
|
47
|
+
protected form: ModalFormData;
|
|
48
|
+
private _id;
|
|
49
|
+
private _widgetMeta;
|
|
50
|
+
protected abstract build(player: Player): void;
|
|
51
|
+
protected abstract onSubmit(player: Player, response: IModalFormResponse): void;
|
|
52
|
+
protected onCancel?(player: Player, response: IModalFormResponse): void;
|
|
53
|
+
title(titleText: RawMessage | string): this;
|
|
54
|
+
divider(): this;
|
|
55
|
+
header(text: RawMessage | string): this;
|
|
56
|
+
label(text: RawMessage | string): this;
|
|
57
|
+
textField(label: string | RawMessage, options: ITextFieldOptions): this;
|
|
58
|
+
dropdown(label: string | RawMessage, options: IDropdownOptions): this;
|
|
59
|
+
slider(label: string | RawMessage, options: ISliderOptions): this;
|
|
60
|
+
toggle(label: string | RawMessage, options: IToggleOptions): this;
|
|
61
|
+
show(player: Player): Promise<IModalFormResponse>;
|
|
62
|
+
private _wrapResponse;
|
|
63
|
+
private _mapValues;
|
|
64
|
+
private _showInternal;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=FormModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
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
|
+
import { IModalFormData } from "./FormModal";
|
|
3
|
+
import { IMessageFormData } from "./FormMessage";
|
|
4
|
+
type AnyShowableForm = IActionFormData | IModalFormData | IMessageFormData;
|
|
5
|
+
type AnyShowableCtor = new () => AnyShowableForm;
|
|
6
|
+
export interface IFormRegistration {
|
|
7
|
+
itemId: string;
|
|
8
|
+
formCtor: AnyShowableCtor;
|
|
9
|
+
}
|
|
10
|
+
export declare function RegisterForm(itemId: string): <T extends AnyShowableCtor>(formCtor: T) => void;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=FormRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRegistry.d.ts","sourceRoot":"","sources":["../../../../_module/util/Forms/FormRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,KAAK,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAC3E,KAAK,eAAe,GAAG,UAAU,eAAe,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;CAC7B;AAID,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,IACtB,CAAC,SAAS,eAAe,EAAE,UAAU,CAAC,KAAG,IAAI,CAKjE"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Vector2, Vector3 } from "@minecraft/server";
|
|
3
2
|
export declare namespace MathUtils {
|
|
3
|
+
/** Clamps a number between a minimum and maximum value */
|
|
4
4
|
function clamp(value: number, min: number, max: number): number;
|
|
5
|
+
/** Linearly interpolates between two values based on a given factor (0 to 1) */
|
|
5
6
|
function lerp(start: number, end: number, factor: number): number;
|
|
7
|
+
/** Converts degrees to radians */
|
|
6
8
|
function toRadians(degrees: number): number;
|
|
9
|
+
/** Converts radians to degrees */
|
|
7
10
|
function toDegrees(radians: number): number;
|
|
8
11
|
function fromRotation(rotation: Vector2): Vector3;
|
|
9
12
|
function rotateOffset(offset: Vector3, yawDegrees: number): Vector3;
|
|
13
|
+
/** Calculates the distance between two points in 3D space */
|
|
10
14
|
function distance3D(pointA: Vector3, pointB: Vector3): number;
|
|
15
|
+
/** Generates a random integer between min and max (inclusive) */
|
|
11
16
|
function randomInt(min: number, max: number): number;
|
|
17
|
+
/** Generates a random float between min and max */
|
|
12
18
|
function randomFloat(min: number, max: number): number;
|
|
13
19
|
}
|
|
14
20
|
//# sourceMappingURL=Math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Math.d.ts","sourceRoot":"","sources":["../../../_module/util/Math.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErD,yBAAiB,SAAS,CAAC;IACxB,0DAA0D;IACzD,SAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;IAED,gFAAgF;IAChF,SAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvE;IAED,kCAAkC;IAClC,SAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;IAED,kCAAkC;IAClC,SAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;IAED,SAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAcvD;IAED,SAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CASzE;IAED,6DAA6D;IAC7D,SAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAKnE;IAED,iEAAiE;IACjE,SAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;IAED,mDAAmD;IACnD,SAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5D;CACJ"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { RawMessage } from '@minecraft/server';
|
|
2
|
+
/**
|
|
3
|
+
* Utility helpers for building rawtext messages.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RawText {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a simple text component.
|
|
8
|
+
* @param value - The text value.
|
|
9
|
+
* @returns Text component object.
|
|
10
|
+
*/
|
|
11
|
+
static text(value: string): RawMessage;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a translation component with optional 'with' parameters.
|
|
14
|
+
* @param key - The translation key.
|
|
15
|
+
* @param params - The optional parameters for translation.
|
|
16
|
+
* @returns Translation component object.
|
|
17
|
+
*/
|
|
18
|
+
static translate(key: string, ...params: string[]): RawMessage;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a score component.
|
|
21
|
+
* @param name - The entity's name whose score is being displayed.
|
|
22
|
+
* @param objective - The name of the score objective.
|
|
23
|
+
* @returns Score component object.
|
|
24
|
+
*/
|
|
25
|
+
static score(name: string, objective: string): RawMessage;
|
|
26
|
+
/**
|
|
27
|
+
* Wraps various text components into a rawtext structure.
|
|
28
|
+
* @param rawText - The raw text components.
|
|
29
|
+
* @returns Raw text object.
|
|
30
|
+
*/
|
|
31
|
+
static message(...rawText: RawMessage[]): RawMessage;
|
|
32
|
+
/**
|
|
33
|
+
* Common formatting and color codes.
|
|
34
|
+
*/
|
|
35
|
+
static FORMAT: {
|
|
36
|
+
DarkRed: string;
|
|
37
|
+
Red: string;
|
|
38
|
+
Gold: string;
|
|
39
|
+
Yellow: string;
|
|
40
|
+
Green: string;
|
|
41
|
+
Lime: string;
|
|
42
|
+
Aqua: string;
|
|
43
|
+
Cyan: string;
|
|
44
|
+
DarkBlue: string;
|
|
45
|
+
Blue: string;
|
|
46
|
+
Magenta: string;
|
|
47
|
+
Purple: string;
|
|
48
|
+
White: string;
|
|
49
|
+
Gray: string;
|
|
50
|
+
DarkGray: string;
|
|
51
|
+
Black: string;
|
|
52
|
+
Obfuscated: string;
|
|
53
|
+
Bold: string;
|
|
54
|
+
StrikeThrough: string;
|
|
55
|
+
Italic: string;
|
|
56
|
+
Reset: string;
|
|
57
|
+
NewLine: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=RawText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RawText.d.ts","sourceRoot":"","sources":["../../../_module/util/RawText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,qBAAa,OAAO;IAChB;;;;OAIG;WACW,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAI7C;;;;;OAKG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU;IAOrE;;;;;OAKG;WACW,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;IAIhE;;;;OAIG;WACW,OAAO,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU;IAI3D;;OAEG;IACH,OAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;MAuBnB;CACJ"}
|