News
Game
Guides
Downloads
Versions
/compute
COMMANDS COMMAND BLOCKS & MAPS CHEATS · LEVEL 2 3 SUBCOMMANDS Added in 26.3

/compute command in Minecraft

/compute evaluates a context provider, a number defined by game data, and gives back the value. It works in three contexts: default, a block position or an entity. The float mode accepts an optional scale, the integer mode does not.

Syntax

/compute block <computePos> (float|integer)
/compute default (float|integer)
/compute entity <computeTarget> (float|integer)
All 9 forms
  • /compute block <computePos> float <provider>
  • /compute block <computePos> float <provider> <scale>
  • /compute block <computePos> integer <provider>
  • /compute default float <provider>
  • /compute default float <provider> <scale>
  • /compute default integer <provider>
  • /compute entity <computeTarget> float <provider>
  • /compute entity <computeTarget> float <provider> <scale>
  • /compute entity <computeTarget> integer <provider>
/compute block
/compute block <computePos> (float|integer)
ArgumentExpectsWhat it does
computePosBlock coordinates (x y z)Block position used as context, for example ~ ~-1 ~ for the block below you.
providerNumber or providerProvider ID such as minecraft:brewing/uses_default, or an inline value; float or integer depending on the mode.
scaleoptionalNumberOptional multiplier applied to the result, available in float mode only.
All 3 forms
  • /compute block <computePos> float <provider>
  • /compute block <computePos> float <provider> <scale>
  • /compute block <computePos> integer <provider>
/compute default
/compute default (float|integer)
ArgumentExpectsWhat it does
providerNumber or providerProvider ID such as minecraft:brewing/uses_default, or an inline value; float or integer depending on the mode.
scaleoptionalNumberOptional multiplier applied to the result, available in float mode only.
All 3 forms
  • /compute default float <provider>
  • /compute default float <provider> <scale>
  • /compute default integer <provider>
/compute entity
/compute entity <computeTarget> (float|integer)
ArgumentExpectsWhat it does
computeTargetEntity selectoroneSingle entity used as context, for example @s or @n[type=minecraft:cow].
providerNumber or providerProvider ID such as minecraft:brewing/uses_default, or an inline value; float or integer depending on the mode.
scaleoptionalNumberOptional multiplier applied to the result, available in float mode only.
All 3 forms
  • /compute entity <computeTarget> float <provider>
  • /compute entity <computeTarget> float <provider> <scale>
  • /compute entity <computeTarget> integer <provider>

Examples

Evaluate a vanilla provider

/compute default integer minecraft:brewing/uses_default

Evaluates the integer provider brewing/uses_default, defined in the 26.3 game data as the constant 20.

Java 26.3

Evaluate in a block context

/compute block ~ ~ ~ integer minecraft:compostable/low

Evaluates the compostable/low provider with the block at your position as context.

Java 26.3

Inline value with a scale

/compute default float 1.5 10

Evaluates the inline float value 1.5 and applies the scale 10.

Java 26.3

Write the value into a storage

/data modify storage mypack:vars uses set compute default integer minecraft:brewing/uses_default

Uses compute as a source of /data modify and saves the result at uses in the mypack:vars storage.

Java 26.3
Build your command

Fill in the fields, then copy the command.

Command generator

What the 26.3 command tree shows

compute default, compute block <pos> and compute entity <target> choose the context; the game data names them command_compute_default, command_compute_position and command_compute_entity. Then float reads a provider of the context_float_provider registry and integer one of context_int_provider. A provider is an ID, such as minecraft:brewing/uses_default or minecraft:compostable/low, or an inline value. Provider types include constant, uniform, add, mul, conditional and storage, plus score for integers.

The same compute source also exists in /data modify, to write the value into NBT. Test providers from the chat or a /function before using them in a pack.

✓ Checked in Java Edition 26.3 · updated 2 November 2026

/compute: FAQ

What can I write as provider?

An ID from the context_float_provider or context_int_provider registry, including providers added by data packs, or an inline value such as a number.

What does scale do in /compute?

It multiplies the result in float mode. The integer mode has no scale argument.

How do I use /compute?

Type it in the chat with cheats on: /compute block <computePos> (float|integer).

Who can use /compute?

Cheats on, or operator level 2.

Since when does /compute exist?

It is in the official command tree since Java Edition 26.3.

Related commands