mojira.dev

Hazel K

Assigned

No issues.

Reported

MCPE-227757 Custom Commands not working Unconfirmed MCPE-227544 Items wont bob in off-hand Duplicate

Comments

So I figured it out, its not the custom commands those work it is just realms basically if you have an addon edit it then have it on realms it wont work. You have to change the uuid then delete it from your cache and then install the new one and re apply that to realms. On singleplayer worlds they update if you change the behavior pack or resource pack its only realms that dont.

here is my main.ts the @minecraft/server version is the latest “2.1.0”

import { system, CustomCommandStatus, CommandPermissionLevel, world, Player } from "@minecraft/server";

system.beforeEvents.startup.subscribe(ev => {
    try {
        ev.customCommandRegistry.registerCommand(
            {
                name: "test:test_command",
                description: "A simple test command",
                permissionLevel: CommandPermissionLevel.Any,
                cheatsRequired: false,
                mandatoryParameters: []
            }, (_origin) => {
                const player = _origin.sourceEntity;

                if (!(player instanceof Player)) {
                    return { success: CustomCommandStatus.Failure, status: 0 };
                }

                player.sendMessage("Hello World");
                return { success: CustomCommandStatus.Success, status: 0 };
            }
        );
    } catch (err) {
        world.sendMessage("Failed to register test command: " + err);
    }
});