Added Trade Station warning for full inventory

#170
This commit is contained in:
mezz committed 2014-09-09 14:43:15 -07:00
1 parent 9d8e572ac8
commit 07afdf63b1
3 files changed
+27 -6

No files matched your search

@@ -286,13 +286,20 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
return (int) Math.floor(itemCount / tradegood.stackSize);
}
public boolean canReceivePayment() {
InventoryAdapter test = inventory.copy();
ItemStack [] payment = inventory.getStacks(SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT);
return test.tryAddStacksCopy(payment, SLOT_RECEIVE_BUFFER, SLOT_RECEIVE_BUFFER_COUNT, true);
}
private int countStorablePayment(int max, ItemStack[] exchange) {
InventoryAdapter test = inventory.copy();
int count = 0;
for (int i = 0; i < max; i++) {
if (test.tryAddStacksCopy(exchange, true))
if (test.tryAddStacksCopy(exchange, SLOT_RECEIVE_BUFFER, SLOT_RECEIVE_BUFFER_COUNT, true))
count++;
else
break;