From dcc90017baaafa74c79acaa053535d73b6222475 Mon Sep 17 00:00:00 2001 From: Pauline Date: Thu, 31 Aug 2023 08:09:34 -0400 Subject: feat(ctjs): initial work on ctjs --- apps/website/tsconfig.json | 9 +- pkgs/ctjs/index.js | 3 + pkgs/ctjs/metadata.json | 9 + pkgs/ctjs/package.json | 4 + pkgs/ctjs/types/ctjs.d.ts | 14053 ++++++++++++++++++++++++++++++++++++++++++ pkgs/ctjs/types/schema.json | 77 + pnpm-lock.yaml | 4 + pnpm-workspace.yaml | 3 +- 8 files changed, 14160 insertions(+), 2 deletions(-) create mode 100644 pkgs/ctjs/index.js create mode 100644 pkgs/ctjs/metadata.json create mode 100644 pkgs/ctjs/package.json create mode 100644 pkgs/ctjs/types/ctjs.d.ts create mode 100644 pkgs/ctjs/types/schema.json 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 @@ +/// +/// + 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 + +/// +/// +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 = MCPacket; + 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 = JavaClass; + 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 #setVolume(float)} + **/ + volume?: number; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * pitch of the sound, see {@link #setPitch(float)} + */ + pitch?: number; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * location of the sound, see {@link #setPosition(float, float, float)}. Defaults to the players position + */ + x?: number; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * location of the sound, see {@link #setPosition(float, float, float)}. Defaults to the players position + */ + y?: number; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * location of the sound, see {@link #setPosition(float, float, float)}. Defaults to the players position + */ + z?: number; + /** + * CONFIGURABLE (can be set in config object, or changed later, but MAKE SURE THE WORLD HAS LOADED) + * fade out model of the sound, see {@link #setAttenuation(int)} + */ + attenuation?: number; + } + + class Chunk { + constructor(chunk: MCChunk); + readonly chunk: MCChunk; + + /** + * Gets the x position of the chunk + */ + getX(): number; + /** + * Gets the z position of the chunk + */ + getZ(): number; + + /** + * Gets the minimum x coordinate of a block in the chunk + * + * @return the minimum x coordinate + */ + getMinBlockX(): number; + + /** + * Gets the minimum z coordinate of a block in the chunk + * + * @return the minimum z coordinate + */ + getMinBlockZ(): number; + + /** + * Gets the skylight level at the given position. This is the value seen in the debug (F3) menu + * + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the skylight level at the location + */ + getSkyLightLevel(x: number, y: number, z: number): number; + + /** + * Gets the block light level at the given position. This is the value seen in the debug (F3) menu + * + * @param x the x coordinate + * @param y the y coordinate + * @param z the z coordinate + * @return the block light level at the location + */ + getBlockLightLevel(x: number, y: number, z: number): number; + + /** + * Gets every entity in this chunk + * + * @return the entity list + */ + getAllEntities(): Entity[]; + + /** + * Gets every entity in this chunk of a certain class + * + * @param clazz the class to filter for (Use `Java.type().class` to get this) + * @return the entity list + */ + getAllEntitiesOfType(clazz: JavaClass): Entity[]; + + /** + * Gets every tile entity in this chunk + * + * @return the tile entity list + */ + getAllTileEntities(): TileEntity[]; + + /** + * Gets every tile entity in this chunk of a certain class + * + * @param clazz the class to filter for (Use `Java.type().class` to get this) + * @return the tile entity list + */ + getAllTileEntitiesOfType(clazz: JavaClass): TileEntity[]; + } + + class PotionEffect { + readonly effect: MCPotionEffect; + + constructor(effect: MCPotionEffect); + + /** + * Returns the translation key of the potion. + * Ex: "potion.poison" + */ + getName(): string; + + /** + * Returns the localized name of the potion that + * is displayed in the player's inventory. + * Ex: "Poison" + */ + getLocalizedName(): string; + + getAmplifier(): number; + + getDuration(): number; + + getID(): number; + + isAmbient(): boolean; + + isDurationMax(): boolean; + + showsParticles(): boolean; + + toString(): string; + } + + class BlockFace { + readonly oppositeIndex: number; + readonly axisDirection: BlockFace$AxisDirection; + readonly axis: BlockFace$Axis; + readonly directionVec: Vec3i; + + constructor( + oppositeIndex: number, + axisDirection: BlockFace$AxisDirection, + axis: BlockFace$Axis, + directionVec: Vec3i, + ); + + static readonly DOWN: BlockFace; + static readonly UP: BlockFace; + static readonly NORTH: BlockFace; + static readonly SOUTH: BlockFace; + static readonly WEST: BlockFace; + static readonly EAST: BlockFace; + + getOpposite(): BlockFace; + + getOffsetX(): number; + getOffsetY(): number; + getOffsetZ(): number; + + rotateAround(axis: BlockFace$Axis): BlockFace; + + rotateX(): BlockFace; + rotateY(): BlockFace; + rotateZ(): BlockFace; + + getName(): string; + + static readonly Plane: typeof BlockFace$Plane; + static readonly AxisDirection: typeof BlockFace$AxisDirection; + static readonly Axis: typeof BlockFace$Axis; + + static fromMCEnumFacing(facing: MCEnumFacing): BlockFace; + } + + class BlockPos extends Vec3i { + constructor(x: number, y: number, z: number); + + constructor(pos: Vec3i); + constructor(pos: MCBlockPos); + constructor(source: Entity); + + add(other: Vec3i): BlockPos; + add(x: number, y: number, z: number): BlockPos; + + plus(other: Vec3i): BlockPos; + + subtract(other: Vec3i): BlockPos; + subtract(x: number, y: number, z: number): BlockPos; + + minus(other: Vec3i): BlockPos; + + up(n?: number): BlockPos; + down(n?: number): BlockPos; + north(n?: number): BlockPos; + south(n?: number): BlockPos; + east(n?: number): BlockPos; + west(n?: number): BlockPos; + + offset(facing: BlockFace, n?: number): BlockPos; + + toMCBlock(): MCBlockPos; + } + + /** + * An immutable wrapper around Minecraft's Block object. Note + * that this references a block "type", and not an actual block + * in the world. If a reference to a particular block is needed, + * use {@link Block} + */ + class BlockType { + readonly mcBlock: MCBlock; + + constructor(block: BlockType); + constructor(blockName: string); + constructor(blockID: number); + constructor(item: Item); + + /** + * Returns a Block based on this block and the + * provided BlockPos + * + * @param blockPos the block position + * @return a Block object + */ + withBlockPos(blockPos: BlockPos): Block; + + getID(): number; + + /** + * Gets the block's registry name. + * Example: minecraft:planks + * + * @return the block's registry name + */ + getRegistryName(): string; + + /** + * Gets the block's unlocalized name. + * Example: tile.wood + * + * @return the block's unlocalized name + */ + getUnlocalizedName(): string; + + /** + * Gets the block's localized name. + * Example: Wooden Planks + * + * @return the block's localized name + */ + getName(): string; + + getLightValue(): number; + + getDefaultState(): MCIBlockState; + + getDefaultMetadata(): number; + + canProvidePower(): boolean; + + getHarvestLevel(): number; + + isTranslucent(): boolean; + + toString(): `BlockType{name=${string}}`; + } + + class Vec3i { + readonly x: number; + readonly y: number; + readonly z: number; + + constructor(x: number, y: number, z: number); + + crossProduct(other: Vec3i): Vec3i; + + distanceSq(other: Vec3i): number; + + distance(other: Vec3i): number; + + distanceSqToCenter(x: number, y: number, z: number): number; + + compareTo(other: Vec3i): number; + + equals(other: any): boolean; + + hashCode(): number; + + toString(): `Vec3i{x=${number},y=${number},z=${number}}`; + } + + class NBTBase { + constructor(rawNBT: MCNBTBase); + readonly rawNBT: MCNBTBase; + /**Gets the type byte for the tag. */ + getId(): number; + /**Creates a clone of the tag. */ + copy(): MCNBTBase; + /**Return whether this compound has no tags. */ + hasNoTags(): boolean; + hasTags(): boolean; + + equals(other: any): boolean; + + hashCode(): number; + + toString(): string; + } + + class NBTTagCompound extends NBTBase { + constructor(rawNBT: MCNBTTagCompound); + readonly rawNBT: MCNBTTagCompound; + tagMap: Map; + + getTagMap(): NBTTagCompound["tagMap"]; + + keySet: Set; + + getKeySet(): NBTTagCompound["keySet"]; + + NBTDataType: typeof NBTDataType; + + getTag(key: string): NBTBase | NBTTagCompound | null; + + getTagId(key: string): number; + + getByte(key: string): number; + getShort(key: string): number; + getInteger(key: string): number; + getLong(key: string): number; + getFloat(key: string): number; + getDouble(key: string): number; + getString(key: string): string; + getByteArray(key: string): number[]; + getIntArray(key: string): number[]; + getBoolean(key: string): boolean; + getCompoundTag(key: string): NBTTagCompound; + getTagList(key: string, type: number): NBTTagList; + + get(key: string, type: NBTDataType, tagType?: number): NBTDataType; + + get(key: string): NBTBase; + + setNBTBase(key: string, value: NBTBase): NBTTagCompound; + + setNBTBase(key: string, value: MCNBTBase): NBTTagCompound; + + setByte(key: string, value: number): NBTTagCompound; + + setShort(key: string, value: number): NBTTagCompound; + + setInteger(key: string, value: number): NBTTagCompound; + + setLong(key: string, value: number): NBTTagCompound; + + setFloat(key: string, value: number): NBTTagCompound; + + setDouble(key: string, value: number): NBTTagCompound; + + setString(key: string, value: string): NBTTagCompound; + + setByteArray(key: string, value: number[]): NBTTagCompound; + + setBoolean(key: string, value: boolean): NBTTagCompound; + + set(key: string, value: NBTDataType): NBTTagCompound; + + removeTag(key: string): NBTTagCompound; + + toObject(): NBTType; + } + + class NBTTagList extends NBTBase { + constructor(rawNBT: MCNBTTagList); + readonly rawNBT: MCNBTTagList; + + tagCount: number; + getTagCount(): number; + + appendTag(nbt: NBTBase): NBTTagList; + + appendTag(nbt: MCNBTBase): NBTTagList; + + set(id: number, nbt: NBTBase): void; + + set(id: number, nbt: MCNBTBase): void; + + insertTag(index: number, nbt: NBTBase): NBTTagList; + + insertTag(index: number, nbt: MCNBTBase): NBTTagList; + + removeTag(index: number): MCNBTBase; + + getCompoundTagAt(index: number): MCNBTTagCompound; + + getIntArrayAt(index: number): number[]; + + getDoubleAt(index: number): number; + + getFloatAt(index: number): number; + + getStringTagAt(index: number): string; + + get(index: number): MCNBTBase; + + get( + index: number, + type: NBTTagCompound["NBTDataType"], + ): number | string | number[] | MCNBTTagCompound | NBTBase; + + toArray(): NBTType[]; + } + + class Player { + readonly INSTANCE: Player; + + asPlayerMP(): PlayerMP; + static asPlayerMP(): PlayerMP; + + /** + * Gets Minecraft's EntityPlayerSP object representing the user + * + * @return The Minecraft EntityPlayerSP object representing the user + */ + getPlayer(): MCEntityPlayerSP; + /** + * Gets Minecraft's EntityPlayerSP object representing the user + * + * @return The Minecraft EntityPlayerSP object representing the user + */ + static getPlayer(): MCEntityPlayerSP; + + getTeam(): Team | null; + static getTeam(): Team | null; + + getX(): number; + static getX(): number; + + getY(): number; + static getY(): number; + + getZ(): number; + static getZ(): number; + + /** + * Gets the player's x motion. + * This is the amount the player will move in the x direction next tick. + * + * @return the player's x motion + */ + getMotionX(): number; + /** + * Gets the player's x motion. + * This is the amount the player will move in the x direction next tick. + * + * @return the player's x motion + */ + static getMotionX(): number; + + /** + * Gets the player's y motion. + * This is the amount the player will move in the y direction next tick. + * + * @return the player's y motion + */ + getMotionY(): number; + /** + * Gets the player's y motion. + * This is the amount the player will move in the y direction next tick. + * + * @return the player's y motion + */ + static getMotionY(): number; + + /** + * Gets the player's z motion. + * This is the amount the player will move in the z direction next tick. + * + * @return the player's z motion + */ + getMotionZ(): number; + /** + * Gets the player's z motion. + * This is the amount the player will move in the z direction next tick. + * + * @return the player's z motion + */ + static getMotionZ(): number; + + /** + * Gets the player's camera pitch. + * + * @return the player's camera pitch + */ + getPitch(): number; + /** + * Gets the player's camera pitch. + * + * @return the player's camera pitch + */ + static getPitch(): number; + + /** + * Gets the player's camera yaw. + * + * @return the player's camera yaw + */ + getYaw(): number; + /** + * Gets the player's camera yaw. + * + * @return the player's camera yaw + */ + static getYaw(): number; + + /** + * Gets the player's yaw rotation without wrapping. + * + * @return the yaw + */ + getRawYaw(): number; + /** + * Gets the player's yaw rotation without wrapping. + * + * @return the yaw + */ + static getRawYaw(): number; + + /** + * Gets the player's username. + * + * @return the player's username + */ + getName(): string; + /** + * Gets the player's username. + * + * @return the player's username + */ + static getName(): string; + + getUUID(): string; + static getUUID(): string; + + getUUIDObj(): JavaUUID; + static getUUIDObj(): JavaUUID; + + getHP(): number; + static getHP(): number; + + getHunger(): number; + static getHunger(): number; + + getSaturation(): number; + static getSaturation(): number; + + getArmorPoints(): number; + static getArmorPoints(): number; + + /** + * Gets the player's air level. + * + * The returned value will be an integer. If the player is not taking damage, it + * will be between 300 (not in water) and 0. If the player is taking damage, it + * will be between -20 and 0, getting reset to 0 every time the player takes damage. + * + * @return the player's air level + */ + getAirLevel(): number; + /** + * Gets the player's air level. + * + * The returned value will be an integer. If the player is not taking damage, it + * will be between 300 (not in water) and 0. If the player is taking damage, it + * will be between -20 and 0, getting reset to 0 every time the player takes damage. + * + * @return the player's air level + */ + static getAirLevel(): number; + + getXPLevel(): number; + static getXPLevel(): number; + + getXPProgress(): number; + static getXPProgress(): number; + + getBiome(): + | "Ocean" + | "Plains" + | "Desert" + | "Extreme Hills" + | "Forest" + | "Taiga" + | "Swampland" + | "River" + | "Hell" + | "The End" + | "FrozenOcean" + | "FrozenRiver" + | "Ice Plains" + | "Ice Mountains" + | "MushroomIsland" + | "MushroomIslandShore" + | "Beach" + | "DesertHills" + | "ForestHills" + | "TaigaHills" + | "Extreme Hills Edge" + | "Jungle" + | "JungleHills" + | "JungleEdge" + | "Deep Ocean" + | "Stone Beach" + | "Cold Beach" + | "Birch Forest" + | "Birch Forest Hills" + | "Roofed Forest" + | "Cold Taiga" + | "Cold Taiga Hills" + | "Mega Taiga" + | "Mega Taiga Hills" + | "Extreme Hills+" + | "Savanna" + | "Savanna Plateau" + | "Mesa" + | "Mesa Plateau F" + | "Mesa Plateau"; + static getBiome(): + | "Ocean" + | "Plains" + | "Desert" + | "Extreme Hills" + | "Forest" + | "Taiga" + | "Swampland" + | "River" + | "Hell" + | "The End" + | "FrozenOcean" + | "FrozenRiver" + | "Ice Plains" + | "Ice Mountains" + | "MushroomIsland" + | "MushroomIslandShore" + | "Beach" + | "DesertHills" + | "ForestHills" + | "TaigaHills" + | "Extreme Hills Edge" + | "Jungle" + | "JungleHills" + | "JungleEdge" + | "Deep Ocean" + | "Stone Beach" + | "Cold Beach" + | "Birch Forest" + | "Birch Forest Hills" + | "Roofed Forest" + | "Cold Taiga" + | "Cold Taiga Hills" + | "Mega Taiga" + | "Mega Taiga Hills" + | "Extreme Hills+" + | "Savanna" + | "Savanna Plateau" + | "Mesa" + | "Mesa Plateau F" + | "Mesa Plateau"; + + /** + * Gets the light level at the player's current position. + * + * @return the light level at the player's current position + */ + getLightLevel(): number; + /** + * Gets the light level at the player's current position. + * + * @return the light level at the player's current position + */ + static getLightLevel(): number; + + isMoving(): boolean; + static isMoving(): boolean; + + isSneaking(): boolean; + static isSneaking(): boolean; + + isSprinting(): boolean; + static isSprinting(): boolean; + + /** + * Checks if player can be pushed by water. + * + * @return true if the player is flying, false otherwise + */ + isFlying(): boolean; + /** + * Checks if player can be pushed by water. + * + * @return true if the player is flying, false otherwise + */ + static isFlying(): boolean; + + isSleeping(): boolean; + static isSleeping(): boolean; + + /** + * Gets the direction the player is facing. + * Example: "South West" + * + * @return The direction the player is facing, one of the four cardinal directions + */ + facing(): + | "South" + | "South West" + | "West" + | "North West" + | "North" + | "North East" + | "East" + | "South East" + | ""; + /** + * Gets the direction the player is facing. + * Example: "South West" + * + * @return The direction the player is facing, one of the four cardinal directions + */ + static facing(): + | "South" + | "South West" + | "West" + | "North West" + | "North" + | "North East" + | "East" + | "South East" + | ""; + + getActivePotionEffects(): PotionEffect[]; + static getActivePotionEffects(): PotionEffect[]; + + /** + * Gets the current object that the player is looking at, + * whether that be a block or an entity. Returns an air {@link BlockType} when not looking + * at anything. + * + * @return the {@link Block}, {@link Entity}, {@link Sign}, or {@link BlockType} being looked at + */ + lookingAt(): Block | Sign | Entity | BlockType; + /** + * Gets the current object that the player is looking at, + * whether that be a block or an entity. Returns an air {@link BlockType} when not looking + * at anything. + * + * @return the {@link Block}, {@link Entity}, {@link Sign}, or {@link BlockType} being looked at + */ + static lookingAt(): Block | Sign | Entity | BlockType; + + getHeldItem(): Item | null; + static getHeldItem(): Item | null; + + setHeldItemIndex(index: number): void; + static setHeldItemIndex(index: number): void; + + getHeldItemIndex(): number; + static getHeldItemIndex(): number; + + /** + * Gets the inventory of the player, i.e. the inventory accessed by 'e'. + * + * @return the player's inventory + */ + getInventory(): Inventory | null; + /** + * Gets the inventory of the player, i.e. the inventory accessed by 'e'. + * + * @return the player's inventory + */ + static getInventory(): Inventory | null; + + /** + * Gets the display name for the player, + * i.e. the name shown in tab list and in the player's nametag. + * @return the display name + */ + getDisplayName(): TextComponent; + /** + * Gets the display name for the player, + * i.e. the name shown in tab list and in the player's nametag. + * @return the display name + */ + static getDisplayName(): TextComponent; + + /** + * Sets the name for this player shown in tab list + * + * @param textComponent the new name to display + */ + setTabDisplayName(textComponent: TextComponent): void; + /** + * Sets the name for this player shown in tab list + * + * @param textComponent the new name to display + */ + static setTabDisplayName(textComponent: TextComponent): void; + + /** + * @deprecated Use the better named method getContainer + */ + getOpenedInventory(): Inventory | undefined; + /** + * @deprecated Use the better named method getContainer + */ + static getOpenedInventory(): Inventory | undefined; + + /** + * Gets the container the user currently has open, i.e. a chest. + * + * @return the currently opened container + */ + getContainer(): Inventory | undefined; + /** + * Gets the container the user currently has open, i.e. a chest. + * + * @return the currently opened container + */ + static getContainer(): Inventory | undefined; + + /** + * Draws the player in the GUI + */ + draw(x: number, y: number, rotate?: boolean): Player; + /** + * Draws the player in the GUI + */ + static draw( + x: number, + y: number, + rotate?: boolean, + showNametag?: boolean, + showArmor?: boolean, + showCape?: boolean, + showHeldItem?: boolean, + showArrow?: boolean, + ): Player; + + getLastX(): number; + static getLastX(): number; + + getLastY(): number; + static getLastY(): number; + + getLastZ(): number; + static getLastZ(): number; + + getRenderX(): number; + static getRenderX(): number; + + getRenderY(): number; + static getRenderY(): number; + + getRenderZ(): number; + static getRenderZ(): number; + } + namespace Player { + class armor { + /** + * @return the item in the player's helmet slot + */ + getHelmet(): Item | null; + /** + * @return the item in the player's helmet slot + */ + static getHelmet(): Item | null; + + /** + * @return the item in the player's chestplate slot + */ + getChestplate(): Item | null; + /** + * @return the item in the player's chestplate slot + */ + static getChestplate(): Item | null; + + /** + * @return the item in the player's leggings slot + */ + getLeggings(): Item | null; + /** + * @return the item in the player's leggings slot + */ + static getLeggings(): Item | null; + + /** + * @return the item in the player's boots slot + */ + getBoots(): Item; + /** + * @return the item in the player's boots slot + */ + static getBoots(): Item; + } + } + + interface testSound { + (name: "ambient.cave.cave", volume: number, pitch: number): void; + } + + class World { + readonly INSTANCE: World; + /** + * Gets Minecraft's WorldClient object + * + * @return The Minecraft WorldClient object + */ + getWorld(): MCWorldClient; + /** + * Gets Minecraft's WorldClient object + * + * @return The Minecraft WorldClient object + */ + static getWorld(): MCWorldClient; + + isLoaded(): boolean; + static isLoaded(): boolean; + /** + * Play a sound at the player location. + * + * @param name the name of the sound + * @param volume the volume of the sound + * @param pitch the pitch of the sound + */ + static playSound(name: string, volume: number, pitch: number): void; + static playSound( + name: "ambient.cave.cave", + volume: number, + pitch: number, + ): void; + static playSound( + name: "ambient.weather.rain", + volume: number, + pitch: number, + ): void; + static playSound( + name: "ambient.weather.thunder", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.hurt.fall.big", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.hurt.fall.big", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.hurt.fall.big", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.hurt.fall.small", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.hurt.fall.small", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.hurt.fall.small", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.hurt", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.hurt", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.hurt", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.die", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.die", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.die", + volume: number, + pitch: number, + ): void; + static playSound(name: "dig.cloth", volume: number, pitch: number): void; + static playSound(name: "dig.glass", volume: number, pitch: number): void; + static playSound( + name: "game.potion.smash", + volume: number, + pitch: number, + ): void; + static playSound(name: "dig.grass", volume: number, pitch: number): void; + static playSound(name: "dig.gravel", volume: number, pitch: number): void; + static playSound(name: "dig.sand", volume: number, pitch: number): void; + static playSound(name: "dig.snow", volume: number, pitch: number): void; + static playSound(name: "dig.stone", volume: number, pitch: number): void; + static playSound(name: "dig.wood", volume: number, pitch: number): void; + static playSound(name: "fire.fire", volume: number, pitch: number): void; + static playSound(name: "fire.ignite", volume: number, pitch: number): void; + static playSound( + name: "item.fireCharge.use", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.blast", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.blast_far", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.largeBlast", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.largeBlast_far", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.launch", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.twinkle", + volume: number, + pitch: number, + ): void; + static playSound( + name: "fireworks.twinkle_far", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.swim.splash", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.swim.splash", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.swim.splash", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.player.swim", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.neutral.swim", + volume: number, + pitch: number, + ): void; + static playSound( + name: "game.hostile.swim", + volume: number, + pitch: number, + ): void; + static playSound(name: "liquid.lava", volume: number, pitch: number): void; + static playSound( + name: "liquid.lavapop", + volume: number, + pitch: number, + ): void; + static playSound(name: "liquid.water", volume: number, pitch: number): void; + static playSound( + name: "minecart.base", + volume: number, + pitch: number, + ): void; + static playSound( + name: "minecart.inside", + volume: number, + pitch: number, + ): void; + static playSound(name: "note.bass", volume: number, pitch: number): void; + static playSound( + name: "note.bassattack", + volume: number, + pitch: number, + ): void; + static playSound(name: "note.bd", volume: number, pitch: number): void; + static playSound(name: "note.harp", volume: number, pitch: number): void; + static playSound(name: "note.hat", volume: number, pitch: number): void; + static playSound(name: "note.pling", volume: number, pitch: number): void; + static playSound(name: "note.snare", volume: number, pitch: number): void; + static playSound( + name: "portal.portal", + volume: number, + pitch: number, + ): void; + static playSound( + name: "portal.travel", + volume: number, + pitch: number, + ): void; + static playSound( + name: "portal.trigger", + volume: number, + pitch: number, + ): void; + static playSound( + name: "random.anvil_break", + volume: number, + pitch: number, + ): void; + static playSound( + name: "random.anvil_land", + volume: number, + pitch: number, + ): void; + static playSound( + name: "random.anvil_use", + volume: number, + pitch: number, + ): void; + static playSound(name: "random.bow", volume: number, pitch: number): void; + static playSound( + name: "random.bowhit", + volume: number, + pitch: number, + ): void; + static playSound(name: "random.break", volume: number, pitch: number): void; + static playSound(name: "random.burp", volume: number, pitch: number): void; + static playSound( + name: "random.chestclosed", + volume: number, + pitch: number, + ): void; + static playSound( + name: "random.chestopen", +