diff --git a/definitions/api/TextColor.d.ts b/definitions/api/TextColor.d.ts index 3645737..a1af62d 100644 --- a/definitions/api/TextColor.d.ts +++ b/definitions/api/TextColor.d.ts @@ -79,4 +79,7 @@ interface ITextColor { formatText(str: string): string; } +/** + * @version 2.0.0 + */ declare const TextColor: ITextColor; \ No newline at end of file diff --git a/definitions/feature/command.d.ts b/definitions/feature/command.d.ts index 75abb0e..718cb5f 100644 --- a/definitions/feature/command.d.ts +++ b/definitions/feature/command.d.ts @@ -1,3 +1,6 @@ +/** + * @since 2.0.0 + */ interface CommandEvents { /** * Called on any command being used. @@ -5,14 +8,27 @@ interface CommandEvents { * @param args The list of arguments of the command line (for example, `['123']` in '.test 123') * @param commandLine The command line (for example, `'.test 123 test'` in '.test 123 test') * @returns Whether the command usage is successful or not (return `false` if the user misused the command) + * @since 2.0.0 */ "execute" : (label: string, args: string[], commandLine: string) => boolean; } -// A class representing a Latite Client command. +/** + * A class representing a Latite Client command. + * @since 2.0.0 +*/ declare class Command { + /** + * @since 2.0.0 + */ readonly name: string; + /** + * @since 2.0.0 + */ readonly description: string; + /** + * @since 2.0.0 + */ readonly aliases: string[]; /** @@ -21,8 +37,12 @@ declare class Command { * @param description A short description of what the command does * @param usage The usage of the command put '$' in place of the actual command name and preifx. Example: usage: "$ " -> ".commandname " * @param aliases Alternative command names the user can use the execute the same command. Can be empty + * @since 2.0.0 */ constructor(name: string, description: string, usage: string, aliases: string[]); + /** + * @since 2.0.0 + */ on: (eventName: K, handler: CommandEvents[K]) => void; } \ No newline at end of file diff --git a/definitions/feature/hudmodule.d.ts b/definitions/feature/hudmodule.d.ts index 02b727c..d90f27a 100644 --- a/definitions/feature/hudmodule.d.ts +++ b/definitions/feature/hudmodule.d.ts @@ -1,15 +1,54 @@ +/** + * @since 2.0.0 + */ declare class HudModule extends Module { + /** + * + * @param name + * @param displayName + * @param description + * @param key + * @param resizable + * @since 2.0.0 + */ constructor(name: string, displayName: string, description: string, key: KeyCode, resizable: boolean); + /** + * @since 2.0.0 + */ getRect(): Rect; + /** + * @since 2.0.0 + */ setRect(newRect: Rect): void; + /** + * @since 2.0.0 + */ setBounds(width: number, height: number): void; + /** + * @since 2.0.0 + */ getSize(): number; + /** + * @since 2.0.0 + */ setSize(): number; + /** + * @since 2.0.0 + */ getPos(): Vector2; + /** + * @since 2.0.0 + */ setPos(x: number, y: number): void; } +/** + * @since 2.0.0 + */ declare class TextModule extends HudModule { + /** + * @since 2.0.0 + */ constructor(name: string, displayName: string, description: string, key: KeyCode); } \ No newline at end of file diff --git a/definitions/feature/manager/commandmgr.d.ts b/definitions/feature/manager/commandmgr.d.ts index 1780aa4..d434d24 100644 --- a/definitions/feature/manager/commandmgr.d.ts +++ b/definitions/feature/manager/commandmgr.d.ts @@ -1,12 +1,17 @@ +/** + * @since 2.0.0 + */ declare class CommandManager { /** * Gets the command prefix, default is '.' + * @since 2.0.0 */ getPrefix(): string; /** * Adds a command into the client * @param cmd The command to add + * @since 2.0.0 */ registerCommand(cmd: Command): void; diff --git a/definitions/feature/manager/mmgr.d.ts b/definitions/feature/manager/mmgr.d.ts index e532a80..65c94a6 100644 --- a/definitions/feature/manager/mmgr.d.ts +++ b/definitions/feature/manager/mmgr.d.ts @@ -1,7 +1,11 @@ +/** + * @since 2.0.0 + */ interface ModuleManager { /** * Registers a module into the Latite mod. This makes it appear in the mod menu, and be interactive. * @param mod The module to register. + * @since 2.0.0 */ registerModule(mod: Module): void; @@ -12,12 +16,14 @@ interface ModuleManager { * For example, ArmorHud is the internal name for Armor Hud. * Position is the internal name of Coordinates * @param name The name of the module to get. + * @since 2.0.0 */ getModuleByName(name: string): Module | null; /** * Loop through each module. * @param callback + * @since 2.0.0 */ forEachModule(callback: (mod: Module) => void): void; } diff --git a/definitions/feature/module.d.ts b/definitions/feature/module.d.ts index 89b39d0..d5c01a6 100644 --- a/definitions/feature/module.d.ts +++ b/definitions/feature/module.d.ts @@ -1,14 +1,20 @@ +/** + * @since 2.0.0 + */ interface ModuleEvents { /** * Called on any module being enabled. + * @since 2.0.0 */ "enable": () => void, /** * Called on any module being disabled. + * @since 2.0.0 */ "disable": () => void, /** * Called on every frame. Return a bool to set the toggle form of the module - `true` makes it a hold module, like player list; `false`, standard toggle form. + * @since 2.0.0 */ "get-hold-to-toggle": () => boolean, // I had no idea how to write this @@ -17,6 +23,7 @@ interface ModuleEvents { * @note Only available in HUD modules. * @param isPreview If it's a preview in the main menu (when module settings are extended.) * @param isEditor If it's in the HUD editor where you move modules around. + * @since 2.0.0 */ "render": (isPreview: boolean, isEditor: boolean) => void, /** @@ -27,58 +34,85 @@ interface ModuleEvents { /** * Called on every frame; use this to render text. Return a string to render it on the next frame. * @note Only available in text modules. + * @since 2.0.0 */ "text": (isPreview: boolean, isEditor: boolean) => string; } +/** + * @since 2.0.0 + */ declare class Module { + /** + * @since 2.0.0 + */ readonly name: string + /** + * @since 2.0.0 + */ readonly displayName: string + /** + * @since 2.0.0 + */ readonly description: string + /** + * @since 2.0.0 + */ readonly key: KeyCode /** * IDs for script modules are always 255. + * @since 2.0.0 */ readonly id: number; /** * If the module is a HUD module (that you can move in the hud editor) + * @since 2.0.0 */ readonly visual: boolean; /** * If the module is visible in the ClickGui + * @since 2.0.0 */ readonly visible: boolean; -/** - * - * @param name The internal name of the module. - * @param displayName The display name of the module. Shown in the ClickGUI. - * @param description A short description of what the module does. - * @param key The default keybind to activate the module. - */ + /** + * + * @param name The internal name of the module. + * @param displayName The display name of the module. Shown in the ClickGUI. + * @param description A short description of what the module does. + * @param key The default keybind to activate the module. + * @since 2.0.0 + */ constructor(name: string, displayName: string, description: string, key: KeyCode); + /** + * @since 2.0.0 + */ on: (eventName: K, handler: ModuleEvents[K]) => void; /** * Checks if the module is enabled. + * @since 2.0.0 */ isEnabled(): boolean; /** * Set the module to be enabled or not. * @param b The new status of the module. + * @since 2.0.0 */ setEnabled(b: boolean): void; /** * Check if the module is blocked. + * @since 2.0.0 */ isBlocked(): boolean; /** * Gets the settings of the module. + * @since 2.0.0 */ getSettings(): Setting[]; @@ -88,6 +122,7 @@ declare class Module { * @param displayName The name that shows in the menu * @param description A short description of what the setting does * @param defVal The default value + * @since 2.0.0 */ addBoolSetting(name: string, displayName: string, description: string, defVal: boolean): Setting; @@ -100,6 +135,7 @@ declare class Module { * @param max The maximum value * @param interval The precision of the setting * @param defVal The default value + * @since 2.0.0 */ addNumberSetting(name: string, displayName: string, description: string, min: number, max: number, interval: number, defVal: number): Setting; @@ -109,6 +145,7 @@ declare class Module { * @param displayName The name that shows in the menu * @param description A short description of what the setting does * @param defVal The default value + * @since 2.0.0 */ addKeySetting(name: string, displayName: string, description: string, defVal: KeyCode): Setting; @@ -118,6 +155,7 @@ declare class Module { * @param displayName The name that shows in the menu * @param description A short description of what the setting does * @param defVal The default value + * @since 2.0.0 */ addTextSetting(name: string, displayName: string, description: string, defVal: string): Setting; @@ -127,6 +165,7 @@ declare class Module { * @param displayName The name that shows in the menu * @param description A short description of what the setting does * @param defVal The default value + * @since 2.0.0 */ addColorSetting(name: string, displayName: string, description: string, defVal: Color): Setting; } diff --git a/definitions/feature/setting.d.ts b/definitions/feature/setting.d.ts index 5fc1b8e..e178f15 100644 --- a/definitions/feature/setting.d.ts +++ b/definitions/feature/setting.d.ts @@ -1,3 +1,6 @@ +/** + * @since 2.0.0 + */ declare class Setting { /** * DO NOT USE - not implemented @@ -6,21 +9,33 @@ declare class Setting { /** * The name of the setting + * @since 2.0.0 */ readonly name: string; + /** + * @since 2.0.0 + */ readonly displayName: string; + /** + * @since 2.0.0 + */ readonly description: string; + /** + * @since 2.0.0 + */ toString(): string; /** * Gets the value of the setting. Could be null. + * @since 2.0.0 */ getValue(): any; /** * Sets the setting value. * @param value The value to set. Must be of type corresponding to the type of the setting. + * @since 2.0.0 */ setValue(value: any): void; @@ -28,6 +43,7 @@ declare class Setting { * Set that this setting will only show when another setting is on or off. * @param settingName The setting that this setting will depend on (internal name). * @param value The value the other setting needs to be for this setting to show + * @since 2.0.0 */ setCondition(settingName: string, value?: boolean): void; } \ No newline at end of file diff --git a/definitions/game.d.ts b/definitions/game.d.ts index 5c9f4ce..c4d0bb5 100644 --- a/definitions/game.d.ts +++ b/definitions/game.d.ts @@ -1,13 +1,18 @@ +/** + * @since 2.0.0 + */ interface Game { /** * Sends a chat message. * @param msg The message to send. + * @since 2.0.0 */ sendChatMessage(msg: string): void; /** * Execute an in-game command. * @param cmd The command to send. Be sure to add '/' before your command. + * @since 2.0.0 */ executeCommand(cmd: string): void; @@ -16,28 +21,33 @@ interface Game { * @param soundName The sound name, for example: mob.enderdragon.growl * @param volume The volume of the sound. Default is 1 * @param pitch Pitch of the sound. Default is 1 + * @since 2.0.0 */ playSoundUI(soundName: string, volume: number, pitch: number): void; /** * Get your player. This will return null if you are not in a game. + * @since 2.0.0 */ getLocalPlayer(): LocalPlayer | null; /** * Gets the server you are connected to. This will return null if you are not in a server. + * @since 2.0.0 */ getServer(): string | null; /** * Gets the featured server name you are connected to. This will return null if you are not in a featured server. * - * Featured server examples: "The Hive" "CubeCraft" "InPvP" "Mineplex" + * Featured server examples: "The Hive" "CubeCraft" "Mineville" + * @since 2.0.0 */ getFeaturedServer(): string | null; /** * Gets the port of the server you're connected to. If you are not in a server, it returns 0. + * @since 2.0.0 */ getPort(): number; @@ -56,26 +66,41 @@ interface Game { /** * Get whether you are in a UI screen + * @since 2.0.0 */ isInUI(): boolean; /** * Gets the size of the viewport. + * @since 2.0.0 */ getScreenSize(): Vector2; /** * Get the mouse position. + * @since 2.0.0 */ getMousePos(): Vector2; + /** + * @since 2.0.2 + */ + getFOV(): Vector2; + + /** + * @since 2.0.2 + */ + getCameraPosition(): Vector3; + /** * Captures the mouse cursor (hides it and allows the player to look around using the mouse cursor.) + * @since 2.1.0 */ captureCursor(): void; /** * Releases the mouse cursor. + * @since 2.1.0 */ releaseCursor(): void; @@ -83,10 +108,14 @@ interface Game { * Gets the user's input setting. Usually a key code; for example, `"forward"` returns `KeyCode.W` by default. * * If this function returns 0, either the key is set to nothing or the specified name was not found. + * @since 2.0.0 */ - getInputBinding(name: InputBinding): number; + getInputBinding(name: InputBinding | string): number; } +/** + * @since 2.0.0 + */ type InputBinding = "attack" | "pickItem" | @@ -123,4 +152,7 @@ type InputBinding = "menuTabRight" | "menuCancel"; -declare const game: Game; +/** + * @since 2.0.0 + */ +declare const game: Game; \ No newline at end of file diff --git a/definitions/gfx/Texture.d.ts b/definitions/gfx/Texture.d.ts index b444b86..a1ca369 100644 --- a/definitions/gfx/Texture.d.ts +++ b/definitions/gfx/Texture.d.ts @@ -1,23 +1,30 @@ +/** + * @since 2.0.0 + */ declare class Texture { /** * Loads a texture from file. * @param filePath The file path to the texture, could be absolute or relative to the script folder + * @since 2.0.0 */ public static load(filePath: string): Texture; /** * Gets a Minecraft texture. Can only be drawn with the Minecraft renderer * @param textureName The texture name, example: `"textures/items/arrow"` + * @since 2.0.0 */ public static get(textureName: string): Texture; /** * Reloads the (Minecraft renderer) texture. + * @since 2.0.0 */ public reload(): void; /** * Destroys the texture. It's highly recommended to set the texture to `null` after you call this + * @since 2.0.0 */ public dispose(): void; } \ No newline at end of file diff --git a/definitions/gfx/graphics.d.ts b/definitions/gfx/graphics.d.ts index 69190ad..62cfc9f 100644 --- a/definitions/gfx/graphics.d.ts +++ b/definitions/gfx/graphics.d.ts @@ -4,6 +4,7 @@ * @member top The y coordinate of the top-left point. * @member right The x coordinate of the bottom-right point. * @member bottom The y coordinate of the bottom-right point. + * @since 2.0.0 */ declare class Rect { /** @@ -12,56 +13,158 @@ declare class Rect { * @param top The y coordinate of the top-left point. * @param right The x coordinate of the bottom-right point. * @param bottom The y coordinate of the bottom-right point. + * @since 2.0.0 */ constructor(left: number, top: number, right: number, bottom: number); + /** + * @since 2.0.0 + */ left: number; + /** + * @since 2.0.0 + */ top: number; + /** + * @since 2.0.0 + */ right: number; + /** + * @since 2.0.0 + */ bottom: number; + /** + * @since 2.0.0 + */ getWidth(): number; + /** + * @since 2.0.0 + */ getHeight(): number; } +/** + * @since 2.0.0 + */ declare class Vector2 { + /** + * @since 2.0.0 + */ add: (vec: Vector2) => Vector2; + /** + * @since 2.0.0 + */ sub: (vec: Vector2) => Vector2; + /** + * @since 2.0.0 + */ mul: (vec: Vector2) => Vector2; + /** + * @since 2.0.0 + */ div: (vec: Vector2) => Vector2; + /** + * @since 2.0.0 + */ distanceTo: (pos: Vector2) => number; /** * A point on the screen. * @param x The x coordinate. * @param y The y coordinate. + * @since 2.0.0 */ constructor(x: number, y: number); + /** + * @since 2.0.0 + */ constructor(); + /** + * @since 2.0.0 + */ x: number; + /** + * @since 2.0.0 + */ y: number; } +/** + * @since 2.0.0 + */ declare class Vector3 { + /** + * @since 2.0.0 + */ add: (vec: Vector3) => Vector3; + /** + * @since 2.0.0 + */ sub: (vec: Vector3) => Vector3; + /** + * @since 2.0.0 + */ mul: (vec: Vector3) => Vector3; + /** + * @since 2.0.0 + */ div: (vec: Vector3) => Vector3; + /** + * @since 2.0.0 + */ distanceTo: (pos: Vector3) => number; + /** + * + * @param x + * @param y + * @param z + * @since 2.0.0 + */ constructor(x: number, y: number, z: number); + /** + * @since 2.0.0 + */ constructor(); + /** + * @since 2.0.0 + */ x: number; + /** + * @since 2.0.0 + */ y: number; + /** + * @since 2.0.0 + */ z: number; } +/** + * @since 2.0.0 + */ declare class Color { + /** + * @since 2.0.0 + */ asAlpha: (opacity: number) => Color; + /** + * @since 2.0.0 + */ public r: number; + /** + * @since 2.0.0 + */ public g: number; + /** + * @since 2.0.0 + */ public b: number; + /** + * @since 2.0.0 + */ public a: number; /** @@ -70,9 +173,13 @@ declare class Color { * @param g Green (0.0 to 1.0) * @param b Blue (0.0 to 1.0) * @param a Opacity (0.0 to 1.0) + * @since 2.0.0 */ constructor(r: number, g: number, b: number, a: number); + /** + * @since 2.0.0 + */ constructor(); /** @@ -81,46 +188,122 @@ declare class Color { * @param g Green (0 to 255) * @param b Blue (0 to 255) * @param a Opacity (0 to 255) + * @since 2.0.0 */ - static RGB(r: number, g: number, b: number, a: number | undefined): Color; + static RGB(r: number, g: number, b: number, a?: number): Color; // THIS IS THE ONE THING I ACTUALLY CHANGED + /** + * @since 2.0.0 + */ static WHITE: Color; + /** + * @since 2.0.0 + */ static BLACK: Color; + /** + * @since 2.0.0 + */ static RED: Color; + /** + * @since 2.0.0 + */ static GREEN: Color; + /** + * @since 2.0.0 + */ static BLUE: Color; } +/** + * @since 2.0.0 + */ declare const enum TextAlignment { + /** + * @since 2.0.0 + */ Left, + /** + * @since 2.0.0 + */ Right, + /** + * @since 2.0.0 + */ Center } +/** + * @since 2.0.0 + */ declare const enum VerticalAlignment { + /** + * @since 2.0.0 + */ Top, + /** + * @since 2.0.0 + */ Bottom, + /** + * @since 2.0.0 + */ Center } -type BackendType - = +/** + * @since 2.0.0 + */ +type BackendType = /** - * */ + * @since 2.0.0 + */ "dx"; +/** + * @since 2.0.0 + */ declare interface Graphics { /** * * @param renderer `"dx"`: uses Direct2D/DirectWrite, `"minecraft":` use the Minecraft renderer + * @since 2.0.0 */ use(renderer: "dx" | "minecraft"): void; + /** + * + * @param rect + * @param color + * @param thickness + * @param radius + * @since 2.0.0 + */ drawRect(rect: Rect, color: Color, thickness: number, radius?: number): void; + /** + * + * @param rect + * @param color + * @param radius + * @since 2.0.0 + */ fillRect(rect: Rect, color: Color, radius?: number): void; + /** + * + * @param text + * @param textSize + * @since 2.0.0 + */ getTextSize(text: string, textSize: number): Vector2; + /** + * + * @param rect + * @since 2.0.0 + */ setClippingRect(rect: Rect): void; + /** + * @since 2.0.0 + */ restoreClippingRect(): void; /** @@ -129,6 +312,7 @@ declare interface Graphics { * @param text The text to draw * @param size The size of the text in pixels * @param color The color of the text + * @since 2.0.0 */ drawText(pos: Vector2, text: string, size: number, color: Color): void; @@ -140,6 +324,7 @@ declare interface Graphics { * @param color The color of the text * @param alignment The horizontal alignment * @param verticalAlignment The vertical alignment + * @since 2.0.0 */ drawTextFull(area: Rect, text: string, size: number, color: Color, alignment: TextAlignment, verticalAlignment: VerticalAlignment): void; @@ -150,8 +335,12 @@ declare interface Graphics { * @param sizeX The size of the texture in pixels * @param sizeY The size of the texture in pixels * @param color The overlay color of the texture (defaults to white) + * @since 2.0.0 */ drawTexture(texture: Texture, pos: Vector2, sizeX: number, sizeY: number, color?: Color): void; } -declare const graphics: Graphics; +/** + * @since 2.0.0 + */ +declare const graphics: Graphics; \ No newline at end of file diff --git a/definitions/gfx/graphics3.d.ts b/definitions/gfx/graphics3.d.ts index 47ef383..ae4885c 100644 --- a/definitions/gfx/graphics3.d.ts +++ b/definitions/gfx/graphics3.d.ts @@ -1,14 +1,22 @@ +/** + * @since 2.0.0 + */ declare interface Graphics3D { /** * Sets the color. * @param color The color to set + * @since 2.0.0 */ setColor(color: Color): void; /** * Sets the colors. (allows for gradients) - * @param color The color to set + * @param vec1 + * @param vec2 + * @param vec3 + * @param vec4 + * @since 2.0.0 */ setColors(vec1: Color, vec2: Color, vec3: Color, vec4: Color): void; @@ -16,6 +24,7 @@ declare interface Graphics3D { * Draws a line into the world (adds a line into the vertex buffer) * @param p1 * @param p2 + * @since 2.0.0 */ drawLine(p1: Vector3, p2: Vector3): void; @@ -24,6 +33,7 @@ declare interface Graphics3D { * @param p1 * @param p2 * @param p3 + * @since 2.0.0 */ drawTriangle(p1: Vector3, p2: Vector3, p3: Vector3): void; @@ -33,14 +43,19 @@ declare interface Graphics3D { * @param p2 * @param p3 * @param p4 + * @since 2.0.0 */ drawQuad(p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3): void; /** * Call this every time you're done rendering. (batched renders the current vertex buffer into the world) * @param cull `true` for rendering through blocks, `false` to not render through blocks + * @since 2.0.0 */ finish(cull?: boolean): void; } +/** + * @since 2.0.0 + */ declare const graphics3D: Graphics3D; \ No newline at end of file diff --git a/definitions/key.d.ts b/definitions/key.d.ts index fafda92..b7d524c 100644 --- a/definitions/key.d.ts +++ b/definitions/key.d.ts @@ -1,3 +1,6 @@ +/** + * @since 2.0.0 + */ declare const enum KeyCode { None = 0, Back = 8, diff --git a/definitions/latite.d.ts b/definitions/latite.d.ts index 8caf959..a1fc897 100644 --- a/definitions/latite.d.ts +++ b/definitions/latite.d.ts @@ -1,14 +1,26 @@ +/** + * @since 2.0.0 + */ interface LatiteEvent { } +/** + * @since 2.0.0 + */ interface CancellableEvent extends LatiteEvent { cancel: boolean; } +/** + * @since 2.0.0 + */ interface SendChatEvent extends CancellableEvent { readonly message: string; } +/** + * @since 2.0.0 + */ type MessageType = "raw" | "chat" | @@ -22,50 +34,121 @@ type MessageType = "text_object" | "object_whisper"; + /** + * @since 2.0.0 + */ interface MessageEvent extends CancellableEvent { + /** + * @since 2.0.0 + */ readonly type: MessageType; /** * Whether or not the message type is a chat message. + * @since 2.0.0 */ readonly isChat: boolean; + /** + * @since 2.0.0 + */ readonly message: string; /** * The sender of the message (if applicable) + * @since 2.0.0 */ readonly sender: string; /** * The Xbox User ID of the sender (if applicable) + * @since 2.0.0 */ readonly xuid: string; } +/** + * @since 2.0.0 + */ declare const enum MouseButton { + /** + * @since 2.0.0 + */ Left = 1, + /** + * @since 2.0.0 + */ Right = 2, + /** + * @since 2.0.0 + */ Middle = 3, + /** + * @since 2.0.0 + */ Scroll = 4 } +/** + * @since 2.0.0 + */ interface ClickEvent extends CancellableEvent { + /** + * @since 2.0.0 + */ readonly button: MouseButton; + /** + * @since 2.0.0 + */ readonly isDown: boolean; + /** + * @since 2.0.0 + */ readonly mouseX: number; + /** + * @since 2.0.0 + */ readonly mouseY: number; } +/** + * @since 2.0.0 + */ interface KeyEvent extends CancellableEvent { + /** + * @since 2.0.0 + */ readonly isDown: boolean; - readonly keyCode: KeyCode; // like 0x43 - readonly keyAsChar: string; // like 'C' + /** + * Example: `0x43` + * @since 2.0.0 + */ + readonly keyCode: KeyCode; + /** + * Example: `'C'` + * @since 2.0.0 + */ + readonly keyAsChar: string; } +/** + * @since 2.0.0 + */ interface ScriptEvent extends LatiteEvent { + /** + * @since 2.0.0 + */ readonly scriptName: string, + /** + * @since 2.0.0 + */ readonly scriptVersion: string, + /** + * @since 2.0.0 + */ readonly scriptAuthor: string } +/** + * @since 2.0.0 + */ type TitleType = "clear" | "reset" | @@ -77,27 +160,39 @@ type TitleType = "actionbarraw" | "times"; +/** + * @since 2.0.0 + */ interface TitleEvent extends CancellableEvent { readonly type: TitleType; readonly text: string; } +/** + * @since 2.0.0 + */ interface TextInputEvent extends CancellableEvent { readonly characters: string; } +/** + * @since 2.0.0 + */ interface ClientEvents { /** * Called on every tick. + * @since 2.0.0 */ "world-tick": LatiteEvent, /** - * + * Called whenever a world is joined. + * @since 2.0.0 */ "join-game": LatiteEvent, /** * Called on the user leaving a world. + * @since 2.0.0 */ "leave-game": LatiteEvent, /** @@ -112,7 +207,9 @@ interface ClientEvents { * sender: string; * xuid: string; * } + * * ``` + * @since 2.0.0 */ "receive-chat": MessageEvent, /** @@ -125,14 +222,17 @@ interface ClientEvents { * cancel: boolean * } * ``` + * @since 2.0.0 */ "send-chat": SendChatEvent, /** * Called on every frame; use this for 2D rendering. + * @since 2.0.0 */ "render2d": LatiteEvent, /** * Called on every frame; use this for DirectX rendering. + * @since 2.0.0 */ "renderDX": LatiteEvent, /** @@ -147,6 +247,7 @@ interface ClientEvents { * cancel: boolean * } * ``` + * @since 2.0.0 */ "key-press": KeyEvent, /** @@ -162,14 +263,17 @@ interface ClientEvents { * cancel: boolean * } * ``` + * @since 2.0.0 */ "click": ClickEvent, /** * Called on every frame; use this for 3D rendering. + * @since 2.0.0 */ "render3d": LatiteEvent, /** * Called on the game being minimized/closed. + * @since 2.0.0 */ "app-suspended": LatiteEvent, /** @@ -183,6 +287,7 @@ interface ClientEvents { * scriptAuthor: string * } * ``` + * @since 2.0.0 */ "load-script": ScriptEvent, /** @@ -196,6 +301,7 @@ interface ClientEvents { * scriptAuthor: string * } * ``` + * @since 2.0.0 */ "unload-script": ScriptEvent, @@ -209,6 +315,7 @@ interface ClientEvents { * text: string * } * ``` + * @since 2.0.0 */ "title": TitleEvent; @@ -221,32 +328,42 @@ interface ClientEvents { * characters: string * } * ``` + * @since 2.0.0 */ "text-input": TextInputEvent; /** * Called whenever the server transfers a player into another server. + * @since 2.0.0 */ "transfer": LatiteEvent; /** * Calls whenever the player goes into a different dimension. + * @since 2.0.0 */ "change-dimension": LatiteEvent; } +/** + * @since 2.0.0 + */ interface Latite { /** * Listens to a client-side event. * @param eventName The event to listen to * @param listener The event callback - * @param priority Positive or negative integer. The priority in which the event listener should have over other events globally. The default is 0. Greater = called first, less = called later. + * @param priority Positive or negative integer. The priority in which the event listener should have over other events globally. + * The default is 0. Greater = called first, less = called later. + * @since 2.0.0 + * @updated 2.1.0 (Added `priority`) */ on(eventName: K, listener: (event: ClientEvents[K]) => void, priority?: number): void /** * Shows a Latite toast on the top of the screen. * @param notif The notification to show. + * @since 2.0.0 */ showNotification(notif: string): void; @@ -254,23 +371,30 @@ interface Latite { * Runs a Latite command. * @param cmd The command to run. Do not add the prefix (.) * @returns The success of the command. + * @since 2.0.0 */ runCommand(cmd: string): boolean; /** * Gets the module manager. Use this to register modules. + * @since 2.0.0 */ getModuleManager(): ModuleManager; /** * Gets the command manager. Use this to register commands. + * @since 2.0.0 */ getCommandManager(): CommandManager; /** * The Latite Client version. Example: "v2.0.0" + * @since 2.0.0 */ readonly version: string; } +/** + * @since 2.0.0 + */ declare const client: Latite; \ No newline at end of file diff --git a/definitions/lib/clipboard.d.ts b/definitions/lib/clipboard.d.ts index a5e995a..c61f6b6 100644 --- a/definitions/lib/clipboard.d.ts +++ b/definitions/lib/clipboard.d.ts @@ -1,19 +1,24 @@ declare namespace include { + /** + * @since 2.0.0 + */ export interface Clipboard { /** * Gets the current clipboard text + * @since 2.0.0 */ get(): string; /** * Sets the clipboard text * @param str The text to set the clipboard to + * @since 2.0.0 */ set(str: string): void; - /** * Gets the copied bitmap. If the clipboard is unable to be opened, it will return null + * @since 2.0.0 */ getBitmap(): Buffer | null; } diff --git a/definitions/lib/filesystem.d.ts b/definitions/lib/filesystem.d.ts index 1e2ca8d..84b4f18 100644 --- a/definitions/lib/filesystem.d.ts +++ b/definitions/lib/filesystem.d.ts @@ -1,9 +1,16 @@ +/** + * @since 2.0.0 + */ declare namespace include { + /** + * @since 2.0.0 + */ export interface Filesystem { /** * Reads a file asynchronously. * @param path The path to read from. * @param callback This will get called when the operation is finished + * @since 2.0.0 */ readAsync(path: string, callback: (err: number, content: Buffer) => void): void; @@ -12,30 +19,35 @@ declare namespace include { * @param path The path to write to * @param data The data to write (see util.stringToBuffer to convert a string to a buffer) * @param callback This will get called when the operation is finished + * @since 2.0.0 */ writeAsync(path: string, data: Buffer, callback: (err: number) => void): void; /** * Reads a file from the path specified. * @param path The relative path from the script. + * @since 2.0.0 */ read(path: string): Buffer; /** * Writes a file to the path specified. * @param path The relative path from the script. * @param data The data to write. For example, `util.stringToBuffer("hello")` + * @since 2.0.0 */ write(path: string, data: Buffer): void; /** * Checks if a file or a directory exists * @param path The path to check if a file or directory exists + * @since 2.0.0 */ exists(path: string): boolean; /** * Creates a folder/directory. * @param path The path to create a directory. + * @since 2.0.0 */ createDirectory(path: string): void; @@ -43,6 +55,7 @@ declare namespace include { * * @param path The path to append to the file. * @param data The data to append, for example, `util.bufferToString("hello")` + * @since 2.0.0 */ append(path: string, data: Buffer): void; } diff --git a/definitions/lib/network.d.ts b/definitions/lib/network.d.ts index ba07c1b..71bec1d 100644 --- a/definitions/lib/network.d.ts +++ b/definitions/lib/network.d.ts @@ -1,24 +1,50 @@ declare namespace include { + /** + * @since 2.0.0 + */ export interface HttpResponse { /** * The body, if the status code is 200 (OK) + * @since 2.0.0 */ body: Buffer, + /** + * @since 2.0.0 + */ statusCode: number, /** * The http client error message + * @since 2.0.0 */ error?: string, } + /** + * @since 2.0.0 + */ interface GetData { + /** + * @since 2.0.0 + */ contentType?: string, + /** + * @since 2.0.0 + */ content?: Buffer, } + /** + * @since 2.0.0 + */ interface PostData { + /** + * @since 2.0.0 + */ contentType?: string, + /** + * @since 2.0.0 + */ content: Buffer, } @@ -27,6 +53,7 @@ declare namespace include { * Sends a basic GET request to a URL. * @param url The URL to send the request. * @param data + * @since 2.0.0 */ get(url: string, data?: GetData): HttpResponse; @@ -35,6 +62,7 @@ declare namespace include { * @param url The URL to send the request. * @param data * @param callback + * @since 2.0.0 */ getAsync(url: string, data: GetData, callback: (resp: HttpResponse) => void): void; @@ -42,6 +70,7 @@ declare namespace include { * Sends a basic POST request to a URL. * @param url The URL to send a POST request. * @param data + * @since 2.0.0 */ post(url: string, data?: PostData): HttpResponse; diff --git a/definitions/molang/Variable.d.ts b/definitions/molang/Variable.d.ts index a488ba7..3fb3096 100644 --- a/definitions/molang/Variable.d.ts +++ b/definitions/molang/Variable.d.ts @@ -1,3 +1,9 @@ +/** + * @since 2.0.0 + */ declare interface MolangVariable { + /** + * @since 2.0.0 + */ number: number; } \ No newline at end of file diff --git a/definitions/molang/Variables.d.ts b/definitions/molang/Variables.d.ts index a41bf2f..5533c09 100644 --- a/definitions/molang/Variables.d.ts +++ b/definitions/molang/Variables.d.ts @@ -1,3 +1,6 @@ +/** + * @since 2.0.0 + */ type MolangVariables = "variable.animation_frames_128x128" | "variable.animation_frames_32x32" | diff --git a/definitions/native/NativeModule.d.ts b/definitions/native/NativeModule.d.ts index c789421..20f058a 100644 --- a/definitions/native/NativeModule.d.ts +++ b/definitions/native/NativeModule.d.ts @@ -1,7 +1,11 @@ +/** + * @since 2.0.0 + */ type NativeType = "void" | "float32" | "float64" | "int32" | "int64"; /** * A class representing a native DLL. + * @since 2.0.0 */ declare class NativeModule { /** @@ -11,11 +15,13 @@ declare class NativeModule { * * This method is restricted to prevent cheating. * @param moduleName The module name, e.g. `"User32.dll"` + * @since 2.0.0 */ static get(moduleName: string): NativeModule | null; /** * The current handle of the module. Warning: will be truncated to Float64 + * @since 2.0.0 */ readonly handle: number; @@ -31,6 +37,7 @@ declare class NativeModule { * @param functionName The procedure name. * @param returnType The return type that is expected. * @param args Arguments to pass to the function. The maximum arguments is 15. + * @since 2.0.0 */ public call(functionName: string, returnType: NativeType, ...args: any[]): number | undefined; } \ No newline at end of file diff --git a/definitions/plugin.d.ts b/definitions/plugin.d.ts index b43cf23..7acea0d 100644 --- a/definitions/plugin.d.ts +++ b/definitions/plugin.d.ts @@ -1,19 +1,44 @@ +/** + * @since 2.0.0 + */ declare const enum Permission { + /** + * @since 2.0.0 + */ SystemAccess = "permission.system_access", } +/** + * @since 2.0.0 + */ interface IPlugin { + /** + * @since 2.0.0 + */ readonly name: string; + /** + * @since 2.0.0 + */ readonly author: string; + /** + * @since 2.0.0 + */ readonly version: string; + /** + * @since 2.0.0 + */ readonly description: string; /** * Requests a permission. * @param permission The permissions to request. * @returns Whether or not the permission was requested. + * @since 2.0.0 */ requestPermission(permission: Permission): boolean; } +/** + * @since 2.0.0 + */ declare const plugin: IPlugin; \ No newline at end of file diff --git a/definitions/script.d.ts b/definitions/script.d.ts index 899bcc0..d9f6fd8 100644 --- a/definitions/script.d.ts +++ b/definitions/script.d.ts @@ -1,24 +1,39 @@ +/** + * @since 2.0.0 + */ interface EngineLibraries { + /** + * @since 2.0.0 + */ "filesystem": include.Filesystem + /** + * @since 2.0.0 + */ "http": include.HTTP + /** + * @since 2.0.0 + */ "clipboard": include.Clipboard } /** * Adds chat message(s) to the chat. * @param contents The contents to send to chat. They will be separated into different chat messages. + * @since 2.0.0 */ declare function clientMessage(... messages: any[]): void; /** * Load a specified library. * @param library The Latite Scripting engine built-in library. + * @since 2.0.0 */ declare function require(library: K): EngineLibraries[K]; /** * Load and run a specified JavaScript module. This returns whatever is in `exports` or `module.exports` of the JavaScript module. * @param path The path to load the JavaScript file. + * @since 2.0.0 */ declare function require(path: string): any; @@ -27,6 +42,7 @@ declare function require(path: string): any; * * **Warning**: This stops execution of both the JavaScript runtime and the game thread. This is only for specific use cases (use setTimeout instead.) * @param ms The amount of time to sleep. + * @since 2.0.0 */ declare function sleep(ms: number): void; @@ -35,6 +51,7 @@ declare function sleep(ms: number): void; * @param func The function to call * @param timeout The time in milliseconds * @returns The Timeout ID + * @since 2.0.0 */ declare function setTimeout(func: () => void, timeout: number): number; @@ -43,24 +60,31 @@ declare function setTimeout(func: () => void, timeout: number): number; * @param func The function to call * @param timeout The time in milliseconds * @returns The Interval ID + * @since 2.0.0 */ declare function setInterval(func: () => void, timeout: number): number; /** * Cancels a timeout with a specified ID (stops it from executing.) No effect if the id is invalid. * @param timeoutId A valid Timeout ID. It is the return value of the `setTimeout` function. + * @since 2.0.0 */ declare function clearTimeout(timeoutId: number): void; /** * Cancels an interval with a specified ID (stops it from executing.) No effect if the id is invalid. * @param intervalId A valid Interval ID. It is the return value of the `setInterval` function. + * @since 2.0.0 */ declare function clearInterval(intervalId: number): void; +/** + * @since 2.0.0 + */ interface ScriptModule { /** * What the script exports. + * @since 2.0.0 */ exports: {} } diff --git a/definitions/util/buffer.d.ts b/definitions/util/buffer.d.ts index 479fbe3..8e157ae 100644 --- a/definitions/util/buffer.d.ts +++ b/definitions/util/buffer.d.ts @@ -1,13 +1,48 @@ +/** + * @since 2.0.0 + */ declare interface Uint8Array { + /** + * + * @param idx + * @since 2.0.0 + */ readInt16(idx: number): number; + /** + * + * @param idx + * @since 2.0.0 + */ readInt32(idx: number): number; + /** + * + * @param idx + * @since 2.0.0 + */ readInt64AsFloat(idx: number): number; + /** + * + * @param idx + * @since 2.0.0 + */ readFloat32(idx: number): number; + /** + * + * @param idx + * @since 2.0.0 + */ readFloat64(idx: number): number; - /// Reads a null-terminated string + /** + * Reads a null-terminated string. + * @param idx + * @since 2.0.0 + */ readString(idx: number): string; } +/** + * @since 2.0.0 + */ declare type Buffer = Uint8Array; \ No newline at end of file diff --git a/definitions/util/util.d.ts b/definitions/util/util.d.ts index 33e33de..f3afa80 100644 --- a/definitions/util/util.d.ts +++ b/definitions/util/util.d.ts @@ -1,14 +1,22 @@ +/** + * @since 2.0.0 + */ interface IUtil { /** * Converts a buffer into a UTF-8 string. * @param buf + * @since 2.0.0 */ bufferToString(buf: Buffer): string; /** * Converts a string to a UTF-8 buffer. * @param str + * @since 2.0.0 */ stringToBuffer(str: string): Buffer; } +/** + * @since 2.0.0 + */ declare var util: IUtil; \ No newline at end of file diff --git a/definitions/world/block.d.ts b/definitions/world/block.d.ts index 1b3a37f..47640a9 100644 --- a/definitions/world/block.d.ts +++ b/definitions/world/block.d.ts @@ -1,15 +1,21 @@ +/** + * @since 2.0.0 + */ declare class Block { /** * Example: minecraft:deepslate_diamond_ore + * @since 2.0.0 */ public readonly name: string; /** * Examle: tile.stone.stone + * @since 2.0.0 */ public readonly translateName: string; /** * Example: itemGroup.name.ore + * @since 2.0.0 */ public readonly itemGroupName: string; } \ No newline at end of file diff --git a/definitions/world/dimension.d.ts b/definitions/world/dimension.d.ts index 1636a06..71698b1 100644 --- a/definitions/world/dimension.d.ts +++ b/definitions/world/dimension.d.ts @@ -1,6 +1,10 @@ +/** + * @since 2.0.0 + */ declare interface Dimension { /** * Returns `true` if in a dimension, returns `false` if not. You will only be able to use the Dimension methods if you are in a world. + * @since 2.0.0 */ exists(): boolean; @@ -9,15 +13,19 @@ declare interface Dimension { * @param x Integer for x coordinate * @param y Integer for y coordinate * @param z Integer for z coordinate + * @since 2.0.0 */ getBlock(x: number, y: number, z: number): Block; /** * Gets the dimension's name, for example, `"Overworld"` + * @since 2.0.0 */ getName(): string; } - -declare const dimension: Dimension; +/** + * @since 2.0.0 + */ +declare const dimension: Dimension; \ No newline at end of file diff --git a/definitions/world/entity.d.ts b/definitions/world/entity.d.ts index 66c2bc5..2033bf7 100644 --- a/definitions/world/entity.d.ts +++ b/definitions/world/entity.d.ts @@ -1,58 +1,69 @@ /** * A class representing an in-game entity. + * @since 2.0.0 */ declare class Entity { /** * The runtime ID of the entity. Local player is always 1. + * @since 2.0.0 */ readonly runtimeId: number; /** * Check if the entity is still valid. In some cases, Latite may invalidate an entity outside of an * event listener. This is to prevent the scripting engine from being used as a cheat. + * @since 2.0.0 */ isValid(): boolean; /** * Get the position. Note that this will fail if you dont have permission to get the position * @throws + * @since 2.0.0 */ getPosition(): Vector3; /** * Get the interpolated position. Use this in the context of rendering based on entity position. + * @since 2.0.0 */ getPositionInterpolated(): Vector3; /** * Get the position the entity was in the last tick. + * @since 2.0.0 */ getPreviousPosition(): Vector3; /** * Get the rotation. Note that this will fail if you dont have permission to get the rotation * @throws + * @since 2.0.0 */ getRotation(): Vector2; /** * Get the dimension name. * for example, "Overworld" + * @since 2.0.0 */ getDimensionName(): string; /** * Gets the number of ticks that the entity is invulnerable (after the entity is hit/hurt), ranges from 0-10 + * @since 2.0.0 */ getHurtTime(): number; /** * Whether the entity is a player or not. + * @since 2.0.0 */ isPlayer(): boolean; /** * Whether the entity is the local player (yourself) or not. + * @since 2.0.0 */ isLocalPlayer(): boolean; @@ -60,6 +71,7 @@ declare class Entity { * Gets the entity type ID. * * https://minecraft.fandom.com/wiki/Bedrock_Edition_data_values#Entity_IDs + * @since 2.0.0 */ getEntityType(): number; @@ -68,6 +80,7 @@ declare class Entity { * * This function is restricted - meaning it will only work on LocalPlayer or if you have OP * @throws + * @since 2.0.0 */ attack(): void; @@ -75,6 +88,7 @@ declare class Entity { * Gets the health of the entity. * * This function is restricted - meaning it will only work on LocalPlayer or if you have OP + * @since 2.0.0 */ getHealth(): number; @@ -82,6 +96,7 @@ declare class Entity { * Gets the hunger of the entity. * * This function is restricted - meaning it will only work on LocalPlayer or if you have OP + * @since 2.0.0 */ getHunger(): number; @@ -89,18 +104,21 @@ declare class Entity { * Gets the saturation of the entity. * * This function is restricted - meaning it will only work on LocalPlayer or if you have OP + * @since 2.0.0 */ getSaturation(): number; /** * Gets the value of a MoLang variable. Returns `null` if the variable was not found. * @param name The variable name. Example: `variable.is_sneaking` + * @since 2.0.0 */ getMolangVariable(name: MolangVariables): MolangVariable; /** * Gets the value of a MoLang variable. Returns `null` if the variable was not found. * @param name The variable name. Example: `variable.is_sneaking` + * @since 2.0.0 */ getMolangVariable(name: string): MolangVariable | null; @@ -108,12 +126,14 @@ declare class Entity { * [Experimental] sets a MoLang variable's value. Returns `null` if unsuccessful and the number that was set if it was successful. * @param name The variable name. Example: `variable.is_sneaking` * @param value The variable's new value. + * @since 2.0.0 */ setMolangVariable(name: string, value: number): number | null; /** * Gets a status flag's state in the current entity. * @param type The entity status flag to get + * @since 2.1.0 */ getFlag(flag: number): boolean; @@ -122,6 +142,7 @@ declare class Entity { * Sets a status flag's state in the current entity. * @param type The entity status flag to get * @param value The new status flag value. + * @since 2.1.0 */ setFlag(flag: number, value: boolean): void; } @@ -129,55 +150,79 @@ declare class Entity { declare class Player extends Entity { /** * Get the player's name (same one as the player list in the pause menu.) + * @since 2.0.0 */ getName(): string; /** * Gets the player's Xbox User ID. + * @since 2.0.0 */ getXUID(): string; /** * Gets the item being held. + * @since 2.0.0 */ getHoldingItem(): ItemStack; /** * Gets the slot of the item being held. + * @since 2.0.0 */ getSelectedSlot(): number; /** * Gets the item at the current inventory slot. Will return null if the specified slot is out of bounds * @param slot The slot number + * @since 2.0.0 */ getItem(slot: number): ItemStack | null; } +/** + * @since 2.0.0 + */ declare const enum LookingAt { + /** + * @since 2.0.0 + */ Block, + /** + * @since 2.0.0 + */ Entity, + /** + * @since 2.0.0 + */ Air } +/** + * @since 2.0.0 + */ declare class LocalPlayer extends Player { /** * Get the progress of breaking a block (ranging from 0 to 1) + * @since 2.0.0 */ getBreakProgress(): number; /** * Same as `getBreakProgress` but doesn't reset + * @since 2.0.0 */ getLastBreakProgress(): number; /** * Get the type of whatever the player is looking at. + * @since 2.0.0 */ getLookingAt(): LookingAt; /** * Get the block selected by looking at it. Will return null if no block is selected. + * @since 2.0.0 */ getSelectedBlock(): Vector3 | null; } \ No newline at end of file diff --git a/definitions/world/item.d.ts b/definitions/world/item.d.ts index fd82d5c..1197122 100644 --- a/definitions/world/item.d.ts +++ b/definitions/world/item.d.ts @@ -1,47 +1,57 @@ /** * A class representing a Minecraft Item definition (not an item instance) + * @since 2.0.0 */ declare class Item { /** * The Namespaced ID of the item (e.g. `minecraft:stone`) + * @since 2.0.0 */ public readonly name: string; /** * The translate name of the item (e.g. `item.stone`) + * @since 2.0.0 */ public readonly translateName: string; } /** * An instance of an `Item` (has count, damage, etc.) + * @since 2.0.0 */ declare class ItemStack { /** * The item type. Will be `null` when the item is air. + * @since 2.0.0 */ public readonly item: Item | null; /** * The auxiliary/data value of the item (not damage) (-32768 to 32767) + * @since 2.0.0 */ public readonly aux: number; /** * Get the display name (e.g. `Cooked Beef`) + * @since 2.0.0 */ getDisplayName(): string; /** * Gets the number of items in the stack + * @since 2.0.0 */ getCount(): number; /** * Gets the pickup time in milliseconds + * @since 2.0.0 */ getPickupTime(): number; /** * Gets the damage of the item (e.g. if a sword was used once, it would have a damage value of 1) + * @since 2.0.0 */ getDamage(): number; } \ No newline at end of file diff --git a/definitions/world/world.d.ts b/definitions/world/world.d.ts index 78e35a4..2d5f7f1 100644 --- a/definitions/world/world.d.ts +++ b/definitions/world/world.d.ts @@ -1,32 +1,44 @@ +/** + * @since 2.0.0 + */ declare interface World { /** * Returns `true` if in a world, returns `false` if not. You will only be able to use the World methods if you are in a world. + * @since 2.0.0 */ exists(): boolean; /** * The saved world name. + * @since 2.0.0 */ getName(): string; /** * Gets the name of the players connected to the world. + * @since 2.0.0 */ getPlayers(): string[]; /** * Returns true if it's your own local world. Returns false if not. + * @since 2.0.0 */ isLocalWorld(): boolean; /** * Gets the clientside entity list (only if you have operator otherwise it will only return you) + * @since 2.0.0 */ getEntities(): Entity[]; /** * Gets the clientside number of entities (including you) + * @since 2.0.0 */ getEntityCount(): number; } +/** + * @since 2.0.0 + */ declare const world: World; \ No newline at end of file