diff --git a/src/entity/projectile/EnderPearl.php b/src/entity/projectile/EnderPearl.php index 7a93d1bc9..9d41d255a 100644 --- a/src/entity/projectile/EnderPearl.php +++ b/src/entity/projectile/EnderPearl.php @@ -23,13 +23,8 @@ declare(strict_types=1); namespace pocketmine\entity\projectile; -use pocketmine\block\Block; -use pocketmine\block\BlockLegacyIds; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\ProjectileHitEvent; -use pocketmine\math\AxisAlignedBB; -use pocketmine\math\RayTraceResult; -use pocketmine\math\Vector3; use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds; use pocketmine\world\particle\EndermanTeleportParticle; use pocketmine\world\sound\EndermanTeleportSound; @@ -37,16 +32,6 @@ use pocketmine\world\sound\EndermanTeleportSound; class EnderPearl extends Throwable{ public const NETWORK_ID = EntityLegacyIds::ENDER_PEARL; - protected function calculateInterceptWithBlock(Block $block, Vector3 $start, Vector3 $end) : ?RayTraceResult{ - if($block->getId() !== BlockLegacyIds::AIR and empty($block->getCollisionBoxes())){ - //TODO: remove this once block collision boxes are fixed properly - $pos = $block->getPos(); - return AxisAlignedBB::one()->offset($pos->x, $pos->y, $pos->z)->calculateIntercept($start, $end); - } - - return parent::calculateInterceptWithBlock($block, $start, $end); - } - protected function onHit(ProjectileHitEvent $event) : void{ $owner = $this->getOwningEntity(); if($owner !== null){ diff --git a/src/resourcepacks/ZippedResourcePack.php b/src/resourcepacks/ZippedResourcePack.php index 7d23b3f9e..0364ccd37 100644 --- a/src/resourcepacks/ZippedResourcePack.php +++ b/src/resourcepacks/ZippedResourcePack.php @@ -105,7 +105,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"); } diff --git a/tests/phpunit/network/mcpe/handler/StupidJsonDecodeTest.php b/tests/phpunit/network/mcpe/handler/StupidJsonDecodeTest.php index 2c3900330..dc22b11dc 100644 --- a/tests/phpunit/network/mcpe/handler/StupidJsonDecodeTest.php +++ b/tests/phpunit/network/mcpe/handler/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']] ]; }