Merge branch 'next-minor' into next-major

This commit is contained in:
Dylan K. Taylor 2022-10-11 22:29:21 +01:00
commit 8dc0d506f4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
15 changed files with 61 additions and 45 deletions

View File

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

38
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5a893a5cf9cd6e4c8f70b332cbde4a2d", "content-hash": "76009ed4482b5d406cac5d9cd83e1ec4",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
"version": "1.1.2", "version": "1.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/adhocore/php-json-comment.git", "url": "https://github.com/adhocore/php-json-comment.git",
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7" "reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7", "url": "https://api.github.com/repos/adhocore/php-json-comment/zipball/651023f9fe52e9efa2198cbaf6e481d1968e2377",
"reference": "fc2f76979f0a44a5f5bc2a2b600d0762fe0e78e7", "reference": "651023f9fe52e9efa2198cbaf6e481d1968e2377",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -51,15 +51,19 @@
], ],
"support": { "support": {
"issues": "https://github.com/adhocore/php-json-comment/issues", "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": [ "funding": [
{ {
"url": "https://paypal.me/ji10", "url": "https://paypal.me/ji10",
"type": "custom" "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", "name": "brick/math",
@ -276,12 +280,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/BedrockData.git", "url": "https://github.com/pmmp/BedrockData.git",
"reference": "1ca9241ce66358cdfb2dbde65d609eb9c185c515" "reference": "e6a51075e600b0494f8fb57574c4b0e77c344475"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/1ca9241ce66358cdfb2dbde65d609eb9c185c515", "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/e6a51075e600b0494f8fb57574c4b0e77c344475",
"reference": "1ca9241ce66358cdfb2dbde65d609eb9c185c515", "reference": "e6a51075e600b0494f8fb57574c4b0e77c344475",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -294,7 +298,7 @@
"issues": "https://github.com/pmmp/BedrockData/issues", "issues": "https://github.com/pmmp/BedrockData/issues",
"source": "https://github.com/pmmp/BedrockData/tree/modern-world-support" "source": "https://github.com/pmmp/BedrockData/tree/modern-world-support"
}, },
"time": "2022-09-21T13:59:15+00:00" "time": "2022-09-28T20:32:25+00:00"
}, },
{ {
"name": "pocketmine/bedrock-item-upgrade-schema", "name": "pocketmine/bedrock-item-upgrade-schema",
@ -1560,16 +1564,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.8.6", "version": "1.8.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618" "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07",
"reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618", "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1599,7 +1603,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "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": [ "funding": [
{ {
@ -1615,7 +1619,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-23T09:54:39+00:00" "time": "2022-10-06T12:51:57+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",

View File

@ -27,7 +27,7 @@ use pocketmine\item\Item;
use pocketmine\item\VanillaItems; use pocketmine\item\VanillaItems;
use function mt_rand; use function mt_rand;
class Melon extends Transparent{ class Melon extends Opaque{
public function getDropsForCompatibleTool(Item $item) : array{ public function getDropsForCompatibleTool(Item $item) : array{
return [ 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{ public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
$down = $this->getSide(Facing::DOWN); $down = $this->getSide(Facing::DOWN);
if(!$down->isTransparent()){ $position = $this->getPosition();
$lightLevel = $position->getWorld()->getFullLightAt($position->x, $position->y, $position->z);
$downId = $down->getTypeId();
//TODO: nylium support
if(($lightLevel <= 12 && !$down->isTransparent()) || $downId === BlockTypeIds::MYCELIUM || $downId === BlockTypeIds::PODZOL){
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player); return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
} }

View File

@ -240,8 +240,7 @@ abstract class Living extends Entity{
$size = $this->getInitialSizeInfo(); $size = $this->getInitialSizeInfo();
if($this->isSwimming() || $this->isGliding()){ if($this->isSwimming() || $this->isGliding()){
$width = $size->getWidth(); $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 * 0.9))->scale($this->getScale()));
$this->setSize((new EntitySizeInfo($width, $width, $width * 2 / 3))->scale($this->getScale()));
}else{ }else{
$this->setSize($size->scale($this->getScale())); $this->setSize($size->scale($this->getScale()));
} }

View File

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

View File

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

View File

@ -59,7 +59,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
} }
public function getItem() : Item{ public function getItem() : Item{
return $this->item; return clone $this->item;
} }
public function getBlock() : Block{ 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. * Returns the item in the slot that the player is trying to equip.
*/ */
public function getItem() : Item{ 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. * Returns the item used.
*/ */
public function getItem() : Item{ 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\convert\TypeConverter;
use pocketmine\network\mcpe\InventoryManager; use pocketmine\network\mcpe\InventoryManager;
use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket; use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket; use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\types\BlockPosition; use pocketmine\network\mcpe\protocol\types\BlockPosition;
@ -132,9 +133,11 @@ class PreSpawnPacketHandler extends PacketHandler{
$this->session->getLogger()->debug("Sending inventory"); $this->session->getLogger()->debug("Sending inventory");
$this->inventoryManager->syncAll(); $this->inventoryManager->syncAll();
$this->inventoryManager->syncCreative();
$this->inventoryManager->syncSelectedHotbarSlot(); $this->inventoryManager->syncSelectedHotbarSlot();
$this->session->getLogger()->debug("Sending creative inventory data");
$this->inventoryManager->syncCreative();
$this->session->getLogger()->debug("Sending crafting data"); $this->session->getLogger()->debug("Sending crafting data");
$this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->server->getCraftingManager())); $this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->server->getCraftingManager()));
@ -147,4 +150,10 @@ class PreSpawnPacketHandler extends PacketHandler{
return true; 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

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

View File

@ -350,6 +350,21 @@ parameters:
count: 3 count: 3
path: ../../../src/block/Mycelium.php 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\\.$#" message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getBlockLightAt\\(\\) expects int, float\\|int given\\.$#"
count: 1 count: 1
@ -525,11 +540,6 @@ parameters:
count: 1 count: 1
path: ../../../src/crash/CrashDump.php 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\\.$#" message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getBlockAt\\(\\) expects int, float\\|int given\\.$#"
count: 1 count: 1

View File

@ -1,6 +1,6 @@
parameters: parameters:
ignoreErrors: 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 count: 1
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php

View File

@ -10,16 +10,6 @@ parameters:
count: 1 count: 1
path: ../../../src/console/ConsoleCommandSender.php 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\\.$#" message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
count: 1 count: 1