Still present in 26.1.2 - root cause analysis is bug in math in net.minecraft.world.item.component.BundleContents#getNumberOfItemsToShow()
current code:
public int getNumberOfItemsToShow() {
int numberOfItemStacks = this.size();
int availableItemsToShow = numberOfItemStacks > 12 ? 11 : 12;
int itemsOnNonFullRow = numberOfItemStacks % 4;
int emptySpaceOnNonFullRow = itemsOnNonFullRow == 0 ? 0 : 4 - itemsOnNonFullRow;
return Math.min(numberOfItemStacks, availableItemsToShow - emptySpaceOnNonFullRow);
}correct code:
public int getNumberOfItemsToShow() {
int numberOfItemStacks = this.size();
int availableItemsToShow = numberOfItemStacks > 12 ? 11 : 12;
int itemsOnNonFullRow = availableItemsToShow % 4; // <-- here it should take how many items should be in last row
int emptySpaceOnNonFullRow = itemsOnNonFullRow == 0 ? 0 : 4 - itemsOnNonFullRow;
return Math.min(numberOfItemStacks, availableItemsToShow - emptySpaceOnNonFullRow);
}the whole logic could be simplified though to:
public int getNumberOfItemsToShow() {
return Math.min(this.size(), 11);
}Linked issues
duplicates 1
Comments 3
Hi!
Thank you for your report!
We've already resolved this issue at MC-275217 , so I will close and link this ticket as a Duplicate.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki
Duplicates MC-275217, which is already resolved as WAI.
The behavior is also mentioned in 1.21.2 chagelog:
Also, your oversimplification will make the tooltip show unneccessary “+1” when the bundle contains exactly 12 stacks of items.