forked from pmmp/BedrockProtocol
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/bedrock-1.21.50'
- Loading branch information
Showing
28 changed files
with
1,413 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#Due to GitHub awkwardness, it's not easy to reduce the review requirement for collaborators. | ||
#Our policy is that 2 collaborators should be aware of every change. | ||
#For outside PRs, this means 2 collaborator reviews. | ||
#For PRs made by collaborators, this means 1 reviewer + the author. | ||
#We trust that collaborators don't need as much oversight. | ||
name: Auto approve collaborator PRs | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
|
||
jobs: | ||
dispatch: | ||
name: Request approval | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Generate access token | ||
id: generate-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }} | ||
private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
repositories: RestrictedActions | ||
|
||
- name: Dispatch restricted action | ||
uses: peter-evans/repository-dispatch@v3 | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
repository: ${{ github.repository_owner }}/RestrictedActions | ||
event-type: auto_approve_collaborator_pr | ||
client-payload: '{"repo": "${{ github.repository }}", "pull_request_id": "${{ github.event.pull_request.number }}" }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of BedrockProtocol. | ||
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
* | ||
* BedrockProtocol is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace pocketmine\network\mcpe\protocol; | ||
|
||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer; | ||
use pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistCategories; | ||
use pocketmine\network\mcpe\protocol\types\camera\CameraAimAssistPreset; | ||
use function count; | ||
|
||
class CameraAimAssistPresetsPacket extends DataPacket implements ClientboundPacket{ | ||
public const NETWORK_ID = ProtocolInfo::CAMERA_AIM_ASSIST_PRESETS_PACKET; | ||
|
||
/** @var CameraAimAssistCategories[] */ | ||
private array $categories; | ||
/** @var CameraAimAssistPreset[] */ | ||
private array $presets; | ||
|
||
/** | ||
* @generate-create-func | ||
* @param CameraAimAssistCategories[] $categories | ||
* @param CameraAimAssistPreset[] $presets | ||
*/ | ||
public static function create(array $categories, array $presets) : self{ | ||
$result = new self; | ||
$result->categories = $categories; | ||
$result->presets = $presets; | ||
return $result; | ||
} | ||
|
||
/** | ||
* @return CameraAimAssistCategories[] | ||
*/ | ||
public function getCategories() : array{ return $this->categories; } | ||
|
||
/** | ||
* @return CameraAimAssistPreset[] | ||
*/ | ||
public function getPresets() : array{ return $this->presets; } | ||
|
||
protected function decodePayload(PacketSerializer $in) : void{ | ||
$this->categories = []; | ||
for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){ | ||
$this->categories[] = CameraAimAssistCategories::read($in); | ||
} | ||
|
||
$this->presets = []; | ||
for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){ | ||
$this->presets[] = CameraAimAssistPreset::read($in); | ||
} | ||
} | ||
|
||
protected function encodePayload(PacketSerializer $out) : void{ | ||
$out->putUnsignedVarInt(count($this->categories)); | ||
foreach($this->categories as $category){ | ||
$category->write($out); | ||
} | ||
|
||
$out->putUnsignedVarInt(count($this->presets)); | ||
foreach($this->presets as $preset){ | ||
$preset->write($out); | ||
} | ||
} | ||
|
||
public function handle(PacketHandlerInterface $handler) : bool{ | ||
return $handler->handleCameraAimAssistPresets($this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.