### Java Method Documentation Example Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/README.md Demonstrates the standard format for documenting Java methods, including signature, description, parameters, return values, exceptions, and usage examples. ```java public ReturnType methodName(Type param1, Type param2) ``` -------------------------------- ### EventLaunchGame Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/events.md Fired when the game or client starts. ```APIDOC ## EventLaunchGame ### Description Fired when the game or client starts. ### Method Event Listener ### Endpoint N/A (Client-side Event) ### Parameters N/A ### Request Example ```javascript JsMacros.on("GameLoad", (event) => { console.log("Game loaded!"); }); ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### ARGB Color Format Example Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Illustrates the 32-bit ARGB integer format for specifying colors, including opaque and semi-transparent examples. ```javascript 0xAARRGGBB ``` ```javascript 0xFF000000 // Black (opaque) ``` ```javascript 0xFFFFFFFF // White (opaque) ``` ```javascript 0xFF0000FF // Red (opaque) ``` ```javascript 0xFF00FF00 // Green (opaque) ``` ```javascript 0xFF0000FF // Blue (opaque) ``` ```javascript 0x80000000 // Black (50% transparent) ``` -------------------------------- ### Vec2D getStart() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Retrieves the starting position of the 2D vector. ```java public Pos2D getStart() ``` -------------------------------- ### Vec3D getStart() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Retrieves the starting position of the 3D vector as a Pos3D object. ```java public Pos3D getStart() ``` -------------------------------- ### JavaScript Usage Example Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/README.md A basic JavaScript snippet illustrating the usage of a method, typically found within method documentation. ```javascript // Usage example ``` -------------------------------- ### Get Configuration and Profile Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Retrieve the current JsMacros configuration and active profile. Configuration is persisted and reloaded automatically. ```javascript const config = JsMacros.getConfig(); const profile = JsMacros.getProfile(); ``` -------------------------------- ### Vec2D Constructor Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Initializes a 2D vector with start and end coordinates. ```java public Vec2D(double x1, double y1, double x2, double y2) ``` -------------------------------- ### Vec3D Constructor Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Initializes a 3D vector with start and end coordinates, including Z components. ```java public Vec3D(double x1, double y1, double z1, double x2, double y2, double z2) ``` -------------------------------- ### Get Block Information Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Ray-trace to get information about the block the player is looking at. Requires a maximum distance and a boolean for precise checking. ```javascript const block = Player.rayTraceBlock(5, false); if (block) { console.log(`Block: ${block.getName()}`); console.log(`Hardness: ${block.getBlockState().getBlock().getHardness()}`); console.log(`Position: ${block.getX()}, ${block.getY()}, ${block.getZ()}`); } ``` -------------------------------- ### MethodWrapper Callback Example Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Illustrates a JavaScript callback function intended to be wrapped by MethodWrapper. The comment indicates the expected MethodWrapper signature. ```javascript const callback = (param) => { return param * 2; }; // MethodWrapper callback ``` -------------------------------- ### Find Blocks in Radius with WorldScanner Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md This example demonstrates how to find blocks matching a filter within a specified radius around a given position. It requires the center position and the radius in blocks. ```javascript const playerPos = Player.getPlayer().getPos(); const scanner = new WorldScannerBuilder() .withBlockFilter(Block => Block.getName) .is('EQUALS', 'minecraft:diamond_ore') .build(); const nearby = scanner.findInRadius(playerPos, 50); ``` -------------------------------- ### Vec3D getDeltaZ() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Calculates the difference between the end and start Z coordinates. ```java public double getDeltaZ() ``` -------------------------------- ### Listen for Key Press Event Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Use JsMacros.on to execute code whenever a specific key event occurs. This example logs a message when the 'r' key is pressed. ```javascript JsMacros.on("Key", (event) => { if (event.key === "r") { console.log("R pressed"); } }); ``` -------------------------------- ### Vec3D getZ1() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Retrieves the starting Z coordinate of the 3D vector. ```java public double getZ1() ``` -------------------------------- ### Vec2D getDeltaX() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Calculates the difference between the end and start X coordinates. ```java public double getDeltaX() ``` -------------------------------- ### Toggle Script Example Source: https://github.com/jsmacrosce/jsmacros/blob/main/docs/web/examples/toggle.html This script toggles a boolean variable to control a loop. It logs the current state (enabled/disabled) to the chat and executes actions within the loop as long as the variable remains true. Use GlobalVars.toggleBoolean to flip the state. ```javascript const name = "ToggleScript"; // the name of the script const enabled = GlobalVars.toggleBoolean(name); Chat.log( Chat.createTextBuilder() .append("[").withColor(0x7) .append(name).withColor(0x5) .append("] ").withColor(0x7) .append(enabled ? "enabled" : "disabled").withColor(0xc) .build() ); while (GlobalVars.getBoolean(name)) { Chat.log("do stuff here..."); Client.waitTick(20); // wait 1 second (synchronized to client ticks) } ``` -------------------------------- ### Get Minecraft Version Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Returns the current Minecraft version as a string. This is useful for compatibility checks or displaying version information. ```javascript const version = Client.mcVersion(); console.log(`Running Minecraft ${version}`); ``` -------------------------------- ### Get Minecraft Instance Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the raw Minecraft client instance for direct Java interop. Use this to access core Minecraft functionalities. ```javascript const mc = Client.getMinecraft(); const window = mc.getWindow(); console.log(`Screen size: ${window.getWidth()}x${window.getHeight()}`); ``` -------------------------------- ### TextHelper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Offers utilities for working with text and chat components, including creating text, getting text width, formatting colors, and stripping formatting codes. ```APIDOC ## TextHelper ### Description Utilities for text and chat components. Allows creation of text components, measurement of text width, color formatting, and removal of formatting codes. ### Methods - `createText(string)` - Create text component - `getWidth(string)` - Get text width in pixels - `formatColor(color)` - Format color value - `stripFormatting(text)` - Remove formatting codes ``` -------------------------------- ### Execute Action Once on Game Load Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Use JsMacros.once to run a function only one time when a specific event, like 'GameLoad', is triggered. Useful for one-time setup tasks. ```javascript JsMacros.once("GameLoad", () => { console.log("Game loaded, running setup"); }); ``` -------------------------------- ### Get All Image Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all image elements currently being rendered. Use this to manage or query image assets. ```java public List getImages() ``` -------------------------------- ### EntityHelper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Generic wrapper for any entity, providing methods to get its position, name, type, health, and alive status. ```APIDOC ## EntityHelper ### Description Generic wrapper for any entity. ### Methods - `getPos()` - Get entity position - `getName()` - Get entity name/display name - `getType()` - Get entity type - `getHealth()` - Get entity health - `isAlive()` - Check if entity is alive ``` -------------------------------- ### Get Registry Manager Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Obtains a helper for interacting with Minecraft registries. This is useful for accessing and managing game registries. ```javascript const registry = Client.getRegistryManager(); ``` -------------------------------- ### Define Custom Library with @Library Annotation Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Register a custom library class using the @Library annotation. This example shows a library instantiated per script execution. ```java import org.jsmacros.library.annotation.Library; import org.jsmacros.library.BaseLibrary; import org.jsmacros.context.BaseScriptContext; import org.jsmacros.library.PerExecLibrary; @Library("MyLib") public class FMyLib extends PerExecLibrary { public FMyLib(BaseScriptContext context) { super(context); } public String myMethod() { return "Hello from MyLib"; } } ``` -------------------------------- ### Get All Item Display Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all item display elements. This is useful for managing custom display objects. ```java public List getItems() ``` -------------------------------- ### Add Pos3D to Vec3D Start Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Modifies the start point of the 3D vector by adding a Pos3D offset. ```java public Vec3D addStart(Pos3D pos) ``` -------------------------------- ### setOnInit(MethodWrapper) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Sets a callback function to be executed when the drawing context initializes. ```APIDOC ## setOnInit(MethodWrapper) ### Description Sets callback to run when the drawing initializes. ### Method ```java public void setOnInit(MethodWrapper callback) ``` ### Example ```javascript const draw = new Draw2D(); draw.setOnInit(() => { console.log("Draw2D initialized"); }); ``` ``` -------------------------------- ### Get Game Options Helper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves a helper to access and modify Minecraft game options. Use this to read or change settings like volume or controls. ```javascript const options = Client.getGameOptions(); // Access various game settings through helper methods ``` -------------------------------- ### Get Block State Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Retrieves the current state of the block. ```javascript const state = block.getBlockState(); ``` -------------------------------- ### Access Java Packages Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Shows how to instantiate Java objects from any package using the global `Packages` object in JavaScript. ```javascript const packet = new Packages.net.minecraft.network.protocol.Packet(); ``` -------------------------------- ### Vec2D getDeltaY() Method Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Calculates the difference between the end and start Y coordinates. ```java public double getDeltaY() ``` -------------------------------- ### WorldScannerBuilder - Basic Scanner Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Demonstrates the creation of a basic WorldScanner using the fluent builder API. ```APIDOC ## WorldScannerBuilder - Basic Scanner ### Description Creates a basic WorldScanner instance without any specific filters. ### Method `new WorldScannerBuilder().build()` ### Endpoint N/A (Client-side API) ### Parameters None ### Request Example ```javascript const scanner = new WorldScannerBuilder().build(); ``` ### Response #### Success Response - `WorldScanner` - An initialized WorldScanner object. #### Response Example ```javascript // scanner object ``` ``` -------------------------------- ### Find First Free Inventory Slot Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Locates and returns the index of the first available empty slot in the player's main inventory. Returns -1 if no free slots are found. Example usage provided for JavaScript. ```java public int findFreeInventorySlot() ``` ```javascript const inv = Inventory.create(); const freeSlot = inv.findFreeInventorySlot(); if (freeSlot >= 0) { console.log(`Free slot at: ${freeSlot}`); } ``` -------------------------------- ### Get Player Game Mode Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Returns the player's current game mode. Possible values are "survival", "creative", "adventure", or "spectator". ```javascript const mode = Player.getGameMode(); if (mode === "creative") { console.log("In creative mode"); } ``` -------------------------------- ### Inventory.create() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Creates an inventory handler for the currently open container, falling back to the player inventory if no container is open. ```APIDOC ## Inventory.create() ### Description Creates an inventory handler for the currently open container, falling back to player inventory if no container is open. ### Method Static Factory Method ### Parameters None ### Return `Inventory` - Appropriate inventory type for current screen ### Example ```javascript const inv = Inventory.create(); inv.click(0); // Click first slot ``` ``` -------------------------------- ### OptionsHelper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Provides methods to access and modify game settings such as render distance, vsync, brightness, volume, and autosave. ```APIDOC ## OptionsHelper ### Description Access and modify game settings. ### Methods - `getViewDistance()` - Get render distance - `setViewDistance(distance)` - Set render distance - `isVsync()` - Check if vsync enabled - `setVsync(enabled)` - Enable/disable vsync - `getGamma()` - Get brightness - `setGamma(gamma)` - Set brightness - `getVolume()` - Get volume level - `setVolume(volume)` - Set volume - `isAutoSave()` - Check autosave enabled - `setAutoSave(enabled)` - Enable/disable autosave ``` -------------------------------- ### Import All Classes Source: https://github.com/jsmacrosce/jsmacros/blob/main/docs/python/README.md Import all classes from JsMacrosAC. Ensure this is done within an 'if __name__ == "":' block to prevent script errors. ```python if __name__ == "": from JsMacrosAC import * ``` -------------------------------- ### setOnFailInit(MethodWrapper) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Sets a callback function to be executed if the drawing context fails to initialize. ```APIDOC ## setOnFailInit(MethodWrapper) ### Description Sets callback to run if initialization fails. ### Method ```java public void setOnFailInit(MethodWrapper callback) ``` ``` -------------------------------- ### Set Initialization Callback Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Sets a callback function to be executed once the drawing context has successfully initialized. This is ideal for setting up initial drawing elements. ```javascript const draw = new Draw2D(); draw.setOnInit(() => { console.log("Draw2D initialized"); }); ``` -------------------------------- ### Inventory.create(Screen) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Creates an inventory handler for a given screen. Returns null if the screen is not a container. ```APIDOC ## Inventory.create(Screen) ### Description Creates an inventory handler for the given screen. Returns null if screen is not a container. ### Method Static Factory Method ### Parameters #### Path Parameters - **s** (Screen) - Optional - Screen to create handler for ### Return `Inventory` - Specific inventory type, or null ### Supported Types - VillagerInventory (MerchantScreen) - EnchantInventory (EnchantmentScreen) - LoomInventory (LoomScreen) - BeaconInventory (BeaconScreen) - AnvilInventory (AnvilScreen) - BrewingStandInventory (BrewingStandScreen) - CartographyInventory (CartographyTableScreen) - FurnaceInventory (FurnaceScreen) - GrindStoneInventory (GrindstoneScreen) - SmithingInventory (SmithingScreen) - StoneCutterInventory (StonecutterScreen) - CraftingInventory (CraftingScreen) - PlayerInventory (InventoryScreen) - CreativeInventory (CreativeModeInventoryScreen) - HorseInventory (HorseInventoryScreen) - ContainerInventory (DispenserScreen, HopperScreen, ShulkerBoxScreen, etc.) ``` -------------------------------- ### Get All Inventory Items Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Retrieves all non-empty items from the inventory. Useful for iterating through all held items. ```javascript const inv = Inventory.create(); for (const item of inv.getItems()) { console.log(`${item.getItemId()}: ${item.getCount()}`); } ``` -------------------------------- ### openInventory() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Opens the player's inventory and returns an inventory handler. This handler can be used to interact with inventory slots. ```APIDOC ## openInventory() ### Description Returns the current inventory handler. ### Method `openInventory()` ### Parameters None ### Response #### Success Response - `Inventory` - Inventory object ### Request Example ```javascript const inv = Player.openInventory(); inv.click(0); // Click slot 0 ``` ``` -------------------------------- ### Get Player Entity Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the player entity wrapper. Returns null if the player is not in the world. ```javascript const player = Player.getPlayer(); if (player) { console.log(`Health: ${player.getHealth()}`); } ``` -------------------------------- ### Get Block Position Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Retrieves the block's position as a Pos3D object. Requires a 'block' object. ```javascript const pos = block.getPos(); // Pos3D ``` -------------------------------- ### Helpers Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Provides utility classes for interacting with various game systems, including registries, text formatting, packet construction, and player/entity properties. ```APIDOC ## Helpers ### Classes - **RegistryHelper**: Provides access to Minecraft registries. - **TextBuilder**: Facilitates the building of text components. - **PacketByteBufferHelper**: Assists in packet construction. - **InteractionManagerHelper**: Handles block and entity interactions. - **ClientPlayerEntityHelper**: Accesses properties of the client's player entity. - **EntityHelper**: Provides access to general entity properties. - **OptionsHelper**: Allows access to game settings. - **StatsHelper**: Provides access to player statistics. ``` -------------------------------- ### Get Interaction Manager Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the interaction manager for block and entity interactions. Returns null if not connected. ```javascript Player.getInteractionManager() ``` -------------------------------- ### ServerInfoHelper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Retrieves information about the currently connected server. ```APIDOC ## ServerInfoHelper ### Description Provides information about the connected server, including its address, port, name, and whether it is a local or Realms server. ### Methods - `getServerAddress()` - Get server IP/hostname - `getServerPort()` - Get server port - `getServerName()` - Get server name - `isLocalServer()` - Check if singleplayer - `isRealms()` - Check if Realms server ``` -------------------------------- ### Get Screen Width Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves the current width of the screen. This can be used for responsive design or positioning elements. ```java public int getWidth() ``` -------------------------------- ### Get Player Stats Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Retrieve player statistics like death count and distance traveled using the StatsHelper. ```javascript const player = Player.getPlayer(); const stats = new StatsHelper(player); console.log(`Deaths: ${stats.getDeathCount()}`); console.log(`Distance: ${stats.getDistanceTraveled()}`); ``` -------------------------------- ### Rendering System Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Provides tools for rendering 2D and 3D elements in the game, including basic shapes, text, items, and images. ```APIDOC ## Rendering System ### Classes - **Draw2D**: For 2D screen rendering. - **Draw3D**: For 3D world rendering. - **Text**: Represents a text element. - **Rect**: Represents a rectangular element. - **Line**: Represents a line element. - **Item**: For displaying items. - **Image**: For displaying images or textures. - **CustomImage**: For creating custom images. - **Line3D**: Represents a 3D line. - **Box**: Represents a 3D bounding box. ``` -------------------------------- ### findFreeInventorySlot() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Finds the first empty slot in the main inventory. Returns the slot index or -1 if no free slot is found. ```APIDOC ## findFreeInventorySlot() ### Description Finds the first empty slot in main inventory. ### Method public int findFreeInventorySlot() ### Response #### Success Response (int) - Slot index, or -1 if none found ### Request Example ```javascript const inv = Inventory.create(); const freeSlot = inv.findFreeInventorySlot(); if (freeSlot >= 0) { console.log(`Free slot at: ${freeSlot}`); } ``` ``` -------------------------------- ### Create Basic World Scanner Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Instantiates a basic WorldScanner using the builder pattern. No specific filters are applied. ```javascript const scanner = new WorldScannerBuilder() .build(); ``` -------------------------------- ### Pos3D toVector Method (Pos3D) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Converts the position to a Vec3D, representing a vector from a given 3D start position to this position. ```java public Vec3D toVector(Pos3D start) ``` ```javascript const from = new Pos3D(0, 0, 0); const to = new Pos3D(1, 2, 3); const vec = to.toVector(from); // Vec3D from (0,0,0) to (1,2,3) ``` -------------------------------- ### Pos3D toVector Method (Pos2D) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Converts the position to a Vec3D, representing a vector from a given 2D start position to this position. ```java public Vec3D toVector(Pos2D start) ``` -------------------------------- ### findFreeHotbarSlot() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Finds the first empty slot in the hotbar. Returns the slot index or -1 if no free slot is found. ```APIDOC ## findFreeHotbarSlot() ### Description Finds the first empty slot in the hotbar. ### Method public int findFreeHotbarSlot() ### Response #### Success Response (int) - Slot index, or -1 if none found ``` -------------------------------- ### Get Block Coordinates Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Retrieves the X, Y, and Z coordinates of a block. Assumes a 'scanner' object is available and has found a block. ```javascript const block = scanner.findFirst(); const x = block.getX(); const y = block.getY(); const z = block.getZ(); ``` -------------------------------- ### WorldScannerBuilder - build Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Finalizes the builder and returns a ready-to-use WorldScanner object. ```APIDOC ## WorldScannerBuilder - build ### Description Finalizes the configuration of the `WorldScannerBuilder` and returns a `WorldScanner` object that can be used to find blocks. ### Method `build()` ### Endpoint N/A (Client-side API) ### Parameters None ### Request Example ```javascript const scanner = new WorldScannerBuilder() .withBlockFilter(Block => Block.getName) .is('EQUALS', 'minecraft:diamond_ore') .andBlockFilter(Block => Block.getHardness) .is('>=', 3) .build(); const results = scanner.findAll(); ``` ### Response #### Success Response (200) - `WorldScanner` - A configured scanner object ready for use. #### Response Example ```javascript // WorldScanner object ``` ``` -------------------------------- ### Draw2D Constructor Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Creates a new 2D drawing context for screen rendering. ```APIDOC ## Draw2D() ### Description Creates a new 2D drawing context. ### Constructor ```java public Draw2D() ``` ### Example ```javascript const draw = new Draw2D(); draw.setOnInit(() => { draw.addRect(10, 10, 100, 100, 0xFF0000FF); }); ``` ``` -------------------------------- ### Create and Use an Event Filterer Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/events.md Demonstrates how to create an event filterer for the 'BlockUpdate' event and set a specific block to filter by. This is useful for efficiently handling updates related to a particular block. ```javascript const filterer = JsMacros.createEventFilterer("BlockUpdate"); filterer.setBlockFilter("minecraft:grass_block"); JsMacros.on("BlockUpdate", filterer, (event) => { console.log("Grass block was updated!"); }); ``` -------------------------------- ### Get All Line Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all line elements currently being rendered. Useful for managing or querying line drawings. ```java public List getLines() ``` -------------------------------- ### Get All Rectangle Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all rectangle elements currently being rendered. Use this to manage or query geometric shapes. ```java public List getRects() ``` -------------------------------- ### Create and Add Pos2D Objects Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Demonstrates creating two Pos2D objects and adding them together. The add method returns a new Pos2D object with the combined coordinates. ```javascript const pos1 = new Pos2D(1, 2); const pos2 = new Pos2D(3, 4); const result = pos1.add(pos2); // Pos2D(4, 6) ``` -------------------------------- ### Time Library Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md The Time library provides methods for time-related operations, such as getting the current time and pausing script execution. ```APIDOC ## Time Library **Access:** `Time` (global object) ### Methods #### `time()` **Description:** Returns the current time in milliseconds since epoch. **Method:** N/A (Global Object Method) **Endpoint:** N/A **Parameters:** None **Return:** `long` - Current system time in milliseconds **Throws:** None **Example:** ```javascript const startTime = Time.time(); // ... perform operation ... const elapsed = Time.time() - startTime; console.log(`Operation took ${elapsed}ms`); ``` ``` ```APIDOC #### `sleep(millis)` **Description:** Pauses the current script execution for the specified duration. **Method:** N/A (Global Object Method) **Endpoint:** N/A **Parameters:** #### Query Parameters - **millis** (long) - Required - Duration to sleep in milliseconds **Return:** `void` **Throws:** `InterruptedException` - If the thread is interrupted while sleeping **Example:** ```javascript console.log("Starting delay..."); Time.sleep(2000); console.log("2 seconds have passed"); ``` ``` -------------------------------- ### createPacketByteBuffer() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Creates a helper utility for constructing and manipulating Minecraft network packets, essential for custom packet handling. ```APIDOC ## createPacketByteBuffer() ### Description Creates a helper for constructing and manipulating Minecraft packets. ### Method GET ### Endpoint Client.createPacketByteBuffer() ### Parameters None ### Response #### Success Response (200) - **Return** (`PacketByteBufferHelper`) - Packet manipulation helper ### Response Example ```json { "example": "PacketByteBufferHelper instance" } ``` ``` -------------------------------- ### Build Complex Text Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Construct formatted text with colors, click events, and hover information using TextBuilder. ```javascript const text = new TextBuilder() .append("Server: ") .append("MyServer").withColor(0xFF00FF00) .append(" [") .append("Status").withColor(0xFFFFFF00).onClick("/status") .append("]") .build(); ``` -------------------------------- ### Get Current Time in Milliseconds Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md Retrieves the current system time in milliseconds since the epoch. Useful for timing operations. ```javascript const startTime = Time.time(); // ... perform operation ... const elapsed = Time.time() - startTime; console.log(`Operation took ${elapsed}ms`); ``` -------------------------------- ### Inventory.click(slot) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Clicks a slot with the left mouse button (pickup action). ```APIDOC ## Inventory.click(slot) ### Description Clicks a slot with left mouse button (pickup action). ### Method Slot Interaction Method ### Parameters #### Path Parameters - **slot** (int) - Required - Slot index to click ### Return `Inventory` - Self for chaining ### Example ```javascript const inv = Inventory.create(); inv.click(0).click(1).click(2); // Chain clicks ``` ``` -------------------------------- ### Create and Initialize Draw2D Context Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Instantiate a new 2D drawing context and add a rectangle upon initialization. This is useful for setting up initial visual elements. ```javascript const draw = new Draw2D(); draw.setOnInit(() => { draw.addRect(10, 10, 100, 100, 0xFF0000FF); }); ``` -------------------------------- ### Vec2D Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Represents a 2D vector with start and end positions. Provides methods for accessing coordinates, calculating differences, and determining magnitude. ```APIDOC ## Vec2D ### Description A 2D vector with start and end positions. ### Constructor ```java public Vec2D(double x1, double y1, double x2, double y2) ``` ### Properties - **x1** (double) - Start X coordinate - **y1** (double) - Start Y coordinate - **x2** (double) - End X coordinate - **y2** (double) - End Y coordinate ### Methods #### getStart() Returns the start position. ```java public Pos2D getStart() ``` #### getEnd() Returns the end position. ```java public Pos2D getEnd() ``` #### getDeltaX() Returns the difference in X coordinates (x2 - x1). ```java public double getDeltaX() ``` #### getDeltaY() Returns the difference in Y coordinates (y2 - y1). ```java public double getDeltaY() ``` #### getMagnitude() Returns the length of the vector. ```java public double getMagnitude() ``` Example: ```javascript const vec = new Vec2D(0, 0, 3, 4); console.log(vec.getMagnitude()); // 5 ``` #### getMagnitudeSq() Returns the squared length of the vector (faster, no sqrt). ```java public double getMagnitudeSq() ``` ``` -------------------------------- ### Work with Items Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Iterate through items in the player's inventory, displaying their names, counts, and durability if applicable. ```javascript const inv = Player.openInventory(); const items = inv.getItems(); for (const item of items) { console.log(`${item.getName()}: ${item.getCount()}x`); if (item.getDamage() > 0) { console.log(` Durability: ${item.getMaxDamage() - item.getDamage()}/${item.getMaxDamage()}`); } } ``` -------------------------------- ### toVector(Pos3D) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Converts the current 3D position to a Vec3D object, representing a vector from a given 3D start position to this position. ```APIDOC ## toVector(Pos3D) ### Description Converts this position to a 3D vector originating from the given 3D start position to this position. ### Method ```java public Vec3D toVector(Pos3D start) ``` ### Parameters #### Path Parameters - **start** (Pos3D) - Required - The 3D starting position. ### Request Example ```javascript const from = new Pos3D(0, 0, 0); const to = new Pos3D(1, 2, 3); const vec = to.toVector(from); // Vec3D from (0,0,0) to (1,2,3) ``` ``` -------------------------------- ### mcVersion() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the current version of Minecraft as a string, useful for compatibility checks or informational purposes. ```APIDOC ## mcVersion() ### Description Returns the current Minecraft version as a string. ### Method GET ### Endpoint Client.mcVersion() ### Parameters None ### Response #### Success Response (200) - **Return** (`String`) - Version string (e.g., "1.20.1") ### Response Example ```json { "example": "1.20.1" } ``` ``` -------------------------------- ### toVector(Pos2D) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Converts the current 3D position to a Vec3D object, representing a vector from a given 2D start position to this position. ```APIDOC ## toVector(Pos2D) ### Description Converts this position to a 3D vector originating from the given 2D start position to this position. ### Method ```java public Vec3D toVector(Pos2D start) ``` ### Parameters #### Path Parameters - **start** (Pos2D) - Required - The 2D starting position. ``` -------------------------------- ### Get Block Name Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Retrieves the registry name of the block. The name is returned as a string, e.g., "minecraft:diamond_ore". ```javascript const name = block.getName(); // "minecraft:diamond_ore" ``` -------------------------------- ### getMinecraft() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the raw Minecraft client instance, enabling direct Java interoperation for advanced client manipulations. ```APIDOC ## getMinecraft() ### Description Returns the raw Minecraft client instance for direct Java interop. ### Method GET ### Endpoint Client.getMinecraft() ### Parameters None ### Response #### Success Response (200) - **Return** (`Minecraft`) - The client instance ### Response Example ```json { "example": "Minecraft client instance" } ``` ``` -------------------------------- ### Get All Text Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all text elements currently being rendered. This is useful for managing or querying text content on the screen. ```java public List getTexts() ``` -------------------------------- ### FJavaUtils - Java Interoperability Utilities Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Utilities for seamless interaction with Java code. ```APIDOC ## FJavaUtils - Java Interoperability Utilities ### Description Provides utilities to facilitate interoperability with Java, allowing direct manipulation of Java objects and methods. ### Methods - `newInstance(className)` - Creates a new instance of a Java class. - `callStatic(className, method)` - Calls a static method on a Java class. - `invoke(object, method)` - Invokes an instance method on a Java object. - `getField(object, field)` - Retrieves the value of a field from a Java object. - `setField(object, field, value)` - Sets the value of a field on a Java object. ``` -------------------------------- ### EventItemPickup Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/events.md Fired when the player picks up an item from the ground or another source. Includes the item and the quantity picked up. ```APIDOC ## EventItemPickup ### Description Fired when the player picks up an item. ### Event Name `"ItemPickup"` ### Properties - **item** (any) - Item picked up - **count** (number) - Count of items picked up ``` -------------------------------- ### Get Item Count by ID Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Returns a map of item IDs to their total counts. Useful for quickly checking the quantity of specific items. ```javascript const inv = Inventory.create(); const counts = inv.getItemCount(); console.log(`Diamonds: ${counts.get("minecraft:diamond") || 0}`); ``` -------------------------------- ### Get FPS Information Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves the FPS debug string, which includes current frame rate and graphics settings. Useful for performance monitoring. ```javascript console.log(Client.getFPS()); // Output: "60 fps T: 60 vsync fancy-clouds B: 1" ``` -------------------------------- ### Pos3D Constructor Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/math-types.md Initializes a new Pos3D object with specified x, y, and z coordinates. ```java public Pos3D(double x, double y, double z) ``` -------------------------------- ### Get Screen Height Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves the current height of the screen. Useful for layout calculations and ensuring elements fit within the viewable area. ```java public int getHeight() ``` -------------------------------- ### Get JsMacros Configuration Manager Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md Access the configuration management interface using `getConfig()`. This object allows you to interact with JsMacros' configuration settings. ```javascript const configManager = JsMacros.getConfig(); ``` -------------------------------- ### Create Packet Byte Buffer Helper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Creates a helper for constructing and manipulating Minecraft packets. This is essential for custom network packet handling. ```java public PacketByteBufferHelper createPacketByteBuffer() ``` -------------------------------- ### Check Inventory for Item by ID Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Checks if the inventory contains an item specified by its unique ID string. Example usage provided for JavaScript. ```java @DocletReplaceParams("item: ItemId") public boolean contains(String item) ``` ```javascript const inv = Inventory.create(); if (inv.contains("minecraft:diamond")) { console.log("Has diamond!"); } ``` -------------------------------- ### Get All Render Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Retrieves a list of all elements currently being rendered, including text, rectangles, and images. Use this to inspect or manipulate all drawn objects. ```java public List getElements() ``` -------------------------------- ### Find Slots Containing Item by ID Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Finds all inventory slots that contain an item matching the provided ID string. An example in JavaScript is included. ```java @DocletReplaceParams("item: ItemId") public int[] findItem(String item) ``` ```javascript const inv = Inventory.create(); const diamondSlots = inv.findItem("minecraft:diamond"); console.log(`Diamond at slots: ${diamondSlots.join(", ")}`); ``` -------------------------------- ### loadWorld(folderName) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Loads a specified singleplayer world by its folder name, allowing players to switch between worlds. ```APIDOC ## loadWorld(folderName) ### Description Loads a singleplayer world by folder name. ### Method POST ### Endpoint Client.loadWorld(folderName) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **folderName** (`String`) - Required - World folder name in saves directory ### Request Example ```json { "folderName": "my_world_save" } ``` ### Response #### Success Response (200) - **Return** (`void`) #### Error Response (500) - **Throws** (`LevelStorageException`) ### Response Example ```json { "example": "void" } ``` ``` -------------------------------- ### once(event, callback) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md Creates a single-use event listener that executes a callback function the first time a specified event occurs and then automatically removes itself. ```APIDOC ## once(event, callback) ### Description Creates a single-use event listener that fires once then removes itself. ### Method ```java public IEventListener once(String event, MethodWrapper, Object, ?> callback) ``` ### Parameters #### Path Parameters - **event** (String) - Required - Event name to listen for - **callback** (MethodWrapper) - Required - Callback invoked when event fires ### Response #### Success Response (200) - **Return** (`IEventListener`) - Listener object #### Error Response - **Throws** (`IllegalArgumentException`) - If event name not found ### Example ```javascript JsMacros.once("GameLoad", (event) => { console.log("Game loaded, this will only run once"); }); ``` ``` -------------------------------- ### Inventory System Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Offers a comprehensive set of classes for managing various types of inventories, including player, container, crafting, and specialized inventories. ```APIDOC ## Inventory System ### Classes - **Inventory**: A generic handler for inventory management. - **PlayerInventory**: Manages the player's main inventory and hotbar. - **ContainerInventory**: Handles generic containers like chests and hoppers. - **CraftingInventory**: Represents the crafting table inventory. - **FurnaceInventory**: Manages the furnace inventory. - **AnvilInventory**: Handles the anvil inventory. - **EnchantInventory**: Represents the enchanting table inventory. - **VillagerInventory**: Manages villager trade inventories. **Additional Inventory Types:** BeaconInventory, BrewingStandInventory, CartographyInventory, GrindStoneInventory, SmithingInventory, StoneCutterInventory, LoomInventory, HorseInventory, RecipeInventory, CreativeInventory. ``` -------------------------------- ### EventQuitGame Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/events.md Fired when the game or client closes. ```APIDOC ## EventQuitGame ### Description Fired when the game or client closes. ### Method Event Listener ### Endpoint N/A (Client-side Event) ### Parameters N/A ### Request Example ```javascript JsMacros.on("GameUnload", (event) => { console.log("Game unloaded!"); }); ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Get Current JsMacros Profile Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md Retrieve the active JsMacros profile object using the `getProfile()` method. This object contains information about the current profile settings. ```javascript const profile = JsMacros.getProfile(); ``` -------------------------------- ### getFPS() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Returns a string containing the current FPS and related graphics performance information. ```APIDOC ## getFPS() ### Description Returns the FPS debug string including frame rate and graphics settings. ### Method GET ### Endpoint Client.getFPS() ### Parameters None ### Response #### Success Response (200) - **Return** (`String`) - FPS info string ### Response Example ```json { "example": "60 fps T: 60 vsync fancy-clouds B: 1" } ``` ``` -------------------------------- ### Initialize and Draw 2D Elements Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Use this snippet to initialize a Draw2D object and add various graphical elements like rectangles, text, lines, and item displays upon initialization. Register the drawing to be rendered on screen. ```javascript const draw = new Draw2D(); draw.setOnInit(() => { // Add a red rectangle draw.reAddElement(new Rect(10, 10, 100, 50, 0xFFFF0000, true)); // Add white text draw.reAddElement(new Text(20, 20, "Hello World", 0xFFFFFFFF, 1, false)); // Add a line draw.reAddElement(new Line(10, 10, 110, 60, 0xFF00FF00, 2)); // Add an item display draw.reAddElement(new Item(50, 70, "minecraft:diamond", 1)); }); // Register to be rendered JsMacros.drawOnScreen(draw); ``` -------------------------------- ### StatsHelper Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Provides methods to access various player statistics, including blocks broken, items used, distance traveled, survival time, death count, and mob kills. ```APIDOC ## StatsHelper ### Description Access player statistics. ### Methods - `getBlocksBroken(block)` - Get block break count - `getItemsUsed(item)` - Get item use count - `getDistanceTraveled()` - Get distance traveled - `getTimeAlive()` - Get survival time - `getDeathCount()` - Get death count - `getMobsKilled()` - Get total kills ``` -------------------------------- ### FUtils - Common Utility Functions Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md A collection of common utility functions for various operations. ```APIDOC ## FUtils - Common Utility Functions ### Description Offers a set of general-purpose utility functions for common programming tasks. ### Methods - `sleep(ms)` - Pauses execution for a specified duration (blocking). - `wait(ms)` - Pauses execution for a specified duration (non-blocking). - `repeat(count, function)` - Executes a given function a specified number of times. - `forEach(list, function)` - Iterates over a list, applying a function to each element. - `map(list, function)` - Transforms a list by applying a function to each element and returning a new list. ``` -------------------------------- ### Create Inventory Handler Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Creates an inventory handler for the currently open container or player inventory. Use this when you need to interact with the active inventory screen. ```javascript const inv = Inventory.create(); inv.click(0); // Click first slot ``` -------------------------------- ### Inventory.click(slot, mousebutton) Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/inventory-system.md Clicks a slot with the specified mouse button. ```APIDOC ## Inventory.click(slot, mousebutton) ### Description Clicks a slot with specified mouse button. ### Method Slot Interaction Method ### Parameters #### Path Parameters - **slot** (int) - Required - Slot index to click - **mousebutton** (int) - Required - Mouse button: 0 (left), 1 (right), 2 (middle/clone) ### Return `Inventory` - Self for chaining ``` -------------------------------- ### getPlayer() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Retrieves a wrapper for the player entity. This can be used to access player-specific information like health. ```APIDOC ## getPlayer() ### Description Returns the player entity wrapper. ### Method `getPlayer()` ### Parameters None ### Response #### Success Response - `ClientPlayerEntityHelper` - Player entity wrapper, or null if not in world ### Request Example ```javascript const player = Player.getPlayer(); if (player) { console.log(`Health: ${player.getHealth()}`); } ``` ``` -------------------------------- ### Access Java Classes with GraalVM Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/api-overview.md Demonstrates how to access Java classes like ArrayList and BlockPos directly using GraalVM's Java integration in JavaScript. ```javascript const ArrayList = Java.type('java.util.ArrayList'); const list = new ArrayList(); const BlockPos = Java.type('net.minecraft.core.BlockPos'); const pos = new BlockPos(100, 64, 200); ``` -------------------------------- ### getGameOptions() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/client-libraries.md Provides access to a helper object for retrieving and modifying Minecraft's game options and settings. ```APIDOC ## getGameOptions() ### Description Returns a helper to access and modify Minecraft game options. ### Method GET ### Endpoint Client.getGameOptions() ### Parameters None ### Response #### Success Response (200) - **Return** (`OptionsHelper`) - Game options accessor ### Response Example ```json { "example": "OptionsHelper instance" } ``` ``` -------------------------------- ### Chunk Helpers Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/helpers-and-utilities.md Utilities for working with world chunks. ```APIDOC ## Chunk Helpers ### Description Provides utilities for interacting with loaded world chunks. ### Methods - `getLoadedChunks()` - Get all loaded chunk positions. - `isChunkLoaded(x, z)` - Check if a specific chunk is loaded. - `getChunkData(x, z)` - Retrieve information about a specific chunk. ``` -------------------------------- ### Build and Find All Blocks Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Finalizes the WorldScanner builder and executes a search to find all matching blocks in the world. Combines block property and hardness filters. ```javascript const scanner = new WorldScannerBuilder() .withBlockFilter(Block => Block.getName) .is('EQUALS', 'minecraft:diamond_ore') .andBlockFilter(Block => Block.getHardness) .is('>=', 3) .build(); const results = scanner.findAll(); ``` -------------------------------- ### EventResourcePackLoaded Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/events.md Fired when a resource pack is loaded. ```APIDOC ## EventResourcePackLoaded ### Description Fired when a resource pack is loaded. ### Method Event Listener ### Endpoint N/A (Client-side Event) ### Parameters N/A ### Request Example ```javascript JsMacros.on("ResourcePackLoaded", (event) => { console.log("Resource pack loaded!"); }); ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Run Script File with Custom Event Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/core-libraries.md Executes a script file and passes a custom event object as context. The event object can be created using JsMacros.createCustomEvent. ```javascript const customEvent = JsMacros.createCustomEvent("myEvent"); const container = JsMacros.runScript("handler.js", customEvent); ``` -------------------------------- ### Set Initialization Failure Callback Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/rendering-system.md Sets a callback function to be executed if the drawing context fails to initialize. This is useful for error handling and fallback mechanisms. ```java public void setOnFailInit(MethodWrapper) ``` -------------------------------- ### WorldScanner.findFirst() Source: https://github.com/jsmacrosce/jsmacros/blob/main/_autodocs/world-scanning.md Finds the first block that matches the configured filters. ```APIDOC ## WorldScanner.findFirst() ### Description Finds the first matching block. ### Method `findFirst()` ### Parameters None ### Return `BlockDataHelper` or null ```