diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index fefc06c0a..406bff36c 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -12,16 +12,16 @@ jobs: steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -53,7 +53,7 @@ jobs: run: echo NAME=$(echo "${GITHUB_REPOSITORY,,}") >> $GITHUB_OUTPUT - name: Build image for tag - uses: docker/build-push-action@v4.1.1 + uses: docker/build-push-action@v5.0.0 with: push: true context: ./pocketmine-mp @@ -66,7 +66,7 @@ jobs: - name: Build image for major tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v4.1.1 + uses: docker/build-push-action@v5.0.0 with: push: true context: ./pocketmine-mp @@ -79,7 +79,7 @@ jobs: - name: Build image for minor tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v4.1.1 + uses: docker/build-push-action@v5.0.0 with: push: true context: ./pocketmine-mp @@ -92,7 +92,7 @@ jobs: - name: Build image for latest tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v4.1.1 + uses: docker/build-push-action@v5.0.0 with: push: true context: ./pocketmine-mp diff --git a/.github/workflows/discord-release-notify.yml b/.github/workflows/discord-release-notify.yml index a74922938..94b7bb99d 100644 --- a/.github/workflows/discord-release-notify.yml +++ b/.github/workflows/discord-release-notify.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup PHP and tools - uses: shivammathur/setup-php@2.25.5 + uses: shivammathur/setup-php@2.26.0 with: php-version: 8.1 diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 4cf78f57e..f7026c646 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -20,7 +20,7 @@ jobs: submodules: true - name: Setup PHP - uses: shivammathur/setup-php@2.25.5 + uses: shivammathur/setup-php@2.26.0 with: php-version: ${{ matrix.php-version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5414deabc..1fd1731a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -173,7 +173,7 @@ jobs: - uses: actions/checkout@v4 - name: Setup PHP and tools - uses: shivammathur/setup-php@2.25.5 + uses: shivammathur/setup-php@2.26.0 with: php-version: 8.1 tools: php-cs-fixer:3.17 diff --git a/build/php b/build/php index 3331f8c0d..a34e48e7d 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 3331f8c0d50075eee250ac4b3a8517a12186137a +Subproject commit a34e48e7da753b633ffaa4a4f9516eae4bb97baa diff --git a/composer.json b/composer.json index 22170ea28..61c5d0664 100644 --- a/composer.json +++ b/composer.json @@ -52,10 +52,10 @@ "symfony/filesystem": "~6.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.35", + "phpstan/phpstan": "1.10.38", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 70bceb5ed..061eb245b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2028bfaf32594237de07fc60f68df728", + "content-hash": "2282bf7835c1ced757460b083813e092", "packages": [ { "name": "adhocore/json-comment", @@ -148,16 +148,16 @@ }, { "name": "pocketmine/bedrock-data", - "version": "2.5.0+bedrock-1.20.30", + "version": "2.5.1+bedrock-1.20.30", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9" + "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9", - "reference": "e920209393a8bf6cb15fb40c3f3149aaf8e1a2b9", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/8f9d96047a731c37b18b28c2bfcdfa2705bb303f", + "reference": "8f9d96047a731c37b18b28c2bfcdfa2705bb303f", "shasum": "" }, "type": "library", @@ -168,9 +168,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.20.30" + "source": "https://github.com/pmmp/BedrockData/tree/2.5.1+bedrock-1.20.30" }, - "time": "2023-09-20T16:34:21+00:00" + "time": "2023-09-27T11:40:15+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", @@ -1378,16 +1378,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.35", + "version": "1.10.38", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", "shasum": "" }, "require": { @@ -1436,20 +1436,20 @@ "type": "tidelift" } ], - "time": "2023-09-19T15:27:56+00:00" + "time": "2023-10-06T14:19:14+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.3.14", + "version": "1.3.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "614acc10c522e319639bf38b0698a4a566665f04" + "reference": "70ecacc64fe8090d8d2a33db5a51fe8e88acd93a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/614acc10c522e319639bf38b0698a4a566665f04", - "reference": "614acc10c522e319639bf38b0698a4a566665f04", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/70ecacc64fe8090d8d2a33db5a51fe8e88acd93a", + "reference": "70ecacc64fe8090d8d2a33db5a51fe8e88acd93a", "shasum": "" }, "require": { @@ -1486,9 +1486,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.14" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.15" }, - "time": "2023-08-25T09:46:39+00:00" + "time": "2023-10-09T18:58:39+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -1541,16 +1541,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.6", + "version": "10.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364" + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", "shasum": "" }, "require": { @@ -1607,7 +1607,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" }, "funding": [ { @@ -1615,7 +1615,7 @@ "type": "github" } ], - "time": "2023-09-19T04:59:03+00:00" + "time": "2023-10-04T15:34:17+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2207,16 +2207,16 @@ }, { "name": "sebastian/complexity", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a" + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c70b73893e10757af9c6a48929fa6a333b56a97a", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", "shasum": "" }, "require": { @@ -2229,7 +2229,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" } }, "autoload": { @@ -2253,7 +2253,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" }, "funding": [ { @@ -2261,7 +2261,7 @@ "type": "github" } ], - "time": "2023-08-31T09:55:53+00:00" + "time": "2023-09-28T11:50:59+00:00" }, { "name": "sebastian/diff", @@ -2396,16 +2396,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { @@ -2419,7 +2419,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2462,7 +2462,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -2470,7 +2470,7 @@ "type": "github" } ], - "time": "2023-09-18T07:15:37+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state", diff --git a/src/block/Cactus.php b/src/block/Cactus.php index ae64c8e64..6f2b04c8a 100644 --- a/src/block/Cactus.php +++ b/src/block/Cactus.php @@ -95,10 +95,10 @@ class Cactus extends Transparent{ } } $this->age = 0; - $world->setBlock($this->position, $this); + $world->setBlock($this->position, $this, update: false); }else{ ++$this->age; - $world->setBlock($this->position, $this); + $world->setBlock($this->position, $this, update: false); } } } diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 8a406924e..7e4d7cbde 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1686,7 +1686,7 @@ abstract class Entity{ */ public function broadcastSound(Sound $sound, ?array $targets = null) : void{ if(!$this->silent){ - NetworkBroadcastUtils::broadcastPackets($targets ?? $this->getViewers(), $sound->encode($this->location)); + $this->getWorld()->addSound($this->location->asVector3(), $sound, $targets ?? $this->getViewers()); } } diff --git a/src/world/World.php b/src/world/World.php index 2ff2b5b2e..c0d3438ee 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -2873,7 +2873,15 @@ class World implements ChunkManager{ }elseif($this->getTile($tilePosition) !== null){ $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Another tile is already at that position"); }else{ - $this->addTile($tile); + $block = $this->getBlockAt($tilePosition->getFloorX(), $tilePosition->getFloorY(), $tilePosition->getFloorZ()); + $expectedClass = $block->getIdInfo()->getTileClass(); + if($expectedClass === null){ + $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Block at that position (" . $block->getName() . ") does not expect a tile"); + }elseif(!($tile instanceof $expectedClass)){ + $logger->error("Cannot add tile at x=$tilePosition->x,y=$tilePosition->y,z=$tilePosition->z: Tile is of wrong type (expected $expectedClass but have " . get_class($tile) . ")"); + }else{ + $this->addTile($tile); + } } } diff --git a/tools/generate-bedrock-data-from-packets.php b/tools/generate-bedrock-data-from-packets.php index ab8a28ced..7316b3f86 100644 --- a/tools/generate-bedrock-data-from-packets.php +++ b/tools/generate-bedrock-data-from-packets.php @@ -276,7 +276,7 @@ class ParserPacketHandler extends PacketHandler{ $meta = $descriptor->getMeta(); if($meta !== 32767){ $blockStateId = $this->blockTranslator->getBlockStateDictionary()->lookupStateIdFromIdMeta($data->name, $meta); - if($blockStateId !== null){ + if($this->blockItemIdMap->lookupBlockId($data->name) !== null && $blockStateId !== null){ $blockState = $this->blockTranslator->getBlockStateDictionary()->generateDataFromStateId($blockStateId); if($blockState !== null && count($blockState->getStates()) > 0){ $data->block_states = self::blockStatePropertiesToString($blockState);