mojira.dev

Nightenom

Assigned

No issues.

Comments

If this is WAI then I don’t know who decided that we are not reading from top-left to bottom-right - first slot is empty background, overall this thing just looks ugly, is not user-friendly in terms etc. And completely unnecessary niche bullshit imho.

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

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);
}