mojira.dev
MC-275217

Bundles with more than two rows of items don't fill up empty spaces with new items

The Bug:

Bundles with more than two rows of items don't fill up empty spaces with new items.

Steps to Reproduce:

  1. Fill a bundle with 16 items.

  2. Take out 2 items and observe the bundle tooltip and observe how there are two empty spaces despite the tooltip saying +X.

Observed Behavior:

Bundles with more than two rows of items don't fill up empty spaces with new items.

Expected Behavior:

Bundles with more than two rows of items would fill up empty spaces with new items.

Linked issues

Attachments

Comments 4

[media]

Yup, Same Issue. 

Also, I Cannot Seem To Scroll Past The Seventh Item In The Bundle.

Still present in 26.1.2 - root cause analysis is bug in math in a in a
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);
}

cannot edit comment - code path for method above is net.minecraft.world.item.component.BundleContents#getNumberOfItemsToShow()

Avoma

(Unassigned)

1283643

Confirmed

Expansion A

24w33a, 26.1.2

Retrieved