Beta
Protected
constructorReadonly
blockReadonly
typeStatic
Readonly
componentIdentifier of this component. Should always be minecraft:sign.
The message to set on the sign. If set to a string, then
call getText
to read that string. If set to a RawMessage,
then calling getRawText
will return a RawText. If set to a
RawText, then calling getRawText
will return the same
object that was passed in.
Sets the text of the sign component
This function can throw errors.
SetRawMessage.ts
const helloWorldMessage: RawMessage = { text: 'Hello World' };
sign.setText(helloWorldMessage);
// Sign text will be saved as a RawText
const result: RawText = sign.getRawText();
JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
SetRawText.ts
const helloWorldText: RawText = { rawtext: [{ text: 'Hello World' }] };
sign.setText(helloWorldText);
// There will be no data transformation unlike calling setText with a RawMessage
const result: RawText = sign.getRawText();
JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
SetString.ts
// Set sign to say 'Hello'
sign.setText('Hello');
sign.getText(); // 'Hello'
Optional
color: DyeColorThe dye color you want or undefined if you want to clear the dye on the sign
Sets the dye color of the text
This function can throw errors.
Represents a block that can display text on it.