For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/interfaces/RawMessage.md.

Interface: RawMessage

chat

Beta

定义一个用于更灵活处理的 JSON 结构。

Defines a JSON structure that is used for more flexible.

Examples

addTranslatedSign.ts
showTranslatedMessageForm.ts
addTranslatedSign.ts
import { DimensionLocation, world, BlockPermutation, BlockComponentTypes } from '@minecraft/server';

function placeTranslatedSign(location: DimensionLocation, text: string) {
  const signBlock = location.dimension.getBlock(location);

  if (!signBlock) {
    console.warn('Could not find a block at specified location.');
    return;
  }
  const signPerm = BlockPermutation.resolve('minecraft:standing_sign', { ground_sign_direction: 8 });
  signBlock.setPermutation(signPerm);

  const signComponent = signBlock.getComponent(BlockComponentTypes.Sign);
  if (signComponent) {
    signComponent.setText({ translate: 'item.skull.player.name', with: [text] });
  } else {
    console.error('Could not find a sign component on the block.');
  }
}

placeTranslatedSign(
  {
    dimension: world.getDimension('overworld'),
    x: 0,
    y: 0,
    z: 0,
  },
  'Steve'
);

Properties

rawtext?

optional rawtext?: RawMessage[]

Beta

Remarks

提供当前消息的原始文本等效内容。

Provides a raw-text equivalent of the current message.


score?

optional score?: RawMessageScore

Beta

Remarks

提供一个将被替换为分数值的令牌。

Provides a token that will get replaced with the value of a score.


text?

optional text?: string

Beta

Remarks

提供一个要使用的字符串字面量值。

Provides a string literal value to use.


translate?

optional translate?: string

Beta

Remarks

提供一个翻译令牌,如果客户端在玩家语言中有与该令牌匹配的可用资源,则会在客户端进行翻译。

Provides a translation token where, if the client has an available resource in the players' language which matches the token, will get translated on the client.


with?

optional with?: string[] | RawMessage

Beta

Remarks

翻译令牌的参数。可以是字符串数组,也可以是包含原始文本对象数组的 RawMessage

Arguments for the translation token. Can be either an array of strings or RawMessage containing an array of raw text objects.

同领域相关