Minecraft:Commands/schedule: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| Line 4: | Line 4: | ||
* 2 {{only|java|short=1}} | * 2 {{only|java|short=1}} | ||
* 1 {{only|bedrock|short=1}} | * 1 {{only|bedrock|short=1}} | ||
|others=Cheat only{{only|bedrock|short=1}} | |others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}} | ||
}} | }} | ||
Schedules the function(s). | Schedules the function(s). | ||
== Usage == | == Usage == | ||
{{ | {{IN|java}}, delays the execution of a [[Minecraft:Function (Java Edition)|function]] or all functions in a function [[Minecraft:tag]]. The function(s) are executed by the [[Minecraft:server]] after specified amount of time passes. | ||
{{ | {{IN|bedrock}}, schedules a [[Minecraft:Function (Bedrock Edition)|function]] to be executed once an area is fully loaded, or after a certain amount of time. | ||
{{ | {{IN|java}}, the same functions or the same function tags cannot have two schedules executed at the same game tick. | ||
{{ | {{IN|java}}, in <code>replace</code> mode, overrides an unexecuted schedule directly when a function or a function tag already has an unexecuted schedule. For example, if a function is scheduled to be executed in 30 seconds, and before it is executed you want to modify the execution time, you can use <code>replace</code> mode to set a new schedule to replace the original. | ||
Even when using the <code>[[Minecraft:Commands/execute|execute]] as ...</code> command, the scheduled function always runs as the server at [[Minecraft:world spawn]]. | Even when using the <code>[[Minecraft:Commands/execute|execute]] as ...</code> command, the scheduled function always runs as the server at [[Minecraft:world spawn]]. | ||
| Line 41: | Line 41: | ||
==Arguments== | ==Arguments== | ||
{{ | {{argument|function|function|function: filepath|CommandFilePath}} | ||
: Specify the function to be run. | : Specify the function to be run. | ||
: {{ | : {{arg desc|je=function|be=commandfilepath}} | ||
{{ | {{el|je|short=1}}: {{argument|time|time}} | ||
: Specify the delay time. | : Specify the delay time. | ||
: {{ | : {{arg desc|je=time|min=0}} | ||
: One thing to note is that the delay time of {{ | : One thing to note is that the delay time of {{Cd|1t}} does NOT always mean one tick of delay. Instead, it schedules the function for the upcoming phase for scheduled functions. | ||
:* If {{ | :* If {{Cd|schedule function <function> 1t}} is executed in {{Cd|#minecraft:tick}} functions, it schedules the function for the phase in the same tick, which comes right after the phase for the {{Cd|#minecraft:tick}} functions. | ||
:* If {{ | :* If {{Cd|schedule function <function> 1t}} is executed during the "scheduled functions" phase, it schedules the function for the next phase, which is coming in the next tick. | ||
:Thus, specifying {{ | :Thus, specifying {{Cd|1t}} in {{Cd|#minecraft:tick}} functions makes the function run within the same tick, and specifying {{Cd|1t}} in scheduled functions makes the function run in the next tick. | ||
{{ | {{el|je|short=1}}: {{argument|function|string}} (in {{cd|/schedule clear ...}} mode) | ||
: Specify the function to be cleared. Should be a namespaced ID (<code>minecraft:</code> cannot be omitted) or a function tag(<code>minecraft:</code> cannot be omitted). | : Specify the function to be cleared. Should be a namespaced ID (<code>minecraft:</code> cannot be omitted) or a function tag(<code>minecraft:</code> cannot be omitted). | ||
: {{ | : {{arg desc|je=string|type=greedy}} | ||
{{ | {{el|je|short=1}}: <code>append|replace</code> | ||
: <code>replace</code> — (default) Simply replaces the current function's schedule time. | : <code>replace</code> — (default) Simply replaces the current function's schedule time. | ||
: <code>append</code> — Allows multiple schedules to exist at different times. | : <code>append</code> — Allows multiple schedules to exist at different times. | ||
{{ | {{el|be|short=1}}: {{argument|be=1|from: x y z|CommandPosition}} and {{argument|be=1|to: x y z|CommandPosition}} | ||
: Specifies the coordinates of opposite corners of a rectangular area used to define a loaded area. | : Specifies the coordinates of opposite corners of a rectangular area used to define a loaded area. | ||
: {{ | : {{arg desc|be=CommandPosition}} | ||
: For <code>x</code> and <code>z</code>, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively. | : For <code>x</code> and <code>z</code>, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively. | ||
{{ | {{el|be|short=1}}: {{argument|be=1|center: x y z|CommandPosition}} | ||
: Specifies the coordinates of the center point of a circular area used to define a loaded area. | : Specifies the coordinates of the center point of a circular area used to define a loaded area. | ||
: {{ | : {{arg desc|be=CommandPosition}} | ||
: For <code>x</code> and <code>z</code>, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively. | : For <code>x</code> and <code>z</code>, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively. | ||
{{ | {{el|be|short=1}}: {{argument|be=1|radius: int|int}} | ||
: Specifies the radius of a circular loaded area as the number of chunks from the center to the edge of the circle. | : Specifies the radius of a circular loaded area as the number of chunks from the center to the edge of the circle. | ||
: {{ | : {{arg desc|be=int}} It should be between 0 and 2,147,483,647 (inclusive). | ||
{{ | {{el|be|short=1}}: {{argument|be=1|name: string|basic_string}} | ||
: Specifies the name of a ticking area, executes function when which is added. | : Specifies the name of a ticking area, executes function when which is added. | ||
: {{ | : {{arg desc|be=string}} | ||
==Result== | ==Result== | ||
| Line 93: | Line 93: | ||
== Output == | == Output == | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|On fail|0|0|0}} | ||
{{ | {{Output table|cmd=/schedule function ...|On success|1|1|The game tick the function is to execute at modulo 2147483647}} | ||
{{ | {{Output table|cmd=/schedule clear ...|On success|1|1|the number of schedules that are cleared.}} | ||
{{ | {{Output table|edition=be|On fail|0}} | ||
{{ | {{Output table|On success|1}} | ||
{{ | {{Output table}} | ||
== History == | == History == | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.14|dev=18w43a|Added {{ | |{{HistoryLine||1.14|dev=18w43a|Added {{cmd|schedule|link=none}}.}} | ||
|{{ | |{{HistoryLine||1.15|dev=19w38a|Added a clear syntax and added an append/replace optional argument (defaults to replace).}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|bedrock}} | ||
|{{HistoryLine||1.16.100|dev=beta 1.16.100.59|Added {{ | |{{HistoryLine||1.16.100|dev=beta 1.16.100.59|Added {{cmd|schedule|link=none}}. | ||
|The command itself works differently from ''Java Edition''.}} | |The command itself works differently from ''Java Edition''.}} | ||
|{{ | |{{HistoryLine||1.21.40|dev=Preview 1.21.40.20|Added new overloads allows you to clear a queued function.}} | ||
}} | }} | ||
| Line 122: | Line 122: | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox commands}} | ||
de:Befehl/schedule | [[Minecraft:de:Befehl/schedule]] | ||
es:Comandos/schedule | [[Minecraft:es:Comandos/schedule]] | ||
ja:コマンド/schedule | [[Minecraft:fr:Commandes/schedule]] | ||
pt:Comandos/schedule | [[Minecraft:ja:コマンド/schedule]] | ||
ru:Команды консоли/schedule | [[Minecraft:pt:Comandos/schedule]] | ||
zh:命令/schedule | [[Minecraft:ru:Команды консоли/schedule]] | ||
[[Minecraft:zh:命令/schedule]] | |||
Latest revision as of 11:07, 20 May 2026
Template:Infobox command Schedules the function(s).
Usage
Template:IN, delays the execution of a function or all functions in a function Minecraft:tag. The function(s) are executed by the Minecraft:server after specified amount of time passes.
Template:IN, schedules a function to be executed once an area is fully loaded, or after a certain amount of time.
Template:IN, the same functions or the same function tags cannot have two schedules executed at the same game tick.
Template:IN, in replace mode, overrides an unexecuted schedule directly when a function or a function tag already has an unexecuted schedule. For example, if a function is scheduled to be executed in 30 seconds, and before it is executed you want to modify the execution time, you can use replace mode to set a new schedule to replace the original.
Even when using the execute as ... command, the scheduled function always runs as the server at Minecraft:world spawn.
Syntax
- Java Edition
schedule function <function> <time> [append|replace]- Adds a schedule.
schedule clear <function>- Removes a schedule.
- Bedrock Edition
schedule on_area_loaded add <from: x y z> <to: x y z> <function: filepath>schedule on_area_loaded add circle <center: x y z> <radius: int> <function: filepath>schedule on_area_loaded add tickingarea <name: string> <function: filepath>- Adds a schedule to be executed once an area is loaded.
schedule delay add <function> <delay (ticks)> [append|replace]schedule delay clear <function>- Delays a schedule.
schedule clear <function: filepath>schedule on_area_loaded clear function <function: filepath>schedule on_area_loaded clear tickingarea <name: string> [function: filepath]- Removes a schedule.
Arguments
- Specify the function to be run.
- Template:Arg desc
Template:El: Template:Argument
- Specify the delay time.
- Template:Arg desc
- One thing to note is that the delay time of Template:Cd does NOT always mean one tick of delay. Instead, it schedules the function for the upcoming phase for scheduled functions.
- If Template:Cd is executed in Template:Cd functions, it schedules the function for the phase in the same tick, which comes right after the phase for the Template:Cd functions.
- If Template:Cd is executed during the "scheduled functions" phase, it schedules the function for the next phase, which is coming in the next tick.
- Thus, specifying Template:Cd in Template:Cd functions makes the function run within the same tick, and specifying Template:Cd in scheduled functions makes the function run in the next tick.
Template:El: Template:Argument (in Template:Cd mode)
- Specify the function to be cleared. Should be a namespaced ID (
minecraft:cannot be omitted) or a function tag(minecraft:cannot be omitted). - Template:Arg desc
Template:El: append|replace
replace— (default) Simply replaces the current function's schedule time.append— Allows multiple schedules to exist at different times.
Template:El: Template:Argument and Template:Argument
- Specifies the coordinates of opposite corners of a rectangular area used to define a loaded area.
- Template:Arg desc
- For
xandz, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively.
Template:El: Template:Argument
- Specifies the coordinates of the center point of a circular area used to define a loaded area.
- Template:Arg desc
- For
xandz, numbers less than -30,000,000 or greater than 30,000,000 are treated as -30,000,000 or 30,000,000 respectively.
Template:El: Template:Argument
- Specifies the radius of a circular loaded area as the number of chunks from the center to the edge of the circle.
- Template:Arg desc It should be between 0 and 2,147,483,647 (inclusive).
Template:El: Template:Argument
- Specifies the name of a ticking area, executes function when which is added.
- Template:Arg desc
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
History
Java Edition
Bedrock Edition
External links
Minecraft:de:Befehl/schedule Minecraft:es:Comandos/schedule Minecraft:fr:Commandes/schedule Minecraft:ja:コマンド/schedule Minecraft:pt:Comandos/schedule Minecraft:ru:Команды консоли/schedule Minecraft:zh:命令/schedule