From 747fdab38955f0ee79648214b2d96d4ddc85a724 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 16 Oct 2014 12:16:23 +0200 Subject: [PATCH] Fixed Inventory->removeItem() --- src/pocketmine/inventory/BaseInventory.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index 75583b7d5..6b6e50737 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -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); - } } }