Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	resources/vanilla
#	src/world/Explosion.php
#	tests/phpunit/item/ItemTest.php
#	tests/phpunit/world/format/io/region/RegionLoaderTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
This commit is contained in:
Dylan K. Taylor
2020-11-01 14:21:47 +00:00
10 changed files with 7 additions and 14 deletions

View File

@ -210,11 +210,11 @@ abstract class BaseInventory implements Inventory{
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$slot = $this->getItem($i);
if($item->equals($slot)){
if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){
if(($diff = min($slot->getMaxStackSize(), $item->getMaxStackSize()) - $slot->getCount()) > 0){
$count -= $diff;
}
}elseif($slot->isNull()){
$count -= $this->getMaxStackSize();
$count -= min($this->getMaxStackSize(), $item->getMaxStackSize());
}
if($count <= 0){