Runs a particular command asynchronously from the context of the broader dimension. Note that there is a maximum queue of 128 asynchronous commands that can be run in a given tick.
Returns a Promise<CommandResult> . Throws an error synchronously if the queue is full.
Normally we recommend avoiding using commands, however, the following command features are not implemented in scripting API (as of 1.19.50).
- Can't get entity by unique id.
- Can't access ender chest.
- Can't access equipments.
- Can't access ender chest.
- Can't access equipments.
- Can't access ender chest.
- Can't access equipments.
- Can't access ticking areas.
- Can't kick player.
/setblock ... destroy
/fillis fast.
- You can't set abilities for each player.
- You can't read player's abilites.
- There's no way to give damage to players & entities.
- Opening GUI with custom command will not possible (unless there's another way) because it's need damage for close the chat UI.
- New execute can be useful to run command with lot of if/unless condition for simplicity or maybe performance.
- Cannot run
/lootcommand with /execute.
- Cannot run mcfunctions.
- Cannot set any game rules.
- Cannot read game rules' value.
- Cannot give item with these following NBT Data:
minecraft:can_place_onminecraft:can_destroyminecraft:item_lockminecraft:keep_in_inventory
- Cannot set player's gamemode.
- Cannot get structure's location.
- Cannot get biome's location.
- Even though the loot is broken from the start, but it's useful for drop or set the item to players/world.
- Cannot add/set/remove/operation/reset players/entities' scores.
- Cannot set world's time.
- Cannot get world's time (relative and daytime).
- Cannot set player's experience.
- Cannot get player's experience.
Following commands useful for mapmaking cannot be replaced with JS code:
/camerashake/fog/stopsound/weather/setspawnpoint/clearspawnpoint/clone