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/compute: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
Line 6: Line 6:
}}
}}


Evaluates [[Minecraft:number provider]]s in various contexts.
Evaluates [[Minecraft:number provider]]s in various [[Minecraft:loot context]]s.


== Syntax ==
== Syntax ==
: {{cmd|compute <CONTEXT> <provider> [<scale>{{!}}integer]}}
: {{cmd|compute <CONTEXT> <provider> [<scale>]}}
: {{cmd|compute <CONTEXT> <provider> integer}}
: Where {{cd|CONTEXT}} is one of:
: Where {{cd|CONTEXT}} is one of:
:: {{cd|default}}
:: {{cd|default}}
::: Run provider with the [[Minecraft:Loot context#minecraft:command_compute_default|{{cd|minecraft:command_compute_default}}]] context, only providing common parameters (execution position and {{cd|this}} entity).
::: Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_default|{{cd|minecraft:command_compute_default}}]] context, which provides common parameters such as the execution position and {{cd|this}} entity.
:: {{cd|block <pos>}}
:: {{cd|block <pos>}}
::: Run provider with the [[Minecraft:Loot context#minecraft:command_compute_position|{{cd|minecraft:command_compute_position}}]] context, providing block state and block entity based on the block at {{cd|<pos>}}.
::: Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_position|{{cd|minecraft:command_compute_position}}]] context, providing the block state and block entity of the block at {{cd|<pos>}}.
:: {{cd|entity <target>}}
:: {{cd|entity <target>}}
::: Run provider with the [[Minecraft:Loot context#minecraft:command_compute_entity|{{cd|minecraft:command_compute_entity}}]] context, providing {{cd|target_entity}} based on the selector result.
::: Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_entity|{{cd|minecraft:command_compute_entity}}]] context, providing the selected entity as {{cd|target_entity}}.
: If {{cd|[<scale>{{!}}integer]}} is set to a number or omitted, the number provider is evaluated in float mode.
 
: If it is set to {{cd|integer}}, the number provider is evaluated in integer mode, truncating after every step.  
: In float mode, {{cd|<provider>}} is evaluated as a floating-point value. If {{cd|<scale>}} is specified, the resulting value is multiplied by it. The resulting value is then rounded down to the nearest integer.
: If {{cd|<scale>}} is omitted, a scale of {{cd|1.0}} is used.
: In integer mode, specified by {{cd|integer}}, the provider is evaluated directly as an integer. The {{cd|<scale>}} argument cannot be used with integer mode.


== Arguments ==
== Arguments ==
{{expand section}}


{{argument|pos|block_pos}}
{{argument|pos|block_pos}}
: Specifies a block that will be available to the number provider.
: Specifies the block whose state and block entity are made available to the number provider.
: {{arg desc|je=block_pos}}
: {{arg desc|je=block_pos}}


{{argument|target|entity}}
{{argument|target|entity}}
: Specifies an entity that will be available to the number provider.
: Specifies the entity whose data is made available to the number provider as {{cd|target_entity}}.
: {{arg desc|je=entity|amount=single|type=entities}}
: {{arg desc|je=entity|amount=single|type=entities}}


Line 36: Line 38:


{{argument|scale|float}}
{{argument|scale|float}}
: The result of the provider will be scaled by this value and rounded towards negative infinity for command output.
: Specifies the value by which the provider's result is multiplied in float mode.
: If omitted, {{cd|1.0}} is used.
: The resulting value is rounded down to the nearest integer after scaling.
: {{arg desc|je=float}}
: {{arg desc|je=float}}


== Result ==
== Result ==
{{Empty section}}
{{Result table}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|The number provider cannot be evaluated in the specified context.|fail}}
{{Result table|The number provider is successfully evaluated.|succeed}}
{{Result table}}


== Output ==
== Output ==
{{Empty section}}
{{Output table}}
{{Output table|edition=je|On fail|0|0}}
{{Output table|On success|The integer result produced by the number provider.|the computed result|the computed result}}
{{Output table}}
 
When the provider has a registered identifier, a successful command also displays its identifier and the computed result. In float mode, if scaling and rounding change the provider's original value, the output also displays the original floating-point value.


== History ==
== History ==

Revision as of 11:06, 31 August 2026

Template:Wip Template:In development Template:Infobox command

Evaluates Minecraft:number providers in various Minecraft:loot contexts.

Syntax

Template:Cmd
Template:Cmd
Where Template:Cd is one of:
Template:Cd
Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_default|Template:Cd]] context, which provides common parameters such as the execution position and Template:Cd entity.
Template:Cd
Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_position|Template:Cd]] context, providing the block state and block entity of the block at Template:Cd.
Template:Cd
Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_entity|Template:Cd]] context, providing the selected entity as Template:Cd.
In float mode, Template:Cd is evaluated as a floating-point value. If Template:Cd is specified, the resulting value is multiplied by it. The resulting value is then rounded down to the nearest integer.
If Template:Cd is omitted, a scale of Template:Cd is used.
In integer mode, specified by Template:Cd, the provider is evaluated directly as an integer. The Template:Cd argument cannot be used with integer mode.

Arguments

Template:Argument

Specifies the block whose state and block entity are made available to the number provider.
Template:Arg desc

Template:Argument

Specifies the entity whose data is made available to the number provider as Template:Cd.
Template:Arg desc

Template:Argument

Specifies the Minecraft:number provider to evaluate.
Template:Arg desc

Template:Argument

Specifies the value by which the provider's result is multiplied in float mode.
If omitted, Template:Cd is used.
The resulting value is rounded down to the nearest integer after scaling.
Template:Arg desc

Result

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

When the provider has a registered identifier, a successful command also displays its identifier and the computed result. In float mode, if scaling and rounding change the provider's original value, the output also displays the original floating-point value.

History

Template:HistoryTable

Navigation

Template:Navbox new content Template:Navbox commands

Minecraft:de:Befehl/compute Minecraft:ja:コマンド/compute Minecraft:zh:命令/compute