Merge remote-tracking branch 'origin/stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-10-11 21:59:40 +01:00
commit 6ae7cb288e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
16 changed files with 77 additions and 47 deletions

View File

@ -53,7 +53,7 @@
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "1.8.6",
"phpstan/phpstan": "1.8.8",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2"

42
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "29badb76ebb63167718947cad48bd37d",
"content-hash": "8153377a26bfd4a342a9b7101580f1ea",
"packages": [
{
"name": "adhocore/json-comment",
"version": "1.1.2",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/adhocore/php-json-comment.git",
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7"
"reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7",
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7",
"url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/651023f9fe52e9efa2198cbaf6e481d1968e2377",
"reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377",
"shasum": ""
},
"require": {
@ -51,15 +51,19 @@
],
"support": {
"issues": "https://github.com/adhocore/php-json-comment/issues",
"source": "https://github.com/adhocore/php-json-comment/tree/1.1.2"
"source": "https://github.com/adhocore/php-json-comment/tree/1.2.1"
},
"funding": [
{
"url": "https://paypal.me/ji10",
"type": "custom"
},
{
"url": "https://github.com/adhocore",
"type": "github"
}
],
"time": "2021-04-09T03:06:06+00:00"
"time": "2022-10-02T11:22:07+00:00"
},
{
"name": "brick/math",
@ -245,16 +249,16 @@
},
{
"name": "pocketmine/bedrock-data",
"version": "1.11.0+bedrock-1.19.30",
"version": "1.11.1+bedrock-1.19.30",
"source": {
"type": "git",
"url": "https://github.com/pmmp/BedrockData.git",
"reference": "2cca1d48421db20740ffd1ce67b40b91acc61187"
"reference": "9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/2cca1d48421db20740ffd1ce67b40b91acc61187",
"reference": "2cca1d48421db20740ffd1ce67b40b91acc61187",
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c",
"reference": "9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c",
"shasum": ""
},
"type": "library",
@ -265,9 +269,9 @@
"description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP",
"support": {
"issues": "https://github.com/pmmp/BedrockData/issues",
"source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.19.30"
"source": "https://github.com/pmmp/BedrockData/tree/1.11.1+bedrock-1.19.30"
},
"time": "2022-09-20T18:19:22+00:00"
"time": "2022-09-27T22:00:01+00:00"
},
{
"name": "pocketmine/bedrock-protocol",
@ -1506,16 +1510,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.8.6",
"version": "1.8.8",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618"
"reference": "08310ce271984587e2a4cda94e1ac66510a6ea07"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618",
"reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07",
"reference": "08310ce271984587e2a4cda94e1ac66510a6ea07",
"shasum": ""
},
"require": {
@ -1545,7 +1549,7 @@
],
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.8.6"
"source": "https://github.com/phpstan/phpstan/tree/1.8.8"
},
"funding": [
{
@ -1561,7 +1565,7 @@
"type": "tidelift"
}
],
"time": "2022-09-23T09:54:39+00:00"
"time": "2022-10-06T12:51:57+00:00"
},
{
"name": "phpstan/phpstan-phpunit",

View File

@ -27,7 +27,7 @@ use pocketmine\item\Item;
use pocketmine\item\VanillaItems;
use function mt_rand;
class Melon extends Transparent{
class Melon extends Opaque{
public function getDropsForCompatibleTool(Item $item) : array{
return [

View File

@ -43,7 +43,11 @@ class RedMushroom extends Flowable{
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
$down = $this->getSide(Facing::DOWN);
if(!$down->isTransparent()){
$position = $this->getPosition();
$lightLevel = $position->getWorld()->getFullLightAt($position->x, $position->y, $position->z);
$downId = $down->getId();
//TODO: nylium support
if(($lightLevel <= 12 && !$down->isTransparent()) || $downId === BlockLegacyIds::MYCELIUM || $downId === BlockLegacyIds::PODZOL){
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}

View File

@ -27,6 +27,7 @@ use pocketmine\block\utils\SignText;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\utils\Binary;
use pocketmine\world\World;
use function array_pad;
use function array_slice;
@ -42,6 +43,13 @@ use function sprintf;
class Sign extends Spawnable{
public const TAG_TEXT_BLOB = "Text";
public const TAG_TEXT_LINE = "Text%d"; //sprintf()able
public const TAG_TEXT_COLOR = "SignTextColor";
public const TAG_GLOWING_TEXT = "IgnoreLighting";
/**
* This tag is set to indicate that MCPE-117835 has been addressed in whatever version this sign was created.
* @see https://bugs.mojang.com/browse/MCPE-117835
*/
public const TAG_LEGACY_BUG_RESOLVE = "TextIgnoreLegacyBugResolved";
/**
* @return string[]
@ -111,5 +119,11 @@ class Sign extends Spawnable{
protected function addAdditionalSpawnData(CompoundTag $nbt) : void{
$nbt->setString(self::TAG_TEXT_BLOB, implode("\n", $this->text->getLines()));
//the following are not yet used by the server, but needed to roll back any changes to glowing state or colour
//if the client uses dye on the sign
$nbt->setInt(self::TAG_TEXT_COLOR, Binary::signInt(0xff_00_00_00));
$nbt->setByte(self::TAG_GLOWING_TEXT, 0);
$nbt->setByte(self::TAG_LEGACY_BUG_RESOLVE, 1);
}
}

View File

@ -256,8 +256,7 @@ abstract class Living extends Entity{
$size = $this->getInitialSizeInfo();
if($this->isSwimming() || $this->isGliding()){
$width = $size->getWidth();
//we don't actually know an appropriate eye height for a swimming mob, but 2/3 should be good enough.
$this->setSize((new EntitySizeInfo($width, $width, $width * 2 / 3))->scale($this->getScale()));
$this->setSize((new EntitySizeInfo($width, $width, $width * 0.9))->scale($this->getScale()));
}else{
$this->setSize($size->scale($this->getScale()));
}

View File

@ -72,7 +72,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
* Returns the item used to destroy the block.
*/
public function getItem() : Item{
return $this->item;
return clone $this->item;
}
/**

View File

@ -65,7 +65,7 @@ class BlockPlaceEvent extends BlockEvent implements Cancellable{
* Gets the item in hand
*/
public function getItem() : Item{
return $this->item;
return clone $this->item;
}
public function getBlockReplaced() : Block{

View File

@ -69,7 +69,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
}
public function getItem() : Item{
return $this->item;
return clone $this->item;
}
public function getBlock() : Block{

View File

@ -60,6 +60,6 @@ class PlayerItemHeldEvent extends PlayerEvent implements Cancellable{
* Returns the item in the slot that the player is trying to equip.
*/
public function getItem() : Item{
return $this->item;
return clone $this->item;
}
}

View File

@ -47,7 +47,7 @@ class PlayerItemUseEvent extends PlayerEvent implements Cancellable{
* Returns the item used.
*/
public function getItem() : Item{
return $this->item;
return clone $this->item;
}
/**

View File

@ -30,6 +30,7 @@ use pocketmine\network\mcpe\convert\GlobalItemTypeDictionary;
use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\network\mcpe\InventoryManager;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\types\BlockPosition;
@ -132,9 +133,11 @@ class PreSpawnPacketHandler extends PacketHandler{
$this->session->getLogger()->debug("Sending inventory");
$this->inventoryManager->syncAll();
$this->inventoryManager->syncCreative();
$this->inventoryManager->syncSelectedHotbarSlot();
$this->session->getLogger()->debug("Sending creative inventory data");
$this->inventoryManager->syncCreative();
$this->session->getLogger()->debug("Sending crafting data");
$this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->server->getCraftingManager()));
@ -147,4 +150,10 @@ class PreSpawnPacketHandler extends PacketHandler{
return true;
}
public function handlePlayerAuthInput(PlayerAuthInputPacket $packet) : bool{
//the client will send this every tick once we start sending chunks, but we don't handle it in this stage
//this is very spammy so we filter it out
return true;
}
}

View File

@ -195,7 +195,7 @@ class Explosion{
}
$entity->attack($ev);
$entity->setMotion($motion->multiply($impact));
$entity->setMotion($entity->getMotion()->addVector($motion->multiply($impact)));
}
}

View File

@ -335,6 +335,21 @@ parameters:
count: 3
path: ../../../src/block/Mycelium.php
-
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
count: 1
path: ../../../src/block/RedMushroom.php
-
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
count: 1
path: ../../../src/block/RedMushroom.php
-
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getFullLightAt\\(\\) expects int, float\\|int given\\.$#"
count: 1
path: ../../../src/block/RedMushroom.php
-
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getBlockLightAt\\(\\) expects int, float\\|int given\\.$#"
count: 1
@ -510,11 +525,6 @@ parameters:
count: 1
path: ../../../src/crash/CrashDump.php
-
message: "#^Parameter \\#1 \\$index of method pocketmine\\\\inventory\\\\BaseInventory\\:\\:setItem\\(\\) expects int, int\\|string given\\.$#"
count: 1
path: ../../../src/entity/ExperienceManager.php
-
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getBlockAt\\(\\) expects int, float\\|int given\\.$#"
count: 1

View File

@ -1,6 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool=\\)\\: mixed\\) does not accept Closure\\|null\\.$#"
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\=\\)\\: mixed\\) does not accept Closure\\|null\\.$#"
count: 1
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php

View File

@ -10,16 +10,6 @@ parameters:
count: 1
path: ../../../src/console/ConsoleCommandSender.php
-
message: "#^Method pocketmine\\\\crafting\\\\CraftingManager\\:\\:getDestructorCallbacks\\(\\) should return pocketmine\\\\utils\\\\ObjectSet\\<Closure\\(\\)\\: void\\> but returns pocketmine\\\\utils\\\\ObjectSet\\<Closure\\(\\)\\: void\\>\\|pocketmine\\\\utils\\\\ObjectSet\\<object\\>\\.$#"
count: 1
path: ../../../src/crafting/CraftingManager.php
-
message: "#^Property pocketmine\\\\crafting\\\\CraftingManager\\:\\:\\$destructorCallbacks \\(pocketmine\\\\utils\\\\ObjectSet\\<Closure\\(\\)\\: void\\>\\|null\\) does not accept pocketmine\\\\utils\\\\ObjectSet\\<object\\>\\.$#"
count: 1
path: ../../../src/crafting/CraftingManager.php
-
message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
count: 1