Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 65eaaba

Browse files
Updated docs for commands (JaylyDev#69)
* Updated docs for commands * Update runCommand.md * Update runCommand.md * Update runCommandAsync.md * Update runCommand.md * Update runCommandAsync.md * Update runCommandAsync.md * Update README.md
1 parent 4fcad22 commit 65eaaba

4 files changed

Lines changed: 161 additions & 98 deletions

File tree

docs/MinecraftApi/@minecraft/server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
### [runCommandAsync](./runCommandAsync.md)
2222

23-
### [Impact of removing runCommand](./impact_of_removing_runCommand.md)
23+
### [runCommand (removed)](./runCommand.md)
2424

2525
![](https://media.discordapp.net/attachments/852517995308646410/1009680002209546240/unknown.png)
2626

@@ -52,4 +52,4 @@
5252
"module_name": "mojang-minecraft",
5353
"version": [ 0, 1, 0 ]
5454
}
55-
```
55+
```

docs/MinecraftApi/@minecraft/server/impact_of_removing_runCommand.md

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# runCommand
2+
3+
Execute a command synchronously.
4+
Returns the result if the command is executed successfully, otherwise throws the reason.
5+
6+
## Removed!
7+
8+
Method `runCommand` has been removed from Gametest/Script API.
9+
10+
Consider `runCommandAsync` as an alternative.
11+
12+
## Commands affected by the removal of runCommand
13+
14+
`runCommandAsync` doesn't return much information.
15+
16+
There are many things we can do with `runCommand` but not anymore with `runCommandAsync`.
17+
18+
### /ability
19+
20+
You can't read player's abilites.
21+
22+
### /gamerule
23+
24+
Cannot read game rules' value.
25+
26+
### /list
27+
28+
Cannot get how many players can join the world (player join limit).
29+
30+
### /locate
31+
32+
1. Cannot get structure's location.
33+
2. Cannot get biome's location.
34+
35+
### /time
36+
37+
Cannot get world's time (relative and daytime).
38+
39+
### /xp
40+
41+
Cannot get player's experience.
42+
43+
### /weather
44+
45+
Cannot get weather.
Lines changed: 114 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,116 @@
11
# runCommandAsync
22

3-
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.
4-
5-
Normally we recommend avoiding using this function however the following command features are not implemented in scripting API (as of 1.19.50).
6-
7-
- `/kick`
8-
- `/gamemode`
9-
- `/gamerule`
10-
- `/weather`
11-
- `/ability`
12-
- `/setblock ... destroy`
13-
- `/xp`
14-
- `/tickingarea`
15-
- `/replaceitem` partial
16-
- `/clear` partial
17-
- `@s[hasitem=]` partial
18-
- `/function` partial
19-
- `/loot` partial
20-
- `/scoreboard` partial
21-
- `/locate`
22-
- `/damage` partial
3+
Runs a particular command asynchronously from the context of the broader dimension.
4+
Note that there is a maximum queue of 128 asynchronous commands that can be run in a given tick.
5+
6+
Returns a `Promise<CommandResult>` . Throws an error **synchronously** if the queue is full.
7+
8+
## Commands you have to use
9+
10+
Normally we recommend avoiding using commands,
11+
however, the following command features are not implemented in scripting API (as of 1.19.50).
12+
13+
### @s
14+
15+
1. Can't get entity by unique id.
16+
17+
### @s[hasitem=]
18+
19+
1. Can't access ender chest.
20+
2. Can't access equipments.
21+
22+
### /replaceitem
23+
24+
1. Can't access ender chest.
25+
2. Can't access equipments.
26+
27+
### /clear
28+
29+
1. Can't access ender chest.
30+
2. Can't access equipments.
31+
32+
### /tickingarea
33+
34+
1. Can't access ticking areas.
35+
36+
### /kick
37+
38+
1. Can't kick player.
39+
40+
### /setblock
41+
42+
1. `/setblock ... destroy`
43+
44+
### /fill
45+
46+
1. `/fill` is fast.
47+
48+
### /ability
49+
50+
1. You can't set abilities for each player.
51+
2. You can't read player's abilites.
52+
53+
### /damage
54+
55+
1. There's no way to give damage to players & entities.
56+
2. Opening GUI with custom command will not possible (unless there's another way) because it's need damage for close the chat UI.
57+
58+
### /execute
59+
60+
1. New execute can be useful to run command with lot of if/unless condition for simplicity or maybe performance.
61+
2. Cannot run `/loot` command with /execute.
62+
63+
### /function
64+
65+
1. Cannot run mcfunctions.
66+
67+
### /gamerule
68+
69+
1. Cannot set any game rules.
70+
2. Cannot read game rules' value.
71+
72+
### /give
73+
74+
1. Cannot give item with these following NBT Data:
75+
1. `minecraft:can_place_on`
76+
2. `minecraft:can_destroy`
77+
3. `minecraft:item_lock`
78+
4. `minecraft:keep_in_inventory`
79+
80+
### /gamemode
81+
82+
1. Cannot set player's gamemode.
83+
84+
### /locate
85+
86+
1. Cannot get structure's location.
87+
2. Cannot get biome's location.
88+
89+
### /loot
90+
91+
1. Even though the loot is broken from the start, but it's useful for drop or set the item to players/world.
92+
93+
### /scoreboard
94+
95+
1. Cannot add/set/remove/operation/reset players/entities' scores.
96+
97+
### /time
98+
99+
1. Cannot set world's time.
100+
2. Cannot get world's time (relative and daytime).
101+
102+
### /xp
103+
104+
1. Cannot set player's experience.
105+
2. Cannot get player's experience.
106+
107+
### Other Commands
108+
109+
Following commands useful for mapmaking cannot be replaced with JS code:
110+
111+
1. `/camerashake`
112+
2. `/fog`
113+
3. `/stopsound`
114+
4. `/weather`
115+
5. `/setspawnpoint` `/clearspawnpoint`
116+
6. `/clone`

0 commit comments

Comments
 (0)