@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.
Files changed (61) hide show
  1. package/_module/BlockFactory.ts +18 -0
  2. package/_module/util/RawText.ts +75 -0
  3. package/_types/_module/BlockFactory.d.ts +16 -0
  4. package/_types/_module/BlockFactory.d.ts.map +1 -0
  5. package/_types/_module/sys/Threads.d.ts.map +1 -0
  6. package/_types/_module/util/Command.d.ts +92 -0
  7. package/_types/_module/util/Command.d.ts.map +1 -0
  8. package/{util → _types/_module/util}/Forms/Form.d.ts +12 -16
  9. package/_types/_module/util/Forms/Form.d.ts.map +1 -0
  10. package/_types/_module/util/Forms/FormAction.d.ts +73 -0
  11. package/_types/_module/util/Forms/FormAction.d.ts.map +1 -0
  12. package/{util → _types/_module/util}/Forms/FormMessage.d.ts +24 -30
  13. package/_types/_module/util/Forms/FormMessage.d.ts.map +1 -0
  14. package/{util → _types/_module/util}/Forms/FormModal.d.ts +66 -57
  15. package/_types/_module/util/Forms/FormModal.d.ts.map +1 -0
  16. package/_types/_module/util/Forms/FormRegistry.d.ts +12 -0
  17. package/_types/_module/util/Forms/FormRegistry.d.ts.map +1 -0
  18. package/{util → _types/_module/util}/Math.d.ts +8 -2
  19. package/_types/_module/util/Math.d.ts.map +1 -0
  20. package/_types/_module/util/RawText.d.ts +60 -0
  21. package/_types/_module/util/RawText.d.ts.map +1 -0
  22. package/{util → _types/_module/util}/Signal.d.ts +3 -5
  23. package/_types/_module/util/Signal.d.ts.map +1 -0
  24. package/_types/_module/util/System.d.ts.map +1 -0
  25. package/_types/_module/util/Vector.d.ts +212 -0
  26. package/_types/_module/util/Vector.d.ts.map +1 -0
  27. package/_types/_module/util/Wrapper/Container.d.ts.map +1 -0
  28. package/_types/_module/util/Wrapper/IEntity.d.ts.map +1 -0
  29. package/_types/_module/util/Wrapper/IPlayer.d.ts.map +1 -0
  30. package/_types/index.d.ts +3 -0
  31. package/_types/index.d.ts.map +1 -0
  32. package/index.js +128 -380
  33. package/index.ts +2 -48
  34. package/package.json +7 -6
  35. package/tsconfig.types.json +2 -2
  36. package/index.d.ts +0 -47
  37. package/util/Command.d.ts +0 -23
  38. package/util/Forms/FormAction.d.ts +0 -41
  39. package/util/Forms/FormRegistry.d.ts +0 -26
  40. package/util/RawText.d.ts +0 -33
  41. package/util/RawText.ts +0 -76
  42. package/util/Vector.d.ts +0 -60
  43. /package/{sys → _module/sys}/Threads.ts +0 -0
  44. /package/{util → _module/util}/Command.ts +0 -0
  45. /package/{util → _module/util}/Forms/Form.ts +0 -0
  46. /package/{util → _module/util}/Forms/FormAction.ts +0 -0
  47. /package/{util → _module/util}/Forms/FormMessage.ts +0 -0
  48. /package/{util → _module/util}/Forms/FormModal.ts +0 -0
  49. /package/{util → _module/util}/Forms/FormRegistry.ts +0 -0
  50. /package/{util → _module/util}/Math.ts +0 -0
  51. /package/{util → _module/util}/Signal.ts +0 -0
  52. /package/{util → _module/util}/System.ts +0 -0
  53. /package/{util → _module/util}/Vector.ts +0 -0
  54. /package/{util → _module/util}/Wrapper/Container.ts +0 -0
  55. /package/{util → _module/util}/Wrapper/IEntity.ts +0 -0
  56. /package/{util → _module/util}/Wrapper/IPlayer.ts +0 -0
  57. /package/{sys → _types/_module/sys}/Threads.d.ts +0 -0
  58. /package/{util → _types/_module/util}/System.d.ts +0 -0
  59. /package/{util → _types/_module/util}/Wrapper/Container.d.ts +0 -0
  60. /package/{util → _types/_module/util}/Wrapper/IEntity.d.ts +0 -0
  61. /package/{util → _types/_module/util}/Wrapper/IPlayer.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@block_factory/lib",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "description": "Typescript Library for Minecraft Bedrock Edition",
@@ -17,14 +17,15 @@
17
17
  ],
18
18
  "license": "MIT",
19
19
  "bugs": {
20
- "url": "https://github.com/Block-Factory-Studio/bf-lib/issues"
20
+ "url": "https://github.com/Block-Factory-Studio/bf-mcbr-library/issues"
21
21
  },
