Minecraft:Block state provider: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 126: | Line 126: | ||
***** {{nbt inherit/block_state}} | ***** {{nbt inherit/block_state}} | ||
**** {{nbt|int|weight}}: The weight of this entry. | **** {{nbt|int|weight}}: The weight of this entry. | ||
< | === rule_based_state_provider === | ||
Provides a block state depending on the current block(s) by matching a sequence of rules. | |||
<div class="treeview"><section begin="json format" /> | |||
* {{nbt|compound}}: A block state provider | |||
** {{nbt|string|type}}: <code>rule_based_state_provider</code> | |||
** {{Nbt|compound|fallback}} The block to use when no rules' predicates match. This field is optional. If unspecified and no rules' predicates match, then no block is placed. | |||
*** {{Nbt inherit/block state provider}} | |||
** {{Nbt|list|rules}} (Required, but can be empty) Rules of the block to use. | |||
*** {{Nbt|compound}} One rule. | |||
**** {{Nbt|compound|if_true}} The [[Minecraft:block predicate]] of this rule. | |||
***** {{list indent|***|{{#lst:block predicate|json format}}}} | |||
**** {{Nbt|compound|then}} The block to use when the predicate is passed. | |||
***** {{Nbt inherit/block state provider}}<section end="json format" /> | |||
</div> | |||
== History == | == History == | ||
{{info needed section|general history of block state providers. Specifically, when block state providers were added or removed.}} | {{info needed section|general history of block state providers. Specifically, when block state providers were added or removed.}} | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java}} | |||
|{{HistoryLine||1.16.2|dev=20w28a|Block state providers now control the blocks placed by many [[Minecraft:configured feature]]s.{{Verify|This is where custom worldgen and configured features were added to data packs. Did block state providers exist even earlier?}}}} | |||
|{{HistoryLine||26.1|dev=snap11|All block state providers now support the {{cd|rule_based_state_provider}} type, which previously was only available for {{cd|disk}} features.}} | |||
|{{HistoryLine|java upcoming}} | |{{HistoryLine|java upcoming}} | ||
|{{HistoryLine||26.3|dev=snap2|Added the {{cd|copy_properties_provider}} block state provider.}} | |{{HistoryLine||26.3|dev=snap2|Added the {{cd|copy_properties_provider}} block state provider.}} | ||
|{{HistoryLine|||dev=snap3|Added the {{cd|random_block_provider}} block state provider. | |{{HistoryLine|||dev=snap3|Added the {{cd|random_block_provider}} block state provider. | ||
|Renamed the {{cd|source_block_state_provider}} field in {{cd|copy_properties_provider}} to {{cd|source}}. | |Renamed the {{cd|source_block_state_provider}} field in {{cd|copy_properties_provider}} to {{cd|source}}. | ||
|The {{cd|rotated_block_provider}} block state provider now works on any block with {{cd|axis}} or {{cd|facing}} properties | |The {{cd|rotated_block_provider}} block state provider now works on any block with {{cd|axis}} or {{cd|facing}} properties, and a {{cd|direction}} field has been added. | ||
}} | }} | ||
}} | }} | ||
Revision as of 11:12, 12 August 2026
Template:Exclusive A block state provider is used to provide a (potentially randomized) Minecraft:block and Minecraft:block state to be placed by Minecraft:configured features.
JSON format
Block state providers are defined using the following format:
- Template:Nbt: A block state provider<section begin="json format" />
- Template:Nbt: The type of the block state provider, see Template:Slink for option.
- Additional fields based on Template:Nbt, see Template:Slink.<section end="json format" />
Types
The following block state provider types exist.
copy_properties_provider
Copies common block state properties from the block at the evaluated position to the resulting state.Template:Upcoming
- Template:Nbt: A block state provider
- Template:Nbt:
copy_properties_provider - Template:Nbt: Provides the block state which the copied properties are copied on top of. Only properties common between both the source and the target blocks will be copied.
- Template:Nbt:
dual_noise_provider
Randomly chooses a block state according to two noise values.
- Template:Nbt: A block state provider
- Template:Nbt:
dual_noise_provider - Template:Nbt: The seed of the noise.
- Template:Nbt: A noise.
- Template:Nbt: Horizontal scale of noise. Must be a positive value.
- Template:Nbt: The noise used for the first selection.
- Template:Nbt: Horizontal scale of the slow noise. Must be a positive value.
- Template:Nbt: The number of block states that selected out by slow noise.
- Template:Nbt: The min number of block states after selection by slow noise. Must be an integer equal to or greater than 1.
- Template:Nbt: The max number of block states after selection by slow noise. Must be an integer equal to or less than 64, and must be greater than Template:Nbt.
- Template:Nbt: Shorthand version of Template:Nbt.
- Template:Nbt: Min number. Must be an integer equal to or greater than 1.
- Template:Nbt: Max number. Must be an integer equal to or less than 64, and must be greater than the min number.
- Template:Nbt: Shorthand version of Template:Nbt when the min equals to the max. Value between 1 and 64 (both inclusive).
- Template:Nbt: List of block states to choose from.
- Template:Nbt: A block state.
- Template:Nbt:
noise_provider
Randomly chooses a block state according to a noise value.
- Template:Nbt: A block state provider
- Template:Nbt:
noise_provider - Template:Nbt: The seed of the noise.
- Template:Nbt: A noise.
- Template:Nbt: Horizontal scale of the noise. Must be a positive value.
- Template:Nbt: (Cannot be empty) List of optional block states.
- Template:Nbt: A block state.
- Template:Nbt:
noise_threshold_provider
Uses different block states when a noise value above or below the threshold.
- Template:Nbt: A block state provider
- Template:Nbt:
noise_threshold_provider - Template:Nbt: The seed of the noise.
- Template:Nbt: A noise.
- Template:Nbt: Horizontal scale of noise. Must be a positive value.
- Template:Nbt: Value between -1.0 and 1.0 (inclusive). The threshold of the noise value. If the noise value is lower than this value, the block states in Template:Cd will be selected.
- Template:Nbt: Value between 0.0 and 1.0 (inclusive). If the noise value is higher than the threshold, the block states in Template:Cd will be selected with a probability of high_chance.
- Template:Nbt: Default block state. These block states is used when the noise value is higher than Template:Cd but high_states is not selected according to high_chance.
- Template:Nbt: (Cannot be empty) List of block states to choose from when lower than threshold.
- Template:Nbt: A block state.
- Template:Nbt: (Cannot be empty) List of block states to choose from when higher than threshold.
- Template:Nbt: A block state.
- Template:Nbt:
simple_state_provider
Specifies a single block state directly
- Template:Nbt: A block state provider
- Template:Nbt:
simple_state_provider - Template:Nbt: The block state to use.
- Template:Nbt:
random_block_provider
Returns the default block state for a randomly chosen block.Template:Upcoming
- Template:Nbt: A block state provider
- Template:Nbt:
random_block_provider - Template:NbtTemplate:NbtTemplate:Nbt: Template:Json ref; Cannot be empty — Blocks to choose from.
- Template:Nbt:
randomized_int_state_provider
Assigns a random value to an integer block property.
- Template:Nbt: A block state provider
- Template:Nbt:
randomized_int_state_provider - Template:Nbt: The name of a block property.
- Template:NbtTemplate:Nbt: The value of the block property.
- Template:Nbt: Another block state provider that specifies the source of the block state.
- Template:Nbt:
rotated_block_provider
Randomly rotates axially-rotated blocksTemplate:Until / any block with Template:Cd or Template:Cd properties.Template:Upcoming
- Template:Nbt: A block state provider
- Template:Nbt:
rotated_block_provider - Template:Nbt: The block ID to use. The block properties are ignored.Template:Until / A block state providerTemplate:Upcoming
- Template:NbtTemplate:Upcoming: Optional. Describes the direction to set. If omitted, a random direction is chosen.
- Template:Nbt:
weighted_state_provider
Chooses a block state from a weighted list.
- Template:Nbt: A block state provider
- Template:Nbt:
weighted_state_provider - Template:Nbt: (Cannot be empty) A weighted list of block state entries.
- Template:Nbt A block state and its corresponding weight.
- Template:Nbt: The block state to use.
- Template:Nbt: The weight of this entry.
- Template:Nbt A block state and its corresponding weight.
- Template:Nbt:
rule_based_state_provider
Provides a block state depending on the current block(s) by matching a sequence of rules.
- Template:Nbt: A block state provider
- Template:Nbt:
rule_based_state_provider - Template:Nbt The block to use when no rules' predicates match. This field is optional. If unspecified and no rules' predicates match, then no block is placed.
- Template:Nbt (Required, but can be empty) Rules of the block to use.
- Template:Nbt One rule.
- Template:Nbt The Minecraft:block predicate of this rule.
- Template:Nbt The block to use when the predicate is passed.
- Template:Nbt inherit/block state provider<section end="json format" />
- Template:Nbt One rule.
- Template:Nbt:
History
Template:Info needed section Template:HistoryTable
Template:Navbox Java Edition technical
Minecraft:fr:Génération du monde personnalisée/Fournisseur d'état de bloc Minecraft:ja:ワールド生成のカスタマイズ/block state provider Minecraft:ko:블록 상태 제공자 Minecraft:pt:Geração de mundo personalizado/provedor de estado de bloco Minecraft:ru:Натуральные декорации/Провайдер состояний блока Minecraft:uk:Постачальник стану блока Minecraft:zh:编码格式/Worldgen#方块状态提供器