Skip to content

Escape

Escapes certain characters from a string by prepending the character with the \ character.

Type ID: kaya:escape

Info

This type escapes the following characters:

Escape sequence Character represented
\b Backspace
\f Formfeed
\n Newline
\r Carriage Return
\\ Backslash
\' Apostrophe/single quotation mark
\" Double quotation mark
\xhh Unicode point below 0x100 (256 in decimal)

Format

Field Type Default Description
string String Provider The string to escape.

Example

{
    "type": "kaya:escape",
    "string": {
        "type": "kaya:nbt",
        "source": {
            "type": "kaya:block",
            "block": "used_block"
        },
        "path": "{}"
    }
}

This example escapes the stringified NBT of the block provided by the kaya:used_block context parameter.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.