22
- "homepage": "https://github.com/Block-Factory-Studio/bf-lib#readme",
22
+ "homepage": "https://github.com/Block-Factory-Studio/bf-mcbr-library#readme",
23
23
  "dependencies": {
24
24
  "@minecraft/server": "^2.4.0",
25
- "@minecraft/server-ui": "^2.0.0",
26
- "all": "^0.0.0",
27
- "esbuild": "^0.27.2"
25
+ "@minecraft/server-ui": "^2.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "esbuild": "^0.25.9"
28
29
  },
29
30
  "scripts": {
30
31
  "build": "node esbuild.config.mjs",
@@ -3,11 +3,11 @@
3
3
  "compilerOptions": {
4
4
  "emitDeclarationOnly": true,
5
5
  "noEmit": false,
6
- "outDir": "dist",
6
+ "outDir": "_types",
7
7
  "rootDir": ".",
8
8
  "declaration": true,
9
9
  "declarationMap": true
10
10
  },
11
11
  "include": ["**/*.ts"],
12
- "exclude": ["node_modules", "dist"]
12
+ "exclude": ["node_modules", "_types"]
13
13
  }
package/index.d.ts DELETED
@@ -1,47 +0,0 @@
1
- import { MathUtils } from "./util/Math";
2
- import { Signal } from "./util/Signal";
3
- import { Vec2, Vec3 } from "./util/Vector";
4
- import { RawText } from "./util/RawText";
5
- import { Command } from "./util/Command";
6
- import { System } from "./util/System";
7
-
8
- import { IForm, IFormValue } from "./util/Forms/Form";
9
- import { ActionFormCtor, IButtonOptions, IActionFormResponse, IActionFormData } from "./util/Forms/FormAction";
10
- import { IModalFormResponse,ITextFieldOptions, IDropdownOptions, ISliderOptions, IToggleOptions, IModalFormData } from "./util/Forms/FormModal";
11
- import { IMessageFormData, IMessageFormResponse } from "./util/Forms/FormMessage";
12
- import { IFormRegistration, RegisterForm } from "./util/Forms/FormRegistry";
13
-
14
- import { Inventory, ContainerWrapper } from "./util/Wrapper/Container";
15
- import { IEntity, IEntityWrapper } from "./util/Wrapper/IEntity";
16
- import { IPlayer, IPlayerWrapper } from "./util/Wrapper/IPlayer";
17
-
18
- import { _THREAD_ } from "./sys/Threads";
19
-
20
- export {
21
- MathUtils, Signal, Vec2, Vec3, RawText, Command, System,
22
- IForm, IFormValue,
23
- ActionFormCtor, IButtonOptions, IActionFormResponse, IActionFormData,
24
- IModalFormResponse, ITextFieldOptions, IDropdownOptions, ISliderOptions, IToggleOptions, IModalFormData,
25
- IMessageFormData, IMessageFormResponse,
26
- IFormRegistration, RegisterForm,
27
- Inventory, ContainerWrapper, IEntity, IEntityWrapper, IPlayer, IPlayerWrapper, _THREAD_
28
- }
29
-
30
- export declare const BlockFactory: {
31
- MathUtils: typeof MathUtils;
32
- Signal: typeof Signal;
33
- Vec2: typeof Vec2;
34
- Vec3: typeof Vec3;
35
- RawText: typeof RawText;
36
- Command: typeof Command;
37
- System: typeof System;
38
- IForm: typeof IForm;
39
- IActionFormData: typeof IActionFormData;
40
- IModalFormData: typeof IModalFormData;
41
- IMessageFormData: typeof IMessageFormData;
42
- RegisterForm: typeof RegisterForm;
43
- ContainerWrapper: typeof ContainerWrapper
44
- IEntityWrapper: typeof IEntityWrapper
45
- IPlayerWrapper: typeof IPlayerWrapper
46
- _THREAD_: typeof _THREAD_;
47
- };
package/util/Command.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import type {
2
- CustomCommand,
3
- CommandPermissionLevel,
4
- CustomCommandParameter,
5
- CustomCommandOrigin,
6
- CustomCommandResult
7
- } from "@minecraft/server";
8
-
9
- export declare namespace Command {
10
- export abstract class ICustomCommand implements CustomCommand {
11
- public abstract description: string;
12
- public abstract name: string;
13
- public abstract permissionLevel: CommandPermissionLevel;
14
- public cheatsRequired?: boolean;
15
- public mandatoryParameters?: CustomCommandParameter[];
16
- public optionalParameters?: CustomCommandParameter[];
17
- public abstract execute(origin: CustomCommandOrigin, ...args: any[]): CustomCommandResult | undefined;
18
- }
19
-
20
- export const customCommands: ICustomCommand[];
21
-
22
- export function RegisterCustomCommand<T extends { new(): ICustomCommand }>(customCommand: T): void;
23
- }
@@ -1,41 +0,0 @@
1
- import { IForm } from "./Form";
2
- import { Player, RawMessage } from "@minecraft/server";
3
- import { ActionFormData, FormCancelationReason } from "@minecraft/server-ui";
4
-
5
- export declare type ActionFormCtor<T extends IActionFormData = IActionFormData> = new () => T;
6
-
7
- export declare interface IButtonOptions {
8
- id?: string | number;
9
- iconPath?: string;
10
- subForm?: ActionFormCtor;
11
- allowReturn?: boolean;
12
- }
13
-
14
- export declare interface IActionFormResponse {
15
- readonly cancelationReason?: FormCancelationReason;
16
- readonly canceled: boolean;
17
- readonly selection?: number;
18
- readonly id?: string | number;
19
- }
20
-
21
- export declare abstract class IActionFormData extends IForm {
22
- protected form: ActionFormData;
23
-
24
- protected abstract build(player: Player): void;
25
-
26
- protected abstract onSubmit(player: Player, response: IActionFormResponse): void;
27
-
28
- protected onCancel?(player: Player, response: IActionFormResponse): void;
29
-
30
- title(titleText: RawMessage | string): this;
31
- body(bodyText: RawMessage | string): this;
32
- divider(): this;
33
- header(text: RawMessage | string): this;
34
- label(text: RawMessage | string): this;
35
-
36
- button(text: RawMessage | string, options?: IButtonOptions): this;
37
-
38
- show(player: Player): Promise<IActionFormResponse>;
39
-
40
- protected _showChained(player: Player, returnStack: ActionFormCtor[]): Promise<IActionFormResponse>;
41
- }
@@ -1,26 +0,0 @@
1
- import { IActionFormData } from "./FormAction";
2
- import { IModalFormData } from "./FormModal";
3
- import { IMessageFormData } from "./FormMessage";
4
-
5
- export type AnyShowableForm =
6
- | IActionFormData
7
- | IModalFormData
8
- | IMessageFormData;
9
-
10
- export type AnyShowableCtor = new () => AnyShowableForm;
11
-
12
- export interface IFormRegistration {
13
- itemId: string;
14
- formCtor: AnyShowableCtor;
15
- }
16
-
17
- /**
18
- * Decorator factory used to bind a form class to an itemId.
19
- *
20
- * Usage:
21
- * @RegisterForm("minecraft:stick")
22
- * export class MyForm extends IMessageFormData {}
23
- */
24
- export declare function RegisterForm(
25
- itemId: string
26
- ): <T extends AnyShowableCtor>(formCtor: T) => void;
package/util/RawText.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import type { RawMessage } from "@minecraft/server";
2
-
3
- export declare namespace RawText {
4
- export const TEXT: (value: string) => RawMessage;
5
- export const TRANSLATE: (key: string, ...params: string[]) => RawMessage;
6
- export const SCORE: (name: string, objective: string) => RawMessage;
7
- export const MESSAGE: (...rawText: RawMessage[]) => RawMessage;
8
- export const FORMAT: {
9
- DarkRed: RawMessage;
10
- Red: RawMessage;
11
- Gold: RawMessage;
12
- Yellow: RawMessage;
13
- Green: RawMessage;
14
- Lime: RawMessage;
15
- Aqua: RawMessage;
16
- Cyan: RawMessage;
17
- DarkBlue: RawMessage;
18
- Blue: RawMessage;
19
- Magenta: RawMessage;
20
- Purple: RawMessage;
21
- White: RawMessage;
22
- Gray: RawMessage;
23
- DarkGray: RawMessage;
24
- Black: RawMessage;
25
- Obfuscated: RawMessage;
26
- Bold: RawMessage;
27
- StrikeThrough: RawMessage;
28
- Italic: RawMessage;
29
- Reset: RawMessage;
30
- NewLine: RawMessage;
31
- };
32
- }
33
- //# sourceMappingURL=RawText.d.ts.map
package/util/RawText.ts DELETED
@@ -1,76 +0,0 @@
1
- import { RawMessage } from '@minecraft/server';
2
-
3
- /**
4
- * Utility helpers for building rawtext messages.
5
- */
6
- export namespace RawText {
7
- /**
8
- * Creates a simple text component.
9
- * @param value - The text value.
10
- * @returns Text component object.
11
- */
12
- export const TEXT = (value: string): RawMessage => ({
13
- 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
- export const TRANSLATE = (key: string, ...params: string[]): RawMessage => ({
23
- translate: key,
24
- with: params.length ? params : undefined
25
- });
26
-
27
- /**
28
- * Creates a score component.
29
- * @param name - The entity's name whose score is being displayed.
30
- * @param objective - The name of the score objective.
31
- * @returns Score component object.
32
- */
33
- export const SCORE = (name: string, objective: string): RawMessage => ({
34
- score: {
35
- name: name,
36
- objective: objective
37
- }
38
- });
39
-
40
- /**
41
- * Wraps various text components into a rawtext structure.
42
- * @param rawText - The raw text components.
43
- * @returns Raw text object.
44
- */
45
- export const MESSAGE = (...rawText: RawMessage[]): RawMessage => ({
46
- rawtext: rawText
47
- });
48
-
49
- /**
50
- * Common formatting and color codes.
51
- */
52
- export const FORMAT = {
53
- DarkRed: TEXT('§4'),
54
- Red: TEXT('§c'),
55
- Gold: TEXT('§6'),
56
- Yellow: TEXT('§e'),
57
- Green: TEXT('§2'),
58
- Lime: TEXT('§a'),
59
- Aqua: TEXT('§b'),
60
- Cyan: TEXT('§3'),
61
- DarkBlue: TEXT('§1'),
62
- Blue: TEXT('§9'),
63
- Magenta: TEXT('§d'),
64
- Purple: TEXT('§5'),
65
- White: TEXT('§f'),
66
- Gray: TEXT('§7'),
67
- DarkGray: TEXT('§8'),
68
- Black: TEXT('§0'),
69
- Obfuscated: TEXT('§k'),
70
- Bold: TEXT('§l'),
71
- StrikeThrough: TEXT('§m'),
72
- Italic: TEXT('§o'),
73
- Reset: TEXT('§r'),
74
- NewLine: TEXT('\n')
75
- }
76
- }
package/util/Vector.d.ts DELETED
@@ -1,60 +0,0 @@
1
- export declare class Vec2 {
2
- x: number;
3
- y: number;
4
- static ZERO: Vec2;
5
- static UP: Vec2;
6
- static DOWN: Vec2;
7
- static LEFT: Vec2;
8
- static RIGHT: Vec2;
9
- constructor(x: number, y: number);
10
- static add(a: Vec2, b: Vec2 | number): Vec2;
11
- static subtract(a: Vec2, b: Vec2 | number): Vec2;
12
- static multiply(a: Vec2, b: Vec2 | number): Vec2;
13
- static divide(a: Vec2, b: Vec2 | number): Vec2;
14
- static lerp(a: Vec2, b: Vec2, t: number): Vec2;
15
- static clamp(v: Vec2, min: Vec2, max: Vec2): Vec2;
16
- static dot(a: Vec2, b: Vec2): number;
17
- static magnitude(a: Vec2): number;
18
- static normalize(a: Vec2): Vec2;
19
- static distance(a: Vec2, b: Vec2): number;
20
- static negate(a: Vec2): Vec2;
21
- static equals(a: Vec2, b: Vec2): boolean;
22
- static approxEquals(a: Vec2, b: Vec2, epsilon?: number): boolean;
23
- static angle(a: Vec2, b: Vec2): number;
24
- static perpendicular(a: Vec2): Vec2;
25
- }
26
- export declare class Vec3 {
27
- x: number;
28
- y: number;
29
- z: number;
30
- static ZERO: Vec3;
31
- static UP: Vec3;
32
- static DOWN: Vec3;
33
- static LEFT: Vec3;
34
- static RIGHT: Vec3;
35
- static FORWARD: Vec3;
36
- static BACK: Vec3;
37
- static WEST: Vec3;
38
- static EAST: Vec3;
39
- static NORTH: Vec3;
40
- static SOUTH: Vec3;
41
- constructor(x: number, y: number, z: number);
42
- static add(a: Vec3, b: Vec3 | number): Vec3;
43
- static subtract(a: Vec3, b: Vec3 | number): Vec3;
44
- static multiply(a: Vec3, b: Vec3 | number): Vec3;
45
- static divide(a: Vec3, b: Vec3 | number): Vec3;
46
- static lerp(a: Vec3, b: Vec3, t: number): Vec3;
47
- static clamp(v: Vec3, min: Vec3, max: Vec3): Vec3;
48
- static dot(a: Vec3, b: Vec3): number;
49
- static cross(a: Vec3, b: Vec3): Vec3;
50
- static magnitude(a: Vec3): number;
51
- static normalize(a: Vec3): Vec3;
52
- static distance(a: Vec3, b: Vec3): number;
53
- static negate(a: Vec3): Vec3;
54
- static equals(a: Vec3, b: Vec3): boolean;
55
- static approxEquals(a: Vec3, b: Vec3, epsilon?: number): boolean;
56
- static angle(a: Vec3, b: Vec3): number;
57
- static project(a: Vec3, onto: Vec3): Vec3;
58
- static cartesian(radius: number, theta: number, phi: number): Vec3;
59
- }
60
- //# sourceMappingURL=Vector.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes