if (!signBlock) { console.warn('Could not find a block at specified location.'); return; } constsignPerm = BlockPermutation.resolve('minecraft:standing_sign', { ground_sign_direction:8 }); signBlock.setPermutation(signPerm);
constsignComponent = 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.'); } }
messageForm .show(player) .then((formData: MessageFormResponse) => { // player canceled the form, or another dialog was up and open. if (formData.canceled || formData.selection === undefined) { return; }
console.warn(`You selected ${formData.selection===0?'Player 1':'Player 2'}`); }) .catch((error: Error) => { console.warn('Failed to show form: ' + error); }); };
showMessage(world.getAllPlayers()[0]);
Example: deathMessage.ts
import { RawText, world } from"@minecraft/server";
Provides a token that will get replaced with the value of a
score.
Optionaltext
text?:string
Remarks
Provides a string literal value to use.
Optionaltranslate
translate?:string
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.
Defines a JSON structure that is used for more flexible.
Example: addTranslatedSign.ts
Example: showTranslatedMessageForm.ts
Example: deathMessage.ts