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

From SAS Gaming Wiki

Template:Wip 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 found at Template:Cd alongside the common parameters.
Template:Cd
Runs the provider with the [[Minecraft:Loot context#minecraft:command_compute_entity|Template:Cd]] context, providing the selected entity as Template:Cd alongside the common parameters.

Float providers are evaluated to produce a floating-point value, but a command's Template:Cd value can only be an integer, so the actual result is rounded down to the nearest integer before being returned. If Template:Cd is specified, the result is multiplied by that before being rounded down, allowing more precision to be returned. Integer providers already produce an integer value, so no scaling is needed.

To store a float without losing any precision, see Template:Cmd instead, which avoids passing the value through Template:Cd.

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:context float provider to evaluate. Can be an Minecraft:identifier or an inline definition.
Template:Arg desc

Template:Argument

Specifies the Minecraft:context int provider to evaluate. Can be an Minecraft:identifier or an inline definition.
Template:Arg desc

Template:Argument

Specifies the value by which the float provider's result is multiplied.
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 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