wolvesfortress/libcamera
Composer 安装命令:
composer require wolvesfortress/libcamera
包简介
A small library for handling camera instructions in PocketMine-MP
README 文档
README
libcamera
A small library for handling camera instructions added in Minecraft Bedrock Edition 1.19.30.
See the official documentation for more information.
Installation
Composer
To install this library through composer, run the following command:
composer require wolvesfortress/libcamera
Virion as Phar
The virion for this library can be found on Poggit.
Usage
Here is a basic example on how this library is used:
Registering the virion
In your main plugin file, register the virion like so:
use muqsit\libcamera\libcamera; use pocketmine\plugin\PluginBase; class MyPlugin extends PluginBase{ public function onEnable() : void{ if(!libcamera::isRegistered()){ libcamera::register($this); } } // ... }
Sending instructions
To send instructions to the camera, use the following code:
- Set
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\network\mcpe\protocol\types\camera\CameraPreset; use pocketmine\network\mcpe\protocol\types\camera\CameraSetInstructionEase; use pocketmine\network\mcpe\protocol\types\camera\CameraSetInstructionEaseType; use pocketmine\network\mcpe\protocol\types\camera\CameraSetInstructionRotation; use pocketmine\network\mcpe\protocol\types\camera\Vector3; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ /** * @phpstan-param CameraPreset $preset * @phpstan-param CameraSetInstructionEase|null $ease * @phpstan-param Vector3|null $camera_pos * @phpstan-param CameraSetInstructionRotation|null $rot * @phpstan-param Vector3|null $facing_pos */ CameraInstruction::set( preset: libcamera::getPresetRegistry()->registered["target"], ease: new CameraSetInstructionEase( CameraSetInstructionEaseType::IN_OUT_CUBIC, (float) 5.0 // duration (sec) ), camera_pos: null, rot: new CameraSetInstructionRotation( (float)20.0, //pitch (float)180.0 //yaw ), facing_pos: null )->send($player); }
- Fade
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\network\mcpe\protocol\types\camera\CameraFadeInstructionColor; use pocketmine\network\mcpe\protocol\types\camera\CameraFadeInstructionTime; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ /** * @phpstan-param CameraFadeInstructionColor|null $color * @phpstan-param CameraFadeInstructionTime|null $time */ CameraInstruction::fade( color: new CameraFadeInstructionColor((float)$r,(float)$g,(float)$b), time: new CameraFadeInstructionTime((float)$fadeInTime,(float)$stayTime,(float)$fadeOutTime) )->send($player); }
- Target
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\network\mcpe\protocol\types\camera\CameraTargetInstruction; use pocketmine\math\Vector3; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ /** * @phpstan-param Vector3|null $targetCenterOffset * @phpstan-param int $actorUniqueId */ CameraInstruction::target( targetCenterOffset: Vector3::zero(), // no offset actorUniqueId: $player->getId() // for example target the player )->send($player); }
- Remove Target
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ CameraInstruction::removeTarget()->send($player); }
- Clear
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ CameraInstruction::clear()->send($player); }
- Multi
use muqsit\libcamera\libcamera; use muqsit\libcamera\CameraInstruction; use pocketmine\network\mcpe\protocol\types\camera\CameraFadeInstructionColor; use pocketmine\network\mcpe\protocol\types\camera\CameraFadeInstructionTime; use pocketmine\math\Vector3; use pocketmine\player\Player; // ... if($player instanceof Player && $player->isOnline()){ CameraInstruction::multi( CameraInstruction::target( targetCenterOffset: Vector3::zero(), actorUniqueId: $player->getId() ), CameraInstruction::fade( color: new CameraFadeInstructionColor((float)$r,(float)$g,(float)$b), time: new CameraFadeInstructionTime((float)$fadeInTime,(float)$stayTime,(float)$fadeOutTime) ) )->send($player); }
Roadmap
At the moment, there are a few improvements that can be/or are being worked on. Here is a list of some of those improvements:
- Allow registering new camera presets
Issues
Any issues/suggestion can be reported here.
Credits
wolvesfortress/libcamera 适用场景与选型建议
wolvesfortress/libcamera 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 12, 最近一次更新时间为 2025 年 07 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wolvesfortress/libcamera 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wolvesfortress/libcamera 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-07-14
