Пример #1
0
 public void removeItem(byte slot, short quantity, boolean allowZero) {
   IItem item = inventory.get(slot);
   if (item == null) { // TODO is it ok not to throw an exception here?
     return;
   }
   item.setQuantity((short) (item.getQuantity() - quantity));
   if (item.getQuantity() < 0) {
     item.setQuantity((short) 0);
   }
   if (item.getQuantity() == 0 && !allowZero) {
     removeSlot(slot);
   }
 }