LDLib

LDLib

333k Downloads

Stack Size not displayed on SlotWidget

mikerooni opened this issue ยท 1 comments

commented

When a SlotWidget or PhantomSlotWidget contains more than a single item, the stack size is not being displayed.

Example Usage

@Override
public Widget createUIWidget() {
    final var group = new WidgetGroup(0, 0, 176, 135);

    var handler = new ItemStackTransfer(1);
    var slot = new PhantomSlotWidget(handler, 0, 10, 10);
    slot.setMaxStackSize(64);
    slot.setChangeListener(() -> {
        System.out.println("stack: " + handler.getStackInSlot(0));
    }).setBackground(GuiTextures.SLOT);
    group.addWidget(slot);

    return group;
}

Expected Behavior

When the stack inside the SlotWidget or PhantomSlotWidget is larger than 1, its size should be displayed like in regular item slots.

Actual Behavior

No matter how large the contained ItemStack is, the SlotWidget does not show the size. It is always displayed as if there was only a single item in the slot.

All other behavior works fine, just as expected:

  • When putting an item in the slot, the stack's actual size is correctly stored in the backing ItemStackTransfer.
  • On SlotWidget:
    • Clicks are handled the same way as on vanilla slots
  • On PhantomSlotWidget:
    • Left-clicking on the slot decreases the stack size by exactly one
    • Right-clicking on the slot increases the stack size by exactly one
    • Shift + Left-clicking halves the stack size
    • Shift + Right-clicking doubles the stack size
commented

Not a bug in LDLib, it only affects side panels in GTCEu-Modern