From d724374d1af369d16647bc1ec3da2e8e733d08e2 Mon Sep 17 00:00:00 2001 From: Dylan T Date: Mon, 16 Sep 2019 15:53:00 +0100 Subject: [PATCH 1/3] StupidJsonDecodeTest: add failing test case for #3113 --- tests/phpunit/network/mcpe/StupidJsonDecodeTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/network/mcpe/StupidJsonDecodeTest.php b/tests/phpunit/network/mcpe/StupidJsonDecodeTest.php index b096c6c9d..40de1a35c 100644 --- a/tests/phpunit/network/mcpe/StupidJsonDecodeTest.php +++ b/tests/phpunit/network/mcpe/StupidJsonDecodeTest.php @@ -34,7 +34,8 @@ class StupidJsonDecodeTest extends TestCase{ ["false", false], ["NULL", null], ['["\",,\"word","a\",,\"word2",]', ['",,"word', 'a",,"word2', '']], - ['["\",,\"word","a\",,\"word2",""]', ['",,"word', 'a",,"word2', '']] + ['["\",,\"word","a\",,\"word2",""]', ['",,"word', 'a",,"word2', '']], + ['["Hello,, PocketMine"]', ['Hello,, PocketMine']] ]; } From 70b1ac856df7c17cc0b1a0ccb3ad304491f1e4f7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 17 Sep 2019 11:01:33 +0100 Subject: [PATCH 2/3] ZippedResourcePack: fix mishandling of wrong root JSON type (crashdump #2840512) --- src/pocketmine/resourcepacks/ZippedResourcePack.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/resourcepacks/ZippedResourcePack.php b/src/pocketmine/resourcepacks/ZippedResourcePack.php index 8aa4ca8cb..d453396b7 100644 --- a/src/pocketmine/resourcepacks/ZippedResourcePack.php +++ b/src/pocketmine/resourcepacks/ZippedResourcePack.php @@ -104,7 +104,9 @@ class ZippedResourcePack implements ResourcePack{ }catch(\RuntimeException $e){ throw new ResourcePackException("Failed to parse manifest.json: " . $e->getMessage(), $e->getCode(), $e); } - + if(!($manifest instanceof \stdClass)){ + throw new ResourcePackException("manifest.json should contain a JSON object, not " . gettype($manifest)); + } if(!self::verifyManifest($manifest)){ throw new ResourcePackException("manifest.json is missing required fields"); } From 11a6e04a288f3379fac160647f5a6f8a037c913b Mon Sep 17 00:00:00 2001 From: Dylan T Date: Wed, 18 Sep 2019 10:02:52 +0100 Subject: [PATCH 3/3] EnderPearl: remove collision box hack (this isn't needed for MCPE anyway) This was intended to address the problem that ender pearls would not stop on grass, saplings, and other similar objects. However, they don't stop on such objects in MCPE anyway, only PC. --- .../entity/projectile/EnderPearl.php | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/src/pocketmine/entity/projectile/EnderPearl.php b/src/pocketmine/entity/projectile/EnderPearl.php index 2bbdfab5e..627f84fde 100644 --- a/src/pocketmine/entity/projectile/EnderPearl.php +++ b/src/pocketmine/entity/projectile/EnderPearl.php @@ -23,36 +23,14 @@ declare(strict_types=1); namespace pocketmine\entity\projectile; -use pocketmine\block\Block; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\ProjectileHitEvent; use pocketmine\level\sound\EndermanTeleportSound; -use pocketmine\math\AxisAlignedBB; -use pocketmine\math\RayTraceResult; -use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\LevelEventPacket; class EnderPearl extends Throwable{ public const NETWORK_ID = self::ENDER_PEARL; - protected function calculateInterceptWithBlock(Block $block, Vector3 $start, Vector3 $end) : ?RayTraceResult{ - if($block->getId() !== Block::AIR and empty($block->getCollisionBoxes())){ - //TODO: remove this once block collision boxes are fixed properly - $bb = new AxisAlignedBB( - $block->x, - $block->y, - $block->z, - $block->x + 1, - $block->y + 1, - $block->z + 1 - ); - - return $bb->calculateIntercept($start, $end); - } - - return parent::calculateInterceptWithBlock($block, $start, $end); - } - protected function onHit(ProjectileHitEvent $event) : void{ $owner = $this->getOwningEntity(); if($owner !== null){