After giving a banner a pattern and then washing the pattern away using a cauldron, the banner no longer stacks with a blank banner, even though their pattern is exactly the same
Relates to MC-251509
How to reproduce:
- Craft two white banners
- Give one of them any pattern
- Wash away the pattern using a cauldron with water
- The banners no longer stack
Causes
A banner that was just crafted has no NBT data.
When applying a pattern the banner item is given a Patterns and an id tag in the BlockEntityTag.
BlockEntityTag of a banner with one pattern:
{Patterns: [{Pattern: "bl", Color: 6}], id: "minecraft:banner"}
When the banner is washed it removes the Patterns tag but not the id.
BlockEntityTag of a banner that was given a pattern and then washed:
{id: "minecraft:banner"}
The NBT doesn't match a freshly crafted banner making them not stack, even though both are a completely blank banner.
If the washed banner is placed and then broken, the dropped item will no longer have the id tag and it will regain the Patterns tag but with an empty list.
BlockEntityTag of a banner that was given a pattern, then washed, then placed and picked up again:
{Patterns: []}
The empty banner stacks with neither a fresh banner nor the washed banner because it now has an empty list of patterns, despite all three being the exact same banner. Normally a blank banner should have no patterns list, instead of the empty list we see here.
The disappearance of the id tag when placing and breaking the banner is also the cause of MC-251509 but in this scenario not only does the id tag disappear, the banner also gains the empty patterns list.
Extra info
The only way the banner stacks with a freshly crafted one after being washed is through the following steps:
- Give blank banner a pattern (banner gains id and patterns tags)
- Place and break the banner (banner loses id tag)
- Wash the banner (banner loses patterns tag)
- The banner now has no NBT tags and will stack with a freshly crafted banner
Possible fixes
If the banner never gains the id tag when adding a pattern to it, none of these issues should ever occur. Seeing how the banner already loses this tag when it is placed and picked up it seems like the banner still works fine without it. This would most likely also be a fix for MC-251509.
Alternatively the banner could always retain the id tag when placing and breaking it. The banner would then also need to gain the id tag when it is crafted to avoid stacking issues with newly crafted banners. The only issue that would then potentially remain is blank banners gaining an empty patterns list after being placed and broken again, as this seems to happen to any banner that has an id tag but no patterns tag (see last section of Causes).