Appearance
helix / ContextInt
Variable: ContextInt โ
constContextInt:object
Defined in: core/values/context-provider/index.ts:42
Integer /compute expressions. Alias it: import { ContextInt as i }.
Type Declaration โ
abs โ
abs: (
input) =>ContextIntProvider
Parameters โ
input โ
Returns โ
add โ
add: (...
inputs) =>ContextIntProvider
a + b + ...
Parameters โ
inputs โ
...IntRef[]
Returns โ
agg โ
agg: (
type) => (...inputs) =>ContextIntProvider
Parameters โ
type โ
string
Returns โ
(...inputs) => ContextIntProvider
avg โ
avg: (...
inputs) =>ContextIntProvider
Arithmetic mean.
Parameters โ
inputs โ
...IntRef[]
Returns โ
bin โ
bin: (
type) => (left,right) =>ContextIntProvider
Parameters โ
type โ
string
Returns โ
(left, right) => ContextIntProvider
binomial โ
binomial: (
n,p) =>ContextIntProvider
n coin flips at probability p, counting successes.
Parameters โ
n โ
p โ
Returns โ
conditional โ
conditional: (
condition,onTrue,onFalse?) =>ContextIntProvider
Pick onTrue or onFalse (default 0) by a predicate.
Parameters โ
condition โ
string | IdValue | PredicateRef
onTrue โ
onFalse? โ
Returns โ
div โ
div: (
left,right) =>ContextIntProvider
left / right
Parameters โ
left โ
right โ
Returns โ
floorDiv โ
floorDiv: (
left,right) =>ContextIntProvider
Divide rounding toward -infinity. Right for coordinates.
Parameters โ
left โ
right โ
Returns โ
floorMod โ
floorMod: (
left,right) =>ContextIntProvider
Floored modulo - the partner of floorDiv; floorMod(-5, 2) is 1, not -1.
Parameters โ
left โ
right โ
Returns โ
fromFloat โ
fromFloat: (
input) =>ContextIntProvider
Truncate a float expression to an int (rounds toward 0).
Parameters โ
input โ
Returns โ
max โ
max: (...
inputs) =>ContextIntProvider
Parameters โ
inputs โ
...IntRef[]
Returns โ
min โ
min: (...
inputs) =>ContextIntProvider
Parameters โ
inputs โ
...IntRef[]
Returns โ
mod โ
mod: (
left,right) =>ContextIntProvider
left % right (truncated division; see ContextInt.floorMod).
Parameters โ
left โ
right โ
Returns โ
mul โ
mul: (...
inputs) =>ContextIntProvider
a * b * ...
Parameters โ
inputs โ
...IntRef[]
Returns โ
negate โ
negate: (
input) =>ContextIntProvider
Parameters โ
input โ
Returns โ
pow โ
pow: (
base,exponent) =>ContextIntProvider
base ** exponent.
Parameters โ
base โ
exponent โ
Returns โ
raw โ
raw: (
json) =>ContextIntProvider
Escape hatch for providers not modelled yet, or one referenced by id.
Parameters โ
json โ
unknown
Returns โ
score โ
score: (
score,fallback?) =>ContextIntProvider
Reads a score into the expression. The holder must be a fake player or @s. A fixed name is taken literally, so @s has to go through context and other selectors can't be read at all.
Parameters โ
score โ
fallback? โ
Returns โ
storage โ
storage: (
storage,path,fallback?) =>ContextIntProvider
Read a number out of command storage.
Parameters โ
storage โ
path โ
string | NbtPathValue
fallback? โ
Returns โ
sub โ
sub: (
left,right) =>ContextIntProvider
left - right
Parameters โ
left โ
right โ
Returns โ
un โ
un: (
type) => (input) =>ContextIntProvider
Parameters โ
type โ
string
Returns โ
(input) => ContextIntProvider
uniform โ
uniform: (
min,max) =>ContextIntProvider
A uniform random draw in [min, max] - a real roll, evaluated by the game.