diff options
| -rw-r--r-- | apps/website/tsconfig.json | 9 | ||||
| -rw-r--r-- | pkgs/ctjs/index.js | 3 | ||||
| -rw-r--r-- | pkgs/ctjs/metadata.json | 9 | ||||
| -rw-r--r-- | pkgs/ctjs/package.json | 4 | ||||
| -rw-r--r-- | pkgs/ctjs/types/ctjs.d.ts | 14053 | ||||
| -rw-r--r-- | pkgs/ctjs/types/schema.json | 77 | ||||
| -rw-r--r-- | pnpm-lock.yaml | 4 | ||||
| -rw-r--r-- | pnpm-workspace.yaml | 3 |
8 files changed, 14160 insertions, 2 deletions
diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 5378929..17881e6 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -1,3 +1,10 @@ { - "extends": "astro/tsconfigs/base" + "extends": "astro/tsconfigs/base", + "compilerOptions": { + "paths": { + "@layouts/*": ["src/layouts/*"], + "@components/*": ["src/components/*"], + "@pages/*": ["src/pages/*"] + } + } } diff --git a/pkgs/ctjs/index.js b/pkgs/ctjs/index.js new file mode 100644 index 0000000..33d0d83 --- /dev/null +++ b/pkgs/ctjs/index.js @@ -0,0 +1,3 @@ +/// <reference types="./types/ctjs.d.ts" /> +/// <reference lib="es2015" /> + diff --git a/pkgs/ctjs/metadata.json b/pkgs/ctjs/metadata.json new file mode 100644 index 0000000..07496c0 --- /dev/null +++ b/pkgs/ctjs/metadata.json @@ -0,0 +1,9 @@ +{ + "$schema": "./types/schema.json", + "name": "OneConfig", + "creator": "Polyfrost", + "entry": "index.js", + "isRequired": true, + "version": "1.0.0", + "description": "A module that provides functions for the OneConfig API." +} diff --git a/pkgs/ctjs/package.json b/pkgs/ctjs/package.json new file mode 100644 index 0000000..feb19d9 --- /dev/null +++ b/pkgs/ctjs/package.json @@ -0,0 +1,4 @@ +{ + "name": "@polyfrost/ctjs", + "version": "0.1.0" +} diff --git a/pkgs/ctjs/types/ctjs.d.ts b/pkgs/ctjs/types/ctjs.d.ts new file mode 100644 index 0000000..f10cc1c --- /dev/null +++ b/pkgs/ctjs/types/ctjs.d.ts @@ -0,0 +1,14053 @@ +// Type definitions for Chattriggers +// Definitions by: Maxssho13, also a lot of credit to Matt for inspiration and reference + +/// <reference no-default-lib="true" /> +/// <reference lib="es2015" /> +export {}; // this line converts this into a module, allowing for importing and modifying global scope +// everything in global will be put into the global scope + +declare global { + const GuiHandler: GuiHandler; + const Java: Java; + /** + * Helper method register a trigger. + * + * Called by taking the original name of the method, i.e. `registerChat`, + * removing the word register, and comparing it case-insensitively with + * the methods below. + * + * Can also be passed a class of type + * {@link ForgeEvent net.minecraftforge.fml.common.eventhandler.Event} as the first parameter + * to register functions for arbitrary forge events. + * + * @param triggerType the type of trigger + * @param method The name of the method or the actual method to callback when the event is fired + * @return The trigger for additional modification + */ + const register: IRegister; + const TriggerRegister: ITriggerRegister; + const InteractAction: typeof ForgePlayerInteractEvent.Action; + const Console: Console; + const Client: Client; + const NBT: NBT; + const Config: Config; + const ChatTriggers: Reference; + const console: console; + const GlStateManager: MCTGlStateManger; + const GL11: JavaGL11; + const GL12: JavaGL12; + const GL13: JavaGL13; + const GL14: JavaGL14; + const GL15: JavaGL15; + const GL20: JavaGL20; + const GL21: JavaGL21; + const GL30: JavaGL30; + const GL31: JavaGL31; + const GL32: JavaGL32; + const GL33: JavaGL33; + const GL40: JavaGL40; + const GL41: JavaGL41; + const GL42: JavaGL42; + const GL43: JavaGL43; + const GL44: JavaGL44; + const GL45: JavaGL45; + + const OnChatTrigger: typeof ChatTrigger; + const OnCommandTrigger: typeof CommandTrigger; + const OnRegularTrigger: typeof RegularTrigger; + const OnRenderTrigger: typeof EventTrigger; + const OnSoundPlayTrigger: typeof SoundPlayTrigger; + const OnStepTrigger: typeof StepTrigger; + const OnTrigger: typeof Trigger; + const Priority: typeof Trigger.Priority; + + // obfuscated type types + type MCTScoreboard = MCScoreboard; + type MCTScoreObjective = MCScoreObjective; + type MCTScorePlayerTeam = MCScorePlayerTeam; + type MCTTileEntity = MCTileEntity; + type MCTGuiContainer = MCGuiContainer; + type MCTSlot = MCSlot; + type MCTGlStateManger = MCGlStateManager; + type MCTBlock = MCBlock; + type MCTBlockPos = MCBlockPos; + type MCTItem = MCItem; + type MCTItemStack = MCItemStack; + type MCTEntityItem = MCEntityItem; + type MCTIBlockState = MCIBlockState; + type MCTIInventory = MCIInventory; + type MCTContainer = MCContainer; + type MCTEntity = MCEntity; + type MCTIChatComponent = MCIChatComponent; + type MCTNBTBase = MCNBTBase; + type MCTNBTTagCompound = MCNBTTagCompound; + type MCTChunk = MCChunk; + type MCTEnumFacing = MCEnumFacing; + type MCTNBTTagList = MCNBTTagList; + type MCTMinecraft = MCMinecraft; + type MCTNetHandlerPlayClient = MCNetHandlerPlayClient; + type MCTGuiNewChat = MCGuiNewChat; + type MCTGuiPlayerTabOverlay = MCGuiPlayerTabOverlay; + type MCTINetHandler = MCINetHandler; + type MCTPacket<T extends MCINetHandler> = MCPacket<T>; + type MCTGuiScreen = MCGuiScreen; + type MCTGameSettings = MCGameSettings; + type MCTEntityPlayer = MCEntityPlayer; + type MCTEntityPlayerSP = MCEntityPlayerSP; + type MCTKeyBinding = MCKeyBinding; + type MCTGuiButton = MCGuiButton; + type MCTDynamicTexture = MCDynamicTexture; + type MCTAbstractTexture = MCAbstractTexture; + type MCTSoundCategory = MCSoundCategory; + type MCTPotion = MCPotion; + type MCTPotionEffect = MCPotionEffect; + type MCTWorld = MCWorld; + type MCTEntityFX = MCEntityFX; + type MCTEnumParticleTypes = MCEnumParticleTypes; + type MCTFontRenderer = MCFontRenderer; + type MCTRenderManager = MCRenderManager; + type MCTEntityLivingBase = MCEntityLivingBase; + type MCTWorldClient = MCWorldClient; + type MCTScore = MCScore; + // forge paths + type ForgeTClientChatReceivedEvent = ForgeClientChatReceivedEvent; + type ForgeTRenderGameOverlayEvent = ForgeRenderGameOverlayEvent; + type ForgeTMouseEvent = ForgeMouseEvent; + type ForgeTPlaySoundEvent = ForgePlaySoundEvent; + type ForgeTConfigChangedEvent = ForgeConfigChangedEvent; + type ForgeTTickEvent = ForgeTickEvent; + type ForgeTNoteBlockEvent = ForgeNoteBlockEvent; + type ForgeTDrawBlockHighlightEvent = ForgeDrawBlockHighlightEvent; + type ForgeTGuiOpenEvent = ForgeGuiOpenEvent; + type ForgeTEntityItemPickupEvent = ForgeEntityItemPickupEvent; + type ForgeTPlayerInteractEvent = ForgePlayerInteractEvent; + type ForgeTGuiScreenEvent = ForgeGuiScreenEvent; + type ForgeTBlockEvent = ForgeBlockEvent; + // java paths + type JavaTGL11 = JavaGL11; + type JavaTGL12 = JavaGL12; + type JavaTGL13 = JavaGL13; + type JavaTGL14 = JavaGL14; + type JavaTGL15 = JavaGL15; + type JavaTGL20 = JavaGL20; + type JavaTGL21 = JavaGL21; + type JavaTGL30 = JavaGL30; + type JavaTGL31 = JavaGL31; + type JavaTGL32 = JavaGL32; + type JavaTGL33 = JavaGL33; + type JavaTGL40 = JavaGL40; + type JavaTGL41 = JavaGL41; + type JavaTGL42 = JavaGL42; + type JavaTGL43 = JavaGL43; + type JavaTGL44 = JavaGL44; + type JavaTGL45 = JavaGL45; + type JavaTThread = JavaThread; + type JavaTUUID = JavaUUID; + type JavaTFile = JavaFile; + type JavaTPath = JavaPath; + type JavaTFileNameFilter = JavaFileNameFilter; + type JavaTClass<T> = JavaClass<T>; + type JavaTURL = JavaURL; + type JavaTURI = JavaURI; + type JavaTURLStreamHandlerFactory = JavaURLStreamHandlerFactory; + type JavaTInputStream = JavaInputStream; + type JavaTURLConnection = JavaURLConnection; + type JavaTProxy = JavaProxy; + type JavaTSocketAddress = JavaSocketAddress; + type JavaTURLStreamHandler = JavaURLStreamHandler; + type JavaTField = JavaField; + type JavaTMethod = JavaMethod; + type JavaTBufferedImage = JavaBufferedImage; + type JavaTColor = JavaColor; + + function cancel( + event: + | ForgePlaySoundEvent + | CancellableEvent + | ForgeEvent + | (string | ForgeClientChatReceivedEvent), + ): void; + // extend prototype + interface String { + addFormatting(): string; + + addColor(): string; + + removeFormatting(): string; + + replaceFormatting(): string; + } + + function easeOut( + start: number, + finish: number, + speed: number, + jump: number, + ): number; + + function easeColor( + start: number, + finish: number, + speed: number, + jump: number, + ): number; + + function sync(func: Function, lock: any): any; + + function print(toPrint: any, end?: string, color?: JavaColor): void; + + function setTimeout(func: () => void, delay: number): void; + + interface Number { + easeOut(to: number, speed: number, jump: number): number; + + easeColor(to: number, speed: number, jump: number): number; + } + + enum LogType { + INFO, + WARN, + ERROR, + } + + class Slot { + constructor(mcSlot: MCSlot); + + readonly mcSlot: MCSlot; + + getMcSlot(): MCSlot; + + getIndex(): number; + + getDisplayX(): number; + + getDisplayY(): number; + + getInventory(): Inventory; + + getItem(): Item | null; + + toString(): string; + } + + class Renderer { + readonly colorized: number; + + BLACK: number; + static BLACK: number; + DARK_BLUE: number; + static DARK_BLUE: number; + DARK_GREEN: number; + static DARK_GREEN: number; + DARK_AQUA: number; + static DARK_AQUA: number; + DARK_RED: number; + static DARK_RED: number; + DARK_PURPLE: number; + static DARK_PURPLE: number; + GOLD: number; + static GOLD: number; + GRAY: number; + static GRAY: number; + DARK_GRAY: number; + static DARK_GRAY: number; + BLUE: number; + static BLUE: number; + GREEN: number; + static GREEN: number; + AQUA: number; + static AQUA: number; + RED: number; + static RED: number; + LIGHT_PURPLE: number; + static LIGHT_PURPLE: number; + YELLOW: number; + static YELLOW: number; + WHITE: number; + static WHITE: number; + + getColor(color: number): number; + static getColor(color: number): number; + + getFontRenderer(): MCFontRenderer; + static getFontRenderer(): MCFontRenderer; + + getRenderManager(): MCRenderManager; + static getRenderManager(): MCRenderManager; + + getStringWidth(text: string): number; + static getStringWidth(text: string): number; + + color(red: number, green: number, blue: number, alpha?: number): number; + static color( + red: number, + green: number, + blue: number, + alpha?: number, + ): number; + + getRainbow(step: number, speed?: number): number; + static getRainbow(step: number, speed?: number): number; + + getRainbowColors(step: number, speed?: number): number[]; + static getRainbowColors(step: number, speed?: number): number[]; + + retainTransforms(retain: boolean): void; + static retainTransforms(retain: boolean): void; + + translate(x: number, y: number, z?: number): void; + static translate(x: number, y: number, z?: number): void; + + scale(scaleX: number, scaleY?: number): void; + static scale(scaleX: number, scaleY?: number): void; + + rotate(angle: number): void; + static rotate(angle: number): void; + + colorize(red: number, green: number, blue: number, alpha?: number): void; + static colorize( + red: number, + green: number, + blue: number, + alpha?: number, + ): void; + + setDrawMode(drawMode: number): Renderer; + static setDrawMode(drawMode: number): Renderer; + + getDrawMode(): number; + static getDrawMode(): number; + + fixAlpha(color: number): number; + static fixAlpha(color: number): number; + + drawRect( + color: number, + x: number, + y: number, + width: number, + height: number, + ): void; + static drawRect( + color: number, + x: number, + y: number, + width: number, + height: number, + ): void; + + drawShape(color: number, ...vertexes: number[][]): void; + static drawShape(color: number, ...vertexes: number[][]): void; + + drawLine( + color: number, + x1: number, + y1: number, + x2: number, + y2: number, + thickness: number, + drawMode?: number, + ): void; + static drawLine( + color: number, + x1: number, + y1: number, + x2: number, + y2: number, + thickness: number, + drawMode?: number, + ): void; + + drawCircle( + color: number, + x: number, + y: number, + radius: number, + steps: number, + drawMode?: number, + ): void; + static drawCircle( + color: number, + x: number, + y: number, + radius: number, + steps: number, + drawMode?: number, + ): void; + + drawString(text: string, x: number, y: number, shadow?: boolean): void; + static drawString( + text: string, + x: number, + y: number, + shadow?: boolean, + ): void; + + drawStringWithShadow(text: string, x: number, y: number): void; + static drawStringWithShadow(text: string, x: number, y: number): void; + + drawImage( + image: Image, + x: number, + y: number, + width: number, + height: number, + ): void; + static drawImage( + image: Image, + x: number, + y: number, + width: number, + height: number, + ): void; + + drawPlayer( + player: PlayerMP | MCEntityPlayer | MCEntityLivingBase, + x: number, + y: number, + rotate?: boolean, + showNametag?: boolean, + showCape?: boolean, + showHeldItem?: boolean, + showArrows?: boolean, + ): void; + static drawPlayer( + player: PlayerMP | MCEntityPlayer | MCEntityLivingBase, + x: number, + y: number, + rotate?: boolean, + showNametag?: boolean, + showCape?: boolean, + showHeldItem?: boolean, + showArrows?: boolean, + ): void; + + finishDraw(): void; + static finishDraw(): void; + } + + namespace Renderer { + class screen { + getWidth(): number; + static getWidth(): number; + + getHeight(): number; + static getHeight(): number; + + getScale(): number; + static getScale(): number; + } + } + + class Shape { + constructor(color: number); + + copy(): Shape; + + clone(): Shape; + + getColor(): number; + setColor(color: number): Shape; + + getDrawMode(): number; + + /** + * Sets the GL draw mode of the shape. Possible draw modes are: + * 0 = points + * 1 = lines + * 2 = line loop + * 3 = line strip + * 5 = triangles + * 5 = triangle strip + * 6 = triangle fan + * 7 = quads + * 8 = quad strip + * 9 = polygon + */ + setDrawMode(drawMode: number): Shape; + + getVertexes(): Vector2f[]; + + addVertex(x: number, y: number): Shape; + + insertVertex(index: number, x: number, y: number): Shape; + + removeVertex(index: number): Shape; + + /** + * Sets the shape as a line pointing from [x1, y1] to [x2, y2] with a thickness + */ + setLine( + x1: number, + y1: number, + x2: number, + y2: number, + thickness: number, + ): Shape; + + /** + * Sets the shape as a circle with a center at [x, y] + * with radius and number of steps around the circle + */ + setCircle(x: number, y: number, radius: number, steps: number): Shape; + + draw(): Shape; + } + + class Rectangle { + constructor( + color: number, + x: number, + y: number, + width: number, + height: number, + ); + + getColor(): number; + setColor(color: number): Rectangle; + + getX(): number; + setX(x: number): Rectangle; + + getY(): number; + setY(y: number): Rectangle; + + getWidth(): number; + setWidth(width: number): Rectangle; + + getHeight(): number; + setHeight(height: number): Rectangle; + + isShadow(): boolean; + setShadow(shadow: boolean): Rectangle; + + getShadowOffset(): Vector2f; + + getShadowOffsetX(): number; + getShadowOffsetY(): number; + + setShadowOffset(x: number, y: number): Rectangle; + + setShadowOffsetX(x: number): Rectangle; + setShadowOffsetY(y: number): Rectangle; + + getShadowColor(): number; + setShadowColor(color: number): Rectangle; + + setShadow(color: number, x: number, y: number): Rectangle; + + getOutline(): boolean; + setOutline(outline: boolean): Rectangle; + + getOutlineColor(): number; + setOutlineColor(color: number): Rectangle; + + getThickness(): number; + setThickness(thickness: number): Rectangle; + + setOutline(color: number, thickness: number): Rectangle; + + draw(): Rectangle; + } + + class Tessellator { + static readonly INSTANCE: Tessellator; + + disableAlpha(): Tessellator; + static disableAlpha(): Tessellator; + + enableAlpha(): Tessellator; + static enableAlpha(): Tessellator; + + alphaFunc(func: number, ref: number): Tessellator; + static alphaFunc(func: number, ref: number): Tessellator; + + enableLighting(): Tessellator; + static enableLighting(): Tessellator; + + disableLighting(): Tessellator; + static disableLighting(): Tessellator; + + disableDepth(): Tessellator; + static disableDepth(): Tessellator; + + enableDepth(): Tessellator; + static enableDepth(): Tessellator; + + depthFunc(depthFunc: number): Tessellator; + static depthFunc(depthFunc: number): Tessellator; + + depthMask(flagIn: boolean): Tessellator; + static depthMask(flagIn: boolean): Tessellator; + + disableBlend(): Tessellator; + static disableBlend(): Tessellator; + + enableBlend(): Tessellator; + static enableBlend(): Tessellator; + + blendFunc(sourceFactor: number, destFactor: number): Tessellator; + static blendFunc(sourceFactor: number, destFactor: number): Tessellator; + + tryBlendFuncSeparate( + sourceFactor: number, + destFactor: number, + sourceFactorAlpha: number, + destFactorAlpha: number, + ): Tessellator; + static tryBlendFuncSeparate( + sourceFactor: number, + destFactor: number, + sourceFactorAlpha: number, + destFactorAlpha: number, + ): Tessellator; + + enableTexture2D(): Tessellator; + static enableTexture2D(): Tessellator; + + disableTexture2D(): Tessellator; + static disableTexture2D(): Tessellator; + + deleteTexture(texture: Image): Tessellator; + static deleteTexture(texture: Image): Tessellator; + + pushMatrix(): Tessellator; + static pushMatrix(): Tessellator; + + popMatrix(): Tessellator; + static popMatrix(): Tessellator; + + static getPartialTicks(): number; + getPartialTicks(): number; + static setPartialTicks(p: number): void; + setPartialTicks(p: number): void; + + /** + * Binds a texture to the client for the Tessellator to use. + * + * @param texture the texture to bind + * @return the Tessellator to allow for method chaining + */ + bindTexture(texture: Image): Tessellator; + /** + * Binds a texture to the client for the Tessellator to use. + * + * @param texture the texture to bind + * @return the Tessellator to allow for method chaining + */ + static bindTexture(texture: Image): Tessellator; + + /** + * Begin drawing with the Tessellator + * with default draw mode of quads and textured + * + * @param drawMode the GL draw mode + * @param textured if the Tessellator is textured + * @return the Tessellator to allow for method chaining + * @see com.chattriggers.ctjs.minecraft.libs.renderer.Shape.setDrawMode + */ + begin(drawMode?: number, textured?: boolean): Tessellator; + /** + * Begin drawing with the Tessellator + * with default draw mode of quads and textured + * + * @param drawMode the GL draw mode + * @param textured if the Tessellator is textured + * @return the Tessellator to allow for method chaining + * @see com.chattriggers.ctjs.minecraft.libs.renderer.Shape.setDrawMode + */ + static begin(drawMode?: number, textured?: boolean): Tessellator; + + /** + * Colorize the Tessellator. + * + * @param red the red value between 0 and 1 + * @param green the green value between 0 and 1 + * @param blue the blue value between 0 and 1 + * @param alpha the alpha value between 0 and 1 + * @return the Tessellator to allow for method chaining + */ + colorize( + red: number, + green: number, + blue: number, + alpha?: number, + ): Tessellator; + /** + * Colorize the Tessellator. + * + * @param red the red value between 0 and 1 + * @param green the green value between 0 and 1 + * @param blue the blue value between 0 and 1 + * @param alpha the alpha value between 0 and 1 + * @return the Tessellator to allow for method chaining + */ + static colorize( + red: number, + green: number, + blue: number, + alpha?: number, + ): Tessellator; + + /** + * Rotates the Tessellator in 3d space. + * Similar to {@link Renderer.rotate com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.rotate} + * + * @param angle the angle to rotate + * @param x if the rotation is around the x axis + * @param y if the rotation is around the y axis + * @param z if the rotation is around the z axis + * @return the Tessellator to allow for method chaining + */ + rotate(angle: number, x: number, y: number, z: number): Tessellator; + /** + * Rotates the Tessellator in 3d space. + * Similar to {@link Renderer.rotate com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.rotate} + * + * @param angle the angle to rotate + * @param x if the rotation is around the x axis + * @param y if the rotation is around the y axis + * @param z if the rotation is around the z axis + * @return the Tessellator to allow for method chaining + */ + static rotate(angle: number, x: number, y: number, z: number): Tessellator; + + /** + * Translates the Tessellator in 3d space. + * Similar to {@link Renderer.translate com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.translate} + * + * @param x the x position + * @param y the y position + * @param z the z position + * @return the Tessellator to allow for method chaining + */ + translate(x: number, y: number, z: number): Tessellator; + /** + * Translates the Tessellator in 3d space. + * Similar to {@link Renderer.translate com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.translate} + * + * @param x the x position + * @param y the y position + * @param z the z position + * @return the Tessellator to allow for method chaining + */ + static translate(x: number, y: number, z: number): Tessellator; + + /** + * Scales the Tessellator in 3d space. + * Similar to {@link Renderer.scale com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.scale} + * + * @param x scale in the x direction or all directions if y and z are not supplied + * @param y scale in the y direction + * @param z scale in the z direction + * @return the Tessellator to allow for method chaining + */ + scale(x: number, y?: number, z?: number): Tessellator; + /** + * Scales the Tessellator in 3d space. + * Similar to {@link Renderer.scale com.chattriggers.ctjs.minecraft.libs.renderer.Renderer.scale} + * + * @param x scale in the x direction or all directions if y and z are not supplied + * @param y scale in the y direction + * @param z scale in the z direction + * @return the Tessellator to allow for method chaining + */ + static scale(x: number, y?: number, z?: number): Tessellator; + + /** + * Sets a new vertex in the Tessellator. + * + * @param x the x position + * @param y the y position + * @param z the z position + * @return the Tessellator to allow for method chaining + */ + pos(x: number, y: number, z: number): Tessellator; + /** + * Sets a new vertex in the Tessellator. + * + * @param x the x position + * @param y the y position + * @param z the z position + * @return the Tessellator to allow for method chaining + */ + static pos(x: number, y: number, z: number): Tessellator; + + /** + * Sets the texture location on the last defined vertex. + * Use directly after using {@link Tessellator.pos} + * + * @param u the u position in the texture + * @param v the v position in the texture + * @return the Tessellator to allow for method chaining + */ + tex(u: number, v: number): Tessellator; + /** + * Sets the texture location on the last defined vertex. + * Use directly after using {@link Tessellator.pos} + * + * @param u the u position in the texture + * @param v the v position in the texture + * @return the Tessellator to allow for method chaining + */ + static tex(u: number, v: number): Tessellator; + + /** + * Finalizes and draws the Tessellator. + */ + draw(): void; + /** + * Finalizes and draws the Tessellator. + */ + static draw(): void; + + /** + * Gets a fixed render position from x, y, and z inputs adjusted with partial ticks + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + * @return the Vector3f position to render at + */ + getRenderPos(x: number, y: number, z: number): Vector3f; + /** + * Gets a fixed render position from x, y, and z inputs adjusted with partial ticks + * @param x the X coordinate + * @param y the Y coordinate + * @param z the Z coordinate + * @return the Vector3f position to render at + */ + static getRenderPos(x: number, y: number, z: number): Vector3f; + + /** + * Renders floating lines of text in the 3D world at a specific position. + * + * @param text The string array of text to render + * @param x X coordinate in the game world + * @param y Y coordinate in the game world + * @param z Z coordinate in the game world + * @param color the color of the text + * @param renderBlackBox render a pretty black border behind the text + * @param scale the scale of the text + * @param increase whether to scale the text up as the player moves away + */ + drawString( + text: string, + x: number, + y: number, + z: number, + color?: number, + renderBlackBox?: boolean, + scale?: number, + increase?: boolean, + ): void; + /** + * Renders floating lines of text in the 3D world at a specific position. + * + * @param text The string array of text to render + * @param x X coordinate in the game world + * @param y Y coordinate in the game world + * @param z Z coordinate in the game world + * @param color the color of the text + * @param renderBlackBox render a pretty black border behind the text + * @param scale the scale of the text + * @param increase whether to scale the text up as the player moves away + */ + static drawString( + text: string, + x: number, + y: number, + z: number, + color?: number, + renderBlackBox?: boolean, + scale?: number, + increase?: boolean, + ): void; + } + + class MathLib { + /** + * Maps a number from one range to another. + * + * @param number the number to map + * @param in_min the original range min + * @param in_max the original range max + * @param out_min the final range min + * @param out_max the final range max + * @return the re-mapped number + */ + map( + number: number, + in_min: number, + in_max: number, + out_min: number, + out_max: number, + ): number; + /** + * Maps a number from one range to another. + * + * @param number the number to map + * @param in_min the original range min + * @param in_max the original range max + * @param out_min the final range min + * @param out_max the final range max + * @return the re-mapped number + */ + static map( + number: number, + in_min: number, + in_max: number, + out_min: number, + out_max: number, + ): number; + + /** + * Clamps a floating number between two values. + * + * @param number the number to clamp + * @param min the minimum + * @param max the maximum + * @return the clamped number + */ + clampFloat(number: number, min: number, max: number): number; + /** + * Clamps a floating number between two values. + * + * @param number the number to clamp + * @param min the minimum + * @param max the maximum + * @return the clamped number + */ + static clampFloat(number: number, min: number, max: number): number; + + /** + * Clamps an integer number between two values. + * + * @param number the number to clamp + * @param min the minimum + * @param max the maximum + * @return the clamped number + */ + clamp(number: number, min: number, max: number): number; + /** + * Clamps an integer number between two values. + * + * @param number the number to clamp + * @param min the minimum + * @param max the maximum + * @return the clamped number + */ + static clamp(number: number, min: number, max: number): number; + } + /** + * Instances a new Sound with certain properties. These properties + * should be passed through as a normal JavaScript object. + * + * REQUIRED: + * - source (String) - filename, relative to ChatTriggers assets directory + * + * OPTIONAL: + * - priority (boolean) - whether or not this sound should be prioritized, defaults to false + * - loop (boolean) - whether or not to loop this sound over and over, defaults to false + * - stream (boolean) - whether or not to stream this sound rather than preload it (should be true for large files), defaults to false + * + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * - category (String) - which category this sound should be a part of, see {@link setCategory}. + * - volume (float) - volume of the sound, see {@link setVolume} + * - pitch (float) - pitch of the sound, see {@link setPitch} + * - x, y, z (float) - location of the sound, see {@link setPosition}. Defaults to the players position. + * - attenuation (int) - fade out model of the sound, see {@link setAttenuation} + * + * @param config the JavaScript config object + */ + class Sound { + constructor(config: ISoundConfig); + + isListening: boolean; + + /** + * Sets the category of this sound, making it respect the Player's sound volume sliders. + * Options are: master, music, record, weather, block, hostile, neutral, player, and ambient + * + * @param category the category + */ + setCategory(category: string): Sound; + + /** + * Sets this sound's volume. + * Will override the category if called after {@link setCategory}, but not if called before. + * + * @param volume New volume, float value ( 0.0f - 1.0f ). + */ + setVolume(volume: number): Sound; + + getVolume(): number; + + /** + * Updates the position of this sound + * + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + */ + setPosition(x: number, y: number, z: number): Sound; + + /** + * Sets this sound's pitch. + * + * @param pitch A float value ( 0.5f - 2.0f ). + */ + setPitch(pitch: number): Sound; + + getPitch(): number; + + /** + * Sets the attenuation (fade out over space) of the song. + * Models are: + * NONE(0) - no fade + * ROLLOFF(1) - this is the default, meant to be somewhat realistic + * LINEAR(2) - fades out linearly, as the name implies + * + * @param model the model + */ + setAttenuation(model: number): Sound; + + /** + * Plays/resumes the sound + */ + play(): void; + + /** + * Pauses the sound, to be resumed later + */ + pause(): void; + + /** + * Completely stops the sound + */ + stop(): void; + + /** + * Immediately restarts the sound + */ + rewind(): void; + } + + interface ISoundConfig { + /**filename, relative to ChatTriggers assets directory */ + source: string; + /**whether or not this sound should be prioritized, defaults to false */ + priority?: boolean; + /**whether or not to loop this sound over and over, defaults to false */ + loop?: boolean; + /**whether or not to stream this sound rather than preload it (should be true for large files), defaults to false */ + stream?: boolean; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * which category this sound should be a part of, see {@link #setCategory(String)} + */ + category?: + | "MASTER" + | "MUSIC" + | "RECORDS" + | "WEATHER" + | "BLOCKS" + | "MOBS" + | "ANIMALS" + | "PLAYERS" + | "AMBIENT"; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * volume of the sound, see {@link #setVolum |
