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
commit 73a8c90bee
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){

View File

@ -157,7 +157,6 @@ class Explosion{
* and creating sounds and particles.
*/
public function explodeB() : bool{
$send = [];
$updateBlocks = [];
$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();
@ -250,7 +249,6 @@ class Explosion{
$updateBlocks[$index] = true;
}
}
$send[] = $pos->subtractVector($source);
}
$this->world->addParticle($source, new HugeExplodeSeedParticle());

View File

@ -116,8 +116,6 @@ class BlockTest extends TestCase{
/**
* @dataProvider blockGetProvider
* @param int $id
* @param int $meta
*/
public function testBlockGet(int $id, int $meta) : void{
$block = $this->blockFactory->get($id, $meta);

View File

@ -57,7 +57,6 @@ class StupidJsonDecodeTest extends TestCase{
/**
* @dataProvider stupidJsonDecodeProvider
*
* @param string $brokenJson
* @param mixed $expect
*
* @throws \ReflectionException

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\utils;
use PHPUnit\Framework\TestCase;
use function yaml_parse;
class ConfigTest extends TestCase{
@ -61,7 +62,6 @@ class ConfigTest extends TestCase{
/**
* @dataProvider fixYamlIndexesProvider
*
* @param string $test
* @param mixed[] $expected
*/
public function testFixYamlIndexes(string $test, array $expected) : void{

View File

@ -51,7 +51,6 @@ class UtilsTest extends TestCase{
}
/**
* @param string $docComment
* @dataProvider parseDocCommentNewlineProvider
*/
public function testParseDocCommentNewlines(string $docComment) : void{

View File

@ -82,8 +82,6 @@ class RegionLoaderTest extends TestCase{
/**
* @dataProvider outOfBoundsCoordsProvider
* @param int $x
* @param int $z
*
* @throws ChunkException
* @throws \InvalidArgumentException
@ -110,9 +108,6 @@ class RegionLoaderTest extends TestCase{
/**
* @dataProvider outOfBoundsCoordsProvider
*
* @param int $x
* @param int $z
*
* @throws \InvalidArgumentException
* @throws \pocketmine\world\format\io\exception\CorruptedChunkException
*/

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\world\format\io\region;
use PHPUnit\Framework\TestCase;
use function sprintf;
class RegionLocationTableEntryTest extends TestCase{

View File

@ -26,6 +26,7 @@ namespace pmmp\TesterPlugin;
use pocketmine\event\Listener;
use pocketmine\event\server\CommandEvent;
use pocketmine\plugin\PluginBase;
use function array_shift;
class Main extends PluginBase implements Listener{

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pmmp\TesterPlugin;
use function time;
abstract class Test{
const RESULT_WAITING = -1;
const RESULT_OK = 0;