Paintings with non-existent variant entity tag are falsely labeled as random variant
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting[entity_data={variant:a,id:painting}]
Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be straightforward: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
Created Issue:
Paintings with non-existent variant entity tag are falsely labeled as random variant
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 default painting variant.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 default painting variant.
Unable to find source-code formatter for language: mcfunction. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml/give @s painting{EntityTag:{variant:"e"}}
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 default painting variant.
Unable to find source-code formatter for language: mcfunction. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml/give @s painting{EntityTag:{variant:"e"}}
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 default painting variant.
/give @s painting{EntityTag:{variant:"e"}}Presumably this is due to painting variants using a defaulted registry lookup for placing and nullable lookup for tooltips.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 default painting variant.
/give @s painting{EntityTag:{variant:"e"}}
Presumably this is due to painting variants using a defaulted registry lookup for placing and nullable lookup for tooltips.When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting{EntityTag:{variant:"e"}}Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the {DecorationItem#appendTooltip) method calls the
{PaintingEntity#readVariantFromNbt} method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the {DecorationItem#useOnBlock} method uses the code path for reading the {EntityTag} compound. This merges the newly-created entity's NBT with the {EntityTag} compound, then loads that compound into the entity involving the {PaintingEntity#readCustomDataFromNbt} method. This method also uses the {PaintingEntity#readVariantFromNbt}method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting{EntityTag: {variant: "e"}}Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the {DecorationItem#appendTooltip) method calls the
{PaintingEntity#readVariantFromNbt} method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the {DecorationItem#useOnBlock} method uses the code path for reading the {EntityTag} compound. This merges the newly-created entity's NBT with the {EntityTag} compound, then loads that compound into the entity involving the {PaintingEntity#readCustomDataFromNbt} method. This method also uses the {PaintingEntity#readVariantFromNbt}method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting{EntityTag: {variant: "e"}}Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the {DecorationItem#appendTooltip) method calls the
{PaintingEntity#readVariantFromNbt} method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the {DecorationItem#useOnBlock} method uses the code path for reading the {EntityTag} compound. This merges the newly-created entity's NBT with the {EntityTag} compound, then loads that compound into the entity involving the {PaintingEntity#readCustomDataFromNbt} method. This method also uses the {PaintingEntity#readVariantFromNbt}method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting{EntityTag: {variant: "e"}}Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting{EntityTag: {variant: "e"}}Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting[entity_data={variant:a,id:painting}]Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be simple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting[entity_data={variant:a,id:painting}]Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be s
imple: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.When creating a painting with an entity tag that specifies a painting variant that does not exist, the tooltip in the creative inventory will list it as a random variant. However, the painting variant that is actually placed is the 1x1 Kebab default painting variant.
/give @s painting[entity_data={variant:a,id:painting}]Code analysis
Using Yarn mappings for 23w06a:
The code path for getting a painting's tooltip in the DecorationItem#appendTooltip method calls the PaintingEntity#readVariantFromNbt method, which returns an empty optional when the identifier in the NBT is not present in the painting variant registry. If the optional is empty, then the tooltip will include the random variant line.
However, the DecorationItem#useOnBlock method uses the code path for reading the EntityTag compound. This merges the newly-created entity's NBT with the EntityTag compound, then loads that compound into the entity involving the PaintingEntity#readCustomDataFromNbt method. This method also uses the PaintingEntity#readVariantFromNbt method, but chains the optional so that it falls back to the Kebab painting variant instead. As a result, the placed painting will always have the Kebab painting variant if the identifier cannot be parsed or the identifier is missing from the painting variant registry.
The change required would be straightforward: the tooltip code path should match the entity loading code path in defaulting the painting variant to Kebab. Alternatively, the entity loading code path could choose a random variant instead of defaulting the painting variant, but this could break existing paintings with broken NBT.
I cannot reproduce this issue in Minecraft 1.21 pre-release 1. I imagine the fix version is 24w18a as that is when painting variants became a dynamic registry, but that is not confirmed.
I can confirm that this issue seems to have been fixed in 24w18a.
Placing the painting given by the command places a random variant.