Fixed Inventory->removeItem()

This commit is contained in:
Shoghi Cervantes 2014-10-16 12:16:23 +02:00
parent 204915450f
commit 747fdab389

View File

@ -124,7 +124,7 @@ abstract class BaseInventory implements Inventory{
$item = clone $item;
if($index < 0 or $index >= $this->size){
return false;
}elseif($item->getID() === 0){
}elseif($item->getID() === 0 or $item->getCount() <= 0){
$this->clear($index, $source);
}
@ -275,16 +275,11 @@ abstract class BaseInventory implements Inventory{
if($slot->equals($item, $slot->getDamage() === null ? false : true)){
$amount = min($item->getCount(), $slot->getCount());
$slot->setCount($slot->getCount() - $amount);
$old = clone $item;
$item->setCount($item->getCount() - $amount);
$this->setItem($i, $item);
if($slot->getCount() <= 0){
unset($slots[$index]);
}
if($item->getCount() <= 0){
$this->clear($i);
}else{
$this->onSlotChange($i, $old);
}
}
}