承接 wolvesfortress/libcamera 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wolvesfortress/libcamera

Composer 安装命令:

composer require wolvesfortress/libcamera

包简介

A small library for handling camera instructions in PocketMine-MP

README 文档

README

libcamera icon

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 wolvesfortress/libcamera 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 28
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-07-14