Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Number provider

From SAS Gaming Wiki
Revision as of 11:08, 23 July 2026 by SyncBot (talk | contribs) (Sync: updated from Minecraft)

Template:For Template:Exclusive Template:Wip A number provider is a data structure used to provide a number, which can be simply a constant, a random number within a certain distribution, a number under a certain condition, etc. Number providers are used in Minecraft:loot tables, Minecraft:predicates, Minecraft:item modifiers, villager trade, Minecraft:trade sets, and in data componentsTemplate:Upcoming (Template:DCL, Template:DCL, and Template:DCL).

JSON definition

Template:In development

Number providers can be defined in Minecraft:data packs, as part of the directory structure below.

Use

In most uses of number provider, it is used as an Minecraft:NBT object, within a larger structure. This includes all uses in Minecraft:loot tables, Minecraft:predicates, Minecraft:item modifiers, villager trade, and Minecraft:trade sets.

In Java 26.3, number provider Minecraft:registry can be used in the component Template:DCL to define how many layers are added when using Minecraft:composter. In this case, only number providers are accepted, not line definitions.

Vanila registries

Template:In development

There are registry number providers used in vanilla Minecraft:data pack.

Template:File: Number providers used in the default component Template:DCL: Template:JSON file Template:JSON file Template:JSON file Template:JSON file Template:JSON file

Template:File: Number providers used in the default component Template:DCL, except Template:Cd: Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:JSON file/cooking Template:File: Template:JSON file Template:JSON file

See Template:Slink for a list of items that use such number providers in the component Template:Cd by default.

Format

A a number provider can be an Template:Nbt or Template:Nbt. They can either be defined as a constant value or as an object.

Or:

Or:

Or:

Number providers types

Template:Past Each type of number provider specifies the rules by which the number will be provided. To do this, they use associated extra contents, which function differently for each type.

The type values can omit or include the namespace Template:Cd, for example using the type Template:Cd or Template:Cd has the same effect.

Number provider types can not be customized via data packs.

Constant

A constant value.

Uniform

A random number following a uniform distribution between two values. The values are inclusive, meaning the provided number can be either Template:Cd or Template:Cd, except if the provided number is a float, in which case it must be strictly less than Template:Cd. If Template:CdTemplate:Cd, the provided number is Template:Cd.

Binomial

A random number following a binomial distribution. The returned float has the same value as the int.

Score

To query and use a Minecraft:scoreboard value. Return Template:Cd if the scoreboard cannot be calculated.

Storage

A value in Minecraft:command storage.

Enchantment level

A value dependent on the level of the Minecraft:loot context enchantment.

Sum

The sum of multiple value providers

Environment attribute

Fetches and provides the value of an Minecraft:environment attribute (that can be represented as a number).

This provider requires a context with an origin position set as long as the environment attribute can vary positionally.

Number dispatcher

Returns the first case which fulfills its condition or the default if none do.

Conditional

Returns the value from Template:PastTemplate:Nbt if its Template:Nbt or Template:PastTemplate:Nbt if not.

Weighted list

Returns a value from a distribution of weighted number providers.

  • Template:Nbt
    • Template:Nbt: Template:CdTemplate:Upcoming
    • Template:Nbt: Returns a value from a distribution of weighted number providers.
      • Template:Nbt: A single weighted number provider:
        • Template:PastTemplate:Nbt: A number provider, which is executed if the weighted number provider is chosen.
        • Template:Nbt: A positive integer. Determines how often this weighted number provider is chosen out of all data in the distribution. Weighted number provider with higher weights are used more often. The chance of an weighted number provider being chosen is [this weighted number provider's weight ÷ total weight of all weighted number provider in the distribution].

History

Template:Info needed section Template:HistoryTable

Navigation

Template:Navbox Java Edition technical

Minecraft:zh:数值提供器