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)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 9: Line 9:


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


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}}
{{MC/Argument|function|function|function: filepath|CommandFilePath}}
: Specify the function to be run.
: Specify the function to be run.
: {{arg desc|je=function|be=commandfilepath}}
: {{MC/Arg desc|je=function|be=commandfilepath}}


{{el|je|short=1}}: {{argument|time|time}}
{{MC/El|je|short=1}}: {{MC/Argument|time|time}}
: Specify the delay time.
: Specify the delay time.
: {{arg desc|je=time|min=0}}
: {{MC/Arg desc|je=time|min=0}}
: 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.
: 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.
:* 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 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 during the "scheduled functions" phase, it schedules the function for the next phase, which is coming in the next tick.
:* 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.
: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.
: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.


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


{{el|je|short=1}}: <code>append|replace</code>
{{MC/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}}
{{MC/El|be|short=1}}: {{MC/Argument|be=1|from: x y z|CommandPosition}} and {{MC/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}}
: {{MC/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}}
{{MC/El|be|short=1}}: {{MC/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}}
: {{MC/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}}
{{MC/El|be|short=1}}: {{MC/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).
: {{MC/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}}
{{MC/El|be|short=1}}: {{MC/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}}
: {{MC/Arg desc|be=string}}


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


{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On fail|0|0|0}}
{{MC/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}}
{{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 clear ...|On success|1|1|the number of schedules that are cleared.}}
{{MC/Output table|cmd=/schedule clear ...|On success|1|1|the number of schedules that are cleared.}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|On success|1}}
{{MC/Output table|On success|1}}
{{Output table}}
{{MC/Output table}}


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


de:Befehl/schedule
de:Befehl/schedule

Latest revision as of 20:13, 9 April 2026

Template:Infobox command Schedules the function(s).

Usage

in Template:Editions, 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 Template:Editions, schedules a function to be executed once an area is fully loaded, or after a certain amount of time.

in Template:Editions, the same functions or the same function tags cannot have two schedules executed at the same game tick.

in Template:Editions, 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:El<function>: function
Template:El: function: filepath: CommandFilePath

Specify the function to be run.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|function}}{{#vardefine:be-arg|function}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
  1. REDIRECT Template:Edition

Template:Rcat: <time>: time

Specify the delay time.
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|time}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
One thing to note is that the delay time of
  1. REDIRECT Template:Code

Template:Redr does NOT always mean one tick of delay. Instead, it schedules the function for the upcoming phase for scheduled functions.

  • If
  1. REDIRECT Template:Code

Template:Redr is executed in

  1. REDIRECT Template:Code

Template:Redr functions, it schedules the function for the phase in the same tick, which comes right after the phase for the

  1. REDIRECT Template:Code

Template:Redr functions.

  • If
  1. REDIRECT Template:Code

Template:Redr is executed during the "scheduled functions" phase, it schedules the function for the next phase, which is coming in the next tick.

Thus, specifying
  1. REDIRECT Template:Code

Template:Redr in

  1. REDIRECT Template:Code

Template:Redr functions makes the function run within the same tick, and specifying

  1. REDIRECT Template:Code

Template:Redr in scheduled functions makes the function run in the next tick.

  1. REDIRECT Template:Edition

Template:Rcat: <function>: string (in

  1. REDIRECT Template:Code

Template:Redr mode)

Specify the function to be cleared. Should be a namespaced ID (minecraft: cannot be omitted) or a function tag(minecraft: cannot be omitted).
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|string}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
  1. REDIRECT Template:Edition

Template:Rcat: append|replace

replace — (default) Simply replaces the current function's schedule time.
append — Allows multiple schedules to exist at different times.
  1. REDIRECT Template:Edition

Template:Rcat: from: x y z: CommandPosition and to: x y z: CommandPosition

Specifies the coordinates of opposite corners of a rectangular area used to define a loaded area.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
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.
  1. REDIRECT Template:Edition

Template:Rcat: center: x y z: CommandPosition

Specifies the coordinates of the center point of a circular area used to define a loaded area.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
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.
  1. REDIRECT Template:Edition

Template:Rcat: 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.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} It should be between 0 and 2,147,483,647 (inclusive).
  1. REDIRECT Template:Edition

Template:Rcat: name: string: basic_string

Specifies the name of a ticking area, executes function when which is added.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|string}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

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

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|The game tick the function is to execute at modulo 2147483647}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/schedule function ...}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of schedules that are cleared.}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/schedule clear ...}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/schedule es:Comandos/schedule ja:コマンド/schedule pt:Comandos/schedule ru:Команды консоли/schedule zh:命令/schedule