### Basic Tellraw Command Example Source: https://github.com/amberwat/negativespacefont/blob/master/README.md Demonstrates a simple use of the tellraw command to show the effect of negative spacing. It combines static text with a translation key for negative space. ```minecraft /tellraw @a [{"text": "Start", "color": "blue"},{"translate": "space.-11"},{"text": "End", "color": "red"}] ``` -------------------------------- ### JSON Example for Negativespacefont Source: https://github.com/amberwat/negativespacefont/blob/master/README.md This JSON example demonstrates how to apply the 'space:default' font to a score objective for dynamic text manipulation in Minecraft. It shows how to set initial text, apply the custom font to a score, and then display subsequent text. ```json [ {"text": "Start", "color": "blue"}, {"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, {"text": "End (moved by a dynamic amount)", "color": "red"} ] ``` -------------------------------- ### Fraction Width Space Calculation Source: https://github.com/amberwat/negativespacefont/blob/master/README.md This example demonstrates the formula for calculating fraction width spaces. It shows how to convert a width value between -1 and 1, expressed as a fraction of 4800, into a character code for Minecraft. ```plaintext 0xD0000 + round(width * 4800) (-1 <= width <= 1) ``` -------------------------------- ### Integer Width Space Calculation Source: https://github.com/amberwat/negativespacefont/blob/master/README.md This example illustrates the formula for calculating integer width spaces. It shows how to convert a width value within the range of -8192 to 8192 into a character code suitable for Minecraft. ```plaintext 0xD0000 + width (-8192 <= width <= 8192) ``` -------------------------------- ### Manual Magic Digit Spacing in Minecraft Source: https://context7.com/amberwat/negativespacefont/llms.txt This example shows how to manually create a specific pixel width gap using tellraw in Minecraft. It involves calculating the required pixel width by summing digit widths and then inserting the corresponding text representations. ```mcfunction /tellraw @a [ {"text": "Start"}, {"font": "space:default", "text": "46"}, {"text": "End (165 pixels gap)"} ] ``` -------------------------------- ### Minecraft tellraw with Dynamic Spacing Source: https://context7.com/amberwat/negativespacefont/llms.txt This example demonstrates how to use Minecraft's tellraw command to display text with dynamic spacing. It utilizes a scoreboard objective 'spacefont' to store spacing values, which are then rendered using a custom font 'space:default'. ```mcfunction scoreboard players operation width spacefont = @s health scoreboard players operation width spacefont *= #scale spacefont function spacefont:magic_digits tellraw @a ["[", {"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, "\u2764]"] ``` -------------------------------- ### Negative Space Font Width Formats (JSON) Source: https://context7.com/amberwat/negativespacefont/llms.txt Provides examples of the various formats supported for width values in Negative Space Font, including integers, maximum aliases, and fractional values for precise control. ```json // Integer widths: -8192 to 8192 {"translate": "space.691"} {"translate": "space.-42"} {"translate": "space.0"} // Maximum width aliases {"translate": "space.max"} // equals 8192 {"translate": "space.-max"} // equals -8192 // Fractional widths (value between -1 and 1) // Supported denominators: 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 25, 30, 32, 40, 48, 50, 60, 64, 75, 80, 96, 100 {"translate": "space.1/2"} // half pixel {"translate": "space.-3/4"} // negative three-quarters {"translate": "space.39/60"} // precise fractional positioning // Infinite widths (special cases) {"translate": "space.infinity"} {"translate": "space.-infinity"} ``` -------------------------------- ### Width Value Reference Source: https://context7.com/amberwat/negativespacefont/llms.txt Details the supported formats for `` values, including integers, maximum aliases, fractional values, and infinite widths. ```APIDOC ## Width Value Formats ### Description Specifies the various formats accepted for `` parameters in translation keys like `space.` and `offset.`. ### Method N/A (Format specification) ### Endpoint N/A ### Parameters N/A ### Request Example ```json // Integer widths: -8192 to 8192 {"translate": "space.691"} {"translate": "space.-42"} {"translate": "space.0"} // Maximum width aliases {"translate": "space.max"} // equals 8192 {"translate": "space.-max"} // equals -8192 // Fractional widths (value between -1 and 1) // Supported denominators: 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 25, 30, 32, 40, 48, 50, 60, 64, 75, 80, 96, 100 {"translate": "space.1/2"} // half pixel {"translate": "space.-3/4"} // negative three-quarters {"translate": "space.39/60"} // precise fractional positioning // Infinite widths (special cases) {"translate": "space.infinity"} {"translate": "space.-infinity"} ``` ### Response N/A ### Response Example N/A ``` -------------------------------- ### Java Fractional Width Characters for Minecraft Source: https://context7.com/amberwat/negativespacefont/llms.txt This Java code illustrates the creation of Unicode characters for fractional pixel widths in Minecraft, using the formula `0x50000 + round(width * 4800)`. This allows for sub-pixel precision in text spacing. ```java // Fractional width formula: 0x50000 + round(width * 4800) // Width range: -1 to 1 (in 1/4800 pixel increments) // Width 0 (neutral) String zero = "\uD900\uDC00"; // Code point U+50000 // Width 0.5 (half pixel right) String halfPixel = "\uD902\u5C60"; // 0x50000 + 2400 = 0x50960 // Width -0.5 (half pixel left) String negHalfPixel = "\uD8FD\u63A0"; // 0x50000 - 2400 = 0x4F6A0 // Width 1 (full pixel) String onePixel = "\uD904\uDEC0"; // Code point U+512C0 ``` -------------------------------- ### JSON Translation Key for New Layer Rendering Source: https://github.com/amberwat/negativespacefont/blob/master/README.md Demonstrates the 'newlayer' translation key in JSON for Minecraft. This key splits text rendering, placing subsequent text on a new layer, which can help with visual layering issues but may impact performance. ```json [ {"text": "Start", "color": "blue"}, {"translate": "space.-51"}, {"translate": "newlayer"}, {"text": "End (moved back 51 pixels and placed on a new layer)", "color": "red"} ] ``` -------------------------------- ### JSON Translation Key for Offset Text Source: https://github.com/amberwat/negativespacefont/blob/master/README.md Shows the 'offset.' translation key in JSON format for Minecraft. This key allows for offsetting specific content without affecting surrounding text, using a pair of space characters. ```json [ "Unaffected part.", { "translate": "offset.-14", "with": [{"text":"This part offset 14 pixels."}] }, "Also an unaffected part." ] ``` -------------------------------- ### Minecraft Data Pack: Centering Titles Source: https://context7.com/amberwat/negativespacefont/llms.txt This Minecraft function demonstrates how to center a title using dynamic spacing. It calculates half the title's width, converts it to magic digits using `spacefont:magic_digits`, and then applies it to the subtitle. ```mcfunction # Function: mypack:show_centered_title # Centers a title based on calculated width # Calculate half the title width (example: 80 pixels total -> 40 offset) scoreboard players set width spacefont -40 # Convert to magic digits function spacefont:magic_digits # Display centered title title @a subtitle [{"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, {"text": "CENTERED TITLE", "bold": true}] ``` -------------------------------- ### Insert Spaces with Negative Space Font (JSON) Source: https://context7.com/amberwat/negativespacefont/llms.txt Demonstrates how to use the `space.` translation key to insert positive or negative spaces, controlling horizontal text positioning. Supports integer, fractional, and maximum width values. ```json /tellraw @a [ {"text": "Start", "color": "blue"}, {"translate": "space.-11"}, {"text": "End (moved back 11 pixels)", "color": "red"} ] /tellraw @a [ {"text": "Before"}, {"translate": "space.50"}, {"text": "After (50 pixels gap)"} ] /tellraw @a [ {"text": "Left edge"}, {"translate": "space.max"}, {"text": "Right edge (8192 pixels away)"} ] /tellraw @a [ {"text": "Precise"}, {"translate": "space.39/60"}, {"text": "alignment"} ] ``` -------------------------------- ### Minecraft Data Pack Load Initialization Source: https://context7.com/amberwat/negativespacefont/llms.txt This JSON configuration file specifies that the `spacefont:load` function should be executed automatically when the data pack is loaded or reloaded in Minecraft, ensuring necessary objectives are set up. ```json // data/minecraft/tags/functions/load.json { "replace": false, "values": [ "spacefont:load" ] } ``` -------------------------------- ### Translation Keys: Content Offset Source: https://context7.com/amberwat/negativespacefont/llms.txt The `offset.` translation key offsets content without affecting surrounding text. It internally uses spaces to create the offset and then cancels it out. ```APIDOC ## POST /tellraw (Example Usage) ### Description Demonstrates the use of the `offset.` translation key for offsetting content without impacting surrounding text. ### Method `tellraw` command (Minecraft) ### Endpoint N/A (Minecraft command) ### Parameters N/A ### Request Example ```json // Offset middle section without affecting surrounding text /tellraw @a [ "Unaffected part.", { "translate": "offset.-14", "with": [{"text": "This part offset 14 pixels.", "color": "gold"}] }, "Also an unaffected part." ] // Offset an icon or symbol precisely /tellraw @a [ "Score: ", { "translate": "offset.5", "with": [{"text": "\u2605", "color": "yellow"}] }, " 100 points" ] ``` ### Response N/A (Minecraft command output) ### Response Example N/A ``` -------------------------------- ### Minecraft Data Pack Load Function Source: https://context7.com/amberwat/negativespacefont/llms.txt This Minecraft function file (`.mcfunction`) is executed on world load/reload. It initializes the `spacefont` scoreboard objective with a dummy type and sets a specific player's score to -1, likely for spacing calculations. ```mcfunction # data/spacefont/functions/load.mcfunction # Automatically runs on world load/reload scoreboard objectives add spacefont dummy scoreboard players set #-1 spacefont -1 ``` -------------------------------- ### Translation Keys: Basic Space Insertion Source: https://context7.com/amberwat/negativespacefont/llms.txt The `space.` translation key inserts a space character with a specified width. Positive values push content to the right, while negative values pull content to the left. ```APIDOC ## POST /tellraw (Example Usage) ### Description Demonstrates the use of the `space.` translation key for basic space insertion. ### Method `tellraw` command (Minecraft) ### Endpoint N/A (Minecraft command) ### Parameters N/A ### Request Example ```json // Move text 11 pixels to the left (negative space) /tellraw @a [ {"text": "Start", "color": "blue"}, {"translate": "space.-11"}, {"text": "End (moved back 11 pixels)", "color": "red"} ] // Move text 50 pixels to the right (positive space) /tellraw @a [ {"text": "Before"}, {"translate": "space.50"}, {"text": "After (50 pixels gap)"} ] // Using maximum width aliases /tellraw @a [ {"text": "Left edge"}, {"translate": "space.max"}, {"text": "Right edge (8192 pixels away)"} ] // Using fractional widths for sub-pixel precision /tellraw @a [ {"text": "Precise"}, {"translate": "space.39/60"}, {"text": "alignment"} ] ``` ### Response N/A (Minecraft command output) ### Response Example N/A ``` -------------------------------- ### Java Integer Width Characters for Minecraft Source: https://context7.com/amberwat/negativespacefont/llms.txt This Java code demonstrates how to generate Unicode surrogate pairs for integer pixel widths, ranging from -8192 to 8192. These are essential for programmatic text spacing in Minecraft plugins and mods. ```java // Formula: 0xD0000 + width (for widths -8192 to 8192) // Must use UTF-16 surrogate pairs for Minecraft // Width 0 (no movement) String zeroWidth = "\uDB00\uDC00"; // Code point U+D0000 // Width 1 (1 pixel right) String onePixel = "\uDB00\uDC01"; // Code point U+D0001 // Width -1 (1 pixel left) String negOnePixel = "\uDAFF\uDFFF"; // Code point U+CFFFF // Width 8192 (maximum right) String maxRight = "\uDB08\uDC00"; // Code point U+D2000 // Width -8192 (maximum left) String maxLeft = "\uDAF8\uDC00"; // Code point U+CE000 // Example usage in plugin player.sendMessage("Start" + negOnePixel.repeat(50) + "Overlapping!"); ``` -------------------------------- ### Offset Content with Negative Space Font (JSON) Source: https://context7.com/amberwat/negativespacefont/llms.txt Illustrates the `offset.` translation key, which shifts content without affecting surrounding text. It achieves this by inserting a space, the content, and then a cancelling space. ```json /tellraw @a [ "Unaffected part.", { "translate": "offset.-14", "with": [{"text": "This part offset 14 pixels.", "color": "gold"}] }, "Also an unaffected part." ] /tellraw @a [ "Score: ", { "translate": "offset.5", "with": [{"text": "\u2605", "color": "yellow"}] }, " 100 points" ] ``` -------------------------------- ### Fix Rendering Layers with Negative Space Font (JSON) Source: https://context7.com/amberwat/negativespacefont/llms.txt Shows how to use the `newlayer` translation key to force text onto a new rendering layer, ensuring foreground elements appear above background elements, resolving overlapping issues. ```json /tellraw @a [ {"text": "Background text", "color": "blue"}, {"translate": "space.-100"}, {"translate": "newlayer"}, {"text": "Foreground text (on top)", "color": "red"} ] /tellraw @a [ {"text": "Background", "color": "gray"}, {"translate": "space.-51"}, {"text": "Might render behind!", "color": "red"} ] /tellraw @a [ {"text": "Background", "color": "gray"}, {"translate": "space.-51"}, {"translate": "newlayer"}, {"text": "Always renders on top!", "color": "red"} ] ``` -------------------------------- ### Translation Keys: New Layer Rendering Source: https://context7.com/amberwat/negativespacefont/llms.txt The `newlayer` translation key inserts a special character that forces subsequent text to render on a new layer above previous content, resolving rendering issues with overlapping text. ```APIDOC ## POST /tellraw (Example Usage) ### Description Demonstrates the use of the `newlayer` translation key to ensure correct rendering order for overlapping text. ### Method `tellraw` command (Minecraft) ### Endpoint N/A (Minecraft command) ### Parameters N/A ### Request Example ```json // Ensure overlapping text renders on top /tellraw @a [ {"text": "Background text", "color": "blue"}, {"translate": "space.-100"}, {"translate": "newlayer"}, {"text": "Foreground text (on top)", "color": "red"} ] // Without newlayer - may have rendering issues /tellraw @a [ {"text": "Background", "color": "gray"}, {"translate": "space.-51"}, {"text": "Might render behind!", "color": "red"} ] // With newlayer - guaranteed correct layering /tellraw @a [ {"text": "Background", "color": "gray"}, {"translate": "space.-51"}, {"translate": "newlayer"}, {"text": "Always renders on top!", "color": "red"} ] ``` ### Response N/A (Minecraft command output) ### Response Example N/A ``` -------------------------------- ### JSON Translation Key for Negative Space Source: https://github.com/amberwat/negativespacefont/blob/master/README.md Illustrates how to use the 'space.' translation key within a JSON array for Minecraft's tellraw command. This key inserts a negative space character to adjust text positioning. ```json [ {"text": "Start", "color": "blue"}, {"translate": "space.-11"}, {"text": "End (moved back 11 pixels)", "color": "red"} ] ``` -------------------------------- ### Java Special Width Characters for Minecraft Source: https://context7.com/amberwat/negativespacefont/llms.txt This Java code defines special Unicode characters for advanced text manipulation in Minecraft, including a 'new layer' character and characters representing positive and negative infinity for spacing. ```java // New layer character (forces new rendering layer) String newLayer = "\uDAC0\uDC00"; // Code point U+C0000 // Positive infinity String posInfinity = "\uDB3F\uDFFF"; // Code point U+DFFFF // Negative infinity String negInfinity = "\uDAC0\uDC01"; // Code point U+C0001 // Example: Ensure overlay renders correctly player.sendMessage("Background" + "\uDAF8\uDE00" + newLayer + "Foreground"); ``` -------------------------------- ### Dynamic Width Calculation with Magic Digits (MCFunction) Source: https://context7.com/amberwat/negativespacefont/llms.txt Demonstrates using the `spacefont:magic_digits` function in Minecraft data packs to convert scoreboard values into dynamic display widths for the `space:default` font. ```mcfunction # Setup: Create the scoreboard (runs automatically on load) scoreboard objectives add spacefont dummy # Set the desired width (e.g., -42 pixels) scoreboard players set width spacefont -42 # Convert width to magic digits function spacefont:magic_digits # Display with dynamic spacing tellraw @a ["Hello ", {"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, " World"] ``` -------------------------------- ### Magic Digits for Data Packs Source: https://context7.com/amberwat/negativespacefont/llms.txt The `spacefont:magic_digits` function allows data pack creators to dynamically calculate and display widths based on scoreboard values, using the `space:default` font. ```APIDOC ## POST /scoreboard and /function (Example Usage) ### Description Utilizes the `spacefont:magic_digits` function to convert scoreboard values into dynamic widths for display using the `space:default` font. ### Method `scoreboard` command and `function` command (Minecraft) ### Endpoint N/A (Minecraft commands) ### Parameters N/A ### Request Example ```mcfunction # Setup: Create the scoreboard (runs automatically on load) scoreboard objectives add spacefont dummy # Set the desired width (e.g., -42 pixels) scoreboard players set width spacefont -42 # Convert width to magic digits function spacefont:magic_digits # Display with dynamic spacing tellraw @a ["Hello ", {"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, " World"] ``` ### Response N/A (Minecraft command output) ### Response Example N/A ``` -------------------------------- ### Minecraft Data Pack: Health Indicator Source: https://context7.com/amberwat/negativespacefont/llms.txt This Minecraft function displays a health bar with dynamic fill. It retrieves player health, scales it, converts it to spacing using `spacefont:magic_digits`, and then renders the health bar using tellraw with visual separators. ```mcfunction # Function: mypack:health_indicator # Shows health bar with dynamic fill # Get player health and scale it execute store result score width spacefont run data get entity @s Health scoreboard players operation width spacefont *= #2 spacefont # Convert to spacing function spacefont:magic_digits # Display health bar tellraw @a ["HP: [", {"color": "red", "text": "||||||||||||||||||||"}, {"translate": "space.-40"}, {"font": "space:default", "score": {"name": "spacer", "objective": "spacefont"}}, {"color": "gray", "text": "||||||||||||||||||||"}, "]"] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.