return { status:CustomCommandStatus.Success, message:`Teleported ${entity.typeId.replace("minecraft:", "")} to ${dimensionId}`, }; }
Example: mojang-dirtster.ts
// This sample is from Mojang, see an updated sample at // https://github.com/microsoft/minecraft-scripting-samples/tree/main/custom-commands import { system, StartupEvent, CommandPermissionLevel, CustomCommand, CustomCommandParamType, CustomCommandStatus, CustomCommandOrigin, CustomCommandResult, world, Entity, Vector3, } from"@minecraft/server";
// This sample is from Mojang, see an updated sample at // https://github.com/microsoft/minecraft-scripting-samples/tree/main/custom-commands import { system, StartupEvent, CommandPermissionLevel, CustomCommand, CustomCommandParamType, CustomCommandStatus, CustomCommandOrigin, CustomCommandResult, world, } from"@minecraft/server";
// This sample is from Mojang, see an updated sample at // https://github.com/microsoft/minecraft-scripting-samples/tree/main/custom-commands import { system, StartupEvent, CommandPermissionLevel, CustomCommand, CustomCommandParamType, CustomCommandStatus, CustomCommandOrigin, CustomCommandResult, world, Entity, } from"@minecraft/server";
Custom Command APIs are released as part of Scripting API 2.0 Beta in Minecraft v1.21.80. Here's a video from Mojang that covers the custom command APIs.
Define the custom command, including name, permissions, and parameters.
Example: jayly-switchdimension.ts
Example: mojang-dirtster.ts
Example: mojang-hellocustomcommand.ts
Example: mojang-party.ts
Custom Command APIs are released as part of Scripting API 2.0 Beta in Minecraft v1.21.80. Here's a video from Mojang that covers the custom command APIs.