Allow shift clicking to get as much as possible

This commit is contained in:
Bruno Rybársky 2024-05-25 15:00:08 +02:00
parent fce0e3ffa1
commit 621d7514bb

@ -84,7 +84,7 @@ public class StorageScreen extends PagedGui {
if (clickedElement != null) { if (clickedElement != null) {
ItemStack clickedItem = clickedElement.getItemStack(); ItemStack clickedItem = clickedElement.getItemStack();
ItemStack noLoreStack = removeCountFromLore(clickedItem); ItemStack noLoreStack = removeCountFromLore(clickedItem);
if (noLoreStack.getCount() > noLoreStack.getMaxCount()) { if (noLoreStack.getCount() > noLoreStack.getMaxCount() && !type.shift) {
noLoreStack.setCount(noLoreStack.getMaxCount()); noLoreStack.setCount(noLoreStack.getMaxCount());
} }
int maxToInsert = canInsertItemIntoPlayerInventory(player, noLoreStack); int maxToInsert = canInsertItemIntoPlayerInventory(player, noLoreStack);
@ -141,6 +141,7 @@ public class StorageScreen extends PagedGui {
public void doSearch(String query) { public void doSearch(String query) {
this.query = query; this.query = query;
this.page = 0;
this.updateDisplay(); this.updateDisplay();
} }
} }