Custom blocks support different rendering depending on context using the minecraft:item_visual component. Some undetermined issue is causing rendering to be incorrect in item contexts using this component. It appears that data from the minecraft:material_instances component may sometimes be taking priority over the item visual component.
Demonstration
The following block’s definition is supposed to be using opaque in-world rendering and blended item rendering:
Notice that the held item render method is opaque instead of blended.
The reverse situation, where a block is supposed to use blended in-world rendering and opaque item rendering, is also incorrect:
In this case, both the held item and icon are incorrect.
Reproduction
The first example above uses the following block definition:
{
"format_version": "1.26",
"minecraft:block": {
"description": {"identifier": "bug_rendering:custom_block_with_differing_material_1"},
"components": {
"minecraft:geometry": "minecraft:geometry.full_block",
"minecraft:material_instances": {
"*": {"render_method": "opaque", "texture": "glass"}
},
"minecraft:item_visual": {
"geometry": "minecraft:geometry.full_block",
"material_instances": {
"*": {"render_method": "blend", "texture": "glass"}
}
}
}
}
}The second simply reverses the render methods.
These examples are 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. Also included are demonstrations of proper behaviors via the following 2 definitions:
bug_rendering:basic_custom_blockbug_rendering:custom_block_with_same_material
Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
Could you please add Observed Results and Expected Results sections, explaining how each of the three blocks behaves vs. how it is supposed to behave?
This ticket will automatically reopen when you reply.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki