mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Fixed #386 Adding items use the correct item max stack size [gh#386]
This commit is contained in:
parent
0dd3d4a457
commit
fbf22cec39
@ -280,11 +280,11 @@ class Player{
|
|||||||
$add = 0;
|
$add = 0;
|
||||||
foreach($inv as $s => $item){
|
foreach($inv as $s => $item){
|
||||||
if($item->getID() === AIR){
|
if($item->getID() === AIR){
|
||||||
$add = min(64, $count);
|
$add = min($item->getMaxStackSize(), $count);
|
||||||
$inv[$s] = BlockAPI::getItem($type, $damage, $add);
|
$inv[$s] = BlockAPI::getItem($type, $damage, $add);
|
||||||
break;
|
break;
|
||||||
}elseif($item->getID() === $type and $item->getMetadata() === $damage){
|
}elseif($item->getID() === $type and $item->getMetadata() === $damage){
|
||||||
$add = min(64 - $item->count, $count);
|
$add = min($item->getMaxStackSize() - $item->count, $count);
|
||||||
if($add <= 0){
|
if($add <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -305,14 +305,14 @@ class Player{
|
|||||||
$add = 0;
|
$add = 0;
|
||||||
foreach($this->inventory as $s => $item){
|
foreach($this->inventory as $s => $item){
|
||||||
if($item->getID() === AIR){
|
if($item->getID() === AIR){
|
||||||
$add = min(64, $count);
|
$add = min($item->getMaxStackSize(), $count);
|
||||||
$this->inventory[$s] = BlockAPI::getItem($type, $damage, $add);
|
$this->inventory[$s] = BlockAPI::getItem($type, $damage, $add);
|
||||||
if($send === true){
|
if($send === true){
|
||||||
$this->sendInventorySlot($s);
|
$this->sendInventorySlot($s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}elseif($item->getID() === $type and $item->getMetadata() === $damage){
|
}elseif($item->getID() === $type and $item->getMetadata() === $damage){
|
||||||
$add = min(64 - $item->count, $count);
|
$add = min($item->getMaxStackSize() - $item->count, $count);
|
||||||
if($add <= 0){
|
if($add <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user