This commit is contained in:
SeanOMik 2021-02-24 13:58:08 -06:00
parent e20fc16a81
commit 779aa69a09
No known key found for this signature in database
GPG Key ID: CA09E5BE1F32728A
1 changed files with 8 additions and 5 deletions

View File

@ -413,10 +413,7 @@ public class ESTerminalGUI implements InventoryHolder, Listener {
case OUT: case OUT:
if (Utils.isItemValid(clickedItem)) { if (Utils.isItemValid(clickedItem)) {
ItemStack takingItem = clickedItem.clone(); ItemStack takingItem = clickedItem.clone();
takingItem.setAmount((clickType == ClickType.OUT_HALF && clickedItem.getAmount() / 2 > 0) ? clickedItem.getAmount() / 2 : clickedItem.getMaxStackSize());
/*Map<ItemStack, Integer> items = openSystem.getAllItems();
int amount = items.values().toArray()[Utils.indexOfSimilarItem(items.keySet(), clickedItem)]*/
takingItem.setAmount((clickType == ClickType.OUT_HALF && clickedItem.getAmount() / 2 > 0) ? clickedItem.getAmount() / 2 : 64);
takingItem = openSystem.removeItem(takingItem); takingItem = openSystem.removeItem(takingItem);
// Remove the item from the search map if its in there // Remove the item from the search map if its in there
@ -430,7 +427,13 @@ public class ESTerminalGUI implements InventoryHolder, Listener {
} }
if (clickType == ClickType.SHIFT_OUT) { if (clickType == ClickType.SHIFT_OUT) {
player.getInventory().addItem(takingItem); HashMap<Integer, ItemStack> leftOverItems = player.getInventory().addItem(takingItem);
// Add the left over items back into the system
for (Map.Entry<Integer, ItemStack> item : leftOverItems.entrySet()) {
System.out.println(item);
openSystem.addItem(item.getValue());
}
} else { } else {
event.getView().setCursor(takingItem); event.getView().setCursor(takingItem);
} }