jorgebyte/fireworkslib
Composer 安装命令:
composer require jorgebyte/fireworkslib
包简介
Advanced fireworks management library for PocketMine-MP with async support
README 文档
README
FireworksLib: Advanced Fireworks Management for PocketMine-MP
A high-performance library for creating and controlling customizable fireworks displays in PocketMine-MP servers.
📦 Installation
- Install via Composer:
composer require jorgebyte/fireworkslib
- Register in your plugin:
use Jorgebyte\FireworksLib\FireworksLib; public function onEnable(): void { FireworksLib::register(); }
✨ Key Features
- Synchronous & Asynchronous Launching
- Customizable Explosions (colors, shapes, effects)
- Batch Processing with configurable delays
- Particle/Sound Synchronization
- Mathematical Trajectory Control (radial distribution, angles)
🚀 Usage Examples
1. Basic Firework Launch
use Jorgebyte\FireworksLib\FireworksManager; use Jorgebyte\FireworksLib\FireworksRegistry; use pocketmine\world\Position; $center = new Position($x, $y, $z, $world); $firework = FireworksRegistry::FIREWORKS(); FireworksManager::launch($center->asLocation(), $firework);
2. Customized Firework Item
use Jorgebyte\FireworksLib\FireworkType; use pocketmine\color\Color; $customFirework = FireworksRegistry::FIREWORKS(); $customFirework->setFlightDuration(3); // 3-second fuse $customFirework->addExplosion( type: FireworkType::STAR, color: new Color(255, 0, 0), // Red fade: new Color(0, 0, 255), // Blue fade flicker: true, trail: true );
3. Asynchronous Batch Launch (Radial Pattern)
use SOFe\AwaitStd\AwaitStd; Await::f2c(function () use ($center, $std) { yield from FireworksManager::launchMultipleAsync( std: $std, center: $center, firework: FireworksRegistry::FIREWORKS(), count: 30, radius: 5.0, delayBetweenBatches: 0.2 )->asGenerator(); });
🧩 API Reference
🔧 FireworksManager
| Method | Parameters | Description |
|---|---|---|
launch |
Location $location, FireworksItem $firework |
Sync single firework launch |
launchAsync |
Location $location, FireworksItem $firework |
Async generator (Traverser) |
launchMultipleAsync |
AwaitStd $std, Location $center, FireworksItem $firework, int $count, float $radius=3.0, float $delayBetweenBatches=0.5 |
Batch launch in radial pattern |
🧪 FireworksItem Methods
// Set flight duration (1-3 recommended) $item->setFlightDuration(int $duration); // Add explosion effect: $item->addExplosion( int $type, // FireworkType::CONSTANT Color $color, // Primary RGB ?Color $fade = null,// Fade color bool $flicker = false, bool $trail = false );
💥 FireworkType Constants
| Constant | Effect |
|---|---|
SMALL_SPHERE |
Standard spherical burst |
HUGE_SPHERE |
Large-scale sphere |
STAR |
Star-shaped explosion |
CREEPER_HEAD |
Creeper-face pattern |
BURST |
Crackle-effect explosion |
🎯 Benefits
- Performance Optimization
- Batch processing with
BATCH_SIZEand tick delays - Async coroutines prevent server lag
- Batch processing with
- Precision Control
- Radial coordinate calculation via
$angleStep = (2 * M_PI) / $count - Customizable delay intervals between batches
- Radial coordinate calculation via
- Extensibility
- Implement custom trajectories by extending
FireworksRocket - Modify
FireworkParticleAnimationfor custom effects
- Implement custom trajectories by extending
🧪 Advanced Implementation
Extending FireworksRocket
class CustomRocket extends FireworksRocket { protected function explode(): void { // Custom explosion logic parent::explode(); // Call default behavior } }
Direct NBT Manipulation
$nbt = $firework->getNamedTag(); $nbt->getCompoundTag("Fireworks")?->setByte("Flight", 2);
🤝 Contribution
- Fork the repository
- Adhere to PER-CS2.0 coding standards
- Submit pull requests with detailed descriptions
Supported by:
Await Generator
Transform your server events with mathematically precise firework displays! 🎆
Developed by Jorgebyte
jorgebyte/fireworkslib 适用场景与选型建议
jorgebyte/fireworkslib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 5, 最近一次更新时间为 2025 年 09 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jorgebyte/fireworkslib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jorgebyte/fireworkslib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-09-13