{"id":30647706,"url":"https://github.com/prismstudiomc/prismapi","last_synced_at":"2025-09-01T08:01:57.928Z","repository":{"id":311710433,"uuid":"1044632141","full_name":"PrismStudioMC/PrismAPI","owner":"PrismStudioMC","description":"The ultimate utility toolkit for PocketMine-MP development. Build better plugins with powerful APIs for items, blocks, commands, promises, behavior packs, and entity properties.","archived":false,"fork":false,"pushed_at":"2025-08-26T04:06:57.000Z","size":251,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-26T06:07:57.705Z","etag":null,"topics":["behavior","pack","plugins","pocketmine"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PrismStudioMC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-26T01:38:37.000Z","updated_at":"2025-08-26T04:53:39.000Z","dependencies_parsed_at":"2025-08-26T06:08:02.842Z","dependency_job_id":"e798da05-bdb9-429f-9564-b7f433ea6aa3","html_url":"https://github.com/PrismStudioMC/PrismAPI","commit_stats":null,"previous_names":["prismstudiomc/prismapi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/PrismStudioMC/PrismAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismStudioMC%2FPrismAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismStudioMC%2FPrismAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismStudioMC%2FPrismAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismStudioMC%2FPrismAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrismStudioMC","download_url":"https://codeload.github.com/PrismStudioMC/PrismAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismStudioMC%2FPrismAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272940214,"owners_count":25018847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behavior","pack","plugins","pocketmine"],"created_at":"2025-08-31T05:01:33.825Z","updated_at":"2025-08-31T05:04:21.545Z","avatar_url":"https://github.com/PrismStudioMC.png","language":"PHP","readme":"# Prism Studio – PrismAPI\n\nPrismAPI is a comprehensive utility API for PocketMine-MP that provides a wide range of tools and functionality for server development. It's not just about behavior packs and entity properties – it's a complete toolkit for building powerful Minecraft server plugins.\n\n## Features\n\n### Core Utility Systems\n\nPrismAPI provides several core utility systems that make plugin development easier and more powerful:\n\n#### ItemFactory\nAdvanced item management with serialization, runtime ID conversion, and item locking capabilities:\n\n```php\nuse PrismAPI\\item\\ItemFactory;\n\n// Get runtime information about items\n$legacyInfo = ItemFactory::LEGACY_INFO($item);\n$runtimeId = ItemFactory::RUNTIME_ID($item);\n$runtimeMeta = ItemFactory::RUNTIME_META($item);\n$stringId = ItemFactory::RUNTIME_STRING_ID($item);\n\n// Serialize and deserialize items\n$serialized = ItemFactory::SERIALIZE($item);\n$deserialized = ItemFactory::DESERIALIZE($serialized);\n\n// Lock items with different modes\n$lockedItem = ItemFactory::LOCK($item, ItemLockMode::FULL);\n\n// Get crafting recipes for an item\n$crafts = ItemFactory::CRAFTS($item, depth: 3);\n```\n\n#### BlockFactory\nComprehensive block management with runtime ID conversion and string ID mapping:\n\n```php\nuse PrismAPI\\block\\BlockFactory;\n\n// Create blocks from runtime string IDs\n$block = BlockFactory::FROM_RUNTIME_STRING_ID(\"minecraft:stone\");\n\n// Get runtime string IDs from blocks\n$stringId = BlockFactory::RUNTIME_STRING_ID_FROM($block);\n```\n\n#### PrismCommand\nEnhanced command system with automatic overload building and parameter handling:\n\n```php\nuse PrismAPI\\utils\\PrismCommand;\n\nclass MyCommand extends PrismCommand {\n    /**\n     * Builds the command overloads for the command.\n     *\n     * @param CommandEnum[] $hardcodedEnums\n     * @param CommandEnum[] $softEnums\n     * @param CommandEnumConstraint[] $enumConstraints\n     * @return array\n     */\n    public function buildOverloads(array \u0026$hardcodedEnums, array \u0026$softEnums, array \u0026$enumConstraints): array\n    {\n        return [\n            new CommandOverload(chaining: false, parameters: [CommandParameter::standard(\"args\", AvailableCommandsPacket::ARG_TYPE_RAWTEXT, 0, true)])\n        ];\n    }\n}\n```\n\n#### PromiseResolver\nAsynchronous programming support with promise-based operations:\n\n```php\nuse PrismAPI\\utils\\PromiseResolver;\n\n$promise = new PromiseResolver();\n\n$promise-\u003ethen(function($result) {\n    // Handle successful resolution\n})-\u003ecatch(function($error) {\n    // Handle errors\n});\n\n// Resolve or reject the promise\n$promise-\u003eresolve(\"Success!\");\n// or\n$promise-\u003ereject(\"Error occurred\");\n```\n\n### Behavior Pack System\n\nPrismAPI implements a full behavior-pack manager so you can use custom behavior packs on your PocketMine-MP server.\n\n#### How it works\n\n1. **Auto-loading:** Behavior packs are automatically detected and loaded from the server’s `behavior_packs/` folder.\n2. **Script handling:** Full support for JavaScript script modules included in behavior packs.\n3. **Smart stacking:** Behavior packs are applied in a configurable priority order.\n4. **Encryption keys:** Supports encrypted behavior packs with decryption keys.\n\n#### Behavior Pack Configuration\n\nCreate a `behavior_packs.yml` file inside the `behavior_packs/` folder:\n\n```yaml\nbehavior_stack:\n  # Packs are applied from bottom to top\n  # Higher packs override resources from lower packs\n  - myBasicPack.zip\n  - myAdvancedPack.zip\n  - myCustomPack.zip\n```\n\n#### Behavior Pack Structure\n\nA behavior pack must include:\n\n* A `manifest.json` describing the pack and its modules\n* Behavior files for entities, blocks, and items\n* Optionally, JavaScript script modules\n\n#### Example `manifest.json`\n\n```json\n{\n  \"format_version\": 2,\n  \"header\": {\n    \"name\": \"My Behavior Pack\",\n    \"description\": \"Description of my pack\",\n    \"uuid\": \"12345678-1234-1234-1234-123456789012\",\n    \"version\": [1, 0, 0],\n    \"min_engine_version\": [1, 20, 0]\n  },\n  \"modules\": [\n    {\n      \"type\": \"data\",\n      \"uuid\": \"87654321-4321-4321-4321-210987654321\",\n      \"version\": [1, 0, 0]\n    },\n    {\n      \"type\": \"script\",\n      \"language\": \"javascript\",\n      \"uuid\": \"11111111-2222-3333-4444-555555555555\",\n      \"entry\": \"scripts/main.js\",\n      \"version\": [1, 0, 0]\n    }\n  ]\n}\n```\n\n### EntityProperties System\n\nThe EntityProperties system synchronizes custom properties between server entities and player clients.\n\n#### Features\n\n1. **Automatic sync:** Properties are synchronized automatically when entities update.\n2. **Type support:** Integer and float properties are supported.\n3. **Value validation:** Minimum and maximum bounds are enforced.\n4. **Smart caching:** Packet caching boosts performance.\n\n#### Defining `EntitySyncProperties`\n\n```php\nuse PrismAPI\\types\\EntitySyncProperties;\n\n// Create an integer property\n$healthProperty = new EntitySyncProperties(\n    \"custom_health\",\n    100,   // default value\n    0,     // min value\n    200    // max value\n);\n\n// Create a float property\n$speedProperty = new EntitySyncProperties(\n    \"movement_speed\",\n    1.0,   // default value\n    0.1,   // min value\n    5.0    // max value\n);\n```\n\n#### Property Structure\n\nEach property includes:\n\n* **Name:** A unique identifier\n* **Default value:** Initial value\n* **Minimum value:** Lower bound\n* **Maximum value:** Upper bound\n\n#### Automatic Synchronization\n\nThe system automatically intercepts:\n\n* `SetActorDataPacket` to synchronize properties\n* `StartGamePacket` to set player properties\n* Entity lifecycle events to clean up removed properties\n\n## Developer API\n### BehaviorPackManager\n\n```php\nuse PrismAPI\\api\\BehaviorPackManager;\n\n$manager = BehaviorPackManager::getInstance();\n$behaviorPacks = $manager-\u003egetBehaviorPacks();\n```\n\n### EntityProperties\n\n```php\nuse PrismAPI\\api\\EntityProperties;\n\n$entityProps = EntityProperties::getInstance();\n// Use the API methods to manage properties\n```\n\n## Error Handling\n\nThe plugin automatically handles:\n\n* Corrupted or invalid behavior packs\n* Manifest parsing errors\n* Property synchronization issues\n\n## Performance\n\n* Cached synchronization packets\n* Deferred loading of behavior packs\n* Optimized property dispatch\n* Memory-aware management\n* Efficient item and block ID mapping\n* Optimized command overload building\n* Smart promise resolution caching\n\n## Installation\n\n1. Download the PrismAPI plugin.\n2. Place the folder into your server’s `plugins/` directory.\n3. Restart the server.\n\n## Support\n\nIf you have questions or issues:\n\n* Check the API documentation\n* Inspect server logs for errors\n* Ensure your behavior packs follow the expected format\n\n## Compatibility\n\n* **PocketMine-MP:** API 5.0.0+\n* **PHP:** 8.0+\n* **Behavior Packs:** Format version 2\n* **Network Protocol:** Latest MCPE protocol support\n\n## License\nThis project is licensed under the [GNU General Public License v3.0](LICENSE) – see the LICENSE file for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismstudiomc%2Fprismapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprismstudiomc%2Fprismapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismstudiomc%2Fprismapi/lists"}