mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Fixed slots overfilling (like on Armor slots)
This commit is contained in:
parent
9b950a98c7
commit
98e9b5594c
@ -205,7 +205,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
foreach($slots as $index => $slot){
|
foreach($slots as $index => $slot){
|
||||||
if($slot->equals($item, $slot->getDamage() === null ? false : true)){
|
if($slot->equals($item, $slot->getDamage() === null ? false : true)){
|
||||||
if($item->getCount() < $item->getMaxStackSize()){
|
if($item->getCount() < $item->getMaxStackSize()){
|
||||||
$amount = min($item->getMaxStackSize() - $item->getCount(), $slot->getCount());
|
$amount = min($item->getMaxStackSize() - $item->getCount(), $slot->getCount(), $this->getMaxStackSize());
|
||||||
$slot->setCount($slot->getCount() - $amount);
|
$slot->setCount($slot->getCount() - $amount);
|
||||||
$old = clone $item;
|
$old = clone $item;
|
||||||
$item->setCount($item->getCount() + $amount);
|
$item->setCount($item->getCount() + $amount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user