Başvuru
Bu sayfa İngilizce gösteriliyor.
text
Text components, translations, styling, clicks, and hover actions.
Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.
How to use it: guide.
WIT declarations
use common.{named-color, rgb-color, argb-color};
record head-profile {
name: option<string>,
id: option<string>,
textures: option<string>,
textures-signature: option<string>,
}
resource text-component {
text: static func(plain: string) -> text-component;
translate: static func(key: string, %with: list<text-component>) -> text-component;
translate-cross: static func(java-key: string, bedrock-key: string, %with: list<text-component>) -> text-component;
entity-names: static func(selector: string, separator: option<string>) -> text-component;
keybind: static func(keybind: string) -> text-component;
custom: static func(namespace: string, key: string, locale: string, %with: list<text-component>) -> text-component;
player-head: static func(profile: head-profile, hat: bool) -> result<text-component, string>;
from-legacy-string: static func(input: string) -> text-component;
from-legacy-string-with-code: static func(input: string, code-symbol: char) -> text-component;
from-json: static func(json: string) -> result<text-component, string>;
to-json: func() -> string;
encode: func() -> list<u8>;
get-text: func() -> string;
to-pretty-console: func() -> string;
color-named: func(color: named-color);
color-rgb: func(color: rgb-color);
gradient-named: func(colors: list<named-color>);
gradient: func(colors: list<rgb-color>);
rainbow: func();
bold: func(value: bool);
italic: func(value: bool);
underlined: func(value: bool);
strikethrough: func(value: bool);
obfuscated: func(value: bool);
font: func(font: string);
shadow-color: func(color: argb-color);
insertion: func(text: string);
click-open-url: func(url: string);
click-open-file: func(path: string);
click-run-command: func(command: string);
click-suggest-command: func(command: string);
click-change-page: func(page: u32);
click-copy-to-clipboard: func(text: string);
hover-show-text: func(text: text-component);
hover-show-item: func(item: string);
hover-show-entity: func(entity-type: string, id: string, name: option<text-component>);
add-text: func(text: string);
add-child: func(child: text-component);
replace-text: func(literal: string, replacement: borrow<text-component>, once: bool) -> u32;
}