Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/schedule: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
SyncBot (talk | contribs)
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 ==
{{MC/In|java}}, delays the execution of a function or all functions in a function tag. The function(s) are executed by the [[Minecraft:server]] after specified amount of time passes.
{{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.


{{MC/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|bedrock}}, schedules a [[Minecraft:Function (Bedrock Edition)|function]] to be executed once an area is fully loaded, or after a certain amount of time.


{{MC/In|java}}, the same functions or the same function tags cannot have two schedules executed at the same game tick.
{{IN|java}}, the same functions or the same function tags cannot have two schedules executed at the same game tick.


{{MC/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.
{{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==


{{MC/Argument|function|function|function: filepath|CommandFilePath}}
{{argument|function|function|function: filepath|CommandFilePath}}
: Specify the function to be run.
: Specify the function to be run.
: {{MC/Arg desc|je=function|be=commandfilepath}}
: {{arg desc|je=function|be=commandfilepath}}


{{MC/El|je|short=1}}: {{MC/Argument|time|time}}
{{el|je|short=1}}: {{argument|time|time}}
: Specify the delay time.
: Specify the delay time.
: {{MC/Arg desc|je=time|min=0}}
: {{arg desc|je=time|min=0}}
: One thing to note is that the delay time of {{MC/Cd|1t}} does NOT always mean one tick of delay. Instead, it schedules the function for the upcoming phase for scheduled functions.
: 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 {{MC/Cd|schedule function <function> 1t}} is executed in {{MC/Cd|#minecraft:tick}} functions, it schedules the function for the phase in the same tick, which comes right after the phase for the {{MC/Cd|#minecraft:tick}} functions.
:* 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 {{MC/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.
:* 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 {{MC/Cd|1t}} in {{MC/Cd|#minecraft:tick}} functions makes the function run within the same tick, and specifying {{MC/Cd|1t}} in scheduled functions makes the function run in the next tick.
: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.


{{MC/El|je|short=1}}: {{MC/Argument|function|string}} (in {{MC/Cd|/schedule clear ...}} mode)
{{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).
: {{MC/Arg desc|je=string|type=greedy}}
: {{arg desc|je=string|type=greedy}}


{{MC/El|je|short=1}}: <code>append|replace</code>
{{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.


{{MC/El|be|short=1}}: {{MC/Argument|be=1|from: x y z|CommandPosition}} and {{MC/Argument|be=1|to: x y z|CommandPosition}}
{{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.
: {{MC/Arg desc|be=CommandPosition}}
: {{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.


{{MC/El|be|short=1}}: {{MC/Argument|be=1|center: x y z|CommandPosition}}
{{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.
: {{MC/Arg desc|be=CommandPosition}}
: {{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.


{{MC/El|be|short=1}}: {{MC/Argument|be=1|radius: int|int}}
{{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.  
: {{MC/Arg desc|be=int}} It should be between 0 and 2,147,483,647 (inclusive).
: {{arg desc|be=int}} It should be between 0 and 2,147,483,647 (inclusive).


{{MC/El|be|short=1}}: {{MC/Argument|be=1|name: string|basic_string}}
{{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.
: {{MC/Arg desc|be=string}}
: {{arg desc|be=string}}


==Result==
==Result==
Line 93: Line 93:
== Output ==
== Output ==


{{MC/Output table}}
{{Output table}}
{{MC/Output table|edition=je|On fail|0|0|0}}
{{Output table|edition=je|On fail|0|0|0}}
{{MC/Output table|cmd=/schedule function ...|On success|1|1|The game tick the function is to execute at modulo 2147483647}}
{{Output table|cmd=/schedule function ...|On success|1|1|The game tick the function is to execute at modulo 2147483647}}
{{MC/Output table|cmd=/schedule clear ...|On success|1|1|the number of schedules that are cleared.}}
{{Output table|cmd=/schedule clear ...|On success|1|1|the number of schedules that are cleared.}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|On success|1}}
{{Output table|On success|1}}
{{MC/Output table}}
{{Output table}}


== History ==
== History ==
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{MC/HistoryLine|java}}
|{{HistoryLine|java}}
|{{HistoryLine||1.14|dev=18w43a|Added {{MC/Cmd|schedule|link=none}}.}}
|{{HistoryLine||1.14|dev=18w43a|Added {{cmd|schedule|link=none}}.}}
|{{MC/HistoryLine||1.15|dev=19w38a|Added a clear syntax and added an append/replace optional argument (defaults to replace).}}
|{{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
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.16.100|dev=beta 1.16.100.59|Added {{MC/Cmd|schedule|link=none}}.
|{{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''.}}
|{{MC/HistoryLine||1.21.40|dev=Preview 1.21.40.20|Added new overloads allows you to clear a queued function.}}
|{{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 ==
{{MC/Navbox commands}}
{{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

Template:Argument

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 x and z, 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 x and z, 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

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

External links

Navigation

Template:Navbox commands

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