Custom components are not applied correctly across permutations of custom blocks. This bug’s existence seems to depend on registration of hooks in scripting, but testing has not definitively confirmed this. What is known is that so-called “data components” — custom components whose sole purpose is to provide JSON data to other components — suffer from this bug.
Workaround possible
To get around this bug, custom components can be duplicated into every discriminated permutation group independently. However, this causes increased file size, increased development time, and makes block definitions more difficult to maintain.
Demonstration
The following video demonstrates this bug. The block contains 2 permutations, obsidian-textured (the default) and glowstone-textured. The obsidian-textured permutation should only have the test_1 custom component. This is handled correctly. The glowstone-textured permutation should have both the test_1 and test_2 custom components, but this is not the case.
The code for such is shown below.
Reproduction
This bug can be observed with the following definition:
{
"format_version": "1.26.0",
"minecraft:block": {
"description": {
"identifier": "bug_components:custom_block",
"states": {
"bug_components:activated": [false, true]
}
},
"components": {
"minecraft:geometry": "minecraft:geometry.full_block",
"minecraft:material_instances": {"*": {"texture": "obsidian"}},
"bug_components:test_1": 0
},
"permutations": [
{
"condition": "q.block_state('bug_components:activated')",
"components": {
"minecraft:geometry": "minecraft:geometry.full_block",
"minecraft:material_instances": {"*": {"texture": "glowstone"}},
"bug_components:test_2": 1
}
}
]
}
}Assume that both bug_components:test_1 and bug_components:test_2 are registered in scripting without providing any hooks, e.g.:
system.beforeEvents.startup.subscribe(
({blockComponentRegistry}) => {
blockComponentRegistry.registerCustomComponent("bug_components:test_1", {})
blockComponentRegistry.registerCustomComponent("bug_components:test_2", {})
}
)This example is taken from the behavior pack in the following world attached for convenience:
This world can be opened (in Minecraft Preview) for inspection or unzipped to access the code associated with such. Interacting with either permutation shows which custom components are applied to which.
Attachments
Comments 0
No comments.