Skip to content

Commit a29b6a7

Browse files
committed
Add a workaround for reference slot not always being in correct scope
1 parent f8f52d9 commit a29b6a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

common/src/main/java/dev/terminalmc/clientsort/client/gui/ControlButtonManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,12 @@ private static void addButton(
427427
AbstractContainerScreen<?> screen,
428428
boolean isPlayerInv
429429
) {
430+
// TODO find a way to reliably get a slot that belongs to the correct
431+
// inventory, since the reference slot is used as the scope slot
432+
// Get the top-most of the right-most slots
430433
return screen.getMenu().slots.stream()
431434
.filter(slot -> isPlayerInv == (slot.container instanceof Inventory))
432-
.max(Comparator.comparingInt(slot -> slot.x - slot.y))
435+
.max(Comparator.comparingInt(slot -> slot.x * 9999 - slot.y))
433436
.orElse(null);
434437
}
435438

0 commit comments

Comments
 (0)