Minecraft:Block components/Upstream: Difference between revisions
More actions
Sync: upstream version from Minecraft |
Remove broken links to missing pages |
||
| Line 24: | Line 24: | ||
Permutations are used to make some block components active only under certain conditions. | Permutations are used to make some block components active only under certain conditions. | ||
Permutations are defined in the {{cd|permutations}} array within {{cd|minecraft:block}}, and consist of two properties: | Permutations are defined in the {{cd|permutations}} array within {{cd|minecraft:block}}, and consist of two properties: | ||
* {{nbt|string|condition}}: A molang expression resolving to a boolean, representing when the permutation's components should be active. This is most often a | * {{nbt|string|condition}}: A molang expression resolving to a boolean, representing when the permutation's components should be active. This is most often a block state query. For example: | ||
<syntaxhighlight lang=json copy> | <syntaxhighlight lang=json copy> | ||
"condition": "query.block_state('minecraft:cardinal_direction') == 'north'"</syntaxhighlight> | "condition": "query.block_state('minecraft:cardinal_direction') == 'north'"</syntaxhighlight> | ||
| Line 79: | Line 79: | ||
=== <code>minecraft:collision_box</code> === | === <code>minecraft:collision_box</code> === | ||
Defines the block's | Defines the block's collision box. This component can be specified in 3 ways. | ||
* '''As a single {{cd|true}} or {{cd|false}} value:''' | * '''As a single {{cd|true}} or {{cd|false}} value:''' | ||
| Line 128: | Line 128: | ||
=== <code>minecraft:connection_rule</code> === | === <code>minecraft:connection_rule</code> === | ||
Defines which blocks this block can connect to with the {{cd|minecraft:connection}} | Defines which blocks this block can connect to with the {{cd|minecraft:connection}} block trait. | ||
Fields: | Fields: | ||
| Line 146: | Line 146: | ||
=== <code>minecraft:crafting_table</code> === | === <code>minecraft:crafting_table</code> === | ||
Gives a custom block the functionality of a | Gives a custom block the functionality of a crafting table. | ||
Fields: | Fields: | ||
* '''{{cd|crafting_tags}}''': | * '''{{cd|crafting_tags}}''': | ||
** An array of | ** An array of recipe tags that this block should be able to craft. There can be at most 64 tags, and each tag can be at most 64 characters. | ||
** The default tag for vanilla crafting recipes is {{cd|crafting_table}}, and custom tags can be specified to allow crafting of recipes with that tag in their | ** The default tag for vanilla crafting recipes is {{cd|crafting_table}}, and custom tags can be specified to allow crafting of recipes with that tag in their definition. | ||
* '''{{cd|table_name}}''': | * '''{{cd|table_name}}''': | ||
** The name to display in the crafting table UI. Specified as a localization string, or will resort to a regular string if it can't be resolved. | ** The name to display in the crafting table UI. Specified as a localization string, or will resort to a regular string if it can't be resolved. | ||
| Line 169: | Line 169: | ||
=== <code>minecraft:destructible_by_explosion</code> === | === <code>minecraft:destructible_by_explosion</code> === | ||
Defines whether the block can be destroyed by | Defines whether the block can be destroyed by explosions, and sets its blast resistance. | ||
This component can be defined in two ways. | This component can be defined in two ways. | ||
| Line 197: | Line 197: | ||
=== <code>minecraft:destructible_by_mining</code> === | === <code>minecraft:destructible_by_mining</code> === | ||
Defines whether the block can be | Defines whether the block can be mined and sets its hardness. | ||
This component can be defined in two ways. | This component can be defined in two ways. | ||
'''As a boolean ({{cd|true}} or {{cd|false}}) value:''' | '''As a boolean ({{cd|true}} or {{cd|false}}) value:''' | ||
A value of {{cd|true}} makes the block destructible in 0 seconds, making it able to be | A value of {{cd|true}} makes the block destructible in 0 seconds, making it able to be instant mined. | ||
A value of {{cd|false}} makes the block indestructible by mining. | A value of {{cd|false}} makes the block indestructible by mining. | ||
| Line 226: | Line 226: | ||
Fields: | Fields: | ||
* '''{{cd|seconds_to_destroy}}''': The amount of time it takes to destroy the block. ''Note that this sets the block's hardness value, not the actual seconds to destroy!'' | * '''{{cd|seconds_to_destroy}}''': The amount of time it takes to destroy the block. ''Note that this sets the block's hardness value, not the actual seconds to destroy!'' | ||
* '''{{cd|item_specific_speeds}}''': ''Optional.'' Specific breaking speed values for each item, it is recommended to use tags because manually defining items can make the list unnecessarily long and remove compatibility with the enchantment | * '''{{cd|item_specific_speeds}}''': ''Optional.'' Specific breaking speed values for each item, it is recommended to use tags because manually defining items can make the list unnecessarily long and remove compatibility with the enchantment Efficiency. | ||
Example: | Example: | ||
<syntaxhighlight lang=json copy> | <syntaxhighlight lang=json copy> | ||
| Line 254: | Line 254: | ||
** ''Optional.'' Sets the number of particles created when the block destroyed. Default is {{cd|100}}, maximum is {{cd|255}}. | ** ''Optional.'' Sets the number of particles created when the block destroyed. Default is {{cd|100}}, maximum is {{cd|255}}. | ||
* '''{{cd|texture}}''': | * '''{{cd|texture}}''': | ||
** ''Optional.'' The | ** ''Optional.'' The texture to use for the particles. This is a texture name defined in {{cd|terrain_texture.json}}. Defaults to the texture of the {{cd|down}} material instance. | ||
* '''{{cd|tint_method}}''': | * '''{{cd|tint_method}}''': | ||
** ''Optional.'' The method with which the particles are tinted. Default is {{cd|none}}. | ** ''Optional.'' The method with which the particles are tinted. Default is {{cd|none}}. | ||
| Line 282: | Line 282: | ||
=== <code>minecraft:embedded_visual</code> === | === <code>minecraft:embedded_visual</code> === | ||
Sets the visuals of the block when it is embedded, such as in a | Sets the visuals of the block when it is embedded, such as in a flowerpot. | ||
This component can not be specified in entries in the {{cd|permutations}} array. | This component can not be specified in entries in the {{cd|permutations}} array. | ||
| Line 322: | Line 322: | ||
=== <code>minecraft:flammable</code> === | === <code>minecraft:flammable</code> === | ||
Defines how | Defines how flammable the block is, in this case, all blocks with this component will burn from fire and lava, unlike vanilla where some blocks do not burn from lava. | ||
This component can be defined in two ways. | This component can be defined in two ways. | ||
| Line 359: | Line 359: | ||
=== <code>minecraft:flower_pottable</code> === | === <code>minecraft:flower_pottable</code> === | ||
Indicates that this block can be placed inside a | Indicates that this block can be placed inside a flower pot. The geometry of the block while inside a flower pot is specified by [[#minecraft:geometry|{{cd|minecraft:geometry}}]] by default, but it can be changed with [[#minecraft:embedded_visual|{{cd|minecraft:embedded_visual}}]]. | ||
This component is specified as an empty object, and can not be specified in an entry to the {{cd|permutations}} array. | This component is specified as an empty object, and can not be specified in an entry to the {{cd|permutations}} array. | ||
| Line 379: | Line 379: | ||
=== <code>minecraft:geometry</code> === | === <code>minecraft:geometry</code> === | ||
Defines the geometry of the block. There are three vanilla models that can be used: {{cd|minecraft:geometry.full_block|minecraft:geometry.cross|minecraft:geometry.full_block_v1|d=and}}. You can also use your own model from a | Defines the geometry of the block. There are three vanilla models that can be used: {{cd|minecraft:geometry.full_block|minecraft:geometry.cross|minecraft:geometry.full_block_v1|d=and}}. You can also use your own model from a resource pack. | ||
This component must be included with [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]]. This component can be specified in two ways. | This component must be included with [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]]. This component can be specified in two ways. | ||
| Line 467: | Line 467: | ||
=== <code>minecraft:light_dampening</code> === | === <code>minecraft:light_dampening</code> === | ||
Sets the number of | Sets the number of light levels that will be dampened by the block. This component is specified as an integer between 0 and 15, where 15 blocks all light. | ||
Example: | Example: | ||
| Line 486: | Line 486: | ||
=== <code>minecraft:liquid_detection</code> === | === <code>minecraft:liquid_detection</code> === | ||
Defines how the block responds to | Defines how the block responds to liquids. | ||
Structure: | Structure: | ||
| Line 494: | Line 494: | ||
** {{nbt|list|detection_rules}}: An array of liquid rules. | ** {{nbt|list|detection_rules}}: An array of liquid rules. | ||
*** {{nbt|compound}}: ''A rule'' | *** {{nbt|compound}}: ''A rule'' | ||
**** {{nbt|bool|can_contain_liquid}}: {{cd|true}} or {{cd|false}} whether the liquid can occupy the same space as the block. In other words, can it be | **** {{nbt|bool|can_contain_liquid}}: {{cd|true}} or {{cd|false}} whether the liquid can occupy the same space as the block. In other words, can it be waterlogged? | ||
**** {{nbt|string|liquid_type}}: The type of liquid this rule applies to. Currently, the only available value is {{cd|water}}. | **** {{nbt|string|liquid_type}}: The type of liquid this rule applies to. Currently, the only available value is {{cd|water}}. | ||
**** {{nbt|string|on_liquid_touches}}: ''Optional.'' Sets what happens when liquid touches the block. Available values are: | **** {{nbt|string|on_liquid_touches}}: ''Optional.'' Sets what happens when liquid touches the block. Available values are: | ||
| Line 663: | Line 663: | ||
=== <code>minecraft:precipitation_interactions</code> === | === <code>minecraft:precipitation_interactions</code> === | ||
Defines how the block is affected by | Defines how the block is affected by precipitation. If the block has [[#minecraft:collision_box|{{cd|minecraft:collision_box}}]] that is not false, it will not be possible to use {{cd|snow_log_no_collision}}. | ||
Structure: | Structure: | ||
| Line 670: | Line 670: | ||
* {{nbt|compound|minecraft:precipitation_interactions}}: The component root. | * {{nbt|compound|minecraft:precipitation_interactions}}: The component root. | ||
** {{nbt|string|precipitation_behavior}}: The block's behavior with precipitation. | ** {{nbt|string|precipitation_behavior}}: The block's behavior with precipitation. | ||
*** {{cd|obstruct_rain_accumulate_snow}}: ''Default.'' Rain particles will land on the block, and | *** {{cd|obstruct_rain_accumulate_snow}}: ''Default.'' Rain particles will land on the block, and snow layers will accumulate if it is snowing. | ||
*** {{cd|obstruct_rain}}: Rain particles will land on the block, but snow will not accumulate. | *** {{cd|obstruct_rain}}: Rain particles will land on the block, but snow will not accumulate. | ||
*** {{cd|none}}: Rain and snow will pass through the block. | *** {{cd|none}}: Rain and snow will pass through the block. | ||
*** {{cd|snow_log_no_collision}}:{{Upcoming|be 26.20}}{{OnlyExperimental|Upcoming Creator Features}} Snow will accumulate inside the block if it is snowing, causing it to become | *** {{cd|snow_log_no_collision}}:{{Upcoming|be 26.20}}{{OnlyExperimental|Upcoming Creator Features}} Snow will accumulate inside the block if it is snowing, causing it to become snowlogged. | ||
</div> | </div> | ||
| Line 685: | Line 685: | ||
=== <code>minecraft:random_offset</code> === | === <code>minecraft:random_offset</code> === | ||
Allows the block's model to be randomly offset, similar to | Allows the block's model to be randomly offset, similar to short grass. The chosen offset is still subject to the block model limits. | ||
Due to current limitations, this component causes the block to be shadowed if it intersects another block. | Due to current limitations, this component causes the block to be shadowed if it intersects another block. | ||
| Line 728: | Line 728: | ||
=== <code>minecraft:redstone_conductivity</code> === | === <code>minecraft:redstone_conductivity</code> === | ||
Defines how the block conducts | Defines how the block conducts redstone power. | ||
Structure: | Structure: | ||
| Line 734: | Line 734: | ||
<div class="treeview"> | <div class="treeview"> | ||
* {{nbt|compound|minecraft:redstone_conductivity}}: The component root. | * {{nbt|compound|minecraft:redstone_conductivity}}: The component root. | ||
** {{nbt|boolean|allows_wire_to_step_down}}: ''Optional.'' Sets whether | ** {{nbt|boolean|allows_wire_to_step_down}}: ''Optional.'' Sets whether redstone wire can step down the side of this block. | ||
** {{nbt|boolean|redstone_conductor}}: ''Optional.'' Sets whether the block | ** {{nbt|boolean|redstone_conductor}}: ''Optional.'' Sets whether the block conducts redstone. | ||
</div> | </div> | ||
| Line 776: | Line 776: | ||
* {{nbt|compound|minecraft:redstone_producer}}: The component root. | * {{nbt|compound|minecraft:redstone_producer}}: The component root. | ||
** {{nbt|int|power}}: Sets the power level that this block produces. Must be between 0 and 15. | ** {{nbt|int|power}}: Sets the power level that this block produces. Must be between 0 and 15. | ||
** {{nbt|string|strongly_powered_face}}: ''Optional.'' Determines the face of the block that | ** {{nbt|string|strongly_powered_face}}: ''Optional.'' Determines the face of the block that strongly powers the block it is connected to. | ||
** {{nbt|list|connected_faces}}: ''Optional.'' A list of the faces of the block that emit redstone power. | ** {{nbt|list|connected_faces}}: ''Optional.'' A list of the faces of the block that emit redstone power. | ||
** {{nbt|boolean|transform_relative}}: ''Optional.'' Whether the faces selected should be relative to the [[#minecraft:transformation|{{cd|minecraft:transformation}}]] component. | ** {{nbt|boolean|transform_relative}}: ''Optional.'' Whether the faces selected should be relative to the [[#minecraft:transformation|{{cd|minecraft:transformation}}]] component. | ||
| Line 793: | Line 793: | ||
=== <code>minecraft:replaceable</code> === | === <code>minecraft:replaceable</code> === | ||
Allows the block to be replaced when another block is placed in its position, like | Allows the block to be replaced when another block is placed in its position, like short grass. | ||
This component is specified as an empty object. | This component is specified as an empty object. | ||
| Line 837: | Line 837: | ||
=== <code>minecraft:support</code> === | === <code>minecraft:support</code> === | ||
Defines the shape of the block with regards to how it can support other blocks like | Defines the shape of the block with regards to how it can support other blocks like torches. This component cannot be used in permutations. | ||
Structure: | Structure: | ||
| Line 844: | Line 844: | ||
* {{nbt|compound|minecraft:support}}: The component root. | * {{nbt|compound|minecraft:support}}: The component root. | ||
** {{nbt|string|shape}}: The support shape of the block. If the component is omitted, the default is unit cube (all sides give support). | ** {{nbt|string|shape}}: The support shape of the block. If the component is omitted, the default is unit cube (all sides give support). | ||
*** <code>stair</code>: Uses the shape of a | *** <code>stair</code>: Uses the shape of a stair (bottom and back give support). This requires the <code>minecraft:vertical_half</code> block state, and either state from the <code>minecraft:placement_direction</code> block trait. | ||
*** <code>fence</code>: Uses the shape of a [[Minecraft:fence]] (bottom and top give support). | *** <code>fence</code>: Uses the shape of a [[Minecraft:fence]] (bottom and top give support). | ||
</div> | </div> | ||
| Line 919: | Line 919: | ||
== Custom components == | == Custom components == | ||
Custom block components allow for custom blocks to take advantage of | Custom block components allow for custom blocks to take advantage of script API capabilities. Custom components are registered in scripts using the method {{cd|StartupEvent.blockComponentRegistry.registerCustomComponent()}}. | ||
Custom components can be added to blocks the same way as any other component, using the namespaced [[Minecraft:identifier]] the component was registered with. Custom components can have arguments of any type, which will be passed to scripts as the second argument. | Custom components can be added to blocks the same way as any other component, using the namespaced [[Minecraft:identifier]] the component was registered with. Custom components can have arguments of any type, which will be passed to scripts as the second argument. | ||
| Line 938: | Line 938: | ||
* {{cd|beforeOnPlayerPlace}}: Called before the player places the block. | * {{cd|beforeOnPlayerPlace}}: Called before the player places the block. | ||
* {{cd|onBlockStateChange}}: Called when an block has its state changed.{{upcoming|BE 26.20}}{{OnlyExperimental|Beta APIs}} | * {{cd|onBlockStateChange}}: Called when an block has its state changed.{{upcoming|BE 26.20}}{{OnlyExperimental|Beta APIs}} | ||
* {{cd|onBreak}}: Called when the block is | * {{cd|onBreak}}: Called when the block is destroyed. | ||
* {{cd|onEntity}}: Called when an entity sends an event to the block. | * {{cd|onEntity}}: Called when an entity sends an event to the block. | ||
* {{cd|onEntityFallOn}}: Called when an entity falls onto the block. This requires the [[#minecraft:entity_fall_on|{{cd|minecraft:entity_fall_on}}]] component. | * {{cd|onEntityFallOn}}: Called when an entity falls onto the block. This requires the [[#minecraft:entity_fall_on|{{cd|minecraft:entity_fall_on}}]] component. | ||
| Line 944: | Line 944: | ||
* {{cd|onPlayerBreak}}: Called when the block is destroyed by a player. | * {{cd|onPlayerBreak}}: Called when the block is destroyed by a player. | ||
* {{cd|onPlayerInteract}}: Called when a player interacts with the block. | * {{cd|onPlayerInteract}}: Called when a player interacts with the block. | ||
* {{cd|onRandomTick}}: Called when the block is | * {{cd|onRandomTick}}: Called when the block is randomly ticked. | ||
* {{cd|onRedstoneUpdate}}: Called when the block receives a redstone update. This requires the [[#minecraft:redstone_consumer|{{cd|minecraft:redstone_consumer}}]] component, and will only be called if the signal power is greater than or equal to the {{cd|min_power}} set in the component. | * {{cd|onRedstoneUpdate}}: Called when the block receives a redstone update. This requires the [[#minecraft:redstone_consumer|{{cd|minecraft:redstone_consumer}}]] component, and will only be called if the signal power is greater than or equal to the {{cd|min_power}} set in the component. | ||
* {{cd|onStepOff}}: Called when an entity steps off the block. | * {{cd|onStepOff}}: Called when an entity steps off the block. | ||
| Line 991: | Line 991: | ||
|{{HistoryLine||1.21.130|dev=Preview 1.21.130.26|exp=Upcoming Creator Features|Extended [[#minecraft:collision_box|{{cd|minecraft:collision_box}}]] height to 24 and added support for arrays of boxes when using a format version of 1.21.130 or higher and the Upcoming Creator Features toggle is enabled.}} | |{{HistoryLine||1.21.130|dev=Preview 1.21.130.26|exp=Upcoming Creator Features|Extended [[#minecraft:collision_box|{{cd|minecraft:collision_box}}]] height to 24 and added support for arrays of boxes when using a format version of 1.21.130 or higher and the Upcoming Creator Features toggle is enabled.}} | ||
|{{HistoryLine|||dev=Preview 1.21.130.27|In [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]] removed redundant experimental field {{cd|shaded}}.|Added [[#minecraft:redstone_consumer|{{cd|minecraft:redstone_consumer}}]] and [[#minecraft:leashable|{{cd|minecraft:leashable}}]] components behind the Upcoming Creator Features experiment.}} | |{{HistoryLine|||dev=Preview 1.21.130.27|In [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]] removed redundant experimental field {{cd|shaded}}.|Added [[#minecraft:redstone_consumer|{{cd|minecraft:redstone_consumer}}]] and [[#minecraft:leashable|{{cd|minecraft:leashable}}]] components behind the Upcoming Creator Features experiment.}} | ||
|{{HistoryLine||26.0|dev=Preview 26.0.23|Added {{cd|use_liquid_clipping}} field to the {{cd|detection_rules}} in [[#minecraft:liquid_detection|{{cd|minecraft:liquid_detection}}]] a boolean field that indicates whether water will pass through the block or not, like a | |{{HistoryLine||26.0|dev=Preview 26.0.23|Added {{cd|use_liquid_clipping}} field to the {{cd|detection_rules}} in [[#minecraft:liquid_detection|{{cd|minecraft:liquid_detection}}]] a boolean field that indicates whether water will pass through the block or not, like a stair.|Updated [[#minecraft:redstone_consumer|{{cd|minecraft:redstone_consumer}}]] renamed field {{cd|propogates_power}} to {{cd|propagates_power}} and release for format version 1.26.0 and higher.|The option {{cd|alpha_masked_tint}} in [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]] no longer requires "Upcoming Creator Features".}} | ||
|{{HistoryLine|||dev=Preview 26.0.25|The components {{cd|minecraft:connection_rule|minecraft:support|minecraft:leashable|d=and}} can be used with format version 1.26.0 and higher without the "Upcoming Creator Features" toggle.}} | |{{HistoryLine|||dev=Preview 26.0.25|The components {{cd|minecraft:connection_rule|minecraft:support|minecraft:leashable|d=and}} can be used with format version 1.26.0 and higher without the "Upcoming Creator Features" toggle.}} | ||
|{{HistoryLine|||dev=Preview 26.0.27|Added block permutation component validation for [[#minecraft:geometry|{{cd|minecraft:geometry}}]] and [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]]. If you add one, you need to add the other.|Rotated the down face of the {{cd|minecraft:geometry.full_block}} model by 180 degrees. The old behavior is still accessible with older {{cd|format_version}}s or the {{cd|minecraft:geometry.full_block_v1}} model.|The [[#minecraft:collision_box|{{cd|minecraft:collision_box}}]] improvements no longer require the "Upcoming Creator Features" experiment.}} | |{{HistoryLine|||dev=Preview 26.0.27|Added block permutation component validation for [[#minecraft:geometry|{{cd|minecraft:geometry}}]] and [[#minecraft:material_instances|{{cd|minecraft:material_instances}}]]. If you add one, you need to add the other.|Rotated the down face of the {{cd|minecraft:geometry.full_block}} model by 180 degrees. The old behavior is still accessible with older {{cd|format_version}}s or the {{cd|minecraft:geometry.full_block_v1}} model.|The [[#minecraft:collision_box|{{cd|minecraft:collision_box}}]] improvements no longer require the "Upcoming Creator Features" experiment.}} | ||
| Line 998: | Line 998: | ||
|{{HistoryLine|||dev=Preview 26.10.23|Experiment active in preview that may utilize the modern parsing pipeline. There are some breaking changes that may affect loading of block json with format version 26.10. Many block components have become more restricted and will miss the block if something that shouldn't happen occurs.|The format {{cd|"tag:tag_name":<nowiki>{}</nowiki>}} has been removed, and replaced by the component [[#minecraft:tags|{{cd|minecraft:tags}}]], despite being mentioned as a replacement, the new format doesn't work, only the old one.}} | |{{HistoryLine|||dev=Preview 26.10.23|Experiment active in preview that may utilize the modern parsing pipeline. There are some breaking changes that may affect loading of block json with format version 26.10. Many block components have become more restricted and will miss the block if something that shouldn't happen occurs.|The format {{cd|"tag:tag_name":<nowiki>{}</nowiki>}} has been removed, and replaced by the component [[#minecraft:tags|{{cd|minecraft:tags}}]], despite being mentioned as a replacement, the new format doesn't work, only the old one.}} | ||
|{{HistoryLine|||dev=Preview 26.10.25|Experiment disabled, and all changes have been disabled, including restricted components and the {{cd|minecraft:tags}} component.}} | |{{HistoryLine|||dev=Preview 26.10.25|Experiment disabled, and all changes have been disabled, including restricted components and the {{cd|minecraft:tags}} component.}} | ||
|{{HistoryLine||26.10|dev=Preview 26.10.25|exp=Upcoming Creator Features|If trait [[Minecraft:Block definition#minecraft:multi_block| {{cd|minecraft:multi_block}}]] is defined, the components [[#minecraft:movable|{{cd|minecraft:movable}}]] and [[#minecraft:placement_filter|{{cd|minecraft:placement_filter}}]] cannot be used in permutations, and movable will have some excluded types.|Added [[#minecraft:chest_obstruction|{{cd|minecraft:chest_obstruction}}]] component it defines how a block placed above a [[Minecraft:chest]] or | |{{HistoryLine||26.10|dev=Preview 26.10.25|exp=Upcoming Creator Features|If trait [[Minecraft:Block definition#minecraft:multi_block| {{cd|minecraft:multi_block}}]] is defined, the components [[#minecraft:movable|{{cd|minecraft:movable}}]] and [[#minecraft:placement_filter|{{cd|minecraft:placement_filter}}]] cannot be used in permutations, and movable will have some excluded types.|Added [[#minecraft:chest_obstruction|{{cd|minecraft:chest_obstruction}}]] component it defines how a block placed above a [[Minecraft:chest]] or ender chest should obstruct their opening.}} | ||
|{{HistoryLine|upcoming bedrock}} | |{{HistoryLine|upcoming bedrock}} | ||
|{{HistoryLine||26.20|dev=Preview 26.20.20|[[Minecraft:Block tag (Bedrock Edition)|Block tags]] are no longer allowed as {{cd|"tag:tag_name":<nowiki>{}</nowiki>}} objects in the components list. Instead, they must be specified in the [[#minecraft:tags|{{cd|minecraft:tags}}]] array component. Many block components have become more restricted. However, in practice, all the changes were not implemented despite being mentioned as having been added.|Fixed y-offset for [[#minecraft:flower_pottable|{{cd|minecraft:flower_pottable}}]] blocks in flower pots to match vanilla for format version 1.26.20+.|For {{cd|format_version}} 1.26.20+ the component [[#minecraft:redstone_producer|{{cd|minecraft:redstone_producer}}]] cannot be defined in the permutations array without defining it in the base components object as well.|Fixed [[#minecraft:placement_filter|{{cd|minecraft:placement_filter}}]] for blocks with trait [[Minecraft:Block definition#minecraft:multi_block|{{cd|minecraft:multi_block}}]] however, the block will not be destroyed when the base is broken.|[[#Custom components|Custom components]] no longer work due to a bug.<ref>{{Bug|MCPE-237057||An error is incorrectly thrown when using custom components}}</ref>}} | |{{HistoryLine||26.20|dev=Preview 26.20.20|[[Minecraft:Block tag (Bedrock Edition)|Block tags]] are no longer allowed as {{cd|"tag:tag_name":<nowiki>{}</nowiki>}} objects in the components list. Instead, they must be specified in the [[#minecraft:tags|{{cd|minecraft:tags}}]] array component. Many block components have become more restricted. However, in practice, all the changes were not implemented despite being mentioned as having been added.|Fixed y-offset for [[#minecraft:flower_pottable|{{cd|minecraft:flower_pottable}}]] blocks in flower pots to match vanilla for format version 1.26.20+.|For {{cd|format_version}} 1.26.20+ the component [[#minecraft:redstone_producer|{{cd|minecraft:redstone_producer}}]] cannot be defined in the permutations array without defining it in the base components object as well.|Fixed [[#minecraft:placement_filter|{{cd|minecraft:placement_filter}}]] for blocks with trait [[Minecraft:Block definition#minecraft:multi_block|{{cd|minecraft:multi_block}}]] however, the block will not be destroyed when the base is broken.|[[#Custom components|Custom components]] no longer work due to a bug.<ref>{{Bug|MCPE-237057||An error is incorrectly thrown when using custom components}}</ref>}} | ||
Latest revision as of 15:39, 9 April 2026
Template:For Template:Exclusive Block components are Minecraft:JSON objects that are added to a custom Minecraft:block definition in a Minecraft:behavior pack to customize the Minecraft:block's behavior and visuals. Template:TOC
Applying
Block components can be applied by adding them to Template:Cd within Template:Cd in the block's definition file.
Components can also be found in a Template:Cd object located in objects within the Template:Cd array. This can be used to make a component only active when the permutation's Template:Cd evaluates to Template:Cd.
Tags
Tags are used to categorize blocks and allow them to work better with vanilla blocks and items. Both vanilla and custom block tags can be added. Tags are added with other components, as an empty object with the format: "tag:<tag_name>": {}
Example: <syntaxhighlight lang=json copy> "tag:minecraft:is_pickaxe_item_destructible": {} </syntaxhighlight>
Permutations
Permutations are used to make some block components active only under certain conditions. Permutations are defined in the Template:Cd array within Template:Cd, and consist of two properties:
- Template:Nbt: A molang expression resolving to a boolean, representing when the permutation's components should be active. This is most often a block state query. For example:
<syntaxhighlight lang=json copy> "condition": "query.block_state('minecraft:cardinal_direction') == 'north'"</syntaxhighlight>
- Template:Nbt: The components for this permutation.
Example:
<syntaxhighlight lang=json copy> "permutations": [
{
"condition": "query.block_state('minecraft:vertical_half') == 'top'",
"components": {
"minecraft:collision_box": {
"origin": [-8,8,-8],
"size": [16,8,16]
}
}
},
{
"condition": "query.block_state('minecraft:vertical_half') == 'bottom'",
"components": {
"minecraft:collision_box": {
"origin": [-8,0,-8],
"size": [16,8,16]
}
}
}
] </syntaxhighlight>
Components list
minecraft:chest_obstruction
Template:Experimental Defines how the block should obstruct Minecraft:chests from opening when placed above one.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: Optional. How the block is evaluated during chest opening if the block is placed above the chest. Defaults to
shape. Valid values are:always: The block will always obstruct a chest from opening.never: The block will never obstruct a chest from opening.shape: The block's AABB shape is used to determine if a chest is obstructed from opening.
- Template:Nbt: Optional. How the block is evaluated during chest opening if the block is placed above the chest. Defaults to
Example:
<syntaxhighlight lang=json copy> "minecraft:chest_obstruction": {
"obstruction_rule": "always"
} </syntaxhighlight>
minecraft:collision_box
Defines the block's collision box. This component can be specified in 3 ways.
- As a single Template:Cd or Template:Cd value:
Example:
<syntaxhighlight lang=json copy> "minecraft:collision_box": true </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- The origin of the collision box. (0,0,0) represents the bottom center of the block.
- Template:Cd:
- The size of the collision box. The total size of the collision box may not be larger than 16×24×16.
Example (Bottom half slab collision):
<syntaxhighlight lang=json copy> "minecraft:collision_box": {
"origin": [-8,0,-8], "size": [16,8,16]
} </syntaxhighlight>
- As a JSON array:
The array consists of the above object, allowing for the definition of multiple collision boxes.
Example:
<syntaxhighlight lang=json copy> "minecraft:collision_box": [
{
"origin": [-8,0,-8],
"size": [16,8,16]
},
{
"origin": [-8,8,-8],
"size": [16,8,8]
}
] </syntaxhighlight>
minecraft:connection_rule
Defines which blocks this block can connect to with the Template:Cd block trait.
Fields:
- Template:Cd:
- Optional. Which blocks this block can connect to. If omitted, the block accepts connections from all blocks. Allowed values are Template:Cd.
- Template:Cd:
- Optional. Enables connection in only certain directions, disabling others; available values are Template:Cd, Template:Cd, Template:Cd, and Template:Cd.
Example: <syntaxhighlight lang=json copy> "minecraft:connection_rule": {
"accepts_connections_from": "only_fences", "enabled_directions": ["north", "south", "east"]
} </syntaxhighlight>
minecraft:crafting_table
Gives a custom block the functionality of a crafting table.
Fields:
- Template:Cd:
- An array of recipe tags that this block should be able to craft. There can be at most 64 tags, and each tag can be at most 64 characters.
- The default tag for vanilla crafting recipes is Template:Cd, and custom tags can be specified to allow crafting of recipes with that tag in their definition.
- Template:Cd:
- The name to display in the crafting table UI. Specified as a localization string, or will resort to a regular string if it can't be resolved.
Example:
<syntaxhighlight lang=json copy> "minecraft:crafting_table": {
"crafting_tags": [ "crafting_table", "custom_crafting_table" ], "table_name": "Custom Crafting Table"
} </syntaxhighlight>
minecraft:destructible_by_explosion
Defines whether the block can be destroyed by explosions, and sets its blast resistance. This component can be defined in two ways.
- As a boolean (Template:Cd or Template:Cd) value:
Example:
<syntaxhighlight lang=json copy> "minecraft:destructible_by_explosion": false </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- Sets the block's resistance to explosions.
- Note that the actual blast resistance value of the block is 1/5 of the value set here.
Example (Blast resistance 6, similar to Minecraft:cobblestone):
<syntaxhighlight lang=json copy> "minecraft:destructible_by_explosion": {
"explosion_resistance": 30
} </syntaxhighlight>
minecraft:destructible_by_mining
Defines whether the block can be mined and sets its hardness. This component can be defined in two ways.
As a boolean (Template:Cd or Template:Cd) value:
A value of Template:Cd makes the block destructible in 0 seconds, making it able to be instant mined. A value of Template:Cd makes the block indestructible by mining.
Example:
<syntaxhighlight lang=json copy> "minecraft:destructible_by_mining": true </syntaxhighlight>
As a JSON object:
Structure:
- Template:Nbt: (root of component)
- Template:Nbt
- Template:Nbt:
- Template:Nbt: The hardness of the block when mined with the target item(s).
- Template:NbtTemplate:Nbt: A description of the item(s). Either a string item identifier or an object.
- Template:Nbt: A Minecraft:Molang expression defining the tags of the target item(s).
- Template:Nbt:
- Template:Nbt
- Template:Nbt
Fields:
- Template:Cd: The amount of time it takes to destroy the block. Note that this sets the block's hardness value, not the actual seconds to destroy!
- Template:Cd: Optional. Specific breaking speed values for each item, it is recommended to use tags because manually defining items can make the list unnecessarily long and remove compatibility with the enchantment Efficiency.
Example: <syntaxhighlight lang=json copy> "minecraft:destructible_by_mining": {
"item_specific_speeds": [
{
"item": {
"tags": "q.all_tags('minecraft:is_pickaxe') && q.any_tag('minecraft:diamond_tier','minecraft:netherite_tier')"
},
"destroy_speed": 30
},
{
"item": "minecraft:iron_axe",
"destroy_speed": 13
}
],
"seconds_to_destroy": 100
} </syntaxhighlight>
minecraft:destruction_particles
Configures the destruction particles created when the block is destroyed.
Fields:
- Template:Cd:
- Optional. Sets the number of particles created when the block destroyed. Default is Template:Cd, maximum is Template:Cd.
- Template:Cd:
- Optional. The texture to use for the particles. This is a texture name defined in Template:Cd. Defaults to the texture of the Template:Cd material instance.
- Template:Cd:
- Optional. The method with which the particles are tinted. Default is Template:Cd.
- Can be Template:Cd.
Example:
<syntaxhighlight lang=json copy> "minecraft:destruction_particles": {
"particle_count": 255, "texture": "cobblestone", "tint_method": "none"
} </syntaxhighlight>
minecraft:display_name
Sets the display name of the block. If omitted, the default display name is "tile.<block identifier>.name". The name given will try be resolved as a localization string. If it cannot be resolved, it will show as given.
This component is specified as a string.
Example:
<syntaxhighlight lang=json copy> "minecraft:display_name": "tile.wiki:custom_block.name" </syntaxhighlight>
minecraft:embedded_visual
Sets the visuals of the block when it is embedded, such as in a flowerpot. This component can not be specified in entries in the Template:Cd array.
Fields:
- Template:Cd:
- A [[#minecraft:geometry|Template:Cd]] component defining the embedded geometry.
- Template:Cd:
- A [[#minecraft:material_instances|Template:Cd]] component defining the embedded material.
Example:
<syntaxhighlight lang=json copy> "minecraft:embedded_visual": {
"geometry": "minecraft:geometry.full_block",
"material_instances": {
"*": {
"texture": "cobblestone"
}
}
} </syntaxhighlight>
minecraft:entity_fall_on
Configures the fall distance required to trigger the Template:Cd custom component script event. The distance defaults to 1 block if omitted.
Fields:
- Template:Cd:
- The distance an entity must fall to trigger the event.
Example:
<syntaxhighlight lang=json copy> "minecraft:entity_fall_on": {
"min_fall_distance": 2
} </syntaxhighlight>
minecraft:flammable
Defines how flammable the block is, in this case, all blocks with this component will burn from fire and lava, unlike vanilla where some blocks do not burn from lava. This component can be defined in two ways.
- As a boolean (Template:Cd or Template:Cd) property:
If Template:Cd, the block can catch fire from nearby blocks. The chance modifier for catching fire is automatically set to 5, and the chance modifier for the block being destroyed by fire is set to 20.
If Template:Cd (or omitted) the block will only catch fire if directly ignited.
Example:
<syntaxhighlight lang=json copy> "minecraft:flammable": true </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- Optional. The chance that the block catches fire from a nearby block. Default is 5.
- If greater than 0, fire on the block will burn until it is destroyed or the fire is put out. If Template:Cd is 0, the block will burn forever.
- If 0 the block will eventually burn out (if it isn't destroyed).
- Template:Cd:
- Optional. The chance the block is destroyed while on fire. Default is 20.
- If 0, the block will not be destroyed by fire.
Example:
<syntaxhighlight lang=json copy> "minecraft:flammable": {
"catch_chance_modifier": 5, "destroy_chance_modifier": 20
} </syntaxhighlight>
minecraft:flower_pottable
Indicates that this block can be placed inside a flower pot. The geometry of the block while inside a flower pot is specified by [[#minecraft:geometry|Template:Cd]] by default, but it can be changed with [[#minecraft:embedded_visual|Template:Cd]]. This component is specified as an empty object, and can not be specified in an entry to the Template:Cd array.
Example:
<syntaxhighlight lang=json copy> "minecraft:flower_pottable": {} </syntaxhighlight>
minecraft:friction
Describes the block's friction. This component is specified as a decimal number between Template:Cd and Template:Cd.
Example:
<syntaxhighlight lang=json copy> "minecraft:friction": 0.4 </syntaxhighlight>
minecraft:geometry
Defines the geometry of the block. There are three vanilla models that can be used: Template:Cd. You can also use your own model from a resource pack. This component must be included with [[#minecraft:material_instances|Template:Cd]]. This component can be specified in two ways.
- As a string:
The identifier of the model for the block.
Example:
<syntaxhighlight lang=json copy> "minecraft:geometry": "minecraft:geometry.full_block" </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- Optional. Defines the visibility of each bone. All bones are visible by default.
- A key-value map of bone names from the model to Minecraft:molang expressions that result in boolean values.
- Template:Cd:
- Optional. An identifier of a culling definition.
- Template:Cd:
- Optional. A string to group multiple blocks when comparing them in a culling rule. Default is Template:Cd but there is also Template:Cd as vanilla.
- Template:Cd:Template:OnlyExperimental
- Optional. An identifier of a voxel shape definition.
- Vanilla shapes are Template:Cd.
- Template:Cd:
- The identifier of the block model to use.
- Template:Cd:
- Optional. Sets whether UVs should be locked to their original rotations, regardless of the [[#minecraft:transformation|Template:Cd]] component.
- Can be an array of bone names to lock, Template:Cd (default) which locks none, or Template:Cd which locks all bones.
Example:
<syntaxhighlight lang=json copy> "minecraft:geometry": {
"identifier": "geometry.some_model",
"culling": "wiki:culling.example_block",
"culling_layer": "minecraft:culling_layer.leaves",
"bone_visibility": {
"north_top": false,
"right_corner": "q.block_state('wiki:corner') == 'right'"
},
"uv_lock": ["bottom"]
} </syntaxhighlight>
minecraft:item_visual
Defines the visuals of the block's item form.
Fields:
- Template:Cd:
- A [[#minecraft:geometry|Template:Cd]] component defining the geometry of the block item.
- Template:Cd:
- A [[#minecraft:material_instances|Template:Cd]] component defining the material of the block item.
Example:
<syntaxhighlight lang=json copy> "minecraft:item_visual": {
"geometry": "minecraft:geometry.full_block",
"material_instances": {
"*": {
"texture": "cobblestone"
}
}
} </syntaxhighlight>
minecraft:leashable
Allows a Minecraft:lead to be attached to the block like a Minecraft:fence and specifies an offset for the leash knot's location.
Fields:
offset:- A Vector3 property (array of three numbers
[x, y, z]) that sets the position of the leash knot.[0, 0, 0]represents the bottom center of the block.
- A Vector3 property (array of three numbers
Example:
<syntaxhighlight lang=json copy> "minecraft:leashable": {
"offset": [0, 8, 0]
} </syntaxhighlight>
minecraft:light_dampening
Sets the number of light levels that will be dampened by the block. This component is specified as an integer between 0 and 15, where 15 blocks all light.
Example:
<syntaxhighlight lang=json copy> "minecraft:light_dampening": 15 </syntaxhighlight>
minecraft:light_emission
Sets the light level emitted by the block. This component is specified as an integer between 0 and 15.
Example:
<syntaxhighlight lang=json copy> "minecraft:light_emission": 14 </syntaxhighlight>
minecraft:liquid_detection
Defines how the block responds to liquids.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: An array of liquid rules.
- Template:Nbt: A rule
- Template:Nbt: Template:Cd or Template:Cd whether the liquid can occupy the same space as the block. In other words, can it be waterlogged?
- Template:Nbt: The type of liquid this rule applies to. Currently, the only available value is Template:Cd.
- Template:Nbt: Optional. Sets what happens when liquid touches the block. Available values are:
- Template:Cd: Default. The block stops liquid from flowing through it.
- Template:Cd: The block is destroyed on contact with flowing liquid.
- Template:Cd: The block breaks and drops its loot on contact with flowing liquid.
- Template:Cd: Liquids flow through the block as if it is not there.
- Template:Nbt: Optional. An array of directions from which liquid can not flow out of (or in to, if Template:Cd is set to Template:Cd) the block.
- Template:Nbt: Template:Cd means the block will use the [[#minecraft:collision_box|Template:Cd]] to visually clip the water like the Minecraft:stairs, Template:Cd ignores liquid clipping, which will render water across the whole block how current behavior.
- Template:Nbt: A rule
- Template:Nbt: An array of liquid rules.
Example:
<syntaxhighlight lang=json copy> "minecraft:liquid_detection": {
"detection_rules": [
{
"liquid_type": "water",
"can_contain_liquid": false,
"on_liquid_touches": "popped",
"use_liquid_clipping": true
}
]
} </syntaxhighlight>
minecraft:loot
Defines the block's loot table. This component is defined as a string path to the loot table. This component is completely ignored if the block is broken with an item enchanted by Minecraft:Silk Touch, resulting in the block dropping itself.
Example: <syntaxhighlight lang=json copy> "minecraft:loot": "loot_tables/blocks/some_block.json" </syntaxhighlight>
minecraft:map_color
Sets the block's color when seen on a Minecraft:map. This component can be defined in three ways.
- As a string:
The hex color value to use for the block's color on a map.
Example:
<syntaxhighlight lang=json copy> "minecraft:map_color": "#7A4F0C" </syntaxhighlight>
- As an array:
An array of three values between 0 and 255, representing the red, green, and blue color values respectively.
Example:
<syntaxhighlight lang=json copy> "minecraft:map_color": [50,205,25] </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- The color to use on the map.
- This is specified as an RGB array, or an hex string, as described above.
- Template:Cd:
- Optional. The method to use to tint the color based on the Minecraft:biome. Available values are Template:Cd.
Example:
<syntaxhighlight lang=json copy> "minecraft:map_color": {
"color": "#FEFEFE", "tint_method": "grass"
} </syntaxhighlight>
minecraft:material_instances
Defines the materials and textures of the block. This component must be included with [[#minecraft:geometry|Template:Cd]].
Structure:
- Template:Nbt: The component root.
- Template:NbtTemplate:Nbt: A material instance definition, or the name of a material instance. The name of the property can be the name of a block face, a "*" to map to all block faces, or a custom name to define a material instance.
- Template:NbtTemplate:Nbt: Optional. Whether the block should have ambient occlusion, and its intensity.
- Template:Nbt: Optional. Sets if these faces are dimmed by their direction.
- Template:Nbt: Optional. Should the UVs for these faces be randomly rotated based on position?
- Template:Nbt: Optional. The block's render method.
- Template:Cd: Default. Non-transparent texture, viewable from the full render distance.
- Template:Cd: Allows for transparent textures, but disables backface culling, and can only be viewed from half the render distance.
- Template:Cd: Like Template:Cd, but reenables backface culling. Also can only be viewed from half the render distance.
- Template:Cd: Allows for texture translucency, but disables backface culling.
- Template:Cd: Like Template:Cd, but disables backface culling.
- Template:Cd: Template:Cd, but past half the render distance it shifts to Template:Cd, like Minecraft:leaves.
- Template:Cd: Template:Cd, but past half the render distance it shifts to Template:Cd.
- Template:Cd: Template:Cd, but past half the render distance it shifts to Template:Cd.
- Template:Nbt: Defines the texture for the material instance. This is the name of a texture defined within Template:Cd.
- Template:Nbt: Optional. Sets the method with which to tint the texture based on the biome. Available values are Template:Cd.
- Template:NbtTemplate:Nbt: A material instance definition, or the name of a material instance. The name of the property can be the name of a block face, a "*" to map to all block faces, or a custom name to define a material instance.
Example:
<syntaxhighlight lang=json copy> "minecraft:material_instances": {
"*": {
"isotropic": true,
"render_method": "opaque",
"texture": "cobblestone"
}
} </syntaxhighlight>
minecraft:movable
Determines the block's behavior when being pushed or pulled by a Minecraft:piston. If trait [[Minecraft:Block definition#minecraft:multi_block| Template:Cd]] is defined, the component cannot be used in permutations, and the only available Template:Cd are Template:Cd.
Fields:
- Template:Cd:
- How the block will react to a piston.
- Can be Template:Cd.
- Template:Cd:
- Optional. Whether or not the block affects nearby blocks when pushed or pulled, allowing behavior similar to slime or honey blocks.
- Can be Template:Cd. Default is Template:Cd.
Example:
<syntaxhighlight lang=json copy> "minecraft:movable": {
"movement_type": "popped"
} </syntaxhighlight>
minecraft:placement_filter
Defines the conditions in which the block can survive. If the conditions are not met, the block can not be placed, and if it already exists, it will break and drop itself. If trait [[Minecraft:Block definition#minecraft:multi_block| Template:Cd]] is defined, the component it cannot be used in permutations.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: A list of conditions.
- Template:Nbt A condition
- Template:Nbt: Optional. A list of allowed faces the block can be placed on, or Template:Cd for all faces.
- Template:Nbt: Optional. A list of blocks that this block can be placed on.
- Template:Nbt A filter
- Template:Nbt: Optional. The block identifier.
- Template:Nbt: Optional. A key-value map of block states to required values.
- Template:Nbt: Optional. A molang expression defining the tags for the block.
- Template:Nbt A filter
- Template:Nbt A condition
- Template:Nbt: A list of conditions.
Example:
<syntaxhighlight lang=json copy> "minecraft:placement_filter": {
"conditions": [
{
"allowed_faces": ["up","down"], "block_filter": [ { "tags": "q.any_tag('stone')" } ] }
]
} </syntaxhighlight>
minecraft:precipitation_interactions
Defines how the block is affected by precipitation. If the block has [[#minecraft:collision_box|Template:Cd]] that is not false, it will not be possible to use Template:Cd.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: The block's behavior with precipitation.
- Template:Cd: Default. Rain particles will land on the block, and snow layers will accumulate if it is snowing.
- Template:Cd: Rain particles will land on the block, but snow will not accumulate.
- Template:Cd: Rain and snow will pass through the block.
- Template:Cd:Template:UpcomingTemplate:OnlyExperimental Snow will accumulate inside the block if it is snowing, causing it to become snowlogged.
- Template:Nbt: The block's behavior with precipitation.
Example:
<syntaxhighlight lang=json copy> "minecraft:precipitation_interactions": {
"precipitation_behavior": "obstruct_rain"
} </syntaxhighlight>
minecraft:random_offset
Allows the block's model to be randomly offset, similar to short grass. The chosen offset is still subject to the block model limits. Due to current limitations, this component causes the block to be shadowed if it intersects another block.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: The settings for the axis (Template:Cd).
- Template:Nbt: The number of possible values within the range to be chosen from. 0 means any value within the range can be chosen.
- Template:Nbt: The range of values to choose from.
- Template:Nbt: The maximum possible value.
- Template:Nbt: The minimun possible value.
- Template:Nbt: The settings for the axis (Template:Cd).
Example:
<syntaxhighlight lang=json copy> "minecraft:random_offset": {
"x": {
"steps": 0,
"range": {
"max": 5,
"min": -5
}
},
"y": {
"steps": 4,
"range": {
"max": 2,
"min": -1
}
},
"z": {
"steps": 0,
"range": {
"max": 5,
"min": -5
}
}
} </syntaxhighlight>
minecraft:redstone_conductivity
Defines how the block conducts redstone power.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: Optional. Sets whether redstone wire can step down the side of this block.
- Template:Nbt: Optional. Sets whether the block conducts redstone.
Example:
<syntaxhighlight lang=json copy> "minecraft:redstone_conductivity": {
"allows_wire_to_step_down": false, "redstone_conductor": false
} </syntaxhighlight>
minecraft:redstone_consumer
Allows the block to consume a redstone signal, sending the Template:Cd custom component event to scripts when the power changes.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: Optional. Sets the minimum power required to trigger the script event. Must be between 0 and 15.
- Template:Nbt: Optional. Sets whether a redstone signal will pass through this block.
Example:
<syntaxhighlight lang=json copy> "minecraft:redstone_consumer": {
"min_power": 0, "propagates_power": true
} </syntaxhighlight>
minecraft:redstone_producer
Allows the block to produce a redstone signal. If the format version is 1.26.20+, adding it to the permutation also requires adding it to the root component.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: Sets the power level that this block produces. Must be between 0 and 15.
- Template:Nbt: Optional. Determines the face of the block that strongly powers the block it is connected to.
- Template:Nbt: Optional. A list of the faces of the block that emit redstone power.
- Template:Nbt: Optional. Whether the faces selected should be relative to the [[#minecraft:transformation|Template:Cd]] component.
Example:
<syntaxhighlight lang=json copy> "minecraft:redstone_producer": {
"power": 15, "strongly_powered_face": "up", "connected_faces": ["north","south"], "transform_relative": true
} </syntaxhighlight>
minecraft:replaceable
Allows the block to be replaced when another block is placed in its position, like short grass. This component is specified as an empty object.
Example:
<syntaxhighlight lang=json copy> "minecraft:replaceable": {} </syntaxhighlight>
minecraft:selection_box
Defines the block's selection box. This component can be defined in two ways.
- As a boolean (Template:Cd or Template:Cd) value:
A value of Template:Cd creates the default full block selection box. A value of Template:Cd makes the block not selectable by players.
Example:
<syntaxhighlight lang=json copy> "minecraft:selection_box": true </syntaxhighlight>
- As a JSON object:
Fields:
- Template:Cd:
- The origin of the selection box. (0,0,0) represents the bottom center of the block.
- Template:Cd:
- The size of the selection box. The total size of the selection box may not be larger than 16×16×16.
Example (Bottom half slab):
<syntaxhighlight lang=json copy> "minecraft:selection_box": {
"origin": [-8,0,-8], "size": [16,8,16]
} </syntaxhighlight>
minecraft:support
Defines the shape of the block with regards to how it can support other blocks like torches. This component cannot be used in permutations.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: The support shape of the block. If the component is omitted, the default is unit cube (all sides give support).
stair: Uses the shape of a stair (bottom and back give support). This requires theminecraft:vertical_halfblock state, and either state from theminecraft:placement_directionblock trait.fence: Uses the shape of a Minecraft:fence (bottom and top give support).
- Template:Nbt: The support shape of the block. If the component is omitted, the default is unit cube (all sides give support).
Example:
<syntaxhighlight lang=json copy> "minecraft:support": {
"shape": "fence"
} </syntaxhighlight>
minecraft:tags
Defines the block's tags. Tags are used to categorize blocks and allow them to work better with vanilla blocks and items. Both vanilla and custom block tags can be added. This component is defined as an array.
Structure:
- Template:Nbt: The list of tags for this block.
Example:
<syntaxhighlight lang=json copy> "minecraft:tags": ["minecraft:is_pickaxe_item_destructible","example:custom_tag"] </syntaxhighlight>
minecraft:tick
Sets the block to tick after a certain number of ticks, which will trigger the onTick custom component event.
This component is required in order to use the onTick event.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: The minimum and maximum possible time between block ticks. The time values are specified in ticks.
- Template:Nbt: Optional. Whether the block should continue to tick after the first tick.
Example:
<syntaxhighlight lang=json copy> "minecraft:tick": {
"interval_range": [20,100], "looping": true
} </syntaxhighlight>
minecraft:transformation
Transforms the block's geometry, collision box, and selection box. The transformations specified here are still subject to the block model limits.
Structure:
- Template:Nbt: The component root.
- Template:Nbt: Optional. The rotation values around each axis.
- Template:Nbt: Optional. The point to apply rotation around. Defaults to the center of the block.
- Template:Nbt: Optional. The scale amount for each axis.
- Template:Nbt: Optional. The point to apply scaling around. Defaults to the center of the block.
- Template:Nbt: Optional. The distance on each axis to translate the block's geometry.
Example:
<syntaxhighlight lang=json copy> "minecraft:transformation": {
"rotation": [0,90,0]
} </syntaxhighlight>
Custom components
Custom block components allow for custom blocks to take advantage of script API capabilities. Custom components are registered in scripts using the method Template:Cd.
Custom components can be added to blocks the same way as any other component, using the namespaced Minecraft:identifier the component was registered with. Custom components can have arguments of any type, which will be passed to scripts as the second argument.
Examples: <syntaxhighlight lang=json copy> "example_namespace:example_component": "foo", "example_namespace:example_component2": 4, "example_namespace:example_component3": [ "hello", "world" ], "example_namespace:example_component4": true, "example_namespace:example_component5": {
"stuff": 4
} </syntaxhighlight>
In scripts, the custom component object can have methods added to listen to any amount of the following events<ref>Template:Cite</ref>:
- Template:Cd: Called before the player places the block.
- Template:Cd: Called when an block has its state changed.Template:UpcomingTemplate:OnlyExperimental
- Template:Cd: Called when the block is destroyed.
- Template:Cd: Called when an entity sends an event to the block.
- Template:Cd: Called when an entity falls onto the block. This requires the [[#minecraft:entity_fall_on|Template:Cd]] component.
- Template:Cd: Called when the block is placed.
- Template:Cd: Called when the block is destroyed by a player.
- Template:Cd: Called when a player interacts with the block.
- Template:Cd: Called when the block is randomly ticked.
- Template:Cd: Called when the block receives a redstone update. This requires the [[#minecraft:redstone_consumer|Template:Cd]] component, and will only be called if the signal power is greater than or equal to the Template:Cd set in the component.
- Template:Cd: Called when an entity steps off the block.
- Template:Cd: Called when an entity steps on to the block.
- Template:Cd: Called when the block ticks (As specified by the [[#minecraft:tick|Template:Cd]] component).