diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 02342bbfd2..c6a5a8ed2a 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -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.0 + uses: docker/build-push-action@v4.1.1 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.0 + uses: docker/build-push-action@v4.1.1 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.0 + uses: docker/build-push-action@v4.1.1 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.0 + uses: docker/build-push-action@v4.1.1 with: push: true context: ./pocketmine-mp diff --git a/build/php b/build/php index 8cb2a2b218..2a21c57900 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 8cb2a2b2181fd42192665985696ea157aa4f731e +Subproject commit 2a21c579007a8fd7244f9faad498cd1c8c33004c diff --git a/src/block/Block.php b/src/block/Block.php index f2268aed93..b4203e6b6b 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -467,7 +467,8 @@ class Block{ /** * Do actions when interacted by Item. Returns if it has done anything * - * @param Item[] &$returnedItems Items to be added to the target's inventory (or dropped, if the inventory is full) + * @param Vector3 $clickVector Exact position where the click occurred, relative to the block's integer position + * @param Item[] &$returnedItems Items to be added to the target's inventory (or dropped, if the inventory is full) */ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ return false; diff --git a/src/block/CakeWithCandle.php b/src/block/CakeWithCandle.php index 187442cd98..4479faee10 100644 --- a/src/block/CakeWithCandle.php +++ b/src/block/CakeWithCandle.php @@ -64,7 +64,7 @@ class CakeWithCandle extends BaseCake{ } public function getPickedItem(bool $addUserData = false) : Item{ - return VanillaBlocks::CAKE()->getPickedItem($addUserData); + return VanillaBlocks::CAKE()->asItem(); } public function getResidue() : Block{ diff --git a/src/data/bedrock/block/upgrade/model/BlockStateUpgradeSchemaModelBlockRemap.php b/src/data/bedrock/block/upgrade/model/BlockStateUpgradeSchemaModelBlockRemap.php index 49b2e0f285..d37a72fb8a 100644 --- a/src/data/bedrock/block/upgrade/model/BlockStateUpgradeSchemaModelBlockRemap.php +++ b/src/data/bedrock/block/upgrade/model/BlockStateUpgradeSchemaModelBlockRemap.php @@ -40,6 +40,7 @@ final class BlockStateUpgradeSchemaModelBlockRemap{ /** * @var BlockStateUpgradeSchemaModelTag[]|null * @phpstan-var array|null + * @required */ public ?array $newState; diff --git a/src/event/block/BlockPlaceEvent.php b/src/event/block/BlockPlaceEvent.php index b92569fc16..3572cb5e09 100644 --- a/src/event/block/BlockPlaceEvent.php +++ b/src/event/block/BlockPlaceEvent.php @@ -43,7 +43,12 @@ class BlockPlaceEvent extends Event implements Cancellable{ protected BlockTransaction $transaction, protected Block $blockAgainst, protected Item $item - ){} + ){ + $world = $this->blockAgainst->getPosition()->getWorld(); + foreach($this->transaction->getBlocks() as [$x, $y, $z, $block]){ + $block->position($world, $x, $y, $z); + } + } /** * Returns the player who is placing the block. diff --git a/src/player/Player.php b/src/player/Player.php index 3083538be6..11dabf7db6 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -1129,7 +1129,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ } /** - * Sets the gamemode, and if needed, kicks the Player. + * Sets the provided gamemode. */ public function setGamemode(GameMode $gm) : bool{ if($this->gamemode->equals($gm)){ diff --git a/src/world/World.php b/src/world/World.php index b2b6dfac2a..deb03ef6dd 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -2032,6 +2032,12 @@ class World implements ChunkManager{ if($clickVector === null){ $clickVector = new Vector3(0.0, 0.0, 0.0); + }else{ + $clickVector = new Vector3( + min(1.0, max(0.0, $clickVector->x)), + min(1.0, max(0.0, $clickVector->y)), + min(1.0, max(0.0, $clickVector->z)) + ); } if(!$this->isInWorld($blockReplace->getPosition()->x, $blockReplace->getPosition()->y, $blockReplace->getPosition()->z)){ diff --git a/src/world/format/io/data/BedrockWorldData.php b/src/world/format/io/data/BedrockWorldData.php index 3a24e9a11c..317ebd6801 100644 --- a/src/world/format/io/data/BedrockWorldData.php +++ b/src/world/format/io/data/BedrockWorldData.php @@ -43,6 +43,7 @@ use pocketmine\world\WorldCreationOptions; use Symfony\Component\Filesystem\Path; use function array_map; use function file_put_contents; +use function sprintf; use function strlen; use function substr; use function time; @@ -154,12 +155,18 @@ class BedrockWorldData extends BaseNbtWorldData{ } $version = $worldData->getInt(self::TAG_STORAGE_VERSION, Limits::INT32_MAX); + if($version === Limits::INT32_MAX){ + throw new CorruptedWorldException(sprintf("Missing '%s' tag in level.dat", self::TAG_STORAGE_VERSION)); + } if($version > self::CURRENT_STORAGE_VERSION){ throw new UnsupportedWorldFormatException("LevelDB world format version $version is currently unsupported"); } //StorageVersion is rarely updated - instead, the game relies on the NetworkVersion tag, which is synced with //the network protocol version for that version. $protocolVersion = $worldData->getInt(self::TAG_NETWORK_VERSION, Limits::INT32_MAX); + if($protocolVersion === Limits::INT32_MAX){ + throw new CorruptedWorldException(sprintf("Missing '%s' tag in level.dat", self::TAG_NETWORK_VERSION)); + } if($protocolVersion > self::CURRENT_STORAGE_NETWORK_VERSION){ throw new UnsupportedWorldFormatException("LevelDB world protocol version $protocolVersion is currently unsupported"); }