Convert a mathematical expression into a Minecraft number provider JSON. Write a formula using variables, arithmetic operators and built-in functions, choose the provider type (Integer or Float), and the generator produces the corresponding JSON ready to paste into a datapack or command block.
This generator translates a mathematical expression into a Minecraft number provider JSON
structure.
Use standard operators (+, -, *, /,
^), parentheses, numbers, variables and function calls.
Each variable must have a value source (score, storage or environment attribute).
The provider type (Integer or Float) determines which functions are native; functions of the
opposite type are automatically wrapped in from_int / from_float for
conversion.
The result can be copied in JSON or compact SNBT format using the format switcher above the
output.
Implicit multiplication is supported: you can write 5x instead of
5*x,
2(x+1) instead of 2*(x+1), or x(9y-1) instead of
x*(9*y-1).
Consecutive letters are treated as separate variables multiplied together: abc
means a*b*c.
To group letters into a single multi-letter variable name, wrap them in apostrophes:
'ab'c means ab*c.
Function names (like abs, cos) are recognized automatically and not
split.
Pre-calculation with !expr!: wrap an arithmetic expression in
exclamation marks to evaluate it at generation time and insert the result as a plain number.
For example, !20*60*5! becomes 6000 in the output (not
const(20)*const(60)*const(5)).
This is useful for unit conversions like ticks → seconds: !20*60*5! for 5
minutes in ticks.
Inside !! you can use numbers, operators (+ - * / ^), parentheses, and
built-in constants (pi, e, tau, phi,
sqrt2, sqrt3).
Variables and functions are not allowed inside !!.
Constant source also supports formulas: when a variable's source is set to
constant, you can enter either a plain number (e.g. 3.14) or a formula
(e.g. 20*60*5) without !!.
The evaluated result is shown next to the input with = for immediate feedback.
Reverse conversion: you can edit the JSON in the Result panel directly, or
paste
an existing number provider JSON there — the formula is automatically updated. You can
also
drag & drop a .json file anywhere on the page to import it.
Errors are shown as a toast notification in the top-right corner and do not clear your JSON.
+ — addition (→ minecraft:add, inputs)- — subtraction (→ minecraft:sub, left/right)* — multiplication (→ minecraft:mul, inputs)/ — division (→ minecraft:div, left/right)^ — power (→ minecraft:pow, base/exponent)abs(x) — absolute value (→ minecraft:abs, input)negate(x) — negation (→ minecraft:negate, input)div(a,b) — division (→ minecraft:div, left/right)mod(a,b) — modulo (→ minecraft:mod, left/right)sub(a,b) — subtraction (→ minecraft:sub, left/right)add(a,b,...) — sum (→ minecraft:add, inputs)avg(a,b,...) — average (→ minecraft:average, operands)max(a,b,...) — maximum (→ minecraft:maximum, operands)min(a,b,...) — minimum (→ minecraft:minimum, operands)mul(a,b,...) — product (→ minecraft:mul, inputs)pow(base,exp) — power (→ minecraft:pow, base/exponent)uniform(min,max) — uniform distribution (→ minecraft:uniform,
min/max)const(n) — constant (→ minecraft:constant, value)weighted_list[(w,v),(w,v),...] — weighted distribution (→
minecraft:weighted_list, distribution)w = integer weight, v = number provider / value;
alias: wl[...](), numbers, variables. Spaces are ignored.from_float(x) — convert float to int (→ minecraft:from_float,
input)floor_div(a,b) — floor division (→ minecraft:floor_div,
left/right)floor_mod(a,b) — floor modulo (→ minecraft:floor_mod,
left/right)binomial(n,p) — binomial distribution (→ minecraft:binomial,
n/p)cos(x) — cosine (→ minecraft:cos, input)ceil(x) — ceiling (→ minecraft:ceil, input)floor(x) — floor (→ minecraft:floor, input)from_int(x) — convert int to float (→ minecraft:from_int, input)round(x) — round (→ minecraft:round, input)sin(x) — sine (→ minecraft:sin, input)sqrt(x) — square root (→ minecraft:sqrt, input)truncate(x) or trunc(x) — truncate fraction (→
minecraft:truncate, input)length(a,b,...) — vector length / hypotenuse, sqrt(a²+b²+...)
(→ minecraft:length, inputs)sin, cos, pow, and
negate.from_float() when used in an Integer
provider.tan(x) — tangent → sin(x)/cos(x)cot(x) — cotangent → cos(x)/sin(x)sec(x) — secant → 1/cos(x)csc(x) — cosecant → 1/sin(x)sinh(x) — hyperbolic sine →
(e^x − e^(negate(x)))/2cosh(x) — hyperbolic cosine →
(e^x + e^(negate(x)))/2tanh(x) — hyperbolic tangent →
(e^x − e^(negate(x)))/(e^x + e^(negate(x)))tan(x)sinh(x)+cosh(x) — equals e^xtanh(x)x * 2 * pi / 360.from_float() when used in an Integer
provider.sin(rad(90)) — sine of 90° (≈ 1)x * 180 / pi.from_float() when used in an Integer
provider.deg(pi) — ≈ 180x * pi / 200.from_float() when used in an Integer
provider.sin(grad(200)) — sine of 200 grad (≈ 0)grad):
x * 200 / pi.from_float() when used in an Integer
provider.dgrad(pi) — ≈ 2000 if
x == 0,
otherwise abs(x)/x (i.e. 1 or -1).conditional with an inline
minecraft:float_value_check predicate that checks if x equals
0.sign(x)expr with respect to
x.x; all other variables are treated
as constants (derivative = 0).f'(sin(x)) → cos(x)f'(x^2) → 2*xf''(sin(x)) → -sin(x)f'{3}(x^3) → 6f'(sin(x)*cos(x)) → cos(x)*cos(x)+sin(x)*(-sin(x))minecraft:constant:pi — π ≈ 3.141592653589793e — Euler's number ≈ 2.718281828459045tau — 2π ≈ 6.283185307179586phi — golden ratio ≈ 1.618033988749895sqrt2 — √2 ≈ 1.4142135623730951sqrt3 — √3 ≈ 1.7320508075688772constant source type for any variable to assign
a fixed numeric value (useful for named constants in your formula).sin(2*pi*x) — uses pi as a built-in constant.e^x — uses e as a built-in constant (same as
pow(e,x)).
from_float(...)from_int(...)sqrt(x) as Integer → from_float(sqrt(x))binomial(4,0.5) as Float →
from_int(binomial(4,0.5))conditional(condition?on_true[;on_false]) or
if(condition?on_true[;on_false])"minecraft:block/fast_cooking" — references a predicate defined in your
datapack"https://misode.github.io/predicate/?share=VRMRftbVNM"VRMRftbVNM{"type":"minecraft:random_chance","chance":0.5}0.on_true and on_false can also be a quoted
string referencing another number provider:
"minecraft:cooking/fast_speed_multiplier".if(VRMRftbVNM?1;0)conditional("https://misode.github.io/predicate/?share=VRMRftbVNM"?x;0)if({"type":"minecraft:random_chance","chance":0.5}?1)conditional("minecraft:block/fast_cooking"?"minecraft:cooking/fast_speed_multiplier";"minecraft:cooking/normal_speed_multiplier")number_dispatcher[(cond1?val1),(cond2?val2);default]dispatch[...], nd[...](condition?value) pairs,
each wrapped in parentheses.conditional(): resource
location, Misode URL, share code, or inline JSON.;) — number provider used when
no case matches; defaults to 0.nd[({"type":"minecraft:weather_check","raining":true}?1),({"type":"minecraft:weather_check","thundering":true}?2);0]dispatch[(VRMRftbVNM?x),(ABC123?y)]number_dispatcher[({"type":"minecraft:random_chance","chance":0.5}?1);0]enchantment_level — value based on enchantment level (float only)Create custom functions and constants. Functions are stored in your browser and can be used in expressions.