From fbf22cec391867cb372881842d3684a9cc1a8c8d Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 13 Jun 2013 10:44:00 +0200 Subject: [PATCH] Fixed #386 Adding items use the correct item max stack size [gh#386] --- src/Player.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Player.php b/src/Player.php index bd6290cd..98580b40 100644 --- a/src/Player.php +++ b/src/Player.php @@ -280,11 +280,11 @@ class Player{ $add = 0; foreach($inv as $s => $item){ if($item->getID() === AIR){ - $add = min(64, $count); + $add = min($item->getMaxStackSize(), $count); $inv[$s] = BlockAPI::getItem($type, $damage, $add); break; }elseif($item->getID() === $type and $item->getMetadata() === $damage){ - $add = min(64 - $item->count, $count); + $add = min($item->getMaxStackSize() - $item->count, $count); if($add <= 0){ continue; } @@ -305,14 +305,14 @@ class Player{ $add = 0; foreach($this->inventory as $s => $item){ if($item->getID() === AIR){ - $add = min(64, $count); + $add = min($item->getMaxStackSize(), $count); $this->inventory[$s] = BlockAPI::getItem($type, $damage, $add); if($send === true){ $this->sendInventorySlot($s); } break; }elseif($item->getID() === $type and $item->getMetadata() === $damage){ - $add = min(64 - $item->count, $count); + $add = min($item->getMaxStackSize() - $item->count, $count); if($add <= 0){ continue; }