stilling/snbt-parser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

stilling/snbt-parser

最新稳定版本:v0.1.2

Composer 安装命令:

composer require stilling/snbt-parser

包简介

Turn Minecraft SNBT data into the corresponding PHP data types.

README 文档

README

tests

Turn Minecraft SNBT data into the corresponding PHP data types.

composer require stilling/snbt-parser

Note

Technically, this package transposes the SNBT data to JSON and parses that using json_decode(), which may not be too performant. A potential v2 may parse SNBT directly.

Here's an example parsing the SNBT data of a chest using the following command: data get block -40 73 -11

use Stilling\SNBTParser\SNBTParser;

SNBTParser::parse('{z: -11, x: -40, id: "minecraft:chest", y: 73, Items: [{count: 1, Slot: 0b, id: "minecraft:golden_horse_armor"}, {count: 1, Slot: 1b, id: "minecraft:saddle"}, {count: 1, Slot: 2b, components: {"minecraft:repair_cost": 1, "minecraft:enchantments": {"minecraft:luck_of_the_sea": 2, "minecraft:lure": 2, "minecraft:unbreaking": 3}, "minecraft:damage": 10}, id: "minecraft:fishing_rod"}, {count: 1, Slot: 3b, id: "minecraft:shield"}]}')

// returns ->

[
    "z" => -11,
    "x" => -40,
    "id" => "minecraft:chest",
    "y" => 73,
    "Items" => [
        [
            "count" => 1,
            "Slot" => 0,
            "id" => "minecraft:golden_horse_armor",
        ],
        [
            "count" => 1,
            "Slot" => 1,
            "id" => "minecraft:saddle",
        ],
        [
            "count" => 1,
            "Slot" => 2,
            "components" => [
                "minecraft:repair_cost" => 1,
                "minecraft:enchantments" => [
                    "minecraft:luck_of_the_sea" => 2,
                    "minecraft:lure" => 2,
                    "minecraft:unbreaking" => 3,
                ],
                "minecraft:damage" => 10,
            ],
            "id" => "minecraft:fishing_rod",
        ],
        [
            "count" => 1,
            "Slot" => 3,
            "id" => "minecraft:shield",
        ],
    ],
]

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-26