diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3bb3e2..44e4990 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build PYMC on: push: branches: [main] + tags: ['v*'] pull_request: branches: [main] @@ -34,6 +35,8 @@ jobs: pip install nuitka python3 -m nuitka --standalone --onefile --assume-yes-for-downloads \ --include-data-file=world/blocks.json=world/blocks.json \ + --include-data-dir=protocol/data=protocol/data \ + --include-data-dir=world/data=world/data \ --include-data-dir=build/stage/native=native \ main.py -o pymc-server-linux-x86_64 - name: Upload Linux artifact @@ -69,6 +72,8 @@ jobs: pip install nuitka python3 -m nuitka --standalone --onefile --assume-yes-for-downloads \ --include-data-file=world/blocks.json=world/blocks.json \ + --include-data-dir=protocol/data=protocol/data \ + --include-data-dir=world/data=world/data \ --include-data-dir=build/stage/native=native \ main.py -o pymc-server-macos-arm64 - name: Upload macOS artifact @@ -120,6 +125,8 @@ jobs: pip install nuitka python -m nuitka --standalone --onefile --assume-yes-for-downloads ` --include-data-file=world/blocks.json=world/blocks.json ` + --include-data-dir=protocol/data=protocol/data ` + --include-data-dir=world/data=world/data ` --include-data-dir=build/stage/native=native ` main.py -o pymc-server-windows-x86_64.exe - name: Stage native binaries for separate download @@ -200,8 +207,67 @@ jobs: - `terrain_gen.exe` — C++ terrain generator (statically linked, no DLL dependencies) - `mob_ai.exe` — C++ mob AI engine (statically linked, no DLL dependencies) - These are built with MinGW UCRT64 and have the C++ runtime baked in, - so they run on stock Windows 10/11 without requiring MSYS2 or MinGW. + These are built with MSVC (/MT) and have the C++ runtime baked in, + so they run on stock Windows 10/11 without the Visual C++ Redistributable. - name: Tag summary run: echo "Created pre-release tag ${{ steps.tag.outputs.tag }} with build artifacts" + + # ── Stable release for version tags (v1.2.0, ...) ── + release: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + needs: [build-linux, build-macos, build-windows] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: release-assets + merge-multiple: true + - name: Name release files + run: | + cd release-assets + mv pymc-server-linux-x86_64 PyMC-linux + mv pymc-server-macos-arm64 PyMC-macos + mv pymc-server-windows-x86_64.exe PyMC-windows.exe + chmod +x PyMC-linux PyMC-macos + ls -lh + - name: Release notes + run: | + VERSION="${GITHUB_REF_NAME#v}" + # Previous stable version tag (highest v* below this one, no pre-releases) + PREV=$(git tag --list 'v[0-9]*' --sort=-v:refname | grep -v -- '-' \ + | awk -v cur="$GITHUB_REF_NAME" 'seen { print; exit } $0 == cur { seen = 1 }') + { + echo "## PyMC ${GITHUB_REF_NAME}" + echo + # The section of CHANGELOG.md for this version + awk -v v="$VERSION" ' + /^## / { found = ($0 ~ "^## \\[?" v "\\]?([ ]|$)"); next } + found' CHANGELOG.md + echo + echo "### 下载" + echo "- \`PyMC-windows.exe\`:Windows (x86_64),双击运行" + echo "- \`PyMC-linux\`:Linux (x86_64),\`chmod +x PyMC-linux && ./PyMC-linux\`" + echo "- \`PyMC-macos\`:macOS (ARM64),\`chmod +x PyMC-macos && ./PyMC-macos\`" + echo "- \`terrain_gen.exe\` / \`mob_ai.exe\`:从 Python 源码在 Windows 上运行时放进 \`native/\` 的原生组件" + echo + echo "Minecraft Java 1.21.1 客户端连接 \`ip:25565\`。" + if [ -n "$PREV" ]; then + echo + echo "**Full Changelog**: ${{ github.server_url }}/${{ github.repository }}/compare/${PREV}...${GITHUB_REF_NAME}" + fi + } > release-notes.md + cat release-notes.md + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + name: PyMC ${{ github.ref_name }} + body_path: release-notes.md + files: release-assets/* diff --git a/.gitignore b/.gitignore index 9b76e83..39449f0 100755 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,17 @@ native/pymc_native_server native/pymc_native_server.exe native/libpymc_native.so native/pymc_native.dll + +# 服务端运行时文件 (原版布局) +/logs/ +/ops.json +/whitelist.json +/banned-players.json +/banned-ips.json +/usercache.json +/server-icon.png +/world/level.dat +/world/level.dat_old +/world/level.dat_new +/world/session.lock +/world/containers.json diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9f6eb11 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# 更新日志 + +## 1.2.0 + +### 原版地形 +- `native/terrain_gen` 重写为原版 1.21.1 主世界生成器的移植:Xoroshiro128++ 随机数、Perlin/Normal/Blended 噪声、完整的密度函数图(噪声路由)、样条、含水层、矿脉、多噪声生物群系和地表规则。数据直接取自原版 worldgen JSON,同一种子下地形形状、洞穴、海洋、河流、山地和生物群系分布与原版一致。 +- 按生物群系生成树木、花草、仙人掌、甘蔗、海草/海带、巨型蘑菇、冰刺、矿石和黏土/沙子/砂砾圆盘(近似原版,可跨区块)。 +- 找不到当前版本的地形生成器时,服务端启动时会自动编译。 + +### 存档 / 读档 +- 区块改存为原版 Anvil `.mca`,原版工具可直接读取;旧的 `.linear` 区域启动时自动转换(原文件保留为 `.linear.bak`)。 +- 修复方块状态属性的编号顺序错误(楼梯、箱子朝向等读档后会变);旧存档自动识别并迁移。 +- 玩家数据改存为原版 `playerdata/.dat`:位置、生命、饥饿、经验、游戏模式、物品栏、末影箱和个人出生点;旧 `.json` 自动迁移。 +- 新增配置项 `region-file-format`(`anvil` / `linear`)。 + +### 出生点 +- 世界出生点采用原版逻辑:按气候寻找陆地,再搜索周围安全地表。 +- 新玩家在 `spawnRadius` 范围内随机选择安全地面,不会出生在水里、岩浆、树顶或方块里;老玩家回到下线位置(被埋住时才挪到附近安全处)。 + +### 其他 +- 重生从 3 秒多降到约 0.1 秒:缓存已编码的区块和数据包,并且像原版一样先发送位置和血量、再推送区块。玩家进服也因此变快。 +- 点击草、蕨、单层雪等可替换方块时,新方块直接替换它(原版行为)。 +- 修复 Windows (MSVC) 下地形生成器无法编译的问题。 +- GitHub Actions:推送 `v*` tag 时自动构建三平台并发布正式版本。 + +### 已知限制 +- 还没有结构(村庄等)和 carver(峡谷);树木等地物的位置与原版不同。 +- 旧版本生成过的区块保持不变,与新生成区块的交界处会有断层,建议新开世界。 diff --git a/CMakeLists.txt b/CMakeLists.txt index 37919f0..06106cf 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,15 @@ endif() # Legacy targets (original subprocess-based tools) # =========================================================== add_executable(terrain_gen native/terrain_gen.cpp) +target_compile_features(terrain_gen PRIVATE cxx_std_17) +# Vanilla terrain must match Java bit for bit: no fused multiply-add, no fast-math. +if(MSVC) + # /fp:precise does not contract a*b+c into FMA (MSVC 2022+ needs /fp:contract for that) + target_compile_options(terrain_gen PRIVATE /fp:precise /DNOMINMAX) +else() + target_compile_options(terrain_gen PRIVATE -ffp-contract=off -fno-fast-math) + target_link_libraries(terrain_gen PRIVATE Threads::Threads) +endif() add_executable(mob_ai native/mob_ai.cpp) # rootree_worldgen uses C++20 features (std::rotl) diff --git a/README.md b/README.md index 2053451..01c0fe3 100755 --- a/README.md +++ b/README.md @@ -12,14 +12,13 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, - [x] 离线模式登录、数据包压缩、KeepAlive、玩家移动同步和区块发送。 - [x] `server.properties` 配置读写,支持原版风格 `level-seed` 解析:数字种子按 64 位整数,字符串种子按 Java `String.hashCode()`。 - [x] 384 高度主世界区块数据结构,支持从 `-64` 到 `319` 的世界高度。 -- [x] C++ 原生地形生成器 `native/terrain_gen`,优先使用原生生成,失败时回退到 Python 生成器。 -- [x] C++ 地形生成批量接口和 biome metadata 返回,降低入服时批量区块生成开销。 -- [x] 类原版主世界地形:气候/生物群系采样、海洋/河流/山地/沙漠/雪地/恶地等基础地貌。 -- [x] 地表规则和装饰:草地、泥土、沙子、红沙、沙石、红沙石、陶瓦、积雪、细雪、方解石、灰化土、砂砾等。 -- [x] 植被和自然特征:多树种树木、草、蕨、枯灌木、甘蔗、南瓜、西瓜、海草、海带等。 -- [x] 安全出生点解析:首次进入和重生时会生成/读取附近区块,避免出生在地下、水里、岩浆或危险方块上。 -- [x] Linear V2 `.linear` 区域文件读写,并支持从 Anvil `.mca` 自动转换。 -- [x] 玩家 JSON 存档:位置、生命值、饱食度、经验、游戏模式和个人出生点。 +- [x] **原版地形引擎** `native/terrain_gen` (C++17, 多线程):移植原版 1.21.1 的随机数 (Xoroshiro128++ / `PositionalRandomFactory`)、Perlin/Normal/Blended 噪声、完整的密度函数图 (noise router, 含 4x8x4 插值单元与 flat/2D 缓存)、样条、含水层 (aquifer)、矿脉 (ore vein)、多噪声生物群系查找和 surface rule。数据直接取自原版 worldgen JSON (`world/data/worldgen_overworld.json`),因此同一种子的地形形状、洞穴、海洋、河流、山地和生物群系分布与原版一致。 +- [x] 原版出生点选择:`Climate.findSpawnPosition` (按气候参数寻找陆地出生点) + 原版 11x11 区块螺旋搜索安全地表。 +- [x] 地物装饰(近似原版):按生物群系配置的树木(橡树/大橡树/白桦/云杉/松树/巨型云杉/丛林/金合欢/深色橡树/沼泽/樱花/红树)、草/花/蕨、仙人掌、甘蔗、海草/海带、巨型蘑菇、冰刺、苔石堆、矿石团簇和黏土/沙子/砂砾圆盘,可跨区块生成。 +- [x] 启动时自动编译原生生成器 (g++/clang++/MSVC),版本不符的旧二进制会被忽略;编译不可用时回退 Python 生成器。 +- [x] 安全出生/重生:新玩家在世界出生点周围 `spawnRadius` 范围内随机挑选安全地面 (原版 `fudgeSpawnLocation`),不会落在水里、岩浆、树顶或方块里;老玩家回到上次下线位置 (被埋住时才会挪到附近安全处);重生优先个人出生点。 +- [x] **原版 Anvil 存档** (`region/r.X.Z.mca`):原版客户端/工具 (MCA Selector、prismarine 等) 可以直接读取;旧 PyMC 的 `.linear` 区域会在启动时自动转换 (原文件保留为 `.linear.bak`)。旧版存档中错误的方块状态顺序会自动识别并迁移。 +- [x] **原版玩家存档** `playerdata/.dat` (gzip NBT):位置、朝向、生命、饥饿、经验、游戏模式、物品栏 (原版槽位编号)、末影箱、能力和个人出生点;旧 `.json` 存档自动迁移;正常关服和定时自动保存都会落盘。 - [x] 基础聊天、方块挖掘/放置、掉落物、经验球和简单生物实体。 - [x] C++ 原生轻量生物 AI `native/mob_ai`,支持随机游走、看向玩家、敌对追击、近战冷却等行为。 - [x] 基础 `gamerule`:昼夜流动、天气循环 (doWeatherCycle)、自然刷怪、自然回血、死亡后自动重生回出生点。 @@ -28,9 +27,17 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, - [x] **战斗系统**:攻击生物(武器伤害表)、生物死亡掉落与经验球、骷髅等远程生物标记。 - [x] **物品耐久与基础附魔**:工具/武器耐久消耗、耐久 (Unbreaking) 减免、锋利 (Sharpness) 增伤。 - [x] **雷暴闪电**:雷暴期间在随机玩家附近落雷,对附近实体造成伤害。 +- [x] **原版服务端外壳**:控制台日志格式 (`[时间] [Server thread/INFO]: ...`)、`logs/latest.log` 自动归档为 `日期-N.log.gz`、启动顺序与 `Done (N s)! For help, type "help"`、`stop`/Ctrl+C/SIGTERM 优雅关闭、`Can't keep up!` 过载警告、控制台命令带不带 `/` 均可。 +- [x] **原版文件布局**:`server.properties`(原版键名与格式,自动补全缺失项)、`ops.json`、`whitelist.json`、`banned-players.json`、`banned-ips.json`、`usercache.json`、`<世界>/level.dat`(出生点、时间、天气、游戏规则、种子、难度)和 `session.lock`;旧版 `permissions.json` 中的 OP/封禁/白名单自动迁移。 +- [x] **RCON**(`enable-rcon`/`rcon.port`/`rcon.password`)与 **正版验证**(`online-mode=true`:RSA + AES/CFB8 加密、Mojang 会话服务器验证、真实 UUID 与皮肤)。 +- [x] **完整的 1.21.1 数据同步**:配置阶段发送全部 11 个原版注册表与标签(游泳、攀爬、工具挖掘速度依赖标签)、Feature Flags;主世界高度 -64..320;全量 1333 个物品 ID 表与堆叠/耐久数据;命令树 (`Commands` 包) 带原版语法提示与 Tab 补全。 +- [x] **原版消息**:所有聊天类消息使用文本组件(1.20.3+ 为 NBT),加入/离开/死亡/聊天/命令反馈使用原版翻译键,客户端按自身语言显示;OP 能看到灰色斜体的 `[某人: 操作]` 通知。 +- [x] **原版核心命令**:help、list、say、me、msg/tell/w、kick、ban/ban-ip/pardon/pardon-ip/banlist、op/deop、whitelist、stop、save-all/on/off、seed、time、weather、difficulty、gamerule、gamemode/defaultgamemode、tp/teleport、give、clear、kill、xp、setworldspawn、spawnpoint、summon;未知命令/无权限显示原版 `<--[HERE]` 错误。 +- [x] **登录检查**:用户名合法性、协议版本(过旧/过新客户端提示)、封禁、白名单、服务器已满、同名重复登录踢出旧连接、`player-idle-timeout`。 +- [x] **玩法细节**:死亡界面与原版死亡消息、掉落物品与经验、重生流程、`keepInventory`/`doImmediateRespawn`/`showDeathMessages` 等规则、受伤动画与击退、PvP(`pvp`)、潜行/疾跑/挥手/手持物品同步、生存/创造模式挖掘与放置确认、`spawn-protection`、天空光与方块光计算。 - [x] 控制台和游戏内基础命令。 - [x] Web 管理台、权限组、OP、封禁和白名单。 -- [x] 单元测试覆盖原生地形、原生 AI、种子解析和安全出生点。 +- [x] 单元测试覆盖原生地形、原版存档读写与迁移、玩家存档、原生 AI、种子解析和安全出生点。 - [x] **红石系统**:tick 引擎、电源/导线/火把/中继器/比较器/观察者/活塞、门与灯控制、TNT 起爆、音符盒、发射器/投掷器;红石时序为原版近似。 - [x] **物品栏系统**:`ItemStack`、玩家物品栏、协议序列化、左右键/Shift/数字键/拖拽/丢弃,以及方块容器交互与持久化;铁砧/附魔台等专业界面仍为简化。 - [x] **PYMC 原生扩展 API**:支持 Python Mod/Plugin 的发现、依赖排序、生命周期、事件和命令注册。Java Fabric/Forge Mod 不受支持;Bukkit/Paper `.jar` 插件通过可选 Java 桥接层提供 best-effort 兼容,详见 `MOD_COMPATIBILITY.md`。 @@ -38,7 +45,7 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, ### 部分实现(不可视为完成) -- [ ] **原版地形近似实现**:已有密度、气候、洞穴、surface rule 和矿石管线,但并非同种子逐区块 1:1 复刻。 +- [ ] **地物 (feature) 装饰**:树木、花草、矿石等按生物群系近似原版生成,但放置随机数和部分参数与原版不同,因此同一种子下树的具体位置与原版不一致。 - [ ] **方块行为系统**:已有多种交互框架和基础行为,但部分容器与特殊方块仍是简化实现。 - [ ] **流体系统**:已有基础水/岩浆传播与交互,但尚未达到完整原版规则。 - [ ] **多版本协议兼容**:已有 47-770 的版本映射和处理器框架;只有核心路径经过有限验证,不能宣称所有版本完整兼容。 @@ -49,22 +56,21 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, ### 正在推进 / 待实现 -- [ ] 完全原版同种子同地形复刻:目标是输入原版 Java 版种子后生成同位置同地形。当前是 clean-room C++ 近似实现,还没有达到逐区块完全一致。 -- [ ] 补齐原版 1.21.1 噪声参数、密度函数、surface rule、carver、aquifer、ore vein 和 feature placement 的精确行为。 +- [ ] 原版 carver (峡谷与旧式洞穴雕刻) 和精确的 feature placement。 - [ ] 结构生成:村庄、废弃矿井、地牢、沉船、沙漠神殿、林地府邸、远古城市等。 - [ ] 完整洞穴系统:大型洞穴、繁茂洞穴、溶洞、地下水体、岩浆湖、深暗之域等。 - [ ] Nether、End 和多维度传送。 - [ ] 完整光照和客户端可见的区块更新细节。 - [ ] 更完整的物品栏交互:创造模式物品栏、铁砧/附魔台完整界面、药水效果。 - [ ] 更完整的生物系统:完整 A* 寻路、繁殖、村民、Boss、刷怪规则和 mob cap。 -- [ ] 正版登录验证、加密链路和更完整的权限模型。 - [ ] 更完整的选择器、NBT 参数和 datapack/function 支持。 ### 当前限制 - 这是服务端原型,不是完整原版服务端替代品。 -- 当前地形生成不会下载或运行 Mojang 原版服务端;地形和 AI 走本项目 C++/Python clean-room 实现。 -- 目标是逐步逼近原版,但现在还不能保证任意原版种子生成完全相同地形。 +- 地形生成不会下载或运行 Mojang 原版服务端;只使用原版公开的 worldgen 数据 JSON。 +- 地形形状/生物群系与原版一致,但还没有结构 (村庄等) 和 carver,树木等地物位置与原版不同。 +- 用旧版本 PyMC 生成的世界,已生成区块保持不变,新生成区块使用新地形,两者交界处会出现断层。 - 不支持 Java Fabric/Forge/NeoForge/Quilt Mod;Bukkit/Paper `.jar` 插件经 Java 桥接层提供生命周期与命令兼容(best-effort),另支持 PYMC 原生 Python 扩展。 ## 当前能力 @@ -74,14 +80,14 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, - 多版本协议兼容 (1.8.9 - 1.21.4, 协议版本 47-770) - 数据包压缩、KeepAlive、玩家移动同步 - 类原版 384 高度主世界区块 -- 优先使用 `native/terrain_gen` C++ 原生地形生成器,回退到原版风格近似或基础 Python 生成器 +- `native/terrain_gen` 原版 1.21.1 地形引擎 (噪声路由、含水层、矿脉、生物群系、surface rule),回退到 Python 近似生成器 - 红石系统:常用组件模拟与机械激活(含 TNT、音符盒、发射器/投掷器),每 2 游戏刻 (0.1s) 红石刻 - 流体系统:水/岩浆流动,水-岩浆交互 - 物品栏系统:ItemStack、PlayerInventory、协议序列化、点击/Shift/拖拽交互与方块容器持久化 - 方块行为:基础容器和多种交互框架,部分行为为简化实现 -- 安全出生点解析,避免首次进入或重生时卡在地下、水里或危险方块上 -- Linear V2 `.linear` 区域文件读写,并支持从 Anvil `.mca` 自动转换 -- 玩家位置、生命值、饱食度、经验、游戏模式等 JSON 存档 +- 原版出生点选择与安全出生/重生 (`spawnRadius` 规则) +- 原版 Anvil `.mca` 区域存档 (可选 Linear V2),旧 `.linear` 自动转换 +- 原版 `playerdata/.dat` 玩家存档 (位置、状态、物品栏、末影箱、出生点) - 基础聊天、方块挖掘/放置、掉落物、经验球和简单生物实体 - 玩家互相可见:实体生成/元数据/移动转发(原生 1.21.1 路径) - 战斗系统:攻击生物、武器伤害表、生物死亡掉落与经验、远程生物标记 @@ -128,9 +134,12 @@ PyMC 是一个用 Python 实现的 Minecraft Java 版 1.21.1 服务端原型, ```bash pip install -r requirements.txt -python main.py +python main.py --nogui ``` +与原版服务端一样,在一个单独的目录中运行即可,首次启动会生成 `server.properties`、`ops.json` 等文件; +也支持 `--port`、`--world`、`--universe`、`--config` 参数。`online-mode=true` 需要 `cryptography` 包。 + 默认监听: - Minecraft 服务端: `0.0.0.0:25565` @@ -146,7 +155,10 @@ python main.py 主要配置在 `server.properties`: - `server-port`:Minecraft 服务端端口 -- `online-mode`:是否正版验证,目前默认 `false` +- `online-mode`:是否正版验证(默认 `false`,开启需安装 `cryptography`) +- `motd` / `max-players` / `difficulty` / `pvp` / `hardcore` / `white-list` / `enforce-whitelist` / `spawn-protection` / `player-idle-timeout` / `enable-status` / `hide-online-players` / `simulation-distance` / `spawn-animals` / `spawn-monsters` / `force-gamemode`:与原版含义相同 +- `enable-rcon` / `rcon.port` / `rcon.password`:RCON 远程控制台 +- 放置 64x64 的 `server-icon.png` 即可在服务器列表显示图标 - `view-distance`:区块视距 - `level-seed`:世界种子 - `gamemode`:默认游戏模式 @@ -156,7 +168,8 @@ python main.py - `permissions-file`:权限文件路径 - `join-immediate-radius`:玩家入服时优先同步的近距离区块半径 - `min-protocol-version` / `max-protocol-version`:允许的协议版本范围 (默认 47-770) -- `vanilla-terrain`:使用原版风格近似地形生成器 (默认 `true`) +- `vanilla-terrain`:没有原生生成器时使用 Python 原版风格近似地形 (默认 `true`) +- `region-file-format`:区域文件格式,`anvil` (原版 `.mca`,默认) 或 `linear` (Linear V2,需 `zstandard`) - `redstone-enabled`:启用红石模拟 (默认 `true`) - `fluid-flow-enabled`:启用流体流动 (默认 `true`) - `mods-directory`:Mod 扫描目录 (默认 `mods`) @@ -198,7 +211,21 @@ build.bat 脚本会编译 `native/terrain_gen.exe`,然后使用 Nuitka 打包为独立可执行文件。 -Linux/macOS 可参考 `build.sh` 和 `CMakeLists.txt`。 +Linux/macOS 可参考 `build.sh` 和 `CMakeLists.txt`。直接 `python main.py` 运行时,如果找不到当前版本的地形生成器,服务端会自动用本机的 g++/clang++ 编译到 `build/native/`。手动编译: + +```bash +g++ -O2 -std=c++17 -ffp-contract=off -pthread -o native/terrain_gen native/terrain_gen.cpp +``` + +`-ffp-contract=off` 不能省略:它保证浮点运算与 Java 逐位一致,否则地形会与原版有细微差异。 + +`world/data/worldgen_overworld.json` 由 `tools/gen_worldgen_data.py` 从原版 1.21.1 的 worldgen 数据生成 (需要联网下载原版数据 JSON),仓库中已附带生成结果,一般无需重新生成: + +```bash +python3 tools/gen_worldgen_data.py +``` + +生物群系参数查找树取自 [cubiomes](https://github.com/Cubitect/cubiomes) (MIT 许可) 的 `btree20` 表;worldgen JSON 来自 [misode/mcmeta](https://github.com/misode/mcmeta) 的 `1.21.1-data-json`。 ### CI/CD @@ -213,7 +240,8 @@ Linux/macOS 可参考 `build.sh` 和 `CMakeLists.txt`。 以下内容是运行产物,默认不提交到仓库: -- `pymc.log` +- `logs/`、`ops.json`、`whitelist.json`、`banned-*.json`、`usercache.json` +- `world/level.dat`、`world/session.lock` - `world/region/` - `world/playerdata/` - `__pycache__/` diff --git a/admin/permissions.py b/admin/permissions.py index 0bd29dd..b63ba09 100755 --- a/admin/permissions.py +++ b/admin/permissions.py @@ -2,8 +2,24 @@ # PyMC - 权限、封禁与白名单管理 # ============================================================ +""" +权限数据的磁盘布局与原版服务端一致: + + ops.json 管理员 (uuid / name / level / bypassesPlayerLimit) + whitelist.json 白名单 (uuid / name) + banned-players.json 封禁玩家 (uuid / name / created / source / expires / reason) + banned-ips.json 封禁 IP (ip / created / source / expires / reason) + usercache.json 玩家名 <-> UUID 缓存 + +权限组 / 用户权限节点是 PyMC 的扩展, 保存在 permissions.json。 +旧版本把 OP、封禁和白名单也写在 permissions.json 里, 首次加载时会自动迁移。 +""" + +import hashlib import json import logging +import time +import uuid as _uuid from copy import deepcopy from pathlib import Path @@ -63,35 +79,211 @@ } +def offline_uuid(username: str) -> _uuid.UUID: + """与 Java 版一致的离线 UUID: UUID.nameUUIDFromBytes("OfflinePlayer:" + name)。""" + digest = bytearray(hashlib.md5(f"OfflinePlayer:{username}".encode("utf-8")).digest()) + digest[6] = (digest[6] & 0x0F) | 0x30 + digest[8] = (digest[8] & 0x3F) | 0x80 + return _uuid.UUID(bytes=bytes(digest)) + + +def _timestamp(epoch: float | None = None) -> str: + """原版 JSON 列表使用的时间格式: 2024-01-31 12:00:00 +0000。""" + return time.strftime("%Y-%m-%d %H:%M:%S +0000", time.gmtime(epoch)) + + +def _read_json_list(path: Path) -> list | None: + if not path.exists(): + return None + try: + with path.open("r", encoding="utf-8") as f: + data = json.load(f) + return data if isinstance(data, list) else [] + except Exception as e: + logger.error(f"Failed to load {path.name}: {e}") + return [] + + +def _write_json(path: Path, data) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + tmp = path.with_name(path.name + ".tmp") + with tmp.open("w", encoding="utf-8") as f: + json.dump(data, f, ensure_ascii=False, indent=2) + tmp.replace(path) + + +class UserCache: + """usercache.json: 记录见过的玩家名与 UUID (原版格式, 30 天过期)。""" + + EXPIRY_SECONDS = 30 * 24 * 3600 + + def __init__(self, filepath: str | Path = "usercache.json"): + self.filepath = Path(filepath) + self.entries: dict[str, dict] = {} + for entry in _read_json_list(self.filepath) or []: + if isinstance(entry, dict) and entry.get("name") and entry.get("uuid"): + self.entries[entry["name"].lower()] = entry + + def record(self, name: str, player_uuid) -> None: + self.entries[name.lower()] = { + "name": name, + "uuid": str(player_uuid), + "expiresOn": _timestamp(time.time() + self.EXPIRY_SECONDS), + } + self.save() + + def lookup(self, name: str) -> str | None: + entry = self.entries.get(name.lower()) + return entry["uuid"] if entry else None + + def name_for(self, name: str) -> str: + """返回缓存中的正确大小写, 未知时原样返回。""" + entry = self.entries.get(name.lower()) + return entry["name"] if entry else name + + def save(self) -> None: + try: + _write_json(self.filepath, list(self.entries.values())) + except OSError as e: + logger.warning(f"Failed to save {self.filepath.name}: {e}") + + class PermissionManager: - """管理权限组、用户权限、封禁和白名单。""" + """管理权限组、用户权限、OP、封禁和白名单。""" - def __init__(self, filepath: str = "permissions.json"): + def __init__(self, filepath: str = "permissions.json", default_op_level: int = 4, + usercache: UserCache | None = None): self.filepath = Path(filepath) + base = self.filepath.parent + self.ops_path = base / "ops.json" + self.whitelist_path = base / "whitelist.json" + self.banned_players_path = base / "banned-players.json" + self.banned_ips_path = base / "banned-ips.json" + self.default_op_level = max(1, min(4, int(default_op_level))) + self.usercache = usercache + self.on_whitelist_toggle = None # callback(enabled) -> 写回 server.properties + self.op_levels: dict[str, int] = {} self.data = deepcopy(DEFAULT_DATA) self.load() + # ------------------------------------------------------------------ + # 磁盘读写 + # ------------------------------------------------------------------ + + def _uuid_for(self, username: str) -> str: + if self.usercache is not None: + cached = self.usercache.lookup(username) + if cached: + return cached + return str(offline_uuid(username)) + def load(self): """从磁盘加载权限文件,不存在则创建默认文件。""" - if not self.filepath.exists(): + previous = deepcopy(self.data) + legacy: dict = {} + if self.filepath.exists(): + try: + with self.filepath.open("r", encoding="utf-8") as f: + loaded = json.load(f) + self.data = deepcopy(DEFAULT_DATA) + legacy = {k: loaded.pop(k) for k in ("ops", "bans", "whitelist") if k in loaded} + self._merge_dict(self.data, loaded) + except Exception as e: + logger.error(f"读取权限文件失败: {e},将保留当前内存配置") + self.data = previous + return + self._load_vanilla_lists(legacy) + if not self.filepath.exists() or legacy: self.save() - return - previous = deepcopy(self.data) - try: - with self.filepath.open("r", encoding="utf-8") as f: - loaded = json.load(f) - self.data = deepcopy(DEFAULT_DATA) - self._merge_dict(self.data, loaded) - except Exception as e: - logger.error(f"读取权限文件失败: {e},将保留当前内存配置") - self.data = previous + def _load_vanilla_lists(self, legacy: dict): + """读取 ops.json 等原版文件; 文件不存在时迁移旧版 permissions.json 数据。""" + # --- ops.json --- + ops = _read_json_list(self.ops_path) + self.op_levels = {} + if ops is None: + names = [str(n) for n in legacy.get("ops", [])] + else: + names = [] + for entry in ops: + if isinstance(entry, dict) and entry.get("name"): + names.append(entry["name"]) + self.op_levels[entry["name"].lower()] = int( + entry.get("level", self.default_op_level)) + self.data["ops"] = names + + # --- whitelist.json --- + enabled = bool(self.data.get("whitelist", {}).get("enabled", False)) + whitelist = _read_json_list(self.whitelist_path) + if whitelist is None: + legacy_wl = legacy.get("whitelist", {}) or {} + players = [str(n) for n in legacy_wl.get("players", [])] + enabled = bool(legacy_wl.get("enabled", enabled)) + else: + players = [e["name"] for e in whitelist if isinstance(e, dict) and e.get("name")] + self.data["whitelist"] = {"enabled": enabled, "players": players} + + # --- banned-players.json / banned-ips.json --- + bans = {"players": {}, "ips": {}} + banned_players = _read_json_list(self.banned_players_path) + if banned_players is None: + for key, record in (legacy.get("bans", {}) or {}).get("players", {}).items(): + bans["players"][key.lower()] = { + "name": record.get("name", key), "reason": record.get("reason", "")} + else: + for entry in banned_players: + if isinstance(entry, dict) and entry.get("name"): + bans["players"][entry["name"].lower()] = dict(entry) + banned_ips = _read_json_list(self.banned_ips_path) + if banned_ips is None: + for ip, record in (legacy.get("bans", {}) or {}).get("ips", {}).items(): + bans["ips"][ip] = {"reason": record.get("reason", "")} + else: + for entry in banned_ips: + if isinstance(entry, dict) and entry.get("ip"): + bans["ips"][entry["ip"]] = dict(entry) + self.data["bans"] = bans def save(self): - """保存权限文件。""" - self.filepath.parent.mkdir(parents=True, exist_ok=True) - with self.filepath.open("w", encoding="utf-8") as f: - json.dump(self.data, f, ensure_ascii=False, indent=2) + """保存 permissions.json (权限组/用户) 以及原版格式的各个列表文件。""" + extension_data = {k: v for k, v in self.data.items() + if k not in ("ops", "bans", "whitelist")} + _write_json(self.filepath, extension_data) + + _write_json(self.ops_path, [ + { + "uuid": self._uuid_for(name), + "name": name, + "level": self.op_levels.get(name.lower(), self.default_op_level), + "bypassesPlayerLimit": False, + } + for name in self.data["ops"] + ]) + _write_json(self.whitelist_path, [ + {"uuid": self._uuid_for(name), "name": name} + for name in self.data["whitelist"]["players"] + ]) + _write_json(self.banned_players_path, [ + { + "uuid": record.get("uuid") or self._uuid_for(record.get("name", key)), + "name": record.get("name", key), + "created": record.get("created") or _timestamp(), + "source": record.get("source") or "Server", + "expires": record.get("expires") or "forever", + "reason": record.get("reason") or "Banned by an operator.", + } + for key, record in self.data["bans"]["players"].items() + ]) + _write_json(self.banned_ips_path, [ + { + "ip": ip, + "created": record.get("created") or _timestamp(), + "source": record.get("source") or "Server", + "expires": record.get("expires") or "forever", + "reason": record.get("reason") or "Banned by an operator.", + } + for ip, record in self.data["bans"]["ips"].items() + ]) def snapshot(self) -> dict: """返回当前数据快照。""" @@ -132,12 +324,27 @@ def set_group(self, name: str, permissions: list[str], inherits: list[str] | Non } self.save() - def has_permission(self, username: str, permission: str) -> bool: + # ------------------------------------------------------------------ + # 权限判定 + # ------------------------------------------------------------------ + + def is_op(self, username: str) -> bool: key = username.lower() - if key in {name.lower() for name in self.data.get("ops", [])}: + return any(name.lower() == key for name in self.data.get("ops", [])) + + def get_op_level(self, username: str) -> int: + """原版权限等级 (0-4): OP 取 ops.json 中的 level, 其余为 0。""" + if self.is_op(username): + return self.op_levels.get(username.lower(), self.default_op_level) + return 0 + + def has_permission(self, username: str, permission: str) -> bool: + if self.is_op(username): return True - record = self.get_user_record(username) + key = username.lower() + record = self.data["users"].get(key) or { + "group": "default", "permissions": [], "denied": []} denied = set(record.get("denied", [])) if self._matches_any(permission, denied): return False @@ -148,81 +355,137 @@ def has_permission(self, username: str, permission: str) -> bool: return self._matches_any(permission, allowed) def get_permission_level(self, username: str) -> str: - if username.lower() in {name.lower() for name in self.data.get("ops", [])}: + if self.is_op(username): return "admin" - return self.get_user_record(username).get("group", "default") + return self.data["users"].get(username.lower(), {}).get("group", "default") - def op(self, username: str): - if username not in self.data["ops"]: - self.data["ops"].append(username) - self.save() + # ------------------------------------------------------------------ + # OP / 封禁 / 白名单 + # ------------------------------------------------------------------ + + def op(self, username: str, level: int | None = None) -> bool: + """设为管理员。返回是否发生变化。""" + if self.is_op(username): + return False + self.data["ops"].append(username) + self.op_levels[username.lower()] = ( + self.default_op_level if level is None else max(1, min(4, int(level)))) + self.save() + return True - def deop(self, username: str): + def deop(self, username: str) -> bool: + if not self.is_op(username): + return False self.data["ops"] = [name for name in self.data["ops"] if name.lower() != username.lower()] + self.op_levels.pop(username.lower(), None) self.save() + return True + + def is_banned(self, username: str) -> bool: + return username.lower() in self.data["bans"]["players"] - def ban_player(self, username: str, reason: str = ""): + def ban_player(self, username: str, reason: str = "", source: str = "Server") -> bool: + already = self.is_banned(username) self.data["bans"]["players"][username.lower()] = { + "uuid": self._uuid_for(username), "name": username, - "reason": reason, + "created": _timestamp(), + "source": source, + "expires": "forever", + "reason": reason or "Banned by an operator.", } self.save() + return not already - def pardon_player(self, username: str): - self.data["bans"]["players"].pop(username.lower(), None) + def pardon_player(self, username: str) -> bool: + removed = self.data["bans"]["players"].pop(username.lower(), None) is not None self.save() - - def ban_ip(self, ip: str, reason: str = ""): - self.data["bans"]["ips"][ip] = {"reason": reason} + return removed + + def ban_ip(self, ip: str, reason: str = "", source: str = "Server") -> bool: + already = ip in self.data["bans"]["ips"] + self.data["bans"]["ips"][ip] = { + "created": _timestamp(), + "source": source, + "expires": "forever", + "reason": reason or "Banned by an operator.", + } self.save() + return not already - def pardon_ip(self, ip: str): - self.data["bans"]["ips"].pop(ip, None) + def pardon_ip(self, ip: str) -> bool: + removed = self.data["bans"]["ips"].pop(ip, None) is not None self.save() + return removed def get_banlist(self) -> dict: return deepcopy(self.data["bans"]) def set_whitelist_enabled(self, enabled: bool): - self.data["whitelist"]["enabled"] = enabled - self.save() + self.data["whitelist"]["enabled"] = bool(enabled) + if self.on_whitelist_toggle is not None: + try: + self.on_whitelist_toggle(bool(enabled)) + except Exception as e: # pragma: no cover - defensive + logger.warning(f"无法写回 white-list 配置: {e}") + + def is_whitelisted(self, username: str) -> bool: + key = username.lower() + return any(name.lower() == key for name in self.data["whitelist"]["players"]) - def add_whitelist(self, username: str): + def add_whitelist(self, username: str) -> bool: + if self.is_whitelisted(username): + return False players = self.data["whitelist"]["players"] - if username not in players: - players.append(username) - players.sort(key=str.lower) - self.save() + players.append(username) + players.sort(key=str.lower) + self.save() + return True - def remove_whitelist(self, username: str): + def remove_whitelist(self, username: str) -> bool: + if not self.is_whitelisted(username): + return False players = self.data["whitelist"]["players"] self.data["whitelist"]["players"] = [ name for name in players if name.lower() != username.lower() ] self.save() + return True def get_whitelist(self) -> dict: return deepcopy(self.data["whitelist"]) - def check_login_allowed(self, username: str, ip: str) -> str | None: - if username.lower() in self.data["bans"]["players"]: - ban = self.data["bans"]["players"][username.lower()] - reason = ban.get("reason") or "你已被封禁" - return f"玩家已被封禁: {reason}" - - if ip in self.data["bans"]["ips"]: - ban = self.data["bans"]["ips"][ip] - reason = ban.get("reason") or "你的 IP 已被封禁" - return f"IP 已被封禁: {reason}" + def check_login(self, username: str, ip: str): + """ + 登录检查。允许时返回 None, 否则返回断开原因 (文本组件), + 与原版的断开消息一致。 + """ + from protocol.text import translate + ban = self.data["bans"]["players"].get(username.lower()) + if ban is not None: + reason = ban.get("reason") or "Banned by an operator." + return translate("multiplayer.disconnect.banned.reason", reason) + + ip_ban = self.data["bans"]["ips"].get(ip) + if ip_ban is not None: + reason = ip_ban.get("reason") or "Banned by an operator." + return translate("multiplayer.disconnect.banned_ip.reason", reason) whitelist = self.data["whitelist"] - if whitelist.get("enabled"): - players = whitelist.get("players", []) - if username.lower() not in {name.lower() for name in players}: - return "服务器已启用白名单" + if whitelist.get("enabled") and not self.is_whitelisted(username) \ + and not self.is_op(username): + return translate("multiplayer.disconnect.not_whitelisted") return None + def check_login_allowed(self, username: str, ip: str) -> str | None: + """兼容旧接口: 返回纯文本原因。""" + reason = self.check_login(username, ip) + if reason is None: + return None + from protocol.text import plain_text + return plain_text(reason) + def get_web_payload(self) -> dict: return { "groups": self.list_groups(), diff --git a/admin/web.py b/admin/web.py index c8e8592..35e7c57 100755 --- a/admin/web.py +++ b/admin/web.py @@ -688,7 +688,7 @@ def start(self): daemon=True, ) self._thread.start() - logger.info(f"Web 管理台已启动: http://{self.host}:{self.port}") + logger.info(f"Web admin console running on http://{self.host}:{self.port}") @staticmethod def _is_loopback_host(host: str) -> bool: @@ -706,7 +706,7 @@ def stop(self): self._httpd.shutdown() self._httpd.server_close() self._httpd = None - logger.info("Web 管理台已关闭") + logger.debug("Web admin console stopped") def _make_handler(self): outer = self diff --git a/build.bat b/build.bat index cfdfce8..7ad510a 100755 --- a/build.bat +++ b/build.bat @@ -62,7 +62,7 @@ if exist "C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe" ( where cl >nul 2>&1 if not errorlevel 1 ( - cl /O2 /EHsc /std:c++17 /Fe:native\terrain_gen.exe native\terrain_gen.cpp + cl /O2 /EHsc /std:c++17 /fp:precise /DNOMINMAX /Fe:native\terrain_gen.exe native\terrain_gen.cpp ) else ( where g++ >nul 2>&1 if errorlevel 1 ( @@ -70,7 +70,7 @@ if not errorlevel 1 ( pause exit /b 1 ) - g++ -O3 -std=c++17 -o native\terrain_gen.exe native\terrain_gen.cpp + g++ -O2 -std=c++17 -ffp-contract=off -pthread -static -o native\terrain_gen.exe native\terrain_gen.cpp ) if errorlevel 1 ( @@ -111,6 +111,8 @@ echo. --include-data-files=native/terrain_gen.exe=terrain_gen.exe ^ --include-data-files=native/mob_ai.exe=mob_ai.exe ^ --include-data-files=world/blocks.json=world/blocks.json ^ + --include-data-dir=protocol/data=protocol/data ^ + --include-data-dir=world/data=world/data ^ --follow-imports ^ --assume-yes-for-downloads ^ --windows-console-mode=force ^ diff --git a/build.sh b/build.sh index e5ea84a..f507668 100755 --- a/build.sh +++ b/build.sh @@ -36,7 +36,7 @@ fi echo "[信息] 正在编译原生地形生成器..." mkdir -p native build -g++ -O3 -std=c++17 -o native/terrain_gen native/terrain_gen.cpp +g++ -O2 -std=c++17 -ffp-contract=off -pthread -o native/terrain_gen native/terrain_gen.cpp if [ $? -ne 0 ]; then echo "[错误] terrain_gen 编译失败!" @@ -85,6 +85,8 @@ python3 -m nuitka \ --include-data-files=native/pymc_native_server=pymc_native_server \ --include-data-files=native/libpymc_native.so=libpymc_native.so \ --include-data-files=world/blocks.json=world/blocks.json \ + --include-data-dir=protocol/data=protocol/data \ + --include-data-dir=world/data=world/data \ --follow-imports \ --assume-yes-for-downloads \ main.py diff --git a/commands/__init__.py b/commands/__init__.py index 6bd34f8..6f208a8 100755 --- a/commands/__init__.py +++ b/commands/__init__.py @@ -157,29 +157,14 @@ async def execute(self, sender, command_string: str) -> int: # Step 2: Resolve command (check per-command aliases, then global aliases) command = self.get_command(cmd_name) - if command is None: - # Check if it's in the unrecognized set - if cmd_name in RECOGNIZED_BUT_UNSUPPORTED: - if sender is not None: - from handlers.play.chat import send_system_message - await send_system_message(sender, f"[PyMC] 已识别原版指令 /{cmd_name},但当前 PyMC 尚未实现其所需游戏系统") - else: - logger.info(f"[PyMC] 已识别原版指令 /{cmd_name},但当前 PyMC 尚未实现其所需游戏系统") - return FAILURE - - if sender is not None: - from handlers.play.chat import send_system_message - await send_system_message(sender, f"[PyMC] 未知命令: /{cmd_name}") - else: - logger.info(f"[PyMC] 未知命令: /{cmd_name}") - return FAILURE - - # Step 3: Check permission - if command.permission and sender is not None: - if not self.server.permissions.has_permission(sender.username, command.permission): - from handlers.play.chat import send_system_message - await send_system_message(sender, f"[PyMC] 你没有权限执行该命令: /{cmd_name}") - return ERROR # -1 for no permission + # Step 3: unknown command or missing permission -> the same vanilla + # error (players never learn which commands exist but are locked). + allowed = command is not None and ( + not command.permission or sender is None + or self.server.permissions.has_permission(sender.username, command.permission)) + if not allowed: + await self._send_unknown_command(sender, command_string) + return FAILURE if command is None else ERROR # Step 4: Parse arguments arguments = {} @@ -190,12 +175,7 @@ async def execute(self, sender, command_string: str) -> int: tokens, command.arguments, start_index=1 ) except ValueError as e: - from handlers.play.chat import send_system_message - msg = f"[PyMC] 参数错误: {e}" - if sender is not None: - await send_system_message(sender, msg) - else: - logger.info(msg) + await self._send_message(sender, {"text": str(e), "color": "red"}) return FAILURE else: remaining_tokens = tokens[1:] @@ -219,6 +199,28 @@ async def execute(self, sender, command_string: str) -> int: # Step 6: Execute and return result return await command.run(context) + async def _send_message(self, sender, message): + if sender is not None: + from handlers.play.chat import send_system_message + await send_system_message(sender, message) + else: + from commands.framework import console_output + console_output(message) + + async def _send_unknown_command(self, sender, command_string: str): + """Vanilla two-line error: message + the input with ``<--[HERE]``.""" + await self._send_message(sender, {"translate": "command.unknown.command", "color": "red"}) + shown = command_string if len(command_string) <= 10 else "..." + command_string[-10:] + await self._send_message(sender, { + "text": "", + "color": "gray", + "extra": [ + {"text": shown, "color": "red", "underlined": True, + "clickEvent": {"action": "suggest_command", "value": "/" + command_string}}, + {"translate": "command.context.here", "color": "red", "italic": True}, + ], + }) + def get_suggestions(self, sender, input_string: str) -> list[str]: """Get tab-completion suggestions for a partial command input.""" input_string = input_string.strip() diff --git a/commands/brigadier.py b/commands/brigadier.py new file mode 100644 index 0000000..610f204 --- /dev/null +++ b/commands/brigadier.py @@ -0,0 +1,236 @@ +# ============================================================ +# PyMC - Declare Commands (Brigadier 命令树) +# ============================================================ + +""" +Builds the ``Commands`` packet (clientbound ``declare_commands``). + +The vanilla client uses this tree for tab completion, syntax highlighting and +the usage hints above the chat box. Without it every ``/command`` is rendered +red as "unknown". The tree is assembled from: + + * the vanilla 1.21.1 command graph (``protocol/data/commands_767.json``), + restricted to commands that are actually registered in the + ``CommandManager`` and that the player may use; + * a generic `` [args...]`` node for every other registered command + (PyMC extensions and plugin commands), with server-side suggestions. +""" + +from __future__ import annotations + +import logging +import struct + +from protocol.data_types import write_string, write_varint + +logger = logging.getLogger("PyMC.命令") + +FLAG_LITERAL = 0x01 +FLAG_ARGUMENT = 0x02 +FLAG_EXECUTABLE = 0x04 +FLAG_REDIRECT = 0x08 +FLAG_SUGGESTIONS = 0x10 + +_PARSER_ALIASES = {"minecraft:nbt_compound_tag": "minecraft:nbt"} +_STRING_TYPES = {"word": 0, "phrase": 1, "greedy": 2} + + +def _min_max(props: dict, fmt: str) -> bytes: + props = props or {} + flags = (0x01 if "min" in props else 0) | (0x02 if "max" in props else 0) + out = bytearray([flags]) + if "min" in props: + out += struct.pack(fmt, props["min"]) + if "max" in props: + out += struct.pack(fmt, props["max"]) + return bytes(out) + + +def _parser_properties(parser: str, props: dict | None) -> bytes: + props = props or {} + if parser == "brigadier:float": + return _min_max(props, ">f") + if parser == "brigadier:double": + return _min_max(props, ">d") + if parser == "brigadier:integer": + return _min_max(props, ">i") + if parser == "brigadier:long": + return _min_max(props, ">q") + if parser == "brigadier:string": + return write_varint(_STRING_TYPES.get(props.get("type", "word"), 0)) + if parser == "minecraft:entity": + flags = (0x01 if props.get("amount") == "single" else 0) + flags |= (0x02 if props.get("type") == "players" else 0) + return bytes([flags]) + if parser == "minecraft:score_holder": + return bytes([0x01 if props.get("amount") == "multiple" else 0]) + if parser == "minecraft:time": + return struct.pack(">i", int(props.get("min", 0))) + if parser in ("minecraft:resource", "minecraft:resource_key", + "minecraft:resource_or_tag", "minecraft:resource_or_tag_key"): + return write_string(props.get("registry", "minecraft:item")) + return b"" + + +class _TreeBuilder: + def __init__(self, parsers: dict[str, int], vanilla_root: dict): + self.parsers = parsers + self.vanilla_root = vanilla_root + self.nodes: list[dict] = [] + self._by_identity: dict[int, int] = {} + self._pending_redirects: list[tuple[int, list[str]]] = [] + self.root = self._new_node({"flags": 0, "name": None}) + self._top_level: dict[str, int] = {} + + def _new_node(self, node: dict) -> int: + node.setdefault("children", []) + self.nodes.append(node) + return len(self.nodes) - 1 + + def _add_vanilla(self, name: str, source: dict, path: list[str]) -> int: + key = id(source) + if key in self._by_identity: + return self._by_identity[key] + if source.get("type") == "argument": + parser = _PARSER_ALIASES.get(source["parser"], source["parser"]) + if parser not in self.parsers: + # Unknown parser: degrade to a greedy string so the node stays usable. + parser, properties = "brigadier:string", {"type": "greedy"} + else: + properties = source.get("properties") + node = {"flags": FLAG_ARGUMENT, "name": name, "parser": parser, + "properties": properties} + else: + node = {"flags": FLAG_LITERAL, "name": name} + if source.get("executable"): + node["flags"] |= FLAG_EXECUTABLE + index = self._new_node(node) + self._by_identity[key] = index + + if "redirect" in source: + self._pending_redirects.append((index, list(source["redirect"]))) + elif path == ["execute", "run"]: + self._pending_redirects.append((index, [])) + for child_name, child in source.get("children", {}).items(): + node["children"].append(self._add_vanilla(child_name, child, path + [child_name])) + return index + + def add_vanilla_command(self, name: str) -> bool: + source = self.vanilla_root.get("children", {}).get(name) + if source is None or name in self._top_level: + return source is not None + index = self._add_vanilla(name, source, [name]) + self._top_level[name] = index + self.nodes[self.root]["children"].append(index) + return True + + def add_generic_command(self, name: str) -> None: + if name in self._top_level: + return + args = self._new_node({ + "flags": FLAG_ARGUMENT | FLAG_EXECUTABLE | FLAG_SUGGESTIONS, + "name": "args", "parser": "brigadier:string", + "properties": {"type": "greedy"}, "suggestions": "minecraft:ask_server", + }) + index = self._new_node({"flags": FLAG_LITERAL | FLAG_EXECUTABLE, "name": name, + "children": [args]}) + self._top_level[name] = index + self.nodes[self.root]["children"].append(index) + + def _resolve_path(self, path: list[str]) -> int | None: + if not path: + return self.root + index = self._top_level.get(path[0]) + for part in path[1:]: + if index is None: + return None + index = next((c for c in self.nodes[index]["children"] + if self.nodes[c]["name"] == part), None) + return index + + def encode(self) -> bytes: + for index, path in self._pending_redirects: + target = self._resolve_path(path) + if target is not None: + self.nodes[index]["redirect"] = target + self.nodes[index]["flags"] |= FLAG_REDIRECT + + out = bytearray(write_varint(len(self.nodes))) + for node in self.nodes: + out.append(node["flags"]) + out += write_varint(len(node["children"])) + for child in node["children"]: + out += write_varint(child) + if node["flags"] & FLAG_REDIRECT: + out += write_varint(node["redirect"]) + if node["name"] is not None: + out += write_string(node["name"]) + if node["flags"] & 0x03 == FLAG_ARGUMENT: + out += write_varint(self.parsers[node["parser"]]) + out += _parser_properties(node["parser"], node.get("properties")) + if node["flags"] & FLAG_SUGGESTIONS: + out += write_string(node["suggestions"]) + out += write_varint(self.root) + return bytes(out) + + +_CACHE: dict[frozenset, bytes] = {} + + +def available_command_names(server, conn) -> list[str]: + """Every name (including aliases) the player can type.""" + manager = getattr(server, "command_manager", None) + if manager is None: + return [] + from commands import GLOBAL_ALIASES + names: set[str] = set() + for command in manager.get_commands_for_sender(conn): + names.add(command.name) + names.update(command.aliases) + for alias, target in GLOBAL_ALIASES.items(): + if target in names: + names.add(alias) + return sorted(n for n in names if n and " " not in n) + + +def build_commands_payload(names: list[str]) -> bytes: + """Encode the command tree for the given set of usable command names.""" + key = frozenset(names) + cached = _CACHE.get(key) + if cached is not None: + return cached + + from protocol.gamedata import load_data + data = load_data("commands_767.json") + builder = _TreeBuilder(data["parsers"], data["tree"]) + vanilla_children = data["tree"].get("children", {}) + + # Redirect targets (e.g. tp -> teleport) must exist before aliases resolve. + for name in names: + source = vanilla_children.get(name) + if source is not None and "redirect" in source: + target = source["redirect"][0] + builder.add_vanilla_command(target) + for name in names: + if not builder.add_vanilla_command(name): + builder.add_generic_command(name) + + payload = builder.encode() + if len(_CACHE) > 64: + _CACHE.clear() + _CACHE[key] = payload + return payload + + +async def send_commands(conn, server) -> None: + """Send (or refresh) the command tree for one player.""" + from protocol.packet_map import get_clientbound_packet + pid = get_clientbound_packet(conn.protocol_version, "declare_commands") + if pid is None or conn.protocol_version != 767: + return + try: + payload = build_commands_payload(available_command_names(server, conn)) + except Exception as e: # never let a tree bug block a login + logger.warning(f"构建命令树失败: {e}") + return + await conn.send_packet(pid, payload) diff --git a/commands/framework.py b/commands/framework.py index 5940a5e..5fe0348 100755 --- a/commands/framework.py +++ b/commands/framework.py @@ -17,6 +17,8 @@ from __future__ import annotations +import contextlib +import contextvars import logging import math from dataclasses import dataclass, field @@ -31,6 +33,49 @@ ERROR = -1 +# ------------------------------------------------------------------ +# Console output (server console / RCON) +# ------------------------------------------------------------------ + +_console_capture: contextvars.ContextVar = contextvars.ContextVar( + "pymc_console_capture", default=None) +_console_source: contextvars.ContextVar = contextvars.ContextVar( + "pymc_console_source", default="Server") + + +def console_source_name() -> str: + """Display name of the non-player command source ("Server" or "Rcon").""" + return _console_source.get() + + +def console_output(message) -> None: + """Print command feedback for a non-player source. + + On the server console this is a normal log line; while an RCON command + runs the text is captured and returned to the RCON client instead. + """ + from protocol.text import plain_text + text = plain_text(message) + captured = _console_capture.get() + if captured is not None: + captured.append(text) + else: + logging.getLogger("minecraft.server").info(text) + + +@contextlib.contextmanager +def capture_console_output(source: str = "Rcon"): + """Collect console feedback produced inside the ``with`` block.""" + lines: list[str] = [] + capture_token = _console_capture.set(lines) + source_token = _console_source.set(source) + try: + yield lines + finally: + _console_capture.reset(capture_token) + _console_source.reset(source_token) + + @dataclass class CommandContext: """Context passed to every command execution. @@ -96,18 +141,70 @@ def get_sender_rotation(self) -> tuple[float, float]: # ---- Messaging ---- - async def reply(self, text: str): - """Send a reply to the command sender.""" + async def reply(self, text): + """Send a reply (string or text component) to the command sender.""" from handlers.play.chat import send_system_message if self.sender is not None: await send_system_message(self.sender, text) else: - logger.info(text) + console_output(text) - async def broadcast(self, text: str): + async def broadcast(self, text): """Broadcast a message to all online players.""" self.server.broadcast_system_message(text) + @property + def source_component(self) -> dict: + """Text component naming the command source (player name or "Server").""" + if self.sender is not None: + from protocol.text import player_name + return player_name(self.sender) + return {"text": console_source_name()} + + async def success(self, message, broadcast_to_ops: bool = True): + """ + Vanilla ``sendSuccess``: feedback to the source, plus (optionally) the + gray italic ``[Source: message]`` notification to other operators and + the console log line. + """ + from protocol.text import to_component, plain_text + component = to_component(message) + gamerules = getattr(self.server, "gamerules", {}) + if self.sender is None: + console_output(component) + elif gamerules.get("sendCommandFeedback", True): + await self.reply(component) + if not broadcast_to_ops: + return + + admin = {"translate": "chat.type.admin", + "with": [self.source_component, component], + "color": "gray", "italic": True} + config = getattr(self.server, "config", {}) + if self.sender is None: + key = ("broadcast-rcon-to-ops" if console_source_name() == "Rcon" + else "broadcast-console-to-ops") + notify_ops = bool(config.get(key, True)) + else: + notify_ops = True + if gamerules.get("logAdminCommands", True): + logging.getLogger("minecraft.server").info(plain_text(admin)) + if notify_ops and gamerules.get("sendCommandFeedback", True): + from handlers.play.chat import send_system_message + permissions = self.server.permissions + for player in self.server.get_online_players(): + if player is self.sender or not permissions.is_op(player.username): + continue + await send_system_message(player, admin) + + async def fail(self, message) -> int: + """Vanilla ``sendFailure``: a red error message; returns FAILURE.""" + from protocol.text import to_component + component = dict(to_component(message)) + component.setdefault("color", "red") + await self.reply(component) + return FAILURE + # ---- Permission ---- def has_permission(self, node: str) -> bool: @@ -247,7 +344,7 @@ async def run(self, context: CommandContext) -> int: return await self._execute_func(context) except Exception as e: logger.error(f"Command /{self.name} execution error: {e}", exc_info=True) - await context.reply(f"\u00a7cCommand error: {e}") + await context.fail({"translate": "command.failed"}) return ERROR logger.warning(f"Command /{self.name} has no execute handler") return FAILURE diff --git a/commands/vanilla/__init__.py b/commands/vanilla/__init__.py index 76d3f93..59ff095 100755 --- a/commands/vanilla/__init__.py +++ b/commands/vanilla/__init__.py @@ -97,3 +97,8 @@ def register_all(manager): # entities, group, perm, defaultgamemode, and duplicates of some # commands from consolidated modules for backward compatibility) register_default(manager) + + # Vanilla-faithful core commands (registered last: they override the + # simplified versions above with real vanilla behaviour and feedback). + from commands.vanilla.essentials import register as register_essentials + register_essentials(manager) diff --git a/commands/vanilla/essentials.py b/commands/vanilla/essentials.py new file mode 100644 index 0000000..cd2c869 --- /dev/null +++ b/commands/vanilla/essentials.py @@ -0,0 +1,1154 @@ +# ============================================================ +# PyMC - 原版核心命令 +# ============================================================ + +""" +Vanilla-faithful implementations of the commands operators and players use +every day. Registered last, so they replace the earlier simplified versions. + +Feedback uses the vanilla translation keys (``commands.*``), so every client +sees it in its own language, operators get the gray ``[Source: ...]`` +notification, and the console/RCON print the en_us text. + + help list say me msg/tell/w + kick ban ban-ip pardon pardon-ip banlist op deop whitelist + stop save-all save-on save-off seed + time weather difficulty gamerule defaultgamemode setworldspawn spawnpoint + gamemode tp/teleport give clear kill xp/experience +""" + +from __future__ import annotations + +import ipaddress +import math + +from commands.framework import Command, CommandContext, SUCCESS, FAILURE +from protocol.text import translate, player_name, text as _text + +GAMEMODES = ("survival", "creative", "adventure", "spectator") +DIFFICULTIES = ("peaceful", "easy", "normal", "hard") + + +# ------------------------------------------------------------------ +# helpers +# ------------------------------------------------------------------ + +def _is_player(obj) -> bool: + from network.connection import Connection + return isinstance(obj, Connection) + + +def _entity_name(obj) -> dict: + if _is_player(obj): + return player_name(obj) + mob_type = getattr(obj, "metadata", {}).get("mob_type") or getattr(obj, "kind", "entity") + return {"translate": f"entity.minecraft.{mob_type}", "fallback": str(mob_type)} + + +def _resolve(ctx: CommandContext, spec: str) -> list: + from commands.selector import resolve_selector + try: + return [t for t in resolve_selector(ctx.server, ctx.sender, spec) if t is not None] + except Exception: + return [] + + +async def _players(ctx: CommandContext, spec: str) -> list | None: + """Resolve a player argument; sends the vanilla error and returns None if empty.""" + found = [t for t in _resolve(ctx, spec) if _is_player(t)] + if not found: + await ctx.fail(translate("argument.entity.notfound.player")) + return None + return found + + +async def _entities(ctx: CommandContext, spec: str) -> list | None: + found = _resolve(ctx, spec) + if not found: + await ctx.fail(translate("argument.entity.notfound.entity")) + return None + return found + + +async def _incomplete(ctx: CommandContext) -> int: + await ctx.fail(translate("command.unknown.argument")) + return FAILURE + + +def _profile_name(ctx: CommandContext, name: str) -> str: + """Correct capitalisation for an (offline) player name.""" + online = ctx.server.find_player(name) + if online is not None: + return online.username + cache = getattr(ctx.server, "usercache", None) + return cache.name_for(name) if cache is not None else name + + +def _gamemode_component(mode: str) -> dict: + return {"translate": f"gameMode.{mode}"} + + +def _difficulty_component(difficulty: str) -> dict: + return {"translate": f"options.difficulty.{difficulty}"} + + +def _item_component(item_id: str) -> dict: + """``[Item Name]`` like vanilla's ItemStack.getDisplayName().""" + short = item_id.split(":", 1)[-1] + pretty = short.replace("_", " ").title() + key = f"item.minecraft.{short}" + try: + from world.chunk_io import BLOCK_NAME_TO_DEFAULT_STATE + if short in BLOCK_NAME_TO_DEFAULT_STATE or item_id in BLOCK_NAME_TO_DEFAULT_STATE: + key = f"block.minecraft.{short}" + except Exception: + pass + return {"translate": "chat.square_brackets", + "with": [{"translate": key, "fallback": pretty}]} + + +def _fmt(value: float) -> str: + return f"{value:.6f}" + + +def _command(manager, name, func, permission, usage="", aliases=None, + description="", category="vanilla"): + cmd = Command(name=name, description=description or name, usage=usage or name, + aliases=aliases or [], permission=permission, category=category) + cmd._execute_func = func + manager.register(cmd) + return cmd + + +async def teleport(server, target, x: float, y: float, z: float, + yaw: float | None = None, pitch: float | None = None) -> None: + """Move a player or entity and synchronise everyone who can see it.""" + target.x, target.y, target.z = float(x), float(y), float(z) + if yaw is not None: + target.yaw = float(yaw) + if pitch is not None: + target.pitch = float(pitch) + if not _is_player(target): + return + target.fall_start_y = target.y + from handlers.play.join import _send_synchronize_position + from handlers.play.chunks import _schedule_chunk_stream_update + from handlers.play.players import relay_player_movement + await _send_synchronize_position(target) + _schedule_chunk_stream_update(target, server) + try: + await relay_player_movement(server, target, force=True) + except TypeError: + await relay_player_movement(server, target) + + +async def refresh_permissions(server, player) -> None: + """Resend the op level and command tree after /op or /deop.""" + if getattr(player, "protocol_version", 0) != 767: + return + from handlers.play.state import send_op_level + from commands.brigadier import send_commands + await send_op_level(player, server) + await send_commands(player, server) + + +# ------------------------------------------------------------------ +# registration +# ------------------------------------------------------------------ + +def register(manager): + server_of = lambda ctx: ctx.server # noqa: E731 + + # ---------------- help ---------------- + async def _help(ctx: CommandContext) -> int: + args = ctx.args + available = sorted(manager.get_commands_for_sender(ctx.sender), key=lambda c: c.name) + if args: + cmd = manager.get_command(args[0].lstrip("/")) + if cmd is None or cmd not in available: + return await ctx.fail(translate("commands.help.failed")) + await ctx.reply(f"/{cmd.usage or cmd.name}") + return SUCCESS + for cmd in available: + await ctx.reply(f"/{cmd.usage or cmd.name}") + return SUCCESS + + _command(manager, "help", _help, "command.help", "help []", aliases=["?"]) + + # ---------------- list ---------------- + async def _list(ctx: CommandContext) -> int: + players = ctx.server.get_online_players() + with_uuid = bool(ctx.args) and ctx.args[0].lower() == "uuids" + names = ", ".join( + f"{p.username} ({p.uuid})" if with_uuid else p.username for p in players) + await ctx.reply(translate("commands.list.players", len(players), + ctx.server.max_players, names)) + return SUCCESS + + _command(manager, "list", _list, "command.list", "list [uuids]") + + # ---------------- say / me / msg ---------------- + async def _say(ctx: CommandContext) -> int: + message = ctx.remaining_input.strip() + if not message: + return await _incomplete(ctx) + ctx.server.broadcast_system_message( + translate("chat.type.announcement", ctx.source_component, _text(message)), log=True) + return SUCCESS + + _command(manager, "say", _say, "command.say", "say ") + + async def _me(ctx: CommandContext) -> int: + action = ctx.remaining_input.strip() + if not action: + return await _incomplete(ctx) + ctx.server.broadcast_system_message( + translate("chat.type.emote", ctx.source_component, _text(action)), log=True) + return SUCCESS + + _command(manager, "me", _me, "command.me", "me ") + + async def _msg(ctx: CommandContext) -> int: + from handlers.play.chat import send_system_message + args = ctx.args + if len(args) < 2: + return await _incomplete(ctx) + targets = await _players(ctx, args[0]) + if targets is None: + return FAILURE + message = ctx.remaining_input.split(None, 1)[1] + for target in targets: + await ctx.reply(translate("commands.message.display.outgoing", + player_name(target), _text(message), + color="gray", italic=True)) + await send_system_message(target, translate( + "commands.message.display.incoming", ctx.source_component, _text(message), + color="gray", italic=True)) + return SUCCESS + + _command(manager, "msg", _msg, "command.msg", "msg ", + aliases=["tell", "w"]) + + # ---------------- kick ---------------- + async def _kick(ctx: CommandContext) -> int: + args = ctx.args + if not args: + return await _incomplete(ctx) + targets = await _players(ctx, args[0]) + if targets is None: + return FAILURE + reason = (ctx.remaining_input.split(None, 1)[1].strip() + if len(args) > 1 else "") + reason_component = _text(reason) if reason else translate("multiplayer.disconnect.kicked") + for target in targets: + from plugins.bridge import hook_player_kick + try: + hook_player_kick(ctx.server, target, reason) + except Exception: + pass + await target.disconnect(reason_component) + await ctx.success(translate("commands.kick.success", + player_name(target), reason_component)) + return SUCCESS + + _command(manager, "kick", _kick, "command.kick", "kick []") + + # ---------------- ban / pardon / banlist ---------------- + def _reason_from(ctx: CommandContext) -> str: + parts = ctx.remaining_input.split(None, 1) + return parts[1].strip() if len(parts) > 1 else "" + + async def _ban(ctx: CommandContext) -> int: + args = ctx.args + if not args: + return await _incomplete(ctx) + permissions = ctx.server.permissions + reason = _reason_from(ctx) or "Banned by an operator." + names = [p.username for p in _resolve(ctx, args[0]) if _is_player(p)] \ + or ([] if args[0].startswith("@") else [_profile_name(ctx, args[0])]) + if not names: + return await ctx.fail(translate("argument.player.unknown")) + banned = 0 + for name in names: + if not permissions.ban_player(name, reason, source=ctx.source_name or "Server"): + continue + banned += 1 + await ctx.success(translate("commands.ban.success", _text(name), _text(reason))) + online = ctx.server.find_player(name) + if online is not None: + await online.disconnect(translate("multiplayer.disconnect.banned")) + if banned == 0: + return await ctx.fail(translate("commands.ban.failed")) + return SUCCESS + + _command(manager, "ban", _ban, "command.ban", "ban []") + + async def _pardon(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + permissions = ctx.server.permissions + record = permissions.data["bans"]["players"].get(ctx.args[0].lower()) + name = (record or {}).get("name", ctx.args[0]) + if not permissions.pardon_player(ctx.args[0]): + return await ctx.fail(translate("commands.pardon.failed")) + await ctx.success(translate("commands.pardon.success", _text(name))) + return SUCCESS + + _command(manager, "pardon", _pardon, "command.pardon", "pardon ") + + def _valid_ip(value: str) -> bool: + try: + ipaddress.ip_address(value) + return True + except ValueError: + return False + + async def _ban_ip(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + target = ctx.args[0] + if not _valid_ip(target): + player = ctx.server.find_player(target) + if player is None: + return await ctx.fail(translate("commands.banip.invalid")) + target = player.address.rsplit(":", 1)[0] + reason = _reason_from(ctx) or "Banned by an operator." + if not ctx.server.permissions.ban_ip(target, reason, source=ctx.source_name or "Server"): + return await ctx.fail(translate("commands.banip.failed")) + await ctx.success(translate("commands.banip.success", _text(target), _text(reason))) + affected = [p for p in ctx.server.get_online_players() + if p.address.rsplit(":", 1)[0] == target] + if affected: + await ctx.success(translate("commands.banip.info", len(affected), + ", ".join(p.username for p in affected))) + for player in affected: + await player.disconnect(translate("multiplayer.disconnect.ip_banned")) + return SUCCESS + + _command(manager, "ban-ip", _ban_ip, "command.ban-ip", "ban-ip []") + + async def _pardon_ip(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + if not _valid_ip(ctx.args[0]): + return await ctx.fail(translate("commands.pardonip.invalid")) + if not ctx.server.permissions.pardon_ip(ctx.args[0]): + return await ctx.fail(translate("commands.pardonip.failed")) + await ctx.success(translate("commands.pardonip.success", _text(ctx.args[0]))) + return SUCCESS + + _command(manager, "pardon-ip", _pardon_ip, "command.pardon-ip", "pardon-ip ") + + async def _banlist(ctx: CommandContext) -> int: + bans = ctx.server.permissions.get_banlist() + which = ctx.args[0].lower() if ctx.args else "" + entries = [] + if which in ("", "players"): + entries += [(r.get("name", k), r) for k, r in bans["players"].items()] + if which in ("", "ips"): + entries += [(ip, r) for ip, r in bans["ips"].items()] + if not entries: + await ctx.reply(translate("commands.banlist.none")) + return SUCCESS + await ctx.reply(translate("commands.banlist.list", len(entries))) + for name, record in entries: + await ctx.reply(translate( + "commands.banlist.entry", _text(name), _text(record.get("source") or "Server"), + _text(record.get("reason") or "Banned by an operator."))) + return SUCCESS + + _command(manager, "banlist", _banlist, "command.banlist", "banlist [ips|players]") + + # ---------------- op / deop ---------------- + async def _op(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + names = [p.username for p in _resolve(ctx, ctx.args[0]) if _is_player(p)] \ + or ([] if ctx.args[0].startswith("@") else [_profile_name(ctx, ctx.args[0])]) + changed = 0 + for name in names: + if ctx.server.permissions.op(name): + changed += 1 + await ctx.success(translate("commands.op.success", _text(name))) + online = ctx.server.find_player(name) + if online is not None: + await refresh_permissions(ctx.server, online) + if not changed: + return await ctx.fail(translate("commands.op.failed")) + return SUCCESS + + _command(manager, "op", _op, "command.op", "op ") + + async def _deop(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + names = [p.username for p in _resolve(ctx, ctx.args[0]) if _is_player(p)] \ + or ([] if ctx.args[0].startswith("@") else [_profile_name(ctx, ctx.args[0])]) + changed = 0 + for name in names: + if ctx.server.permissions.deop(name): + changed += 1 + await ctx.success(translate("commands.deop.success", _text(name))) + online = ctx.server.find_player(name) + if online is not None: + await refresh_permissions(ctx.server, online) + if not changed: + return await ctx.fail(translate("commands.deop.failed")) + return SUCCESS + + _command(manager, "deop", _deop, "command.deop", "deop ") + + # ---------------- whitelist ---------------- + async def _enforce_whitelist(ctx: CommandContext): + if not ctx.server.config.get("enforce-whitelist", False): + return + permissions = ctx.server.permissions + if not permissions.data["whitelist"]["enabled"]: + return + for player in ctx.server.get_online_players(): + if not permissions.is_whitelisted(player.username) \ + and not permissions.is_op(player.username): + await player.disconnect(translate("multiplayer.disconnect.not_whitelisted")) + + async def _whitelist(ctx: CommandContext) -> int: + args = ctx.args + if not args: + return await _incomplete(ctx) + permissions = ctx.server.permissions + action = args[0].lower() + enabled = bool(permissions.data["whitelist"]["enabled"]) + if action == "on": + if enabled: + return await ctx.fail(translate("commands.whitelist.alreadyOn")) + permissions.set_whitelist_enabled(True) + await ctx.success(translate("commands.whitelist.enabled")) + await _enforce_whitelist(ctx) + elif action == "off": + if not enabled: + return await ctx.fail(translate("commands.whitelist.alreadyOff")) + permissions.set_whitelist_enabled(False) + await ctx.success(translate("commands.whitelist.disabled")) + elif action == "list": + names = permissions.data["whitelist"]["players"] + if not names: + await ctx.reply(translate("commands.whitelist.none")) + else: + await ctx.reply(translate("commands.whitelist.list", len(names), ", ".join(names))) + elif action in ("add", "remove") and len(args) >= 2: + name = _profile_name(ctx, args[1]) + if action == "add": + if not permissions.add_whitelist(name): + return await ctx.fail(translate("commands.whitelist.add.failed")) + await ctx.success(translate("commands.whitelist.add.success", _text(name))) + else: + if not permissions.remove_whitelist(name): + return await ctx.fail(translate("commands.whitelist.remove.failed")) + await ctx.success(translate("commands.whitelist.remove.success", _text(name))) + await _enforce_whitelist(ctx) + elif action == "reload": + permissions.load() + permissions.data["whitelist"]["enabled"] = enabled + await ctx.success(translate("commands.whitelist.reloaded")) + await _enforce_whitelist(ctx) + else: + return await _incomplete(ctx) + return SUCCESS + + _command(manager, "whitelist", _whitelist, "command.whitelist", + "whitelist (on|off|list|add|remove|reload)") + + # ---------------- stop / save ---------------- + async def _stop(ctx: CommandContext) -> int: + await ctx.success(translate("commands.stop.stopping")) + ctx.server.request_stop() + return SUCCESS + + _command(manager, "stop", _stop, "command.stop", "stop") + + async def _save_all(ctx: CommandContext) -> int: + server = ctx.server + await ctx.success(translate("commands.save.saving"), broadcast_to_ops=False) + try: + server.save_all_player_states() + server.world_storage.flush() + from world.block_behavior import container_manager + container_manager.save(str(server.world_storage.world_dir)) + server.save_level_data() + except Exception: + return await ctx.fail(translate("commands.save.failed")) + await ctx.success(translate("commands.save.success")) + return SUCCESS + + _command(manager, "save-all", _save_all, "command.save-all", "save-all [flush]") + + async def _save_on(ctx: CommandContext) -> int: + if ctx.server.autosave_enabled: + return await ctx.fail(translate("commands.save.alreadyOn")) + ctx.server.autosave_enabled = True + await ctx.success(translate("commands.save.enabled")) + return SUCCESS + + async def _save_off(ctx: CommandContext) -> int: + if not ctx.server.autosave_enabled: + return await ctx.fail(translate("commands.save.alreadyOff")) + ctx.server.autosave_enabled = False + await ctx.success(translate("commands.save.disabled")) + return SUCCESS + + _command(manager, "save-on", _save_on, "command.save-on", "save-on") + _command(manager, "save-off", _save_off, "command.save-off", "save-off") + + # ---------------- seed ---------------- + async def _seed(ctx: CommandContext) -> int: + seed = str(int(getattr(ctx.server, "seed", 0))) + seed_component = { + "translate": "chat.square_brackets", + "with": [{"text": seed, "color": "green", + "clickEvent": {"action": "copy_to_clipboard", "value": seed}, + "hoverEvent": {"action": "show_text", + "contents": {"translate": "chat.copy.click"}}, + "insertion": seed}], + } + await ctx.reply(translate("commands.seed.success", seed_component)) + return SUCCESS + + _command(manager, "seed", _seed, "command.seed", "seed") + + # ---------------- time ---------------- + async def _sync_time(server): + from handlers.play.join import _send_time_update + for player in server.get_online_players(): + await _send_time_update(player, server) + + def _parse_time(raw: str) -> int | None: + raw = raw.lower() + scale = 1 + if raw and raw[-1] in "dst": + scale = {"d": 24000, "s": 20, "t": 1}[raw[-1]] + raw = raw[:-1] + try: + value = float(raw) + except ValueError: + return None + return int(round(value * scale)) if value >= 0 else None + + async def _time(ctx: CommandContext) -> int: + args = ctx.args + if len(args) < 2: + return await _incomplete(ctx) + manager_ = ctx.server._time_manager + action = args[0].lower() + if action == "set": + presets = {"day": 1000, "noon": 6000, "night": 13000, "midnight": 18000} + value = presets.get(args[1].lower()) + if value is None: + value = _parse_time(args[1]) + if value is None: + return await ctx.fail(translate("argument.time.invalid_unit")) + manager_.day_time_total = value + await _sync_time(ctx.server) + await ctx.success(translate("commands.time.set", value)) + elif action == "add": + value = _parse_time(args[1]) + if value is None: + return await ctx.fail(translate("argument.time.invalid_unit")) + manager_.add_time(value) + await _sync_time(ctx.server) + await ctx.success(translate("commands.time.set", manager_.time)) + elif action == "query": + what = args[1].lower() + values = {"daytime": manager_.time, "gametime": manager_.age % 2147483647, + "day": manager_.get_day_count() % 2147483647} + if what not in values: + return await _incomplete(ctx) + await ctx.reply(translate("commands.time.query", values[what])) + else: + return await _incomplete(ctx) + return SUCCESS + + _command(manager, "time", _time, "command.time", "time (add|query|set)") + + # ---------------- weather ---------------- + async def _weather(ctx: CommandContext) -> int: + args = ctx.args + if not args or args[0].lower() not in ("clear", "rain", "thunder"): + return await _incomplete(ctx) + kind = args[0].lower() + duration = 0 + if len(args) >= 2: + parsed = _parse_time(args[1]) + if parsed is None: + return await ctx.fail(translate("argument.time.invalid_unit")) + duration = parsed + else: + import random + ranges = {"clear": (12000, 180000), "rain": (12000, 24000), "thunder": (3600, 15600)} + duration = random.randint(*ranges[kind]) + await ctx.server.set_weather(kind, duration) + await ctx.success(translate(f"commands.weather.set.{kind}")) + return SUCCESS + + _command(manager, "weather", _weather, "command.weather", "weather (clear|rain|thunder)") + + # ---------------- difficulty ---------------- + async def _difficulty(ctx: CommandContext) -> int: + server = ctx.server + current = str(server.config.get("difficulty", "easy")).lower() + if not ctx.args: + await ctx.reply(translate("commands.difficulty.query", _difficulty_component(current))) + return SUCCESS + wanted = ctx.args[0].lower() + wanted = {"0": "peaceful", "1": "easy", "2": "normal", "3": "hard", + "p": "peaceful", "e": "easy", "n": "normal", "h": "hard"}.get(wanted, wanted) + if wanted not in DIFFICULTIES: + return await _incomplete(ctx) + if wanted == current: + return await ctx.fail(translate("commands.difficulty.failure", + _difficulty_component(current))) + server.config["difficulty"] = wanted + server.save_runtime_config() + from handlers.play.state import send_difficulty + for player in server.get_online_players(): + await send_difficulty(player, server) + await ctx.success(translate("commands.difficulty.success", _difficulty_component(wanted))) + return SUCCESS + + _command(manager, "difficulty", _difficulty, "command.difficulty", + "difficulty [peaceful|easy|normal|hard]") + + # ---------------- gamerule ---------------- + async def _gamerule(ctx: CommandContext) -> int: + args = ctx.args + rules = ctx.server.gamerules + if not args: + return await _incomplete(ctx) + known = {name.lower(): name for name in rules.known_rules()} \ + if hasattr(rules, "known_rules") else {} + name = known.get(args[0].lower()) + if name is None: + return await _incomplete(ctx) + if len(args) == 1: + value = rules.get(name) + shown = str(value).lower() if isinstance(value, bool) else str(value) + await ctx.reply(translate("commands.gamerule.query", _text(name), _text(shown))) + return SUCCESS + raw = args[1] + old = rules.get(name) + if isinstance(old, bool): + if raw.lower() not in ("true", "false"): + return await ctx.fail(translate("parsing.bool.invalid", raw)) + else: + try: + int(raw) + except ValueError: + return await ctx.fail(translate("parsing.int.invalid", raw)) + rules.set(name, raw) + value = rules.get(name) + shown = str(value).lower() if isinstance(value, bool) else str(value) + try: + from plugins.bridge import hook_gamerule_change + hook_gamerule_change(ctx.server, name, old, value) + except Exception: + pass + if name == "doDaylightCycle": + await _sync_time(ctx.server) + elif name == "doImmediateRespawn": + from handlers.play.state import send_game_event + for player in ctx.server.get_online_players(): + await send_game_event(player, 11, 1.0 if value else 0.0) + ctx.server.save_level_data() + await ctx.success(translate("commands.gamerule.set", _text(name), _text(shown))) + return SUCCESS + + _command(manager, "gamerule", _gamerule, "command.gamerule", "gamerule []") + + # ---------------- gamemode / defaultgamemode ---------------- + def _parse_mode(raw: str) -> str | None: + from handlers.play.state import normalize_gamemode + mode = normalize_gamemode(raw, "") + return mode if mode in GAMEMODES else None + + async def _gamemode(ctx: CommandContext) -> int: + from handlers.play.chat import send_system_message + from handlers.play.state import set_player_gamemode + args = ctx.args + if not args: + return await _incomplete(ctx) + mode = _parse_mode(args[0]) + if mode is None: + return await ctx.fail(translate("argument.gamemode.invalid", args[0])) + if len(args) >= 2: + targets = await _players(ctx, args[1]) + if targets is None: + return FAILURE + elif ctx.sender is not None: + targets = [ctx.sender] + else: + return await ctx.fail(translate("permissions.requires.player")) + changed = 0 + for target in targets: + old = target.gamemode + if old == mode: + continue + await set_player_gamemode(ctx.server, target, mode) + changed += 1 + try: + from plugins.bridge import hook_player_gamemode_change + hook_player_gamemode_change(ctx.server, target, GAMEMODES.index(old), + GAMEMODES.index(mode)) + except Exception: + pass + if target is ctx.sender: + await ctx.success(translate("commands.gamemode.success.self", + _gamemode_component(mode))) + else: + if ctx.server.gamerules.get("sendCommandFeedback", True): + await send_system_message( + target, translate("gameMode.changed", _gamemode_component(mode))) + await ctx.success(translate("commands.gamemode.success.other", + player_name(target), _gamemode_component(mode))) + return SUCCESS if changed else FAILURE + + _command(manager, "gamemode", _gamemode, "command.gamemode", + "gamemode []") + + async def _defaultgamemode(ctx: CommandContext) -> int: + if not ctx.args: + return await _incomplete(ctx) + mode = _parse_mode(ctx.args[0]) + if mode is None: + return await ctx.fail(translate("argument.gamemode.invalid", ctx.args[0])) + ctx.server.config["gamemode"] = mode + ctx.server.save_runtime_config() + if ctx.server.config.get("force-gamemode", False): + from handlers.play.state import set_player_gamemode + for player in ctx.server.get_online_players(): + if player.gamemode != mode: + await set_player_gamemode(ctx.server, player, mode) + await ctx.success(translate("commands.defaultgamemode.success", + _gamemode_component(mode))) + return SUCCESS + + _command(manager, "defaultgamemode", _defaultgamemode, "command.defaultgamemode", + "defaultgamemode ") + + # ---------------- teleport ---------------- + def _looks_like_coord(token: str) -> bool: + if token.startswith(("~", "^")): + return True + try: + float(token) + return True + except ValueError: + return False + + def _coords(ctx: CommandContext, tokens: list[str], base) -> tuple | None: + from commands.arguments import parse_coordinate, resolve_coordinate + try: + out = [] + for index, token in enumerate(tokens[:3]): + parsed = parse_coordinate(token) + value = resolve_coordinate(parsed, base[index]) + # vanilla: integer x/z without a decimal point are block-centred + if index != 1 and token.lstrip("-").isdigit(): + value += 0.5 + out.append(value) + return tuple(out) + except (ValueError, IndexError): + return None + + async def _tp(ctx: CommandContext) -> int: + args = ctx.args + if not args: + return await _incomplete(ctx) + server = ctx.server + sender = ctx.sender + + if _looks_like_coord(args[0]): + # /tp + if sender is None: + return await ctx.fail(translate("permissions.requires.entity")) + if len(args) < 3: + return await _incomplete(ctx) + targets, coord_tokens, rest = [sender], args[0:3], args[3:] + elif len(args) == 1: + # /tp + if sender is None: + return await ctx.fail(translate("permissions.requires.entity")) + dest = await _entities(ctx, args[0]) + if dest is None: + return FAILURE + if len(dest) > 1: + return await ctx.fail(translate("argument.entity.toomany")) + await teleport(server, sender, dest[0].x, dest[0].y, dest[0].z, + dest[0].yaw, dest[0].pitch) + await ctx.success(translate("commands.teleport.success.entity.single", + _entity_name(sender), _entity_name(dest[0]))) + return SUCCESS + elif len(args) == 2: + # /tp + targets = await _entities(ctx, args[0]) + if targets is None: + return FAILURE + dest = await _entities(ctx, args[1]) + if dest is None: + return FAILURE + if len(dest) > 1: + return await ctx.fail(translate("argument.entity.toomany")) + for target in targets: + await teleport(server, target, dest[0].x, dest[0].y, dest[0].z, + dest[0].yaw, dest[0].pitch) + if len(targets) == 1: + await ctx.success(translate("commands.teleport.success.entity.single", + _entity_name(targets[0]), _entity_name(dest[0]))) + else: + await ctx.success(translate("commands.teleport.success.entity.multiple", + len(targets), _entity_name(dest[0]))) + return SUCCESS + else: + # /tp [ ] + targets = await _entities(ctx, args[0]) + if targets is None: + return FAILURE + if len(args) < 4: + return await _incomplete(ctx) + coord_tokens, rest = args[1:4], args[4:] + + base = ctx.get_sender_position() + position = _coords(ctx, coord_tokens, base) + if position is None: + return await ctx.fail(translate("argument.pos3d.incomplete")) + x, y, z = position + if abs(x) > 3.0e7 or abs(z) > 3.0e7 or not -2.0e7 <= y <= 2.0e7: + return await ctx.fail(translate("commands.teleport.invalidPosition")) + yaw = pitch = None + if len(rest) >= 2: + try: + yaw, pitch = float(rest[0].lstrip("~") or 0), float(rest[1].lstrip("~") or 0) + except ValueError: + yaw = pitch = None + for target in targets: + await teleport(server, target, x, y, z, yaw, pitch) + if len(targets) == 1: + await ctx.success(translate("commands.teleport.success.location.single", + _entity_name(targets[0]), _fmt(x), _fmt(y), _fmt(z))) + else: + await ctx.success(translate("commands.teleport.success.location.multiple", + len(targets), _fmt(x), _fmt(y), _fmt(z))) + return SUCCESS + + _command(manager, "tp", _tp, "command.tp", + "tp (|| ...)", aliases=["teleport"]) + + # ---------------- give ---------------- + async def _give(ctx: CommandContext) -> int: + from world.inventory import ItemStack, is_known_item, send_inventory_sync + args = ctx.args + if len(args) < 2: + return await _incomplete(ctx) + targets = await _players(ctx, args[0]) + if targets is None: + return FAILURE + item_id = args[1].split("[", 1)[0].split("{", 1)[0].lower() + if ":" not in item_id: + item_id = f"minecraft:{item_id}" + if not is_known_item(item_id) or item_id == "minecraft:air": + return await ctx.fail(translate("argument.item.id.invalid", item_id)) + count = 1 + if len(args) >= 3: + try: + count = int(args[2]) + except ValueError: + return await ctx.fail(translate("parsing.int.invalid", args[2])) + if count < 1: + return await ctx.fail(translate("argument.integer.low", 1, count)) + stack_size = ItemStack(item_id, 1).max_stack_size + if count > stack_size * 100: + return await ctx.fail(translate("commands.give.failed.toomanyitems", + stack_size * 100, _item_component(item_id))) + for target in targets: + inventory = getattr(target, "inventory_obj", None) + if inventory is None: + continue + leftover = inventory.add_item(ItemStack(item_id, count)) + target.inventory_state_id += 1 + await send_inventory_sync(target) + if leftover > 0: + # 物品栏放不下: 掉落在玩家脚下 (原版行为) + remaining = leftover + while remaining > 0: + drop = min(stack_size, remaining) + entity = ctx.server.entity_manager.create_item( + target.x, target.y + 0.5, target.z, item_id, drop) + entity.pickup_delay = 0 + remaining -= drop + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(ctx.server, target) + if len(targets) == 1: + await ctx.success(translate("commands.give.success.single", count, + _item_component(item_id), player_name(targets[0]))) + else: + await ctx.success(translate("commands.give.success.multiple", count, + _item_component(item_id), len(targets))) + return SUCCESS + + _command(manager, "give", _give, "command.give", "give []") + + # ---------------- clear ---------------- + async def _clear(ctx: CommandContext) -> int: + from world.inventory import send_inventory_sync + args = ctx.args + if args: + targets = await _players(ctx, args[0]) + if targets is None: + return FAILURE + elif ctx.sender is not None: + targets = [ctx.sender] + else: + return await ctx.fail(translate("permissions.requires.player")) + item_filter = None + if len(args) >= 2: + item_filter = args[1].lower() + if ":" not in item_filter: + item_filter = f"minecraft:{item_filter}" + max_count = -1 + if len(args) >= 3: + try: + max_count = max(0, int(args[2])) + except ValueError: + return await ctx.fail(translate("parsing.int.invalid", args[2])) + total = 0 + for target in targets: + inventory = getattr(target, "inventory_obj", None) + if inventory is None: + continue + if max_count == 0: + total += inventory.count_item(item_filter) if item_filter else sum( + s.count for s in inventory.slots if s is not None) + continue + removed = inventory.clear_items(item_filter, max_count) + if item_filter is None and getattr(inventory, "carried_item", None) is not None: + removed += inventory.carried_item.count + inventory.carried_item = None + total += removed + target.inventory_state_id += 1 + await send_inventory_sync(target) + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(ctx.server, target) + if total == 0: + if len(targets) == 1: + return await ctx.fail(translate("clear.failed.single", player_name(targets[0]))) + return await ctx.fail(translate("clear.failed.multiple", len(targets))) + prefix = "commands.clear.test" if max_count == 0 else "commands.clear.success" + if len(targets) == 1: + await ctx.success(translate(f"{prefix}.single", total, player_name(targets[0]))) + else: + await ctx.success(translate(f"{prefix}.multiple", total, len(targets))) + return SUCCESS + + _command(manager, "clear", _clear, "command.clear", "clear [] [] []") + + # ---------------- kill ---------------- + async def _kill(ctx: CommandContext) -> int: + from handlers.play.join import _kill_player + if ctx.args: + targets = await _entities(ctx, ctx.args[0]) + if targets is None: + return FAILURE + elif ctx.sender is not None: + targets = [ctx.sender] + else: + return await ctx.fail(translate("permissions.requires.entity")) + for target in targets: + if _is_player(target): + if not getattr(target, "_dead", False): + await _kill_player(target, ctx.server, translate( + "death.attack.genericKill", player_name(target))) + from handlers.play.join import _send_update_health + await _send_update_health(target) + elif getattr(target, "kind", "") == "mob": + from handlers.play.combat import damage_mob + damage_mob(ctx.server, target, float("inf")) + else: + ctx.server.entity_manager.remove_entity(target.entity_id) + if len(targets) == 1: + await ctx.success(translate("commands.kill.success.single", _entity_name(targets[0]))) + else: + await ctx.success(translate("commands.kill.success.multiple", len(targets))) + return SUCCESS + + _command(manager, "kill", _kill, "command.kill", "kill []") + + # ---------------- experience ---------------- + def _points_for_level(level: int) -> int: + if level >= 30: + return 112 + (level - 30) * 9 + if level >= 15: + return 37 + (level - 15) * 5 + return 7 + level * 2 + + def _total_for_level(level: int) -> int: + return sum(_points_for_level(i) for i in range(max(0, level))) + + async def _xp(ctx: CommandContext) -> int: + from handlers.play.join import _add_player_experience, _send_set_experience + args = ctx.args + if len(args) < 2: + return await _incomplete(ctx) + action = args[0].lower() + targets = await _players(ctx, args[1]) + if targets is None: + return FAILURE + if action == "query": + if len(args) < 3 or args[2].lower() not in ("points", "levels") or len(targets) > 1: + return await _incomplete(ctx) + target = targets[0] + if args[2].lower() == "levels": + await ctx.reply(translate("commands.experience.query.levels", + player_name(target), target.experience_level)) + else: + points = int(round(target.experience_progress + * _points_for_level(target.experience_level))) + await ctx.reply(translate("commands.experience.query.points", + player_name(target), points)) + return SUCCESS + if action not in ("add", "set") or len(args) < 3: + return await _incomplete(ctx) + try: + amount = int(args[2]) + except ValueError: + return await ctx.fail(translate("parsing.int.invalid", args[2])) + unit = args[3].lower() if len(args) >= 4 else "points" + if unit not in ("points", "levels"): + return await _incomplete(ctx) + if action == "set" and amount < 0: + return await ctx.fail(translate("argument.integer.low", 0, amount)) + for target in targets: + if unit == "levels": + level = amount if action == "set" else target.experience_level + amount + target.experience_level = max(0, level) + if target.experience_level == 0 and level < 0: + target.experience_progress = 0.0 + elif action == "set": + needed = _points_for_level(target.experience_level) + if amount >= needed: + return await ctx.fail(translate("commands.experience.set.points.invalid")) + target.experience_progress = amount / needed + elif amount >= 0: + await _add_player_experience(target, amount) + continue + else: + points = (_total_for_level(target.experience_level) + + int(round(target.experience_progress + * _points_for_level(target.experience_level))) + amount) + points = max(0, points) + level = 0 + while points >= _points_for_level(level): + points -= _points_for_level(level) + level += 1 + target.experience_level = level + target.experience_progress = points / _points_for_level(level) + target.experience_total = _total_for_level(target.experience_level) + int(round( + target.experience_progress * _points_for_level(target.experience_level))) + await _send_set_experience(target) + key = f"commands.experience.{action}.{unit}.success" + if len(targets) == 1: + await ctx.success(translate(f"{key}.single", amount, player_name(targets[0]))) + else: + await ctx.success(translate(f"{key}.multiple", amount, len(targets))) + return SUCCESS + + _command(manager, "xp", _xp, "command.xp", "xp (add|set|query) ...", + aliases=["experience"]) + + # ---------------- setworldspawn / spawnpoint ---------------- + def _block_pos(ctx: CommandContext, tokens: list[str]) -> tuple[int, int, int] | None: + if len(tokens) < 3: + if ctx.sender is None: + return None + return (math.floor(ctx.sender.x), math.floor(ctx.sender.y), math.floor(ctx.sender.z)) + return ctx.parse_int_coordinates(tokens, 0) + + async def _setworldspawn(ctx: CommandContext) -> int: + position = _block_pos(ctx, ctx.args) + if position is None: + return await _incomplete(ctx) + server = ctx.server + server.spawn_position = position + server._spawn_resolved = True + server.save_level_data() + from handlers.play.join import _send_spawn_position + for player in server.get_online_players(): + await _send_spawn_position(player, *position) + await ctx.success(translate("commands.setworldspawn.success", *position, _fmt(0.0))) + return SUCCESS + + _command(manager, "setworldspawn", _setworldspawn, "command.setworldspawn", + "setworldspawn []") + + async def _spawnpoint(ctx: CommandContext) -> int: + args = ctx.args + if args: + targets = await _players(ctx, args[0]) + if targets is None: + return FAILURE + elif ctx.sender is not None: + targets = [ctx.sender] + else: + return await ctx.fail(translate("permissions.requires.player")) + position = _block_pos(ctx, args[1:]) + if position is None: + return await _incomplete(ctx) + for target in targets: + target.personal_spawn = position + server_of(ctx).save_player_state(target) + if len(targets) == 1: + await ctx.success(translate("commands.spawnpoint.success.single", *position, + _fmt(0.0), "minecraft:overworld", player_name(targets[0]))) + else: + await ctx.success(translate("commands.spawnpoint.success.multiple", *position, + _fmt(0.0), "minecraft:overworld", len(targets))) + return SUCCESS + + _command(manager, "spawnpoint", _spawnpoint, "command.spawnpoint", + "spawnpoint [] []") + + # ---------------- summon ---------------- + async def _summon(ctx: CommandContext) -> int: + from world.entities import MOB_PROFILES + from handlers.play.entities import broadcast_entity_spawn + args = ctx.args + if not args: + return await _incomplete(ctx) + entity_type = args[0].lower().split(":", 1)[-1] + base = ctx.get_sender_position() + position = base + if len(args) >= 4: + position = ctx.parse_coordinates(args, 1) + if position is None: + return await ctx.fail(translate("argument.pos3d.incomplete")) + x, y, z = position + manager_ = ctx.server.entity_manager + if entity_type == "lightning_bolt": + entity = manager_.create_lightning(x, y, z) + elif entity_type in MOB_PROFILES: + entity = manager_.create_mob(x, y, z, mob_type=entity_type) + else: + from protocol.gamedata import entity_type_ids + if f"minecraft:{entity_type}" not in entity_type_ids(): + return await ctx.fail(translate("argument.resource.invalid_type", + f"minecraft:{entity_type}", + "minecraft:entity_type", "minecraft:entity_type")) + return await ctx.fail(translate("commands.summon.failed")) + await broadcast_entity_spawn(ctx.server, entity) + try: + from plugins.bridge import hook_entity_spawn + hook_entity_spawn(ctx.server, entity.entity_id, entity_type, x, y, z) + except Exception: + pass + await ctx.success(translate( + "commands.summon.success", + {"translate": f"entity.minecraft.{entity_type}", "fallback": entity_type})) + return SUCCESS + + _command(manager, "summon", _summon, "command.summon", "summon []") diff --git a/config.py b/config.py index 03a9e7a..40dd289 100755 --- a/config.py +++ b/config.py @@ -8,25 +8,48 @@ logger = logging.getLogger("PyMC.配置") -# 默认配置 +# 默认配置。 +# +# 键名、默认值与原版 1.21.1 的 server.properties 保持一致;PyMC 自己的 +# 扩展项排在后面。保存时与原版一样按键名排序写出。 DEFAULT_CONFIG = { - "server-ip": "0.0.0.0", - "server-port": 25565, - "motd": "PyMC - Python Minecraft 1.21.1 服务器", - "max-players": 20, - "online-mode": False, - "view-distance": 4, - "network-compression-threshold": 256, - "gamemode": "creative", - "difficulty": "normal", + # ---- 原版 (vanilla) ---- + "allow-flight": False, + "broadcast-console-to-ops": True, + "broadcast-rcon-to-ops": True, + "difficulty": "easy", + "enable-command-block": False, + "enable-rcon": False, + "enable-status": True, + "enforce-whitelist": False, + "force-gamemode": False, + "gamemode": "survival", + "hardcore": False, + "hide-online-players": False, "level-name": "world", - "level-type": "default", "level-seed": "", - "level-spawn-x": 0, - "level-spawn-y": 100, - "level-spawn-z": 0, - "spawn-protection": 0, - "enable-command-block": True, + "level-type": "minecraft:normal", + "log-ips": True, + "max-players": 20, + "motd": "A Minecraft Server", + "network-compression-threshold": 256, + "online-mode": False, + "op-permission-level": 4, + "player-idle-timeout": 0, + "pvp": True, + "rcon.password": "", + "rcon.port": 25575, + "server-ip": "", + "server-port": 25565, + "simulation-distance": 10, + "spawn-animals": True, + "spawn-monsters": True, + "spawn-protection": 16, + "view-distance": 10, + "white-list": False, + + # ---- PyMC 扩展 ---- + "debug": False, # 输出 DEBUG 级别日志 "web-admin-enabled": True, "web-admin-host": "127.0.0.1", "web-admin-port": 25568, @@ -50,8 +73,11 @@ "network-packet-batching": True, # Enable packet batching for reduced TCP writes "network-movement-rate-hz": 20.0, # Max position updates per second per player + # World storage: "anvil" (.mca, vanilla) or "linear" (.linear, needs zstandard) + "region-file-format": "anvil", + # Vanilla terrain generation - "vanilla-terrain": True, # Use the vanilla-style approximate terrain generator + "vanilla-terrain": True, # Python fallback generator when terrain_gen is missing # Redstone "redstone-enabled": True, # Enable redstone simulation @@ -62,71 +88,100 @@ # Mod and plugin directories "mods-directory": "mods", # Directory for PYMC native Python mods "plugins-directory": "plugins", # Directory for PYMC native Python plugins -} -# 类型映射 (用于自动转换配置值) -TYPE_MAP = { - "server-port": int, - "max-players": int, - "online-mode": lambda v: v.lower() in ("true", "1", "yes"), - "view-distance": int, - "network-compression-threshold": int, - "level-spawn-x": int, - "level-spawn-y": int, - "level-spawn-z": int, - "spawn-protection": int, - "enable-command-block": lambda v: v.lower() in ("true", "1", "yes"), - "web-admin-enabled": lambda v: v.lower() in ("true", "1", "yes"), - "web-admin-port": int, - "web-admin-allow-remote": lambda v: v.lower() in ("true", "1", "yes"), - "chunk-generation-multithreading": lambda v: v.lower() in ("true", "1", "yes"), - "chunk-generation-workers": int, - "join-immediate-radius": int, - "min-protocol-version": int, - "max-protocol-version": int, - - # Watchdog - "watchdog-enabled": lambda v: v.lower() in ("true", "1", "yes"), - "watchdog-health-port": int, - "watchdog-partner-pid": int, - "watchdog-max-missed-heartbeats": int, - - # Network optimization - "network-packet-batching": lambda v: v.lower() in ("true", "1", "yes"), - "network-movement-rate-hz": float, + # Tab list header/footer (empty = none, like vanilla) + "tab-list-header": "", + "tab-list-footer": "", +} - # Vanilla terrain / Redstone / Fluids - "vanilla-terrain": lambda v: v.lower() in ("true", "1", "yes"), - "redstone-enabled": lambda v: v.lower() in ("true", "1", "yes"), - "fluid-flow-enabled": lambda v: v.lower() in ("true", "1", "yes"), - # Mod and plugin directories (string, no conversion needed) -} +def _parse_bool(value: str) -> bool: + return value.strip().lower() in ("true", "1", "yes", "on") + + +# 类型映射 (用于自动转换配置值): 由默认值的类型推导 +TYPE_MAP = {} +for _key, _default in DEFAULT_CONFIG.items(): + if isinstance(_default, bool): + TYPE_MAP[_key] = _parse_bool + elif isinstance(_default, int): + TYPE_MAP[_key] = int + elif isinstance(_default, float): + TYPE_MAP[_key] = float +# 旧版本 PyMC 写入的出生点键 (现在保存在 level.dat 中, 仅作首次迁移用) +for _key in ("level-spawn-x", "level-spawn-y", "level-spawn-z"): + TYPE_MAP[_key] = int + +# 不再写回 server.properties 的旧键 +LEGACY_KEYS = {"level-spawn-x", "level-spawn-y", "level-spawn-z"} + + +def _unescape(value: str) -> str: + """解析 Java .properties 转义 (\\: \\= \\n \\uXXXX)。""" + if "\\" not in value: + return value + out = [] + i = 0 + while i < len(value): + ch = value[i] + if ch == "\\" and i + 1 < len(value): + nxt = value[i + 1] + if nxt == "u" and i + 5 < len(value) + 1: + try: + out.append(chr(int(value[i + 2:i + 6], 16))) + i += 6 + continue + except ValueError: + pass + out.append({"n": "\n", "t": "\t", "r": "\r"}.get(nxt, nxt)) + i += 2 + continue + out.append(ch) + i += 1 + return "".join(out) + + +def _escape(value: str) -> str: + """按 Java Properties.store 的规则转义值。""" + out = [] + for i, ch in enumerate(value): + if ch == "\\": + out.append("\\\\") + elif ch == "\n": + out.append("\\n") + elif ch in ":=#!": + out.append("\\" + ch) + elif ch == " " and i == 0: + out.append("\\ ") + else: + out.append(ch) + return "".join(out) def load_config(filepath: str = "server.properties") -> dict: """ 加载服务器配置文件。 - 如果文件不存在则创建默认配置。 - + 如果文件不存在则创建默认配置;缺失的键会用默认值补齐并写回。 + 返回: 配置字典 """ config = dict(DEFAULT_CONFIG) + seen: set[str] = set() if os.path.exists(filepath): - logger.info(f"正在加载配置文件: {filepath}") + logger.debug(f"正在加载配置文件: {filepath}") try: with open(filepath, 'r', encoding='utf-8') as f: for line in f: line = line.strip() # 跳过空行和注释 - if not line or line.startswith('#'): + if not line or line.startswith('#') or line.startswith('!'): continue if '=' in line: key, value = line.split('=', 1) key = key.strip() - value = value.strip() + value = _unescape(value.strip()) # 类型转换 if key in TYPE_MAP: @@ -137,29 +192,35 @@ def load_config(filepath: str = "server.properties") -> dict: continue config[key] = value + seen.add(key) except Exception as e: logger.error(f"读取配置文件失败: {e},使用默认配置") + if any(key not in seen for key in DEFAULT_CONFIG): + save_config(config, filepath) else: - logger.info(f"配置文件不存在,正在创建默认配置: {filepath}") save_config(config, filepath) return config def save_config(config: dict, filepath: str = "server.properties"): - """保存配置到文件。""" + """保存配置到文件 (原版格式: 两行注释头 + 按键名排序)。""" + import time try: with open(filepath, 'w', encoding='utf-8') as f: - f.write("# ============================================================\n") - f.write("# PyMC 服务器配置文件\n") - f.write("# Minecraft 1.21.1 服务端\n") - f.write("# ============================================================\n\n") + f.write("#Minecraft server properties\n") + f.write(time.strftime("#%a %b %d %H:%M:%S %Z %Y\n")) - for key, value in config.items(): + for key in sorted(config): + if key in LEGACY_KEYS: + continue + value = config[key] if isinstance(value, bool): value = "true" if value else "false" - f.write(f"{key}={value}\n") + elif isinstance(value, float) and value.is_integer(): + value = int(value) + f.write(f"{key}={_escape(str(value))}\n") - logger.info(f"配置文件已保存: {filepath}") + logger.debug(f"配置文件已保存: {filepath}") except Exception as e: logger.error(f"保存配置文件失败: {e}") diff --git a/handlers/configuration.py b/handlers/configuration.py index 2db2578..d2f3a71 100755 --- a/handlers/configuration.py +++ b/handlers/configuration.py @@ -18,117 +18,105 @@ logger = logging.getLogger("PyMC.配置") -def _build_damage_type_registry() -> dict: - """ - 构建 1.21.1 所需的基础伤害类型注册表。 - - 客户端在进入世界时会初始化 DamageSources。 - 如果缺少 vanilla 预期的 key(例如 minecraft:in_fire), - 客户端或某些客户端模组会在收到 Join Game 包后直接崩溃。 - """ - damage_keys = [ - "in_fire", - "campfire", - "lightning_bolt", - "on_fire", - "lava", - "hot_floor", - "in_wall", - "cramming", - "drown", - "starve", - "cactus", - "fall", - "fly_into_wall", - "out_of_world", - "generic", - "magic", - "wither", - "dragon_breath", - "dry_out", - "sweet_berry_bush", - "freeze", - "stalagmite", - "falling_block", - "falling_anvil", - "falling_stalactite", - "sting", - "mob_attack", - "mob_attack_no_aggro", - "player_attack", - "arrow", - "trident", - "mob_projectile", - "spit", - "wind_charge", - "fireworks", - "fireball", - "unattributed_fireball", - "wither_skull", - "thrown", - "indirect_magic", - "thorns", - "explosion", - "player_explosion", - "sonic_boom", - "bad_respawn_point", - "outside_border", - "generic_kill", - ] - - return { - f"minecraft:{key}": { - "message_id": key, - "scaling": "never", - "exhaustion": NbtFloat(0.0), - } - for key in damage_keys - } - - async def handle_configuration(conn: Connection, packet_id: int, payload: bytes, server): - """处理配置阶段的数据包。""" + """处理配置阶段的数据包 (serverbound, 1.20.5+ 编号)。""" if packet_id == 0x00: # Client Information - 客户端设置信息 - logger.debug(f"收到客户端设置信息: {conn.username}") + parse_client_information(conn, payload) - elif packet_id == 0x01: + elif packet_id == 0x02: # Custom Payload (Plugin Message) - 品牌信息等 - logger.debug(f"收到插件消息: {conn.username}") + _handle_plugin_message(conn, payload) elif packet_id == 0x03: # Finish Configuration - 客户端确认配置完成 await _handle_finish_configuration(conn, server) + elif packet_id == 0x04: + # Keep Alive + pass + elif packet_id == 0x07: # Known Packs - logger.debug(f"收到已知资源包信息: {conn.username}") + logger.debug(f"收到已知数据包信息: {conn.username}") else: logger.debug(f"配置阶段忽略数据包: 0x{packet_id:02X}") +def parse_client_information(conn: Connection, payload: bytes) -> None: + """ + 解析 Client Information (配置阶段 0x00 / 游戏阶段 client_settings)。 + + Locale(String) ViewDistance(Byte) ChatMode(VarInt) ChatColors(Bool) + SkinParts(UByte) MainHand(VarInt) TextFiltering(Bool) AllowListing(Bool) + """ + from protocol.data_types import read_string, read_varint + try: + offset = 0 + locale, offset = read_string(payload, offset) + view_distance = payload[offset] + if view_distance >= 128: + view_distance -= 256 + offset += 1 + _chat_mode, offset = read_varint(payload, offset) + offset += 1 # chat colors + skin_parts = payload[offset] + offset += 1 + main_hand, offset = read_varint(payload, offset) + offset += 1 # text filtering + allow_listing = bool(payload[offset]) if offset < len(payload) else True + except (IndexError, ValueError) as e: + logger.debug(f"无法解析客户端设置 [{conn.username}]: {e}") + return + conn.locale = locale + conn.client_view_distance = max(0, int(view_distance)) + conn.skin_parts = skin_parts & 0x7F + conn.main_hand = main_hand + conn.allow_server_listing = allow_listing + + +def _handle_plugin_message(conn: Connection, payload: bytes) -> None: + from protocol.data_types import read_string + try: + channel, offset = read_string(payload, 0) + if channel == "minecraft:brand": + conn.client_brand, _ = read_string(payload, offset) + except (IndexError, ValueError, UnicodeDecodeError): + pass + + async def send_configuration_packets(conn: Connection, server): """ 发送配置阶段所需的所有数据包。 仅在 1.20.2+ (配置阶段) 时调用。 + + 顺序与原版服务端一致: + brand -> feature flags -> known packs -> registry data -> tags -> finish """ if not has_configuration_phase(conn.protocol_version): logger.warning(f"尝试为不支持配置阶段的客户端 (协议 {conn.protocol_version}) 发送配置数据包") return - # 1. 发送服务端品牌信息 - await _send_plugin_message(conn, "minecraft:brand", b'\x04PyMC') + # 1. 服务端品牌信息 + brand = server.config.get("server-brand", "PyMC") if server is not None else "PyMC" + await _send_plugin_message(conn, "minecraft:brand", write_string(str(brand))) - # 2. 发送已知资源包 (Known Packs) + # 2. 启用的特性开关 + await _send_feature_flags(conn, ["minecraft:vanilla"]) + + # 3. 已知数据包 (Known Packs) await _send_known_packs(conn) - # 3. 发送注册表数据 (Registry Data) + # 4. 注册表数据 (Registry Data) await _send_registry_data(conn) - # 4. 发送完成配置信号 + # 5. 标签 (Update Tags) —— 游泳、攀爬、工具挖掘速度等都依赖标签 + await _send_tags(conn) + + # 6. 完成配置 await _send_finish_configuration(conn) @@ -138,17 +126,23 @@ async def _send_plugin_message(conn: Connection, channel: str, data: bytes): await conn.send_packet(0x01, payload) +async def _send_feature_flags(conn: Connection, flags: list[str]): + """发送 Feature Flags 数据包 (配置阶段: 0x0C)。""" + payload = bytearray(write_varint(len(flags))) + for flag in flags: + payload.extend(write_identifier(flag)) + await conn.send_packet(0x0C, bytes(payload)) + + async def _send_known_packs(conn: Connection): """ 发送 Known Packs 数据包 (0x0E)。 - 告诉客户端服务器知道的资源包。 + 告诉客户端服务器知道的数据包。 """ - # Adjust version string based on client protocol from protocol.versions import get_version_name version_str = get_version_name(conn.protocol_version) payload = bytearray() - # 已知包数量: 1 (核心资源包) payload.extend(write_varint(1)) payload.extend(write_string("minecraft")) # 命名空间 payload.extend(write_string("core")) # ID @@ -156,135 +150,72 @@ async def _send_known_packs(conn: Connection): await conn.send_packet(0x0E, bytes(payload)) -async def _send_registry_data(conn: Connection): +def build_registry_data_payloads() -> list[bytes]: """ - 发送所有必需的注册表数据。 - 1.20.2+ 使用 Registry Data 数据包 (0x07) 逐个发送注册表。 + 构建全部 Registry Data (0x07) 负载。 + + 内容来自原版 1.21.1 数据 (protocol/data/registries_767.json),包含完整的 + 维度类型、生物群系、聊天类型、伤害类型、附魔、画、狼变种、盔甲纹饰、 + 旗帜图案和唱片注册表。条目顺序即客户端分配的数字 ID。 """ + from protocol.gamedata import synced_registries + + payloads = [] + for registry_id, entries in synced_registries().items(): + payload = bytearray() + payload.extend(write_identifier(registry_id)) + payload.extend(write_varint(len(entries))) + for entry_id, nbt_bytes in entries: + payload.extend(write_identifier(entry_id)) + payload.extend(write_boolean(True)) # 附带数据 + payload.extend(nbt_bytes) + payloads.append(bytes(payload)) + return payloads + - # --- 维度类型注册表 --- - await _send_single_registry(conn, "minecraft:dimension_type", { - "minecraft:overworld": { - "has_skylight": NbtByte(1), - "has_ceiling": NbtByte(0), - "ultrawarm": NbtByte(0), - "natural": NbtByte(1), - "coordinate_scale": NbtDouble(1.0), - "bed_works": NbtByte(1), - "respawn_anchor_works": NbtByte(0), - "min_y": 0, - "height": 384, - "logical_height": 384, - "infiniburn": "#minecraft:infiniburn_overworld", - "effects": "minecraft:overworld", - "ambient_light": NbtFloat(0.0), - "piglin_safe": NbtByte(0), - "has_raids": NbtByte(1), - "monster_spawn_light_level": 0, - "monster_spawn_block_light_limit": 0, - }, - "minecraft:the_nether": { - "has_skylight": NbtByte(0), - "has_ceiling": NbtByte(1), - "ultrawarm": NbtByte(1), - "natural": NbtByte(0), - "coordinate_scale": NbtDouble(8.0), - "bed_works": NbtByte(0), - "respawn_anchor_works": NbtByte(1), - "min_y": 0, - "height": 256, - "logical_height": 128, - "infiniburn": "#minecraft:infiniburn_nether", - "effects": "minecraft:the_nether", - "ambient_light": NbtFloat(0.1), - "piglin_safe": NbtByte(1), - "has_raids": NbtByte(0), - "monster_spawn_light_level": 7, - "monster_spawn_block_light_limit": 15, - "fixed_time": NbtLong(18000), - }, - "minecraft:the_end": { - "has_skylight": NbtByte(0), - "has_ceiling": NbtByte(0), - "ultrawarm": NbtByte(0), - "natural": NbtByte(0), - "coordinate_scale": NbtDouble(1.0), - "bed_works": NbtByte(0), - "respawn_anchor_works": NbtByte(0), - "min_y": 0, - "height": 256, - "logical_height": 256, - "infiniburn": "#minecraft:infiniburn_end", - "effects": "minecraft:the_end", - "ambient_light": NbtFloat(0.0), - "piglin_safe": NbtByte(0), - "has_raids": NbtByte(1), - "monster_spawn_light_level": 0, - "monster_spawn_block_light_limit": 0, - "fixed_time": NbtLong(6000), - }, - }) - - # --- 生物群系注册表 --- - await _send_single_registry( - conn, - "minecraft:worldgen/biome", - build_biome_registry_entries() - ) - - # --- 聊天类型注册表 --- - await _send_single_registry(conn, "minecraft:chat_type", { - "minecraft:chat": { - "chat": { - "translation_key": "chat.type.text", - "parameters": ["sender", "content"], - }, - "narration": { - "translation_key": "chat.type.text.narrate", - "parameters": ["sender", "content"], - } - }, - }) - - # --- 伤害类型注册表 --- - await _send_single_registry( - conn, - "minecraft:damage_type", - _build_damage_type_registry() - ) - - # --- 画作种类注册表 (可为空但必须发送) --- - await _send_single_registry(conn, "minecraft:painting_variant", { - "minecraft:kebab": { - "asset_id": "minecraft:kebab", - "width": 1, - "height": 1, - }, - }) - - # --- 狼变种注册表 --- - await _send_single_registry(conn, "minecraft:wolf_variant", { - "minecraft:pale": { - "wild_texture": "minecraft:entity/wolf/wolf", - "tame_texture": "minecraft:entity/wolf/wolf_tame", - "angry_texture": "minecraft:entity/wolf/wolf_angry", - "biomes": "minecraft:plains", - }, - }) +_REGISTRY_PAYLOAD_CACHE: list[bytes] | None = None +_TAGS_PAYLOAD_CACHE: bytes | None = None + + +async def _send_registry_data(conn: Connection): + """逐个发送所有同步注册表 (Registry Data, 0x07)。""" + global _REGISTRY_PAYLOAD_CACHE + if _REGISTRY_PAYLOAD_CACHE is None: + _REGISTRY_PAYLOAD_CACHE = build_registry_data_payloads() + for payload in _REGISTRY_PAYLOAD_CACHE: + await conn.send_packet(0x07, payload) + + +def build_tags_payload() -> bytes: + """构建 Update Tags 负载: [registry -> [tag -> [numeric id]]]。""" + from protocol.gamedata import tags + + all_tags = tags() + payload = bytearray(write_varint(len(all_tags))) + for registry_id, registry_tags in all_tags.items(): + payload.extend(write_identifier(registry_id)) + payload.extend(write_varint(len(registry_tags))) + for tag_name, ids in registry_tags.items(): + payload.extend(write_identifier(tag_name)) + payload.extend(write_varint(len(ids))) + for numeric_id in ids: + payload.extend(write_varint(numeric_id)) + return bytes(payload) + + +async def _send_tags(conn: Connection): + """发送 Update Tags 数据包 (配置阶段: 0x0D)。""" + global _TAGS_PAYLOAD_CACHE + if _TAGS_PAYLOAD_CACHE is None: + _TAGS_PAYLOAD_CACHE = build_tags_payload() + await conn.send_packet(0x0D, _TAGS_PAYLOAD_CACHE) async def _send_single_registry(conn: Connection, registry_id: str, entries: dict): """ - 发送单个注册表的 Registry Data 数据包 (0x07)。 - - 格式: - - Identifier: 注册表 ID - - VarInt: 条目数量 - - 每个条目: - - Identifier: 条目 ID - - Boolean: 是否有数据 - - NBT: 条目数据 (如果有) + 发送单个注册表的 Registry Data 数据包 (0x07),条目为 Python dict。 + 供插件/Mod 追加自定义注册表条目使用。 """ payload = bytearray() payload.extend(write_identifier(registry_id)) @@ -309,7 +240,7 @@ async def _handle_finish_configuration(conn: Connection, server): 客户端确认配置完成,进入游戏阶段。 """ conn.state = ConnectionState.PLAY - logger.info(f"玩家 {conn.username} 完成配置,进入游戏") + logger.debug(f"玩家 {conn.username} 完成配置,进入游戏") # 发送 Play 阶段的初始数据包 from handlers.play import send_join_game diff --git a/handlers/handshake.py b/handlers/handshake.py index 59d47af..72867eb 100755 --- a/handlers/handshake.py +++ b/handlers/handshake.py @@ -40,7 +40,7 @@ async def handle_handshake(conn: Connection, packet_id: int, payload: bytes): conn.protocol_version = protocol_version conn.mc_version = get_version_name(protocol_version) - logger.info(f"握手: 协议版本={protocol_version} ({conn.mc_version}), " + logger.debug(f"握手: 协议版本={protocol_version} ({conn.mc_version}), " f"地址={server_address}:{server_port}, " f"下一状态={next_state}") @@ -66,5 +66,5 @@ def _setup_version_handler(conn: Connection): from handlers.versioned import get_version_handler conn.version_handler = get_version_handler(conn.protocol_version) handler_name = conn.version_handler.__class__.__name__ - logger.info(f"已为 {conn.mc_version} (协议 {conn.protocol_version}) " + logger.debug(f"已为 {conn.mc_version} (协议 {conn.protocol_version}) " f"加载版本处理器: {handler_name}") diff --git a/handlers/login.py b/handlers/login.py index cbc0f76..0447241 100755 --- a/handlers/login.py +++ b/handlers/login.py @@ -26,6 +26,10 @@ async def handle_login(conn: Connection, packet_id: int, payload: bytes, # Login Start await _handle_login_start(conn, payload, server) + elif packet_id == 0x01: + # Encryption Response (online-mode) + await _handle_encryption_response(conn, payload, server) + elif packet_id == 0x03: # Login Acknowledged - 客户端确认登录成功,进入配置阶段 # Only for 1.20.2+ (configuration phase) @@ -35,6 +39,11 @@ async def handle_login(conn: Connection, packet_id: int, payload: bytes, logger.debug(f"登录阶段忽略数据包: 0x{packet_id:02X}") +def _is_valid_username(username: str) -> bool: + return 1 <= len(username) <= 16 and all( + ch.isascii() and (ch.isalnum() or ch == "_") for ch in username) + + async def _handle_login_start(conn: Connection, payload: bytes, server): """ 处理 Login Start 数据包 (0x00)。 @@ -55,9 +64,23 @@ async def _handle_login_start(conn: Connection, payload: bytes, server): except (ValueError, IndexError): player_uuid = None + from protocol.text import translate + from protocol.versions import NATIVE_PROTOCOL_VERSION, get_version_name + auth_log = logging.getLogger("minecraft.auth") + + # 原版: 用户名必须是 1-16 位的 [A-Za-z0-9_] + if not _is_valid_username(username): + conn.username = "" + await _send_disconnect_login(conn, translate("multiplayer.disconnect.invalid_player_data")) + return + conn.username = username - logger.info(f"玩家 {username} 正在登录... (来自 {conn.address}, " - f"版本 {conn.mc_version}, 协议 {conn.protocol_version})") + logger.debug(f"玩家 {username} 正在登录... (来自 {conn.address}, " + f"版本 {conn.mc_version}, 协议 {conn.protocol_version})") + + if not getattr(server, "accepting_players", True): + await _send_disconnect_login(conn, {"text": "Server is still starting! Please wait before reconnecting."}) + return # Check if this protocol version is allowed by server config min_version = int(server.config.get("min-protocol-version", 47)) @@ -69,26 +92,113 @@ async def _handle_login_start(conn: Connection, payload: bytes, server): ) if (not is_supported(conn.protocol_version) or conn.protocol_version not in allowed_versions): - logger.info(f"拒绝玩家 {username}: 协议版本 {conn.protocol_version} " - f"不在允许范围 [{min_version}, {max_version}]") - await _send_disconnect_login(conn, f"Your protocol version ({conn.protocol_version}) is not supported.") + native_name = get_version_name(NATIVE_PROTOCOL_VERSION) + key = ("multiplayer.disconnect.outdated_client" + if conn.protocol_version < NATIVE_PROTOCOL_VERSION + else "multiplayer.disconnect.incompatible") + auth_log.info(f"Disconnecting {username} ({conn.address}): " + f"unsupported protocol version {conn.protocol_version}") + await conn.disconnect(translate(key, native_name), log=False) + return + + ip = conn.address.rsplit(":", 1)[0] + deny_reason = server.permissions.check_login(username, ip) + if deny_reason is None and len(server.get_online_players()) >= int(server.max_players) \ + and not server.permissions.is_op(username): + deny_reason = translate("multiplayer.disconnect.server_full") + if deny_reason is not None: + from protocol.text import plain_text + auth_log.info(f"Disconnecting {username} ({conn.address}): {plain_text(deny_reason)}") + await conn.disconnect(deny_reason, log=False) + return + + # 同名玩家已在线: 与原版一样踢掉旧连接 + existing = server.find_player(username) + if existing is not None and existing is not conn: + await existing.disconnect(translate("multiplayer.disconnect.duplicate_login")) + + if server.online_mode: + # 正版验证: 发送 Encryption Request, 等待 Encryption Response + await _send_encryption_request(conn, server) return - ip = conn.address.split(":", 1)[0] - deny_reason = server.permissions.check_login_allowed(username, ip) - if deny_reason: - logger.info(f"拒绝玩家 {username} 登录: {deny_reason}") + # 离线模式: 根据用户名生成 UUID (与原版一致) + conn.uuid = conn.generate_offline_uuid() + await _complete_login(conn, server) + + +async def _send_encryption_request(conn: Connection, server): + """Encryption Request (0x01): server id + RSA 公钥 + verify token。""" + import os + conn.verify_token = os.urandom(4) + public_key = server.keypair.public_der + payload = bytearray() + payload.extend(write_string("")) # server id (空) + payload.extend(write_varint(len(public_key))) + payload.extend(public_key) + payload.extend(write_varint(len(conn.verify_token))) + payload.extend(conn.verify_token) + if conn.protocol_version >= 766: + payload.extend(write_boolean(True)) # should authenticate + await conn.send_packet(0x01, bytes(payload)) + + +async def _handle_encryption_response(conn: Connection, payload: bytes, server): + """Encryption Response (0x01): 启用加密并向会话服务器验证玩家身份。""" + from network import encryption + from protocol.text import translate + auth_log = logging.getLogger("minecraft.auth") + + if not server.online_mode or not conn.verify_token or not conn.username: + await conn.disconnect(translate("multiplayer.disconnect.unexpected_query_response")) + return + try: + offset = 0 + length, offset = read_varint(payload, offset) + encrypted_secret = payload[offset:offset + length] + offset += length + length, offset = read_varint(payload, offset) + encrypted_token = payload[offset:offset + length] + shared_secret = server.keypair.decrypt(encrypted_secret) + token = server.keypair.decrypt(encrypted_token) + except Exception: + await conn.disconnect(translate("multiplayer.disconnect.invalid_public_key_signature")) + return + if token != conn.verify_token or len(shared_secret) != 16: + await conn.disconnect(translate("multiplayer.disconnect.invalid_public_key_signature")) + return + conn.verify_token = b"" + conn.enable_encryption(shared_secret) + + server_hash = encryption.server_id_hash("", shared_secret, server.keypair.public_der) + try: + profile = await encryption.has_joined(conn.username, server_hash) + except Exception as e: + auth_log.error(f"Couldn't verify username because servers are unavailable: {e}") + await conn.disconnect(translate("multiplayer.disconnect.authservers_down")) + return + if not profile or not profile.get("id"): + auth_log.error(f"Username '{conn.username}' tried to join with an invalid session") + await conn.disconnect(translate("multiplayer.disconnect.unverified_username")) + return + + conn.uuid = uuid.UUID(profile["id"]) + conn.username = profile.get("name", conn.username) + conn.profile_properties = list(profile.get("properties", [])) + + # 验证后的真实名字再做一次封禁/白名单检查 + ip = conn.address.rsplit(":", 1)[0] + deny_reason = server.permissions.check_login(conn.username, ip) + if deny_reason is not None: await conn.disconnect(deny_reason) return + await _complete_login(conn, server) - # 离线模式: 根据用户名生成 UUID - if not server.online_mode: - conn.uuid = conn.generate_offline_uuid() - else: - if player_uuid is not None: - conn.uuid = player_uuid - else: - conn.uuid = conn.generate_offline_uuid() + +async def _complete_login(conn: Connection, server): + """分配实体 ID、启用压缩并发送 Login Success。""" + username = conn.username + auth_log = logging.getLogger("minecraft.auth") # 分配实体 ID conn.entity_id = server.get_next_entity_id() @@ -97,11 +207,10 @@ async def _handle_login_start(conn: Connection, payload: bytes, server): if server.compression_threshold >= 0: await _send_set_compression(conn, server.compression_threshold) conn.compression_threshold = server.compression_threshold - logger.info(f"已为 {username} 启用压缩 (阈值: {server.compression_threshold} 字节)") # 发送 Login Success await _send_login_success(conn) - logger.info(f"玩家 {username} 登录成功 (UUID: {conn.uuid}, 实体ID: {conn.entity_id})") + auth_log.info(f"UUID of player {username} is {conn.uuid}") # Handle post-login transition based on version if has_configuration_phase(conn.protocol_version): @@ -111,7 +220,6 @@ async def _handle_login_start(conn: Connection, payload: bytes, server): else: # Pre-1.20.2: Go directly to play phase conn.state = ConnectionState.PLAY - logger.info(f"玩家 {username} 直接进入游戏阶段 (无配置阶段)") # Send join game directly from handlers.play import send_join_game @@ -146,7 +254,16 @@ async def _send_login_success(conn: Connection): payload.extend(write_string(conn.username)) if conn.protocol_version >= 761: - payload.extend(write_varint(0)) # Empty profile properties + # Profile properties (online-mode 下包含带签名的皮肤 textures) + properties = getattr(conn, "profile_properties", None) or [] + payload.extend(write_varint(len(properties))) + for prop in properties: + payload.extend(write_string(prop.get("name", ""))) + payload.extend(write_string(prop.get("value", ""))) + signature = prop.get("signature") + payload.extend(write_boolean(signature is not None)) + if signature is not None: + payload.extend(write_string(signature)) if conn.protocol_version == 767: payload.extend(write_boolean(True)) @@ -154,12 +271,8 @@ async def _send_login_success(conn: Connection): await conn.send_packet(0x02, bytes(payload)) -async def _send_disconnect_login(conn: Connection, reason: str): - """Send a Login Disconnect packet (0x00).""" - import json - chat_json = json.dumps({"text": reason}, ensure_ascii=False) - payload = write_string(chat_json) - await conn.send_packet(0x00, payload) +async def _send_disconnect_login(conn: Connection, reason): + """Send a Login Disconnect packet (0x00) and close the connection.""" await conn.disconnect(reason) @@ -175,7 +288,7 @@ async def _handle_login_acknowledged(conn: Connection, server): return conn.state = ConnectionState.CONFIGURATION - logger.info(f"玩家 {conn.username} 进入配置阶段") + logger.debug(f"玩家 {conn.username} 进入配置阶段") # 发送配置阶段所需的数据包 from handlers.configuration import send_configuration_packets diff --git a/handlers/play/__init__.py b/handlers/play/__init__.py index 1173ab8..2a6e2e1 100755 --- a/handlers/play/__init__.py +++ b/handlers/play/__init__.py @@ -203,110 +203,212 @@ def _is_serverbound_packet(conn: Connection, packet_id: int, def _player_window_slot_to_inventory(slot: int) -> int | None: """Translate protocol window-0 slots to PlayerInventory indices.""" - if slot == 0: # crafting output - return 45 - if 1 <= slot <= 4: # 2x2 crafting input - return 40 + slot - if 5 <= slot <= 8: # helmet, chest, legs, boots - return 44 - slot - if 9 <= slot <= 35: # main inventory - return slot - if 36 <= slot <= 44: # hotbar - return slot - 36 - if slot == 45: # offhand - return 40 - return None + from world.inventory import window_slot_to_inventory + return window_slot_to_inventory(slot) + + +_REVERSE_MAPS: dict[int, dict[int, str]] = {} + + +def _serverbound_name(conn: Connection, packet_id: int) -> str | None: + """把客户端数据包 ID 解析为逻辑名称 (按连接协商的协议版本)。""" + from protocol.packet_map import SERVERBOUND_PACKETS, build_serverbound_reverse_map + version = conn.protocol_version + if version not in SERVERBOUND_PACKETS: + return None + reverse = _REVERSE_MAPS.get(version) + if reverse is None: + reverse = _REVERSE_MAPS[version] = build_serverbound_reverse_map(version) + return reverse.get(packet_id) async def handle_play(conn: Connection, packet_id: int, payload: bytes, server): """分发 Play 阶段的客户端数据包。""" - - # Handle respawn: if player is dead, only accept confirm_teleportation - # In 1.21.1, the client sends Client Status (action=0) to respawn. - # We treat any packet while dead as a respawn request. - if getattr(conn, '_dead', False): - if packet_id == 0x00: # Confirm Teleportation - _handle_confirm_teleportation(conn, payload) - else: - await _handle_respawn(conn, server) + name = _serverbound_name(conn, packet_id) + if name is None: return - if _is_serverbound_packet(conn, packet_id, "confirm_teleportation", 0x00): - # Confirm Teleportation + if name == "keep_alive": + _handle_keepalive(conn, payload) + return + if name == "confirm_teleportation": _handle_confirm_teleportation(conn, payload) + return + if name == "client_command": + await _handle_client_command(conn, payload, server) + return + if name == "client_settings": + await _handle_client_settings(conn, payload, server) + return + if name == "custom_payload": + from handlers.configuration import _handle_plugin_message + _handle_plugin_message(conn, payload) + return + if name == "ping_request": + from protocol.packet_map import get_clientbound_packet + pid = get_clientbound_packet(conn.protocol_version, "ping_response") + if pid is not None: + await conn.send_packet(pid, payload[:8]) + return + if name in ("chunk_batch_received", "pong", "chat_session_update", + "configuration_acknowledged"): + return - elif _is_serverbound_packet(conn, packet_id, "chat_command", 0x05): - # Chat Command - await _handle_chat_command(conn, payload, server) + # 死亡后只接受重生请求和聊天/命令; 忽略移动、交互等动作 + if getattr(conn, '_dead', False) and name not in ( + "chat_message", "chat_command", "signed_chat_command", "tab_complete"): + return - elif _is_serverbound_packet(conn, packet_id, "signed_chat_command", 0x06): - # Signed Chat Command - await _handle_chat_command(conn, payload, server) + import time as _time + if name not in ("player_on_ground",): + conn.last_active = _time.monotonic() - elif _is_serverbound_packet(conn, packet_id, "chat_message", 0x07): - # Chat Message (聊天消息) + if name in ("chat_command", "signed_chat_command"): + await _handle_chat_command(conn, payload, server) + elif name == "chat_message": await _handle_chat_message(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "chunk_batch_received", 0x09): - # Chunk Batch Received (客户端确认区块批次) - pass # 不需要特殊处理 - - elif _is_serverbound_packet(conn, packet_id, "keep_alive", 0x1A): - # Keep Alive - _handle_keepalive(conn, payload) - - elif _is_serverbound_packet(conn, packet_id, "player_position", 0x1C): - # Player Position + elif name == "tab_complete": + await _handle_tab_complete(conn, payload, server) + elif name == "player_position": await _handle_player_position(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "player_position_rotation", 0x1D): - # Player Position and Rotation + elif name == "player_position_rotation": await _handle_player_position_rotation(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "player_rotation", 0x1E): - # Player Rotation + elif name == "player_rotation": await _handle_player_rotation(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "player_on_ground", 0x1F): - # Player On Ground + elif name == "player_on_ground": await _handle_player_on_ground(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "block_dig", 0x26): - # Block Dig + elif name == "block_dig": await _handle_block_dig(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "held_item_slot", 0x31): - # Held Item Slot + elif name == "held_item_slot": _handle_held_item_slot(conn, payload) - - elif _is_serverbound_packet(conn, packet_id, "block_place", 0x3A): - # Use Item On / Block Place + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) + elif name == "block_place": await _handle_block_place(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "click_container", 0x0C): - # Click Container (window click) + elif name == "click_container": await _handle_click_container(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "close_container", 0x0D): - # Close Container + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) + elif name == "close_container": _handle_close_container(conn, payload) - - elif _is_serverbound_packet(conn, packet_id, "interact", 0x14): - # Interact (Entity): 攻击动作由战斗系统处理 + elif name == "interact": await _handle_interact(conn, payload, server) - - elif _is_serverbound_packet(conn, packet_id, "set_creative_mode_slot", 0x22): - # Set Creative Mode Slot + elif name == "set_creative_mode_slot": await _handle_creative_inventory_action(conn, payload, server) + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) + elif name == "entity_action": + await _handle_entity_action(conn, payload, server) + elif name == "arm_animation": + await _handle_arm_animation(conn, payload, server) + elif name == "player_abilities": + _handle_player_abilities(conn, payload) + elif name == "use_item": + pass # TODO: item use in air (eating, bows, ...) + + +async def _handle_client_command(conn: Connection, payload: bytes, server): + """Client Command: 0 = Perform Respawn, 1 = Request Stats。""" + from protocol.data_types import read_varint, write_varint + action, _ = read_varint(payload, 0) + if action == 0: + if getattr(conn, '_dead', False): + await _handle_respawn(conn, server) + elif action == 1: + from protocol.packet_map import get_clientbound_packet + pid = get_clientbound_packet(conn.protocol_version, "statistics") + if pid is not None: + await conn.send_packet(pid, write_varint(0)) + + +async def _handle_client_settings(conn: Connection, payload: bytes, server): + """游戏内修改设置 (视距/皮肤层/主手): 重新同步给其他玩家。""" + from handlers.configuration import parse_client_information + old_parts = conn.skin_parts + parse_client_information(conn, payload) + if conn.skin_parts != old_parts: + from handlers.play.players import broadcast_player_metadata + await broadcast_player_metadata(server, conn) + + +async def _handle_tab_complete(conn: Connection, payload: bytes, server): + """Command Suggestions Request -> Command Suggestions Response。""" + from protocol.data_types import read_varint, read_string, write_varint, write_string, write_boolean + from protocol.packet_map import get_clientbound_packet + transaction_id, offset = read_varint(payload, 0) + text, _ = read_string(payload, offset) + manager = getattr(server, "command_manager", None) + pid = get_clientbound_packet(conn.protocol_version, "tab_complete") + if manager is None or pid is None: + return - elif _is_serverbound_packet(conn, packet_id, "use_item", 0x29): - # Use Item (right-click air) - pass # TODO: item use in air - + body = text[1:] if text.startswith("/") else text + try: + suggestions = manager.get_suggestions(conn, body) or [] + except Exception as e: + logger.debug(f"命令补全失败 ({text!r}): {e}") + suggestions = [] + + # 被替换的范围: 最后一个参数 (命令名补全时为整个命令名) + last_space = text.rfind(" ") + start = last_space + 1 if last_space >= 0 else (1 if text.startswith("/") else 0) + prefix = text[start:].lower() + cleaned = [] + for suggestion in suggestions: + suggestion = str(suggestion) + if last_space < 0: + suggestion = suggestion.lstrip("/") + if suggestion and suggestion.lower().startswith(prefix) and suggestion not in cleaned: + cleaned.append(suggestion) + cleaned.sort() + + out = bytearray() + out.extend(write_varint(transaction_id)) + out.extend(write_varint(start)) + out.extend(write_varint(len(text) - start)) + out.extend(write_varint(len(cleaned))) + for suggestion in cleaned: + out.extend(write_string(suggestion)) + out.extend(write_boolean(False)) # no tooltip + await conn.send_packet(pid, bytes(out)) + + +async def _handle_entity_action(conn: Connection, payload: bytes, server): + """Player Command: 潜行/疾跑状态变化, 同步给其他玩家。""" + from protocol.data_types import read_varint + _entity_id, offset = read_varint(payload, 0) + action, offset = read_varint(payload, offset) + if action == 0: + conn.sneaking = True + elif action == 1: + conn.sneaking = False + elif action == 3: + conn.sprinting = True + elif action == 4: + conn.sprinting = False else: - # 忽略未处理的数据包 - pass + return + from handlers.play.players import broadcast_player_metadata + await broadcast_player_metadata(server, conn) + + +async def _handle_arm_animation(conn: Connection, payload: bytes, server): + """Swing Arm: 把挥手动画转发给其他玩家。""" + from protocol.data_types import read_varint + hand, _ = read_varint(payload, 0) if payload else (0, 0) + from handlers.play.players import broadcast_player_animation + await broadcast_player_animation(server, conn, 0 if hand == 0 else 3) + + +def _handle_player_abilities(conn: Connection, payload: bytes): + """Player Abilities (serverbound): 仅允许有飞行能力的模式切换飞行。""" + if not payload: + return + flying = bool(payload[0] & 0x02) + conn.flying = flying and conn.gamemode in ("creative", "spectator") + if conn.flying: + conn.fall_start_y = conn.y async def _handle_click_container(conn: Connection, payload: bytes, server): @@ -339,55 +441,9 @@ def _handle_close_container(conn: Connection, payload: bytes): async def _handle_respawn(conn: Connection, server): - """Handle player respawn after death.""" - from protocol.data_types import ( - write_varint, write_long, write_byte, write_ubyte, - write_boolean, write_identifier, - ) - from handlers.play.join import ( - _send_synchronize_position, _send_update_health, - _send_set_experience, _send_time_update, - ) - from handlers.play.spawn import _resolve_player_respawn_location - from handlers.play.chat import send_system_message - from protocol.packet_map import get_clientbound_packet - - respawn_x, respawn_y, respawn_z = _resolve_player_respawn_location(conn, server) - conn.x = float(respawn_x) + 0.5 - conn.y = float(respawn_y) - conn.z = float(respawn_z) + 0.5 - conn.fall_start_y = conn.y - conn.health = 20.0 - conn.food = 20 - conn.saturation = 5.0 - conn.air_supply = 300 - conn.fire_ticks = 0 - conn.freeze_ticks = 0 - conn.damage_cooldown_ticks = 0 - conn.last_damage_reason = "" - conn._dead = False - - # Send Respawn packet (client needs this to exit death screen) - respawn_pid = get_clientbound_packet(conn.protocol_version, "respawn") - if respawn_pid is not None: - payload = bytearray() - payload.extend(write_varint(0)) # Dimension type (overworld) - payload.extend(write_identifier("minecraft:overworld")) - payload.extend(write_long(0)) # Hashed seed - gamemode_map = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} - payload.extend(write_ubyte(gamemode_map.get(conn.gamemode, 1))) - payload.extend(write_byte(-1)) # Previous gamemode - payload.extend(write_boolean(False)) # Is debug - payload.extend(write_boolean(False)) # Is flat - payload.extend(write_boolean(False)) # Has death location - payload.extend(write_varint(0)) # Portal cooldown - await conn.send_packet(respawn_pid, bytes(payload)) - - await _send_synchronize_position(conn) - await _send_update_health(conn) - await _send_set_experience(conn) - await _send_time_update(conn, server) - await send_system_message(conn, "[PyMC] 你已重生") + """Handle player respawn after death (Client Command: Perform Respawn).""" + from handlers.play.join import respawn_player + await respawn_player(conn, server) async def _handle_creative_inventory_action(conn: Connection, payload: bytes, server): @@ -400,7 +456,7 @@ async def _handle_creative_inventory_action(conn: Connection, payload: bytes, se offset = 0 slot_idx, offset = read_short(payload, offset) - clicked_item = decode_slot_entry(payload, offset) + clicked_item, offset = decode_slot_entry(payload, offset) inv = getattr(conn, 'inventory_obj', None) if inv is None: diff --git a/handlers/play/blocks.py b/handlers/play/blocks.py index 8e99f4d..17178a5 100755 --- a/handlers/play/blocks.py +++ b/handlers/play/blocks.py @@ -205,21 +205,7 @@ def _get_held_item_for_placement(conn: Connection) -> tuple[int, str | None]: if block_state is not None: return (block_state, held.item_id) - # Fallback to hotbar mapping for creative mode without inventory - block_state = HOTBAR_PLACEABLES[conn.selected_hotbar_slot % len(HOTBAR_PLACEABLES)] - # Map back to item name - _STATE_TO_ITEM = { - STONE: "minecraft:stone", - GRASS_BLOCK: "minecraft:grass_block", - DIRT: "minecraft:dirt", - COBBLESTONE: "minecraft:cobblestone", - OAK_PLANKS: "minecraft:oak_planks", - GLASS: "minecraft:glass", - SAND: "minecraft:sand", - OAK_LOG: "minecraft:oak_log", - TORCH: "minecraft:torch", - } - return (block_state, _STATE_TO_ITEM.get(block_state)) + return (0, None) def _consume_placement_item(conn: Connection, item_name: str | None): @@ -253,37 +239,48 @@ async def _handle_block_dig(conn: Connection, payload: bytes, server): status, offset = read_varint(payload, offset) (x, y, z), offset = read_position(payload, offset) _, offset = read_byte(payload, offset) # face - _, offset = read_varint(payload, offset) # sequence + sequence, offset = read_varint(payload, offset) - # status 0 = started digging, 1 = cancelled, 2 = finished, 3 = drop item stack - if status == 3: - # Drop item stack from inventory - _drop_held_item(conn, server) + # status: 0 = started digging, 1 = cancelled, 2 = finished, + # 3 = drop item stack, 4 = drop item, 5 = release use item, 6 = swap hands + if status in (3, 4): + _drop_held_item(conn, server, whole_stack=(status == 3)) return - - if status == 1: - # Cancelled digging - no action + if status == 6: + await _swap_hands(conn, server) return - - if status != 2: + if status not in (0, 2): + if status == 1: + await _acknowledge_block_change(conn, sequence) return current = _get_block_at(server, x, y, z) - if current is None or current == AIR: + block_name, _ = STATE_ID_TO_BLOCK.get(current or 0, ("minecraft:air", {})) + hardness = get_block_hardness(block_name) + + # 创造模式和瞬间破坏的方块 (硬度 0: 花草、火把等) 只会收到 "开始挖掘"; + # 其余方块在 "完成挖掘" 时破坏。 + instant = conn.gamemode == "creative" or hardness == 0 + should_break = (status == 2) or (status == 0 and instant) + + if (not should_break or current is None or current == AIR + or conn.gamemode in ("adventure", "spectator") + or not _within_reach(conn, x, y, z) + or _is_spawn_protected(conn, server, x, z) + or (hardness < 0 and conn.gamemode != "creative")): + if status == 2 and current is not None: + # 拒绝破坏: 把真实方块发回去纠正客户端的预测 + await _send_block_change(conn, x, y, z, current) + await _acknowledge_block_change(conn, sequence) return # Plugin hook: allow plugins to cancel block break from mods.bridge import hook_block_break if not hook_block_break(server, conn, x, y, z, current): + await _send_block_change(conn, x, y, z, current) + await _acknowledge_block_change(conn, sequence) return # Cancelled by a plugin - # Check block hardness - unbreakable blocks can't be mined - block_name, _ = STATE_ID_TO_BLOCK.get(current, ("minecraft:air", {})) - hardness = get_block_hardness(block_name) - if hardness < 0: - # Unbreakable block (bedrock, etc.) - return - # Check if we should drop the container's contents container = container_manager.get_container(x, y, z) if container is not None: @@ -304,8 +301,11 @@ async def _handle_block_dig(conn: Connection, payload: bytes, server): # Remove the block from the world changed_chunks = set_world_block(server, x, y, z, AIR) if not changed_chunks: + await _acknowledge_block_change(conn, sequence) return await _broadcast_block_change(server, x, y, z, AIR) + await _acknowledge_block_change(conn, sequence) + await _broadcast_block_break_effect(server, conn, x, y, z, current) # 生存/冒险模式下消耗工具耐久 if conn.gamemode in ("survival", "adventure"): @@ -360,21 +360,78 @@ async def _handle_block_dig(conn: Connection, payload: bytes, server): entity.vz = ((z * 438289 + x * 193496) % 100 - 50) / 2500.0 await broadcast_entity_spawn(server, entity) - # Damage tool on use - if tool_item is not None and not tool_item.is_empty: - tool_type = tool_item.get_tool_type() - if tool_type is not None: - tool_item.damage += 1 - max_damage = _get_tool_max_damage(tool_item.item_id) - if max_damage > 0 and tool_item.damage >= max_damage: - inv.set_slot(conn.selected_hotbar_slot, None) - conn.inventory_state_id = getattr(conn, 'inventory_state_id', 0) + 1 +REACH_DISTANCE_SQ = 7.0 * 7.0 # 原版服务端允许的交互距离 (略大于客户端的 4.5/5) + + +def _within_reach(conn: Connection, x: int, y: int, z: int) -> bool: + dx = conn.x - (x + 0.5) + dy = (conn.y + 1.5) - (y + 0.5) + dz = conn.z - (z + 0.5) + return dx * dx + dy * dy + dz * dz <= REACH_DISTANCE_SQ -def _drop_held_item(conn: Connection, server): - """Drop the currently held item (Q key press).""" - from world.inventory import ItemStack +def _is_spawn_protected(conn: Connection, server, x: int, z: int) -> bool: + """spawn-protection: 出生点周围只有 OP 能改动方块 (没有任何 OP 时不生效)。""" + radius = int(getattr(server, "config", {}).get("spawn-protection", 0) or 0) + permissions = getattr(server, "permissions", None) + if radius <= 0 or permissions is None or not permissions.data.get("ops"): + return False + if permissions.is_op(conn.username): + return False + spawn_x, _, spawn_z = server.spawn_position + return max(abs(x - spawn_x), abs(z - spawn_z)) <= radius + + +async def _acknowledge_block_change(conn: Connection, sequence: int): + """ + Acknowledge Block Change: 客户端在收到与其操作序号对应的确认之前, + 会一直保留自己预测的方块状态 (1.19+)。 + """ + from protocol.packet_map import get_clientbound_packet + if conn.protocol_version < 759: + return + pid = get_clientbound_packet(conn.protocol_version, "acknowledge_player_digging") + if pid is not None: + await conn.send_packet(pid, write_varint(sequence)) + + +async def _broadcast_block_break_effect(server, breaker: Connection, + x: int, y: int, z: int, block_state: int): + """World Event 2001: 其他玩家看到/听到方块破坏的粒子和音效。""" + from protocol.packet_map import get_clientbound_packet + from protocol.data_types import write_int, write_boolean + payload = (write_int(2001) + write_position(x, y, z) + + write_int(int(block_state)) + write_boolean(False)) + for other in server.get_online_players(): + if other is breaker or other.protocol_version != 767: + continue + if (x >> 4, z >> 4) not in other.loaded_chunks: + continue + pid = get_clientbound_packet(other.protocol_version, "world_event") + if pid is not None: + await other.send_packet(pid, payload) + + +async def _swap_hands(conn: Connection, server): + """F 键: 交换主手与副手物品。""" + inv = getattr(conn, 'inventory_obj', None) + if inv is None: + return + slot = conn.selected_hotbar_slot + main, off = inv.get_slot(slot), inv.get_slot(40) + inv.set_slot(slot, off) + inv.set_slot(40, main) + conn.inventory_state_id += 1 + from world.inventory import send_slot_update + await send_slot_update(conn, slot) + await send_slot_update(conn, 40) + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) + + +def _drop_held_item(conn: Connection, server, whole_stack: bool = True): + """Drop the held item (Q = one item, Ctrl+Q = the whole stack).""" inv = getattr(conn, 'inventory_obj', None) if inv is None: return @@ -382,31 +439,37 @@ def _drop_held_item(conn: Connection, server): held = inv.get_held_item_from_slot(conn.selected_hotbar_slot) if held is None or held.is_empty: return + if conn.gamemode == "spectator": + return - if conn.gamemode in ("creative", "spectator"): - return # Don't drop in creative for now - - # Schedule the drop as an async task import asyncio + import math from handlers.play.entities import broadcast_entity_spawn + count = held.count if whole_stack else 1 + async def _do_drop(): entity = server.entity_manager.create_item( - conn.x, conn.y + 0.5, conn.z, - item_name=held.item_id, count=held.count + conn.x, conn.y + 1.3, conn.z, + item_name=held.item_id, count=count ) - # Throw the item slightly forward - import math - rad = math.radians(conn.yaw) - entity.vx = -math.sin(rad) * 0.3 - entity.vy = 0.2 - entity.vz = math.cos(rad) * 0.3 - entity.pickup_delay = 20 # Can't pick up immediately + # 朝视线方向抛出 + yaw = math.radians(conn.yaw) + pitch = math.radians(conn.pitch) + entity.vx = -math.sin(yaw) * math.cos(pitch) * 0.3 + entity.vy = -math.sin(pitch) * 0.3 + 0.1 + entity.vz = math.cos(yaw) * math.cos(pitch) * 0.3 + entity.pickup_delay = 40 # 原版: 丢出的物品 2 秒内不能拾取 await broadcast_entity_spawn(server, entity) - # Remove from inventory - inv.set_slot(conn.selected_hotbar_slot, None) + held.count -= count + if held.count <= 0: + inv.set_slot(conn.selected_hotbar_slot, None) conn.inventory_state_id = getattr(conn, 'inventory_state_id', 0) + 1 + from world.inventory import send_slot_update + await send_slot_update(conn, conn.selected_hotbar_slot) + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) asyncio.create_task(_do_drop()) @@ -437,6 +500,49 @@ def _get_tool_max_damage(item_id: str) -> int: return _DURABILITY.get(item_id, 0) +def _is_replaceable(block_state: int) -> bool: + """空气、流体和花草等可被直接替换的方块。""" + if block_state == AIR: + return True + from world.chunk_io import STATE_ID_TO_BLOCK + name, props = STATE_ID_TO_BLOCK.get(block_state, ("minecraft:stone", {})) + if name == "minecraft:snow": + return str(props.get("layers", "1")) == "1" + return name in _REPLACEABLE_BLOCKS + + +_REPLACEABLE_BLOCKS = frozenset({ + "minecraft:air", "minecraft:cave_air", "minecraft:void_air", + "minecraft:water", "minecraft:lava", "minecraft:short_grass", "minecraft:tall_grass", + "minecraft:fern", "minecraft:large_fern", "minecraft:dead_bush", "minecraft:seagrass", + "minecraft:tall_seagrass", "minecraft:snow", "minecraft:fire", "minecraft:soul_fire", + "minecraft:vine", "minecraft:glow_lichen", "minecraft:hanging_roots", + "minecraft:crimson_roots", "minecraft:warped_roots", "minecraft:nether_sprouts", + "minecraft:bubble_column", "minecraft:light", "minecraft:structure_void", +}) + +_NON_SOLID_HINTS = ("torch", "flower", "sapling", "button", "lever", "sign", "rail", + "redstone_wire", "carpet", "pressure_plate", "ladder", "vine", + "tulip", "dandelion", "poppy", "mushroom", "banner", "tripwire", + "repeater", "comparator", "short_grass", "fern", "dead_bush") + + +def _collides_with_player(server, x: int, y: int, z: int, block_state: int) -> bool: + """实心方块不能放在玩家身体所在的位置。""" + from world.chunk_io import STATE_ID_TO_BLOCK + name, _ = STATE_ID_TO_BLOCK.get(block_state, ("minecraft:stone", {})) + if any(hint in name for hint in _NON_SOLID_HINTS): + return False + for player in server.get_online_players(): + if player.gamemode == "spectator" or getattr(player, "_dead", False): + continue + if (player.x + 0.3 > x and player.x - 0.3 < x + 1 + and player.z + 0.3 > z and player.z - 0.3 < z + 1 + and player.y + 1.8 > y and player.y < y + 1): + return True + return False + + async def _handle_block_place(conn: Connection, payload: bytes, server): """处理方块放置和方块交互。集成物品栏和方块行为系统。""" from world.block_behavior import ( @@ -453,8 +559,26 @@ async def _handle_block_place(conn: Connection, payload: bytes, server): _, offset = read_float(payload, offset) # cursorY _, offset = read_float(payload, offset) # cursorZ _, offset = read_boolean(payload, offset) # insideBlock - _, offset = read_boolean(payload, offset) # worldBorderHit - _, offset = read_varint(payload, offset) # sequence + if conn.protocol_version >= 768: + _, offset = read_boolean(payload, offset) # worldBorderHit (1.21.2+) + sequence, offset = read_varint(payload, offset) + + try: + await _use_item_on(conn, server, hand, target_x, target_y, target_z, face) + finally: + await _acknowledge_block_change(conn, sequence) + + +async def _use_item_on(conn: Connection, server, hand: int, + target_x: int, target_y: int, target_z: int, face: int): + """Use Item On 的实际逻辑: 方块交互优先, 其次放置手持方块。""" + from world.block_behavior import ( + get_block_behavior, get_block_name_from_state, container_manager, + ) + from world.chunk_io import STATE_ID_TO_BLOCK + + if conn.gamemode == "spectator" or not _within_reach(conn, target_x, target_y, target_z): + return # Get the target block target_block = _get_block_at(server, target_x, target_y, target_z) @@ -478,8 +602,10 @@ async def _handle_block_place(conn: Connection, payload: bytes, server): return # 2. Check block behavior (chest, crafting table, door, etc.) + # 潜行时跳过交互, 直接放置方块 (原版行为) behavior = get_block_behavior(target_name) - if behavior is not None and behavior.is_interactive(): + if (behavior is not None and behavior.is_interactive() + and not getattr(conn, "sneaking", False)): try: action_taken = await behavior.on_use( conn, server, target_x, target_y, target_z, face, hand @@ -490,23 +616,40 @@ async def _handle_block_place(conn: Connection, payload: bytes, server): logger.warning(f"Block behavior error for {target_name}: {e}") # 3. Attempt block placement - dx, dy, dz = FACE_OFFSETS.get(face, (0, 1, 0)) - place_x = target_x + dx - place_y = target_y + dy - place_z = target_z + dz + # Clicking a replaceable block (grass, fern, a single snow layer...) puts + # the new block in its place, like vanilla BlockPlaceContext. + if target_block != AIR and _is_replaceable(target_block): + place_x, place_y, place_z = target_x, target_y, target_z + else: + dx, dy, dz = FACE_OFFSETS.get(face, (0, 1, 0)) + place_x = target_x + dx + place_y = target_y + dy + place_z = target_z + dz if place_y < -64 or place_y >= 320: return - existing = _get_block_at(server, place_x, place_y, place_z) - if existing is None or existing != AIR: - return - # Get the block to place from the player's held item block_state, item_name = _get_held_item_for_placement(conn) - if block_state == 0: + if block_state == 0 or hand != 0: return # Nothing to place + async def _reject(): + """拒绝放置: 纠正客户端预测的方块, 并把被扣掉的物品同步回去。""" + real = _get_block_at(server, place_x, place_y, place_z) + if real is not None: + await _send_block_change(conn, place_x, place_y, place_z, real) + from world.inventory import send_slot_update + await send_slot_update(conn, conn.selected_hotbar_slot) + + existing = _get_block_at(server, place_x, place_y, place_z) + if (existing is None or not _is_replaceable(existing) + or conn.gamemode == "adventure" + or _is_spawn_protected(conn, server, place_x, place_z) + or _collides_with_player(server, place_x, place_y, place_z, block_state)): + await _reject() + return + # Call block behavior on_place if available placed_name, _ = STATE_ID_TO_BLOCK.get(block_state, ("minecraft:air", {})) place_behavior = get_block_behavior(placed_name) @@ -524,16 +667,18 @@ async def _handle_block_place(conn: Connection, payload: bytes, server): # Plugin hook: allow plugins to cancel block placement from mods.bridge import hook_block_place if not hook_block_place(server, conn, place_x, place_y, place_z, block_state): + await _reject() return # Cancelled by a plugin changed_chunks = set_world_block(server, place_x, place_y, place_z, block_state) if not changed_chunks: + await _reject() return await _broadcast_block_change(server, place_x, place_y, place_z, block_state) # Notify redstone engine of block change if server.redstone_engine: - server.redstone_engine.on_block_change(place_x, place_y, place_z, AIR, block_state) + server.redstone_engine.on_block_change(place_x, place_y, place_z, existing, block_state) # Notify fluid system if hasattr(server, 'fluid_system') and server.fluid_system: @@ -566,3 +711,5 @@ async def _handle_block_place(conn: Connection, payload: bytes, server): if inv is not None: from world.inventory import send_slot_update await send_slot_update(conn, conn.selected_hotbar_slot) + from handlers.play.players import broadcast_player_equipment + await broadcast_player_equipment(server, conn) diff --git a/handlers/play/chat.py b/handlers/play/chat.py index 0d57394..078acf3 100755 --- a/handlers/play/chat.py +++ b/handlers/play/chat.py @@ -65,53 +65,67 @@ }) -def build_system_message_payload(message: str | dict) -> bytes: - """构建 1.21.1 system_chat 负载。""" - if isinstance(message, dict): - component = message - else: - component = {"text": message, "color": "gray"} - +def build_system_message_payload(message: str | dict, overlay: bool = False, + protocol_version: int = 767) -> bytes: + """构建 system_chat 负载 (文本组件 + overlay 标志)。""" + from protocol.text import encode_component payload = bytearray() - payload.extend(encode_nbt(component, with_type=True)) - payload.extend(write_boolean(False)) # overlay + payload.extend(encode_component(message, protocol_version)) + payload.extend(write_boolean(overlay)) return bytes(payload) -async def send_system_message(conn: Connection, text: str): - """发送系统聊天消息给单个玩家,使用版本兼容的方式。""" +async def send_system_message(conn: Connection, text, overlay: bool = False): + """发送系统聊天消息给单个玩家 (字符串或文本组件)。""" if conn.version_handler is not None: - await conn.version_handler.send_system_chat(conn, text) + await conn.version_handler.send_system_chat(conn, text, overlay) else: - # Fallback for native version - await conn.send_packet(0x6C, build_system_message_payload(text)) + from protocol.packet_map import get_clientbound_packet + pid = get_clientbound_packet(conn.protocol_version, "system_chat") or 0x6C + await conn.send_packet( + pid, build_system_message_payload(text, overlay, conn.protocol_version)) + + +async def send_action_bar(conn: Connection, text): + """在动作栏 (物品栏上方) 显示一条消息。""" + await send_system_message(conn, text, overlay=True) + + +MAX_CHAT_LENGTH = 256 + + +def _is_legal_chat(message: str) -> bool: + return all(ch != "\u00a7" and ord(ch) >= 32 and ch != "\x7f" for ch in message) async def _handle_chat_message(conn: Connection, payload: bytes, server): """ - 处理 Chat Message (0x07)。 - 在 1.21.1 中,聊天消息使用签名系统,但离线模式下我们简化处理。 + 处理 Chat Message。 + + 离线模式下忽略签名字段,按原版 ``chat.type.text`` 格式 (``<名字> 消息``) + 广播给所有玩家,并在控制台输出 ``<名字> 消息``。 """ from protocol.data_types import read_string - offset = 0 - message, offset = read_string(payload, offset) + from protocol.text import player_name, translate + message, _ = read_string(payload, 0) + message = message.strip() + if not message: + return + if len(message) > MAX_CHAT_LENGTH or not _is_legal_chat(message): + await conn.disconnect(translate("multiplayer.disconnect.illegal_characters")) + return + if message.startswith("/"): + await execute_server_command(server, message[1:], source_conn=conn) + return # Plugin hook: allow plugins to cancel or modify chat from mods.bridge import hook_player_chat if not hook_player_chat(server, conn, message): return # Cancelled by a plugin - logger.info(f"<{conn.username}> {message}") - - chat_component = { - "translate": "chat.type.text", - "with": [ - {"text": conn.username, "color": "yellow"}, - {"text": message} - ] - } - # Use version-aware broadcast for chat messages - server.broadcast_system_message(json.dumps(chat_component, ensure_ascii=False)) + logging.getLogger("minecraft.chat").info(f"<{conn.username}> {message}") + server.broadcast_system_message( + translate("chat.type.text", player_name(conn), {"text": message})) async def _handle_chat_command(conn: Connection, payload: bytes, server): @@ -125,33 +139,59 @@ async def _handle_chat_command(conn: Connection, payload: bytes, server): if not hook_player_command(server, conn, command): return # Cancelled by a plugin - logger.info(f"{conn.username} 执行命令: /{command}") + logging.getLogger("minecraft.command").info( + f"{conn.username} issued server command: /{command}") await execute_server_command(server, command, source_conn=conn) -def build_player_info_update(conn: Connection) -> bytes: +GAMEMODE_IDS = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} + +# Player Info Update action bits (1.19.3+) +INFO_ADD_PLAYER = 0x01 +INFO_INIT_CHAT = 0x02 +INFO_GAMEMODE = 0x04 +INFO_LISTED = 0x08 +INFO_LATENCY = 0x10 +INFO_DISPLAY_NAME = 0x20 + + +def _player_latency(conn: Connection) -> int: + rtt = getattr(conn, "keepalive_rtt_ms", None) + return int(rtt) if rtt is not None else 0 + + +def build_player_info_update(conn: Connection, actions: int | None = None) -> bytes: """ - 构建 Player Info Update 数据包负载 (0x3E)。 - Action: Add Player + Listed + 构建 Player Info Update 数据包负载。 + + 默认动作: Add Player + Update Game Mode + Update Listed + Update Latency, + 与原版服务端在玩家加入时发送的内容一致 (Tab 列表显示延迟和游戏模式)。 """ - payload = bytearray() + if actions is None: + actions = INFO_ADD_PLAYER | INFO_GAMEMODE | INFO_LISTED | INFO_LATENCY - # Actions BitSet: 0x01 (Add Player) | 0x08 (Update Listed) - actions = 0x01 | 0x08 + payload = bytearray() payload.append(actions) - - # 玩家数量 - payload.extend(write_varint(1)) - - # 玩家 UUID + payload.extend(write_varint(1)) # 玩家数量 payload.extend(write_uuid(conn.uuid)) - # --- Action: Add Player --- - payload.extend(write_string(conn.username)) # 名称 - payload.extend(write_varint(0)) # 属性数量 = 0 - - # --- Action: Update Listed --- - payload.extend(write_boolean(True)) # 是否在列表中 + if actions & INFO_ADD_PLAYER: + payload.extend(write_string(conn.username)) + properties = getattr(conn, "profile_properties", None) or [] + payload.extend(write_varint(len(properties))) + for prop in properties: + payload.extend(write_string(prop.get("name", ""))) + payload.extend(write_string(prop.get("value", ""))) + signature = prop.get("signature") + payload.extend(write_boolean(signature is not None)) + if signature is not None: + payload.extend(write_string(signature)) + if actions & INFO_GAMEMODE: + payload.extend(write_varint(GAMEMODE_IDS.get(getattr(conn, "gamemode", "survival"), 0))) + if actions & INFO_LISTED: + payload.extend(write_boolean(True)) + if actions & INFO_LATENCY: + payload.extend(write_varint(_player_latency(conn))) return bytes(payload) diff --git a/handlers/play/chunks.py b/handlers/play/chunks.py index 98cd3a5..230acc5 100755 --- a/handlers/play/chunks.py +++ b/handlers/play/chunks.py @@ -18,7 +18,10 @@ import asyncio import logging +import math import time +import threading +from collections import OrderedDict from protocol.data_types import ( write_varint, write_int, write_long, @@ -164,67 +167,50 @@ async def _send_chunk_data_terrain(conn: Connection, chunk_x: int, chunk_z: int, def _build_chunk_light_data(chunk_blocks: list[list[list[int]]]) -> tuple[int, int, int, int, list[bytes], list[bytes]]: """ - 为 24 个世界 section + 上下边界构建简化版光照数据。 - 规则: - - 露天列保持 15 级天光 - - 遇到第一个非空气/非流体方块后,下面不再有天光 - - 方块光当前仍为 0 + 为 24 个世界 section + 上下边界构建光照数据 (天空光 + 方块光)。 + 实际计算见 world.lighting。 """ - section_count = 26 # 24 world sections + bottom/top boundary - section_bytes = [bytearray(2048) for _ in range(section_count)] - - for z in range(16): - for x in range(16): - sky_open = True - for y_index in range(len(chunk_blocks) - 1, -1, -1): - block_id = chunk_blocks[y_index][z][x] - transparent = block_id in (AIR, WATER) - if sky_open and transparent: - world_section = y_index // 16 - section_idx = world_section + 1 - local_y = y_index % 16 - nibble_index = (local_y * 16 * 16) + (z * 16) + x - byte_index = nibble_index // 2 - shift = 0 if (nibble_index % 2) == 0 else 4 - section_bytes[section_idx][byte_index] |= 0xF << shift - elif not transparent: - sky_open = False - - # 顶部边界 section 作为天空光源,保持全亮;底部边界置空。 - section_bytes[-1] = bytearray([0xFF] * 2048) - - sky_mask = 0 - empty_sky_mask = 0 - sky_arrays: list[bytes] = [] - for idx, data in enumerate(section_bytes): - if any(data): - sky_mask |= 1 << idx - sky_arrays.append(bytes(data)) - else: - empty_sky_mask |= 1 << idx + from world.lighting import build_light_sections + return build_light_sections(chunk_blocks) - block_mask = 0 - empty_block_mask = (1 << section_count) - 1 - block_arrays: list[bytes] = [] - return sky_mask, block_mask, empty_sky_mask, empty_block_mask, sky_arrays, block_arrays +_PAYLOAD_CACHE: "OrderedDict[tuple[int, int], tuple[bytes, bytes]]" = OrderedDict() +_PAYLOAD_CACHE_LOCK = threading.Lock() +_PAYLOAD_CACHE_SIZE = 512 -async def _send_prebuilt_chunk(conn: Connection, chunk_x: int, chunk_z: int, - motion_blocking: list[int], world_surface: list[int], - chunk_data: bytes, chunk_blocks: list[list[list[int]]]): + +def build_native_chunk_payload(chunk_x: int, chunk_z: int, + motion_blocking: list[int], world_surface: list[int], + chunk_data: bytes, chunk_blocks: list[list[list[int]]]) -> bytes: """ - 发送已预生成的区块数据包。 - 区块生成和编码已在线程池中完成,此处仅组装协议数据包并发送。 - 使用版本处理器来发送正确的格式。 + Cached wrapper: the section bytes fully determine blocks, light and + heightmaps, so an identical ``chunk_data`` means an identical payload. """ - if conn.version_handler is not None and conn.protocol_version < 767: - # For older versions, we may need to re-encode the chunk data - await _send_versioned_chunk(conn, chunk_x, chunk_z, - motion_blocking, world_surface, - chunk_data, chunk_blocks) - return + key = (chunk_x, chunk_z) + with _PAYLOAD_CACHE_LOCK: + cached = _PAYLOAD_CACHE.get(key) + if cached is not None and cached[0] == chunk_data: + _PAYLOAD_CACHE.move_to_end(key) + return cached[1] + payload = _build_native_chunk_payload(chunk_x, chunk_z, motion_blocking, world_surface, + chunk_data, chunk_blocks) + with _PAYLOAD_CACHE_LOCK: + _PAYLOAD_CACHE[key] = (chunk_data, payload) + _PAYLOAD_CACHE.move_to_end(key) + while len(_PAYLOAD_CACHE) > _PAYLOAD_CACHE_SIZE: + _PAYLOAD_CACHE.popitem(last=False) + return payload + + +def _build_native_chunk_payload(chunk_x: int, chunk_z: int, + motion_blocking: list[int], world_surface: list[int], + chunk_data: bytes, chunk_blocks: list[list[list[int]]]) -> bytes: + """ + 组装 1.21.1 的 Chunk Data and Update Light 负载。 - # Native 1.21.1 chunk data format + 光照计算是纯 Python 的重活, 调用方应在工作线程里执行本函数, + 不要放在事件循环 (游戏刻) 上。 + """ payload = bytearray() # Chunk X, Z (Int) @@ -249,6 +235,7 @@ async def _send_prebuilt_chunk(conn: Connection, chunk_x: int, chunk_z: int, sky_mask, block_mask, empty_sky_mask, empty_block_mask, sky_arrays, block_arrays = ( _build_chunk_light_data(chunk_blocks) ) + def _write_bitset(mask: int): """Write a BitSet: VarInt(0) if mask==0, else VarInt(1)+Long(mask).""" if mask: @@ -272,9 +259,32 @@ def _write_bitset(mask: int): payload.extend(write_varint(2048)) payload.extend(block_light_section) + return bytes(payload) + + +async def _send_prebuilt_chunk(conn: Connection, chunk_x: int, chunk_z: int, + motion_blocking: list[int], world_surface: list[int], + chunk_data: bytes, chunk_blocks: list[list[list[int]]], + payload: bytes | None = None): + """ + 发送已预生成的区块数据包。 + ``payload`` 为预先在线程池中组装好的负载; 未提供时在线程池中现算。 + """ + if conn.version_handler is not None and conn.protocol_version < 767: + # For older versions, we may need to re-encode the chunk data + await _send_versioned_chunk(conn, chunk_x, chunk_z, + motion_blocking, world_surface, + chunk_data, chunk_blocks) + return + + if payload is None: + payload = await asyncio.get_running_loop().run_in_executor( + None, build_native_chunk_payload, chunk_x, chunk_z, + motion_blocking, world_surface, chunk_data, chunk_blocks) + chunk_pid = conn.version_handler.get_packet_id("chunk_data") if conn.version_handler else 0x27 if chunk_pid is not None: - await conn.send_packet(chunk_pid, bytes(payload)) + await conn.send_packet(chunk_pid, payload) async def _send_versioned_chunk(conn: Connection, chunk_x: int, chunk_z: int, @@ -304,18 +314,30 @@ async def _send_versioned_chunk(conn: Connection, chunk_x: int, chunk_z: int, async def _send_chunk_batch(conn: Connection, chunk_results): - """发送一批区块。""" + """发送一批区块 (Chunk Batch Start / 区块... / Chunk Batch Finished)。""" if not chunk_results or not conn.alive: return - await conn.send_packet(0x0D, b'') - for cx, cz, motion_blocking, world_surface, chunk_data, chunk_blocks in chunk_results: + native = not (conn.version_handler is not None and conn.protocol_version < 767) + payloads = None + if native: + # 光照 + 负载组装放到工作线程, 避免阻塞游戏刻 + def _build_all(): + return [build_native_chunk_payload(*record) for record in chunk_results] + payloads = await asyncio.get_running_loop().run_in_executor(None, _build_all) + if not conn.alive: + return + await conn.send_packet(0x0D, b'') + + for index, (cx, cz, motion_blocking, world_surface, chunk_data, chunk_blocks) in enumerate(chunk_results): if not conn.alive: break await _send_prebuilt_chunk( - conn, cx, cz, motion_blocking, world_surface, chunk_data, chunk_blocks + conn, cx, cz, motion_blocking, world_surface, chunk_data, chunk_blocks, + payload=payloads[index] if payloads is not None else None, ) - await conn.send_packet(0x0C, write_varint(len(chunk_results))) + if native: + await conn.send_packet(0x0C, write_varint(len(chunk_results))) async def _send_chunk_results_streamed(conn: Connection, chunk_results, @@ -346,7 +368,7 @@ def _generate_deferred(): chunk_results = await loop.run_in_executor(None, _generate_deferred) await _send_chunk_results_streamed(conn, chunk_results) conn.loaded_chunks.update((cx, cz) for cx, cz, *_ in chunk_results) - logger.info( + logger.debug( f"已向 {conn.username} 补发远距离区块 {len(chunk_results)} 个 " f"(总计 {total_count} 个, 用时 {time.time() - start:.1f}s)" ) @@ -372,8 +394,8 @@ async def _unload_distant_chunks(conn: Connection, desired_coords: set, server): async def _stream_chunks_around_player(conn: Connection, server): """在玩家跨区块移动时,继续补发新进入视距的区块。""" while conn.alive: - center_cx = int(conn.x) >> 4 - center_cz = int(conn.z) >> 4 + center_cx = math.floor(conn.x) >> 4 + center_cz = math.floor(conn.z) >> 4 if conn.chunk_center == (center_cx, center_cz): return @@ -381,13 +403,15 @@ async def _stream_chunks_around_player(conn: Connection, server): from handlers.play.join import _send_center_chunk await _send_center_chunk(conn, center_cx, center_cz) - desired_coords = set(_sorted_chunk_coords(center_cx, center_cz, server.view_distance)) + from handlers.play.join import effective_view_distance + view_distance = effective_view_distance(conn, server) + desired_coords = set(_sorted_chunk_coords(center_cx, center_cz, view_distance)) # Unload chunks that are now outside view distance await _unload_distant_chunks(conn, desired_coords, server) missing_coords = [ - coord for coord in _sorted_chunk_coords(center_cx, center_cz, server.view_distance) + coord for coord in _sorted_chunk_coords(center_cx, center_cz, view_distance) if coord not in conn.loaded_chunks ] if not missing_coords: @@ -395,7 +419,7 @@ async def _stream_chunks_around_player(conn: Connection, server): loop = asyncio.get_event_loop() start = time.time() - logger.info( + logger.debug( f"玩家 {conn.username} 进入新区块中心 {center_cx},{center_cz}," f"正在补发 {len(missing_coords)} 个新区块..." ) @@ -410,7 +434,7 @@ def _generate_missing(): await _send_chunk_results_streamed(conn, chunk_results) conn.loaded_chunks.update((cx, cz) for cx, cz, *_ in chunk_results) - logger.info( + logger.debug( f"已向 {conn.username} 动态补发新区块 {len(chunk_results)} 个 " f"(中心={center_cx},{center_cz}, 用时 {time.time() - start:.1f}s)" ) diff --git a/handlers/play/combat.py b/handlers/play/combat.py index 6d65d0f..451e543 100644 --- a/handlers/play/combat.py +++ b/handlers/play/combat.py @@ -71,14 +71,47 @@ def get_attack_damage(conn: Connection) -> float: return 1.0 +async def _broadcast_entity_hurt(server, entity_id: int, x: float, z: float, + attacker: Connection | None = None, + damage_type: str = "minecraft:player_attack", + dead: bool = False): + """Damage Event (+ 死亡时 Entity Event 3): 受击变红、音效和死亡动画。""" + from protocol.data_types import write_varint, write_boolean, write_int, write_byte + from protocol.gamedata import registry_index + from protocol.packet_map import get_clientbound_packet + type_id = registry_index("minecraft:damage_type").get(damage_type, 0) + cause = (attacker.entity_id + 1) if attacker is not None else 0 + payload = (write_varint(entity_id) + write_varint(type_id) + write_varint(cause) + + write_varint(cause) + write_boolean(False)) + for player in server.get_online_players(): + if player.protocol_version != 767: + continue + if entity_id not in player.tracked_entities and entity_id not in player.tracked_players: + continue + pid = get_clientbound_packet(player.protocol_version, "damage_event") + if pid is not None: + await player.send_packet(pid, payload) + if dead: + spid = get_clientbound_packet(player.protocol_version, "entity_status") + if spid is not None: + await player.send_packet(spid, write_int(entity_id) + write_byte(3)) + + +def _knockback(attacker: Connection, strength: float = 0.4) -> tuple[float, float, float]: + yaw = math.radians(attacker.yaw) + return (-math.sin(yaw) * strength, 0.36, math.cos(yaw) * strength) + + async def _handle_interact(conn: Connection, payload: bytes, server): - """处理 Interact 包中的攻击动作。""" + """处理 Interact 包中的攻击动作 (攻击生物 / PvP)。""" parsed = parse_interact(payload) if parsed is None: return entity_id, action_type = parsed if action_type != INTERACT_TYPE_ATTACK: return + if conn.gamemode == "spectator": + return # 攻击冷却 now = time.monotonic() @@ -87,6 +120,33 @@ async def _handle_interact(conn: Connection, payload: bytes, server): return conn._last_attack_time = now + # --- PvP --- + victim = next((p for p in server.get_online_players() + if p.entity_id == entity_id and p is not conn), None) + if victim is not None: + if not server.config.get("pvp", True): + return + if victim.gamemode in ("creative", "spectator") or getattr(victim, "_dead", False): + return + dx, dy, dz = victim.x - conn.x, victim.y - conn.y, victim.z - conn.z + if dx * dx + dy * dy + dz * dz > ATTACK_RANGE_SQUARED: + return + from handlers.play.join import _damage_player + victim.damage_cooldown_ticks = 0 + await _damage_player(victim, get_attack_damage(conn), f"player:{conn.username}", server) + # 击退: Set Entity Velocity 发给被攻击的玩家本人 + from protocol.data_types import write_varint, write_short + from protocol.packet_map import get_clientbound_packet + vx, vy, vz = _knockback(conn) + pid = get_clientbound_packet(victim.protocol_version, "entity_velocity") + if pid is not None and not getattr(victim, "_dead", False): + await victim.send_packet(pid, write_varint(victim.entity_id) + b"".join( + write_short(max(-32768, min(32767, int(v * 8000)))) for v in (vx, vy, vz))) + if conn.gamemode in ("survival", "adventure"): + from world.item_properties import damage_held_item + await damage_held_item(conn, server) + return + entity = server.entity_manager.get_entity(entity_id) if entity is None or entity.kind != "mob": return @@ -95,17 +155,18 @@ async def _handle_interact(conn: Connection, payload: bytes, server): damage = get_attack_damage(conn) killed = damage_mob(server, entity, damage, source=conn) + await _broadcast_entity_hurt(server, entity.entity_id, entity.x, entity.z, + attacker=conn, dead=killed) + if not killed: + vx, vy, vz = _knockback(conn) + entity.vx, entity.vy, entity.vz = vx, vy, vz + entity.on_ground = False # 生存/冒险模式下消耗武器耐久 if conn.gamemode in ("survival", "adventure"): from world.item_properties import damage_held_item await damage_held_item(conn, server) - if killed: - from handlers.play.chat import send_system_message - mob_name = entity.metadata.get("mob_type", "生物") - await send_system_message(conn, f"[PyMC] 你击杀了 {mob_name}") - def damage_mob(server, entity, amount: float, source=None) -> bool: """ @@ -141,7 +202,7 @@ def damage_mob(server, entity, amount: float, source=None) -> bool: entity.x, entity.y + 0.3, entity.z, xp) server.entity_manager.remove_entity(entity.entity_id) - logger.info( + logger.debug( f"生物 {entity.metadata.get('mob_type', '?')} (id={entity.entity_id}) " f"被击杀, 掉落已生成" ) diff --git a/handlers/play/entities.py b/handlers/play/entities.py index 562b06a..932856f 100755 --- a/handlers/play/entities.py +++ b/handlers/play/entities.py @@ -62,7 +62,11 @@ async def _send_experience_orb_spawn(conn: Connection, entity): async def _send_generic_entity_spawn(conn: Connection, entity): - entity_type_id = ENTITY_TYPE_IDS.get(entity.metadata.get("mob_type", entity.kind)) + type_name = entity.metadata.get("mob_type", entity.kind) + entity_type_id = ENTITY_TYPE_IDS.get(type_name) + if entity_type_id is None: + from protocol.gamedata import entity_type_ids + entity_type_id = entity_type_ids().get(f"minecraft:{str(type_name).split(':')[-1]}") if entity_type_id is None: return @@ -82,29 +86,23 @@ async def _send_generic_entity_spawn(conn: Connection, entity): payload.extend(write_short(_encode_entity_velocity_component(entity.vz))) await conn.send_packet(0x01, bytes(payload)) - # Send entity metadata (health bar for mobs) - if entity.kind == "mob": + # 生物不带自定义名称 (与原版一致): 客户端按实体类型显示本地化名称。 + # 物品实体需要 metadata index 8 (Slot) 才能渲染出具体物品。 + if entity.kind == "item": + from world.inventory import ItemStack, encode_slot_entry + from protocol.packet_map import get_clientbound_packet + stack = ItemStack( + entity.metadata.get("item_name", "minecraft:stone"), + max(1, int(entity.metadata.get("count", 1))), + ) meta = bytearray() meta.extend(write_varint(entity.entity_id)) - # Index 0: Entity flags (Byte) - meta.extend(write_ubyte(0)) # index - meta.extend(write_varint(0)) # type = Byte - meta.extend(write_ubyte(0)) # flags = 0 - # Index 2: Custom name (Optional) - import json as _json - mob_name = entity.metadata.get("mob_type", "mob") - display_name = {"translate": f"entity.minecraft.{mob_name}"} - meta.extend(write_ubyte(2)) # index - meta.extend(write_varint(5)) # type = Optional - meta.extend(write_boolean(True)) # has custom name - meta.extend(write_string(_json.dumps(display_name))) - # Index 3: Custom name visible (Boolean) - meta.extend(write_ubyte(3)) # index - meta.extend(write_varint(7)) # type = Boolean - meta.extend(write_boolean(False)) - # Terminator + meta.extend(write_ubyte(8)) # index 8: item stack + meta.extend(write_varint(7)) # type 7 = Slot + meta.extend(encode_slot_entry(stack)) meta.extend(write_ubyte(0xFF)) - await conn.send_packet(0x58, bytes(meta)) + pid = get_clientbound_packet(conn.protocol_version, "entity_metadata") or 0x58 + await conn.send_packet(pid, bytes(meta)) def build_entity_teleport_payload(entity) -> bytes: @@ -148,6 +146,8 @@ async def _send_entity_remove(conn: Connection, entity_ids: list[int]): async def _send_visible_entities_to_player(conn: Connection, server): for entity in server.entity_manager.list_entities(): + if entity.entity_id in conn.tracked_entities: + continue if not _entity_within_tracking_range(entity, conn, server.view_distance): continue if entity.kind == "orb": @@ -160,12 +160,14 @@ async def _send_visible_entities_to_player(conn: Connection, server): async def broadcast_entity_spawn(server, entity): for conn in server.get_online_players(): + if entity.entity_id in conn.tracked_entities: + continue if not _entity_within_tracking_range(entity, conn, server.view_distance): continue if entity.kind == "orb": await _send_experience_orb_spawn(conn, entity) conn.tracked_entities.add(entity.entity_id) - elif entity.kind in {"item", "mob"}: + elif entity.kind in {"item", "mob", "lightning_bolt"}: await _send_generic_entity_spawn(conn, entity) conn.tracked_entities.add(entity.entity_id) diff --git a/handlers/play/join.py b/handlers/play/join.py index 1201856..baaaf21 100755 --- a/handlers/play/join.py +++ b/handlers/play/join.py @@ -65,69 +65,144 @@ logger = logging.getLogger("PyMC.游戏") +def _restore_player_state(conn: Connection, server, player_state: dict | None): + """把存档中的玩家状态恢复到连接对象上 (在发送 Login 包之前调用)。""" + from handlers.play.state import normalize_gamemode + default_mode = normalize_gamemode(server.config.get("gamemode", "survival")) + force_mode = bool(server.config.get("force-gamemode", False)) + + if player_state: + conn.yaw = float(player_state.get("yaw", conn.yaw)) + conn.pitch = float(player_state.get("pitch", conn.pitch)) + conn.health = float(player_state.get("health", conn.health)) + conn.food = int(player_state.get("food", conn.food)) + conn.saturation = float(player_state.get("saturation", conn.saturation)) + conn.experience_total = int(player_state.get("experience_total", conn.experience_total)) + conn.experience_level = int(player_state.get("experience_level", conn.experience_level)) + conn.experience_progress = float(player_state.get("experience_progress", conn.experience_progress)) + conn.gamemode = normalize_gamemode(player_state.get("gamemode"), default_mode) + conn.on_ground = bool(player_state.get("on_ground", True)) + conn.air_supply = int(player_state.get("air_supply", 300)) + conn.fire_ticks = int(player_state.get("fire_ticks", 0)) + conn.freeze_ticks = int(player_state.get("freeze_ticks", 0)) + conn.flying = bool(player_state.get("flying", False)) + slot = int(player_state.get("selected_slot", 0)) + conn.selected_hotbar_slot = slot if 0 <= slot < 9 else 0 + personal_spawn = player_state.get("personal_spawn") + conn.personal_spawn = None + if isinstance(personal_spawn, (list, tuple)) and len(personal_spawn) == 3: + try: + conn.personal_spawn = tuple(int(v) for v in personal_spawn) + except (TypeError, ValueError): + conn.personal_spawn = None + if conn.health <= 0: + # 死亡状态下退出的玩家: 重新进入时在出生点满血复活 + conn.health, conn.food, conn.saturation = 20.0, 20, 5.0 + player_state.pop("x", None) + else: + conn.gamemode = default_mode + conn.personal_spawn = None + + if force_mode: + conn.gamemode = default_mode + if conn.gamemode not in ("creative", "spectator"): + conn.flying = False + + async def send_join_game(conn: Connection, server): """ - 发送 Login (Join Game) 数据包及相关初始化数据包。 - 这是玩家进入 Play 阶段后收到的第一个数据包。 - 使用版本处理器来发送正确的格式。 + 玩家进入 Play 阶段后的完整进服流程,数据包顺序与原版服务端一致: + + Login -> Difficulty -> Abilities -> Held Slot -> Op Level -> Commands + -> 区块中心/视距 -> 出生点区块 -> Spawn Position -> 位置同步 + -> 生命/经验/时间/天气/物品栏 -> Player Info -> 加入消息 -> 实体 """ - logger.info(f"正在发送游戏数据给 {conn.username} (版本 {conn.mc_version}, 协议 {conn.protocol_version})...") load_start = time.time() server._initialize_terrain_generator() - - terrain = server.terrain_generator use_native = getattr(server, '_use_native_terrain', False) + native_path = conn.protocol_version >= 767 + + # --- 0. 读取玩家存档 (Login 包需要正确的游戏模式) --- + player_state = server.world_storage.load_player_data(str(conn.uuid)) + first_join = player_state is None + _restore_player_state(conn, server, player_state) + + from world.inventory import PlayerInventory, initialize_player_inventory + inventory_data = player_state.get("inventory") if player_state else None + if isinstance(inventory_data, list): + # Compatibility with compact saves written by earlier releases. + conn.inventory_obj = PlayerInventory() + conn.inventory_obj.deserialize(inventory_data) + elif isinstance(inventory_data, dict): + conn.inventory_obj = PlayerInventory.deserialize_full(inventory_data) + else: + initialize_player_inventory(conn) + conn.inventory_state_id = 0 # --- 1. Login (Join Game) 数据包 --- - # Use version handler for version-specific Join Game format if conn.version_handler is not None: await conn.version_handler.send_join_game(conn, server) else: await _send_login_play(conn, server) - # --- 2. 发送游戏事件: 等待区块 --- + if native_path: + from handlers.play.state import ( + send_abilities, send_difficulty, send_held_slot, send_op_level, + ) + await send_difficulty(conn, server) + await send_abilities(conn) + await send_held_slot(conn) + await send_op_level(conn, server) + from commands.brigadier import send_commands + await send_commands(conn, server) + + # --- 2. 解析出生位置 (存档位置不安全时回退到安全出生点) --- + target_x, target_y, target_z = _resolve_initial_player_location( + server, player_state + ) + if player_state and all(k in player_state for k in ("x", "y", "z")): + # 保留方块内的小数坐标, 仅当安全位置与存档方块一致时 + px, py, pz = (float(player_state["x"]), float(player_state["y"]), + float(player_state["z"])) + if (math.floor(px), math.floor(pz)) == (int(target_x), int(target_z)) \ + and abs(py - float(target_y)) < 1.0: + conn.x, conn.y, conn.z = px, py, pz + else: + conn.x, conn.y, conn.z = float(target_x) + 0.5, float(target_y), float(target_z) + 0.5 + else: + conn.x, conn.y, conn.z = float(target_x) + 0.5, float(target_y), float(target_z) + 0.5 + conn.fall_start_y = conn.y + + # --- 3. 等待区块 + 区块中心 --- if conn.version_handler is not None: await conn.version_handler.send_game_event(conn, 13, 0.0) else: await _send_game_event(conn, 13, 0.0) - # --- 3. 设置区块中心 --- - center_cx = int(server.spawn_position[0]) >> 4 - center_cz = int(server.spawn_position[2]) >> 4 + center_cx = math.floor(conn.x) >> 4 + center_cz = math.floor(conn.z) >> 4 conn.chunk_center = (center_cx, center_cz) + view_distance = effective_view_distance(conn, server) if conn.version_handler is not None: await conn.version_handler.send_set_center_chunk(conn, center_cx, center_cz) - await conn.version_handler.send_set_chunk_cache_radius(conn, server.view_distance) else: await _send_center_chunk(conn, center_cx, center_cz) - await conn.send_packet(0x62, write_varint(server.view_distance)) # set_chunk_cache_radius (simulation_distance) — was 0x55 (wrong) - view_distance = server.view_distance chunk_coords = _sorted_chunk_coords(center_cx, center_cz, view_distance) immediate_radius = min(server.join_immediate_radius, view_distance) immediate_count = (immediate_radius * 2 + 1) ** 2 immediate_coords = chunk_coords[:immediate_count] deferred_coords = chunk_coords[immediate_count:] - # 在线程池中预生成所有区块数据 (避免阻塞事件循环) + # 在线程池中准备区块数据 (避免阻塞事件循环) loop = asyncio.get_event_loop() - logger.info(f"正在准备 {len(chunk_coords)} 个区块 (视距={view_distance}, " - f"引擎={'C++' if use_native else 'Python'})...") - gen_start = time.time() + logger.debug(f"正在为 {conn.username} 准备 {len(chunk_coords)} 个区块 (视距={view_distance}, " + f"引擎={'C++' if use_native else 'Python'})...") def _generate_chunks(coords): - """在工作线程中批量准备区块数据。""" - results, loaded, generated = server.generate_chunk_results(coords) - if loaded > 0: - logger.info(f"从存档加载 {loaded} 个区块") - if generated > 0: - logger.info(f"新生成 {generated} 个区块") - return results + return server.generate_chunk_results(coords)[0] immediate_results = await loop.run_in_executor(None, _generate_chunks, immediate_coords) - gen_elapsed = time.time() - gen_start - logger.info(f"出生点附近区块已准备完成: {len(immediate_results)} 个, 耗时 {gen_elapsed:.1f}s") - await _send_chunk_batch(conn, immediate_results) conn.loaded_chunks.update((cx, cz) for cx, cz, *_ in immediate_results) @@ -136,73 +211,18 @@ def _generate_chunks(coords): for cx, cz, motion_blocking, world_surface, chunk_data, chunk_blocks in immediate_results: server.redstone_engine.scan_chunk(cx, cz, chunk_blocks) - # --- 5. 恢复玩家存档位置,必要时回退到安全出生点 --- - player_state = server.world_storage.load_player_data(str(conn.uuid)) - from world.inventory import PlayerInventory, initialize_player_inventory - inventory_data = player_state.get("inventory") if player_state else None - if isinstance(inventory_data, list): - # Compatibility with compact saves written by earlier releases. - conn.inventory_obj = PlayerInventory() - conn.inventory_obj.deserialize(inventory_data) - elif isinstance(inventory_data, dict): - conn.inventory_obj = PlayerInventory.deserialize_full(inventory_data) - else: - initialize_player_inventory(conn) - conn.inventory_state_id = 0 - target_x, target_y, target_z = _resolve_initial_player_location( - server, player_state - ) + # --- 4. 出生点 + 位置同步 --- await _send_spawn_position(conn, *server.spawn_position) - # --- 6. 同步玩家位置 --- - conn.x = float(target_x) + 0.5 - conn.y = float(target_y) - conn.z = float(target_z) + 0.5 - if player_state: - conn.yaw = float(player_state.get("yaw", conn.yaw)) - conn.pitch = float(player_state.get("pitch", conn.pitch)) - conn.health = float(player_state.get("health", conn.health)) - conn.food = int(player_state.get("food", conn.food)) - conn.saturation = float(player_state.get("saturation", conn.saturation)) - conn.experience_total = int(player_state.get("experience_total", conn.experience_total)) - conn.experience_level = int(player_state.get("experience_level", conn.experience_level)) - conn.experience_progress = float(player_state.get("experience_progress", conn.experience_progress)) - conn.gamemode = str(player_state.get("gamemode", server.config.get("gamemode", "creative"))) - conn.on_ground = bool(player_state.get("on_ground", True)) - conn.air_supply = int(player_state.get("air_supply", 300)) - conn.fire_ticks = int(player_state.get("fire_ticks", 0)) - conn.freeze_ticks = int(player_state.get("freeze_ticks", 0)) - personal_spawn = player_state.get("personal_spawn") - if ( - isinstance(personal_spawn, (list, tuple)) - and len(personal_spawn) == 3 - ): - try: - conn.personal_spawn = ( - int(personal_spawn[0]), - int(personal_spawn[1]), - int(personal_spawn[2]), - ) - except (TypeError, ValueError): - conn.personal_spawn = None - else: - conn.personal_spawn = None - else: - conn.gamemode = server.config.get("gamemode", "creative") - conn.personal_spawn = None - conn.fall_start_y = conn.y - - # Use version handler for version-specific position/health/experience/time sync if conn.version_handler is not None: await conn.version_handler.send_synchronize_position(conn) await conn.version_handler.send_update_health(conn) await conn.version_handler.send_set_experience(conn) - await conn.version_handler.send_update_time(conn, server.world_time) else: await _send_synchronize_position(conn) await _send_update_health(conn) await _send_set_experience(conn) - await _send_time_update(conn, server) + await _send_time_update(conn, server) # 同步当前天气状态 (晴天时为空操作) from handlers.play.weather import send_weather_state @@ -211,32 +231,38 @@ def _generate_chunks(coords): from world.inventory import send_inventory_sync await send_inventory_sync(conn) - # --- 7. Tab list header/footer --- - import json as _json - from protocol.packet_map import get_clientbound_packet - tab_header = _json.dumps({"text": "\u00a7bPyMC Server"}, ensure_ascii=False) - tab_footer = _json.dumps({"text": "\u00a77Welcome to PyMC!"}, ensure_ascii=False) - tab_pid = get_clientbound_packet(conn.protocol_version, "playerlist_header") - if tab_pid is not None: - tab_payload = bytearray() - tab_payload.extend(write_string(tab_header)) - tab_payload.extend(write_string(tab_footer)) - await conn.send_packet(tab_pid, bytes(tab_payload)) + if native_path: + from handlers.play.state import send_ticking_state + await send_ticking_state(conn) - # --- 8. 通知其他玩家 --- + # --- 5. Tab 列表页眉/页脚 (可选, 由 server.properties 配置) --- + await send_tab_header_footer(conn, server) + + # --- 6. 通知其他玩家 + 加入消息 --- + conn.joined = True + conn.last_active = time.monotonic() await _broadcast_player_join(conn, server) await _send_visible_entities_to_player(conn, server) + from protocol.text import translate, player_name + logging.getLogger("minecraft.server").info( + f"{conn.username}[/{conn.address}] logged in with entity id {conn.entity_id} " + f"at ({conn.x:.1f}, {conn.y:.1f}, {conn.z:.1f})" + ) + server.broadcast_system_message( + translate("multiplayer.player.joined", player_name(conn), color="yellow"), + log=True, + ) + usercache = getattr(server, "usercache", None) + if usercache is not None: + usercache.record(conn.username, conn.uuid) + # Plugin hook: fire PlayerJoinEvent from mods.bridge import hook_player_join hook_player_join(server, conn) - load_elapsed = time.time() - load_start - logger.info(f"加载完成,用时 {load_elapsed:.1f}s") - logger.info( - f"玩家 {conn.username} 已成功加入游戏 " - f"(位置: {int(conn.x)}, {int(conn.y)}, {int(conn.z)})" - ) + logger.debug(f"{conn.username} 进服流程完成, 用时 {time.time() - load_start:.2f}s" + f"{' (首次进入)' if first_join else ''}") if deferred_coords: asyncio.create_task(_send_deferred_chunks( @@ -244,6 +270,40 @@ def _generate_chunks(coords): )) +def effective_view_distance(conn: Connection, server) -> int: + """服务端视距与客户端请求视距取较小值 (原版行为)。""" + view_distance = int(server.view_distance) + client = int(getattr(conn, "client_view_distance", 0) or 0) + if client >= 2: + view_distance = min(view_distance, client) + return max(2, view_distance) + + +async def send_tab_header_footer(conn: Connection, server): + """发送 Tab 列表页眉/页脚; 未配置时不发送 (原版默认没有)。""" + header = str(server.config.get("tab-list-header", "") or "") + footer = str(server.config.get("tab-list-footer", "") or "") + if not header and not footer: + return + from protocol.packet_map import get_clientbound_packet + from protocol.text import encode_component + tab_pid = get_clientbound_packet(conn.protocol_version, "playerlist_header") + if tab_pid is None: + return + payload = (encode_component(header, conn.protocol_version) + + encode_component(footer, conn.protocol_version)) + await conn.send_packet(tab_pid, payload) + + +def hashed_seed(server) -> int: + """SHA-256(seed) 的前 8 字节 (客户端用于生物群系噪声), 与原版一致。""" + import hashlib + from network.server import parse_vanilla_seed + seed = parse_vanilla_seed(server.config.get("level-seed", 0)) + digest = hashlib.sha256(struct.pack(">q", seed)).digest() + return struct.unpack(">q", digest[:8])[0] + + async def _send_login_play(conn: Connection, server): """ 发送 Login (Join Game) 数据包 (0x2B)。 @@ -255,7 +315,7 @@ async def _send_login_play(conn: Connection, server): payload.extend(write_int(conn.entity_id)) # Is Hardcore (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.config.get("hardcore", False)))) # Dimension Count + Dimension Names (VarInt + Array of Identifier) dimension_names = [ @@ -274,16 +334,16 @@ async def _send_login_play(conn: Connection, server): payload.extend(write_varint(server.view_distance)) # Simulation Distance (VarInt) - payload.extend(write_varint(server.view_distance)) + payload.extend(write_varint(int(getattr(server, "simulation_distance", server.view_distance)))) # Reduced Debug Info (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.gamerules.get("reducedDebugInfo", False)))) # Enable Respawn Screen (Boolean) - payload.extend(write_boolean(True)) + payload.extend(write_boolean(not server.gamerules.get("doImmediateRespawn", False))) # Do Limited Crafting (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.gamerules.get("doLimitedCrafting", False)))) # Dimension Type (VarInt - 注册表索引) payload.extend(write_varint(0)) # 0 = overworld @@ -292,11 +352,11 @@ async def _send_login_play(conn: Connection, server): payload.extend(write_identifier("minecraft:overworld")) # Hashed Seed (Long) - payload.extend(write_long(0)) + payload.extend(write_long(hashed_seed(server))) # Game Mode (Unsigned Byte) - 0=生存, 1=创造, 2=冒险, 3=旁观 gamemode_map = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} - payload.extend(write_ubyte(gamemode_map.get(server.config.get("gamemode", "creative"), 1))) + payload.extend(write_ubyte(gamemode_map.get(conn.gamemode, 0))) # Previous Game Mode (Byte) - -1 表示无 payload.extend(write_byte(-1)) @@ -440,46 +500,315 @@ async def _send_collect_entity( await conn.send_packet(0x6F, bytes(payload)) +def world_time_fields(server) -> tuple[int, int]: + """ + (世界总刻数, 昼夜时间) —— Update Time 数据包的两个字段。 + doDaylightCycle=false 时昼夜时间取负值, 客户端据此停止本地推进太阳。 + """ + manager = getattr(server, "_time_manager", None) + if manager is None: + value = int(getattr(server, "world_time", 0)) + return value, value + day_time = int(manager.day_time_total) + if not server.gamerules.get("doDaylightCycle", True): + day_time = -day_time if day_time > 0 else -1 + return int(manager.age), day_time + + async def _send_time_update(conn: Connection, server): """发送世界时间。""" + age, day_time = world_time_fields(server) if conn.version_handler is not None: - await conn.version_handler.send_update_time(conn, server.world_time) + await conn.version_handler.send_update_time(conn, age, day_time) return payload = bytearray() - payload.extend(write_long(int(server.world_time))) - payload.extend(write_long(int(server.world_time))) + payload.extend(write_long(age)) + payload.extend(write_long(day_time)) await conn.send_packet(0x64, bytes(payload)) +# 伤害原因 -> (原版 damage_type, 死亡消息翻译键) +DAMAGE_SOURCES = { + "摔落": ("minecraft:fall", "death.attack.fall"), + "虚空": ("minecraft:out_of_world", "death.attack.outOfWorld"), + "窒息": ("minecraft:in_wall", "death.attack.inWall"), + "溺水": ("minecraft:drown", "death.attack.drown"), + "岩浆": ("minecraft:lava", "death.attack.lava"), + "火焰": ("minecraft:in_fire", "death.attack.inFire"), + "燃烧": ("minecraft:on_fire", "death.attack.onFire"), + "高温地面": ("minecraft:hot_floor", "death.attack.hotFloor"), + "仙人掌": ("minecraft:cactus", "death.attack.cactus"), + "甜浆果丛": ("minecraft:sweet_berry_bush", "death.attack.sweetBerryBush"), + "冰冻": ("minecraft:freeze", "death.attack.freeze"), + "饥饿": ("minecraft:starve", "death.attack.starve"), + "闪电": ("minecraft:lightning_bolt", "death.attack.lightningBolt"), + "爆炸": ("minecraft:explosion", "death.attack.explosion"), + "魔法": ("minecraft:magic", "death.attack.magic"), + "kill": ("minecraft:generic_kill", "death.attack.genericKill"), + "generic": ("minecraft:generic", "death.attack.generic"), +} + +# 原版 damage_type 名称 (/damage 命令) 也可直接作为原因传入 +for _key, _msg in ( + ("fall", "fall"), ("out_of_world", "outOfWorld"), ("in_wall", "inWall"), + ("drown", "drown"), ("lava", "lava"), ("in_fire", "inFire"), ("on_fire", "onFire"), + ("hot_floor", "hotFloor"), ("cactus", "cactus"), ("sweet_berry_bush", "sweetBerryBush"), + ("freeze", "freeze"), ("starve", "starve"), ("lightning_bolt", "lightningBolt"), + ("explosion", "explosion"), ("magic", "magic"), ("generic_kill", "genericKill"), + ("generic", "generic"), ("wither", "wither"), ("cramming", "cramming"), + ("fly_into_wall", "flyIntoWall"), ("dragon_breath", "dragonBreath"), + ("dry_out", "dryout"), ("stalagmite", "stalagmite"), ("thorns", "thorns"), +): + DAMAGE_SOURCES.setdefault(_key, (f"minecraft:{_key}", f"death.attack.{_msg}")) + DAMAGE_SOURCES.setdefault(f"minecraft:{_key}", (f"minecraft:{_key}", f"death.attack.{_msg}")) + + +def resolve_damage_source(conn: Connection, reason: str): + """ + 把内部伤害原因解析为 (damage_type, 死亡消息组件)。 + + 支持: 环境原因 (见 DAMAGE_SOURCES)、生物类型名 ("zombie")、 + 远程生物 ("skeleton的箭") 以及玩家攻击 ("player:<名字>")。 + """ + from protocol.gamedata import entity_type_ids + from protocol.text import translate, player_name + victim = player_name(conn) + reason = str(reason or "generic") + + if reason in DAMAGE_SOURCES: + damage_type, key = DAMAGE_SOURCES[reason] + return damage_type, translate(key, victim) + if reason.startswith("player:"): + return "minecraft:player_attack", translate( + "death.attack.player", victim, {"text": reason[7:]}) + ranged = reason.endswith("的箭") + mob = reason[:-2] if ranged else reason + mob = mob.split(":")[-1] + if f"minecraft:{mob}" in entity_type_ids(): + mob_component = {"translate": f"entity.minecraft.{mob}"} + if ranged: + return "minecraft:arrow", translate("death.attack.arrow", victim, mob_component) + return "minecraft:mob_attack", translate("death.attack.mob", victim, mob_component) + return "minecraft:generic", translate("death.attack.generic", victim) + + +async def _broadcast_damage_event(conn: Connection, server, damage_type: str): + """Damage Event + 受伤音效: 客户端据此播放受伤动画 (屏幕泛红/实体变红)。""" + from protocol.gamedata import registry_index + from protocol.packet_map import get_clientbound_packet + type_id = registry_index("minecraft:damage_type").get(damage_type, 0) + payload = bytearray() + payload.extend(write_varint(conn.entity_id)) + payload.extend(write_varint(type_id)) + payload.extend(write_varint(0)) # source cause id + 1 (0 = none) + payload.extend(write_varint(0)) # source direct id + 1 (0 = none) + payload.extend(write_boolean(False)) # has source position + data = bytes(payload) + for other in server.get_online_players(): + if other.protocol_version < 767: + continue + if other is not conn and conn.entity_id not in other.tracked_players: + continue + pid = get_clientbound_packet(other.protocol_version, "damage_event") + if pid is not None: + await other.send_packet(pid, data) + + async def _damage_player(conn: Connection, amount: float, reason: str, server): - """对玩家造成基础伤害。死亡时回到出生点。""" + """对玩家造成伤害; 生命值归零时进入死亡流程 (死亡界面 + 死亡消息)。""" if not conn.alive or conn.gamemode in {"creative", "spectator"}: return + if getattr(conn, "_dead", False) or amount <= 0: + return if conn.damage_cooldown_ticks > 0 and conn.last_damage_reason == reason: return + gamerules = server.gamerules + if reason == "摔落" and not gamerules.get("fallDamage", True): + return + if reason in ("火焰", "燃烧", "岩浆", "高温地面") and not gamerules.get("fireDamage", True): + return + if reason == "溺水" and not gamerules.get("drowningDamage", True): + return + if reason == "冰冻" and not gamerules.get("freezeDamage", True): + return + + damage_type, death_message = resolve_damage_source(conn, reason) conn.health = max(0.0, conn.health - amount) conn.damage_cooldown_ticks = 10 conn.last_damage_reason = reason await _send_update_health(conn) + await _broadcast_damage_event(conn, server, damage_type) if conn.health > 0: - await send_system_message(conn, f"[PyMC] 你受到了 {amount:.1f} 点{reason}伤害") return + await _kill_player(conn, server, death_message) - # Send death screen with message - import json as _json + +async def _kill_player(conn: Connection, server, death_message): + """玩家死亡: 掉落物品/经验、显示死亡界面、广播死亡消息。""" from protocol.packet_map import get_clientbound_packet as _gcp - death_msg = _json.dumps({"text": f"你被 {reason} 杀死了"}, ensure_ascii=False) - dp = bytearray() - dp.extend(write_varint(conn.entity_id)) - dp.extend(write_varint(0)) - dp.extend(write_string(death_msg)) - dpid = _gcp(conn.protocol_version, "death_combat_event") - if dpid is not None: - await conn.send_packet(dpid, bytes(dp)) + from protocol.text import encode_component + + conn.health = 0.0 conn._dead = True + conn.fire_ticks = 0 + + if not server.gamerules.get("keepInventory", False): + await _drop_player_inventory(conn, server) + + pid = _gcp(conn.protocol_version, "death_combat_event") + if pid is not None: + payload = bytearray() + payload.extend(write_varint(conn.entity_id)) + payload.extend(encode_component(death_message, conn.protocol_version)) + await conn.send_packet(pid, bytes(payload)) + + # Entity Event 3 = 死亡动画 (其他玩家看到倒地) + status_pid = _gcp(conn.protocol_version, "entity_status") + for other in server.get_online_players(): + if other is conn or conn.entity_id not in other.tracked_players: + continue + opid = _gcp(other.protocol_version, "entity_status") + if opid is not None: + await other.send_packet(opid, write_int(conn.entity_id) + write_byte(3)) + + from protocol.text import plain_text + if server.gamerules.get("showDeathMessages", True): + server.broadcast_system_message(death_message, log=True) + else: + logging.getLogger("minecraft.server").info(plain_text(death_message)) + + from plugins.bridge import hook_player_death + hook_player_death(server, conn, plain_text(death_message)) + + if server.gamerules.get("doImmediateRespawn", False): + await respawn_player(conn, server) + + +async def _drop_player_inventory(conn: Connection, server): + """死亡时掉落全部物品和部分经验 (keepInventory=false)。""" + inventory = getattr(conn, "inventory_obj", None) + if inventory is not None: + import random + for index, stack in enumerate(list(inventory.slots)): + if stack is None or stack.is_empty: + continue + item = server.entity_manager.create_item( + conn.x + random.uniform(-0.5, 0.5), conn.y + 0.5, + conn.z + random.uniform(-0.5, 0.5), stack.item_id, stack.count) + item.pickup_delay = 40 + inventory.slots[index] = None + inventory.carried_item = None + conn.inventory_state_id += 1 + from world.inventory import send_inventory_sync + await send_inventory_sync(conn) + + dropped_xp = min(100, conn.experience_level * 7) + if dropped_xp > 0: + server.entity_manager.create_experience_orb(conn.x, conn.y + 0.5, conn.z, dropped_xp) + conn.experience_total = 0 + conn.experience_level = 0 + conn.experience_progress = 0.0 + + +async def respawn_player(conn: Connection, server): + """ + 玩家点击 "重生" 后的完整重生流程。 + + 客户端收到 Respawn 后会重建世界 (丢弃所有区块和实体), 因此需要重新发送 + 区块、位置、生命值、物品栏以及周围的实体。 + """ + from handlers.play.spawn import _resolve_player_respawn_location + from handlers.play.state import send_abilities, send_held_slot + from protocol.packet_map import get_clientbound_packet + + # The safe-spot search may have to load/generate chunks: keep it off the event loop. + respawn_x, respawn_y, respawn_z = await asyncio.get_event_loop().run_in_executor( + None, _resolve_player_respawn_location, conn, server) + conn.x = float(respawn_x) + 0.5 + conn.y = float(respawn_y) + conn.z = float(respawn_z) + 0.5 + conn.fall_start_y = conn.y + conn.on_ground = True + conn.health = 20.0 + conn.food = 20 + conn.saturation = 5.0 + conn.air_supply = 300 + conn.fire_ticks = 0 + conn.freeze_ticks = 0 + conn.damage_cooldown_ticks = 60 # 重生保护 + conn.last_damage_reason = "" + conn._dead = False + + respawn_pid = get_clientbound_packet(conn.protocol_version, "respawn") + if respawn_pid is not None: + gamemode_map = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} + payload = bytearray() + payload.extend(write_varint(0)) # Dimension type (overworld) + payload.extend(write_identifier("minecraft:overworld")) + payload.extend(write_long(hashed_seed(server))) + payload.extend(write_ubyte(gamemode_map.get(conn.gamemode, 0))) + payload.extend(write_byte(-1)) # Previous gamemode + payload.extend(write_boolean(False)) # Is debug + payload.extend(write_boolean(False)) # Is flat + payload.extend(write_boolean(False)) # Has death location + payload.extend(write_varint(0)) # Portal cooldown + payload.extend(write_byte(0)) # Data kept (0 = nothing) + await conn.send_packet(respawn_pid, bytes(payload)) + + # 客户端世界已重建: 重新发送区块与实体 + conn.loaded_chunks.clear() + conn.tracked_entities.clear() + conn.tracked_players.clear() + + await send_abilities(conn) + await send_held_slot(conn) + await _send_spawn_position(conn, *server.spawn_position) + await _send_game_event(conn, 13, 0.0) + + # Like vanilla: position and health right away, chunks stream in after + # (the client holds the player on the "loading terrain" screen meanwhile). + await _send_synchronize_position(conn) + await _send_update_health(conn) + await _send_set_experience(conn) + + center_cx = math.floor(conn.x) >> 4 + center_cz = math.floor(conn.z) >> 4 + conn.chunk_center = (center_cx, center_cz) + await _send_center_chunk(conn, center_cx, center_cz) + view_distance = effective_view_distance(conn, server) + chunk_coords = _sorted_chunk_coords(center_cx, center_cz, view_distance) + loop = asyncio.get_event_loop() + results = await loop.run_in_executor( + None, lambda: server.generate_chunk_results(chunk_coords)[0]) + from handlers.play.chunks import _send_chunk_results_streamed + await _send_chunk_results_streamed(conn, results) + conn.loaded_chunks.update((cx, cz) for cx, cz, *_ in results) + await _send_time_update(conn, server) + from handlers.play.weather import send_weather_state + await send_weather_state(conn, server) + from world.inventory import send_inventory_sync + await send_inventory_sync(conn) + + # 其他玩家: 移除旧实体后重新生成 + from handlers.play.players import send_player_spawn, remove_player_entity + remove_pid_payload = write_varint(1) + write_varint(conn.entity_id) + for other in server.get_online_players(): + if other is conn: + continue + if conn.entity_id in other.tracked_players: + rpid = get_clientbound_packet(other.protocol_version, "remove_entities") + if rpid is not None: + await other.send_packet(rpid, remove_pid_payload) + await remove_player_entity(other, conn.entity_id) + await send_player_spawn(other, conn) + await send_player_spawn(conn, other) + await _send_visible_entities_to_player(conn, server) + + from plugins.bridge import hook_player_respawn + hook_player_respawn(server, conn) async def _update_player_motion_state(conn: Connection, new_y: float, new_on_ground: bool, server): diff --git a/handlers/play/players.py b/handlers/play/players.py index d57ca67..81abc69 100644 --- a/handlers/play/players.py +++ b/handlers/play/players.py @@ -50,8 +50,8 @@ def _supports_player_spawn(conn: Connection) -> bool: - """仅原生 1.21.1 路径支持玩家实体生成。""" - return conn.version_handler is None + """仅原生 1.21.1 协议路径支持玩家实体生成。""" + return getattr(conn, "protocol_version", 767) == 767 def build_spawn_player_payload(player: Connection) -> bytes: @@ -73,17 +73,107 @@ def build_spawn_player_payload(player: Connection) -> bytes: return bytes(payload) +# 实体 metadata: index 0 = 状态标志 (Byte), index 6 = 姿势 (Pose) +ENTITY_FLAG_ON_FIRE = 0x01 +ENTITY_FLAG_SNEAKING = 0x02 +ENTITY_FLAG_SPRINTING = 0x08 +POSE_STANDING = 0 +POSE_SNEAKING = 5 +METADATA_TYPE_BYTE = 0 +METADATA_TYPE_POSE = 21 + + +def player_entity_flags(player: Connection) -> int: + flags = 0 + if getattr(player, "fire_ticks", 0) > 0: + flags |= ENTITY_FLAG_ON_FIRE + if getattr(player, "sneaking", False): + flags |= ENTITY_FLAG_SNEAKING + if getattr(player, "sprinting", False): + flags |= ENTITY_FLAG_SPRINTING + return flags + + def build_player_metadata_payload(player: Connection) -> bytes: - """构建 Set Entity Data 负载: 显示全部皮肤层 (披风/帽子/袖子等)。""" + """ + 构建 Set Entity Data 负载: + index 0 状态标志 (着火/潜行/疾跑) + index 6 姿势 (站立/潜行) + index 17 皮肤层 (来自客户端设置, 披风/帽子/袖子等) + """ payload = bytearray() payload.extend(write_varint(player.entity_id)) + payload.extend(write_ubyte(0)) + payload.extend(write_varint(METADATA_TYPE_BYTE)) + payload.extend(write_ubyte(player_entity_flags(player))) + payload.extend(write_ubyte(6)) + payload.extend(write_varint(METADATA_TYPE_POSE)) + payload.extend(write_varint( + POSE_SNEAKING if getattr(player, "sneaking", False) else POSE_STANDING)) payload.extend(write_ubyte(SKIN_PARTS_INDEX)) - payload.extend(write_varint(0)) # metadata type 0 = Byte - payload.extend(write_ubyte(SKIN_PARTS_ALL)) + payload.extend(write_varint(METADATA_TYPE_BYTE)) + payload.extend(write_ubyte(getattr(player, "skin_parts", SKIN_PARTS_ALL) & 0x7F)) payload.extend(write_ubyte(0xFF)) # terminator return bytes(payload) +async def broadcast_player_metadata(server, player: Connection): + """把玩家的姿态/皮肤层变化同步给能看到他的玩家。""" + payload = build_player_metadata_payload(player) + for observer in server.get_online_players(): + if observer is player or player.entity_id not in observer.tracked_players: + continue + await observer.send_packet(SET_ENTITY_DATA_PID, payload) + + +def build_equipment_payload(player: Connection) -> bytes | None: + """构建 Set Equipment 负载 (主手/副手/护甲)。""" + from world.inventory import encode_slot_entry + inventory = getattr(player, "inventory_obj", None) + if inventory is None: + return None + held = inventory.get_slot(int(getattr(player, "selected_hotbar_slot", 0))) + entries = [ + (0, held), # main hand + (1, inventory.get_slot(40)), # off hand + (2, inventory.get_slot(36)), # boots + (3, inventory.get_slot(37)), # leggings + (4, inventory.get_slot(38)), # chestplate + (5, inventory.get_slot(39)), # helmet + ] + payload = bytearray(write_varint(player.entity_id)) + for i, (slot, item) in enumerate(entries): + last = i == len(entries) - 1 + payload.append(slot | (0 if last else 0x80)) + payload.extend(encode_slot_entry(item)) + return bytes(payload) + + +async def broadcast_player_equipment(server, player: Connection, only: Connection | None = None): + """同步玩家手持物品与护甲给其他玩家。""" + payload = build_equipment_payload(player) + if payload is None: + return + observers = [only] if only is not None else server.get_online_players() + for observer in observers: + if observer is player or player.entity_id not in observer.tracked_players: + continue + pid = get_clientbound_packet(observer.protocol_version, "entity_equipment") + if pid is not None: + await observer.send_packet(pid, payload) + + +async def broadcast_player_animation(server, player: Connection, animation: int): + """Entity Animation: 0 = 挥动主手, 3 = 挥动副手。""" + payload = write_varint(player.entity_id) + write_ubyte(animation) + for observer in server.get_online_players(): + if observer is player or player.entity_id not in observer.tracked_players: + continue + pid = get_clientbound_packet(observer.protocol_version, "animation") + if pid is not None: + await observer.send_packet(pid, payload) + + def build_rotate_head_payload(player: Connection) -> bytes: """构建 Rotate Head 数据包负载。""" payload = bytearray() @@ -105,6 +195,11 @@ async def send_player_spawn(observer: Connection, player: Connection): await observer.send_packet(SPAWN_ENTITY_PID, build_spawn_player_payload(player)) await observer.send_packet(SET_ENTITY_DATA_PID, build_player_metadata_payload(player)) observer.tracked_players.add(player.entity_id) + equipment = build_equipment_payload(player) + if equipment is not None: + pid = get_clientbound_packet(observer.protocol_version, "entity_equipment") + if pid is not None: + await observer.send_packet(pid, equipment) async def sync_player_visibility(server, new_conn: Connection): @@ -128,7 +223,7 @@ def _player_within_tracking_range(player: Connection, observer: Connection, return dx * dx + dz * dz <= max_distance -async def relay_player_movement(server, moved: Connection): +async def relay_player_movement(server, moved: Connection, force: bool = False): """ 将玩家的位置和视角转发给视距内的其他玩家。 @@ -139,7 +234,7 @@ async def relay_player_movement(server, moved: Connection): return optimizer = getattr(server, "network_optimizer", None) - if optimizer is not None and not optimizer.should_send_movement(moved): + if not force and optimizer is not None and not optimizer.should_send_movement(moved): return rotate_payload = build_rotate_head_payload(moved) diff --git a/handlers/play/spawn.py b/handlers/play/spawn.py index f8dbfdb..32536be 100755 --- a/handlers/play/spawn.py +++ b/handlers/play/spawn.py @@ -139,81 +139,23 @@ def _spawn_candidate_from_column(chunk_blocks, local_x: int, local_z: int): def _resolve_spawn_location(server, block_x: int, block_z: int) -> tuple[int, int, int]: """ - 在出生点附近选择一个更安全、更平坦的落脚点。 - 优先选择草地/泥土/沙地等自然地表,并要求头顶有足够空间。 + The nearest column around (x, z) where a player can stand safely + (used when a saved position is no longer valid). """ - search_radius = 8 - preferred_blocks = { - GRASS_BLOCK, DIRT, COARSE_DIRT, PODZOL, MOSS_BLOCK, - SAND, RED_SAND, GRAVEL, SNOW_BLOCK, CLAY, - } - chunk_cache: dict[tuple[int, int], list[list[list[int]]] | None] = {} - - def _column_top(world_x: int, world_z: int): - chunk_x = int(world_x) >> 4 - chunk_z = int(world_z) >> 4 - chunk_blocks = _load_or_generate_spawn_chunk(server, chunk_x, chunk_z, chunk_cache) - if chunk_blocks is None: - return None - - local_x = int(world_x) & 15 - local_z = int(world_z) & 15 - return _spawn_candidate_from_column(chunk_blocks, local_x, local_z) - - def _surface_slope(world_x: int, world_z: int) -> int: - center = _column_top(world_x, world_z) - if center is None: - return 999 - deltas = [] - for dx, dz in ((-1, 0), (1, 0), (0, -1), (0, 1)): - neighbor = _column_top(world_x + dx, world_z + dz) - if neighbor is None: - continue - deltas.append(abs(center["world_y"] - neighbor["world_y"])) - return max(deltas) if deltas else 0 - - best_choice = None - best_score = None - fallback_choice = None - fallback_score = None - fallback_y = int(server.spawn_position[1]) - - for dz in range(-search_radius, search_radius + 1): - for dx in range(-search_radius, search_radius + 1): - world_x = int(block_x) + dx - world_z = int(block_z) + dz - column = _column_top(world_x, world_z) - if column is None: - continue - - if dx == 0 and dz == 0: - fallback_y = column["spawn_y"] - - slope = _surface_slope(world_x, world_z) - distance = abs(dx) + abs(dz) - score = distance * 6 + slope * 10 - if column["world_y"] < 62: - score += 20 - - if fallback_score is None or score < fallback_score: - fallback_score = score - fallback_choice = (world_x, column["spawn_y"], world_z) - - if column["block_id"] not in preferred_blocks: - continue - - if column["block_id"] in preferred_blocks: - score -= 40 - - if best_score is None or score < best_score: - best_score = score - best_choice = (world_x, column["spawn_y"], world_z) - - if best_choice is not None: - return best_choice - if fallback_choice is not None: - return fallback_choice - return int(block_x), fallback_y, int(block_z) + cache: dict = {} + pos = overworld_respawn_pos(server, int(block_x), int(block_z), cache) + if pos is not None: + return pos + for radius in range(1, 17): + for dx in range(-radius, radius + 1): + for dz in (-radius, radius) if abs(dx) != radius else range(-radius, radius + 1): + pos = overworld_respawn_pos(server, int(block_x) + dx, int(block_z) + dz, cache) + if pos is not None: + return pos + pos = _search_safe_nearby(server, int(block_x), int(block_z), 256, cache) + if pos is not None: + return pos + return int(block_x), int(server.spawn_position[1]), int(block_z) def _get_spawn_check_block( @@ -233,9 +175,41 @@ def _get_spawn_check_block( return int(chunk_blocks[int(world_y) + 64][int(world_z) & 15][int(world_x) & 15]) +_SUFFOCATING_STATES: frozenset[int] | None = None + + +def _suffocating_states() -> frozenset[int]: + """ + 会让玩家窒息的方块状态: 完整的不透光实心方块 (石头、泥土、木板...)。 + 台阶、楼梯、树叶、玻璃、花草、火把、箱子等都不会 (与原版一致)。 + 数据来自 world/blocks.json 的 boundingBox / filterLight。 + """ + global _SUFFOCATING_STATES + if _SUFFOCATING_STATES is None: + import json + from world.chunk_io import _find_blocks_json + states: set[int] = set() + try: + with open(_find_blocks_json(), "r", encoding="utf-8") as f: + for block in json.load(f): + if (block.get("boundingBox") == "block" + and int(block.get("filterLight", 0)) >= 15 + and not block.get("transparent", False)): + states.update(range(block["minStateId"], block["maxStateId"] + 1)) + except Exception: + states = set() + _SUFFOCATING_STATES = frozenset(states) + return _SUFFOCATING_STATES + + def _is_suffocating_block(block_id: int | None) -> bool: - """是否为会造成窒息的实体方块。""" - return block_id is not None and block_id not in PASSABLE_BLOCKS + """是否为会造成窒息的完整实心方块。""" + if block_id is None: + return False + states = _suffocating_states() + if states: + return block_id in states + return block_id not in PASSABLE_BLOCKS def _is_safe_player_location(server, world_x: int, world_y: int, world_z: int) -> bool: @@ -251,31 +225,247 @@ def _is_safe_player_location(server, world_x: int, world_y: int, world_z: int) - return _is_spawn_ground_block(below_block) +# ------------------------------------------------------------------ +# Vanilla spawn logic (PlayerRespawnLogic / MinecraftServer.setInitialSpawn) +# ------------------------------------------------------------------ + +def _block_tables(): + """(fluid ids, full-top-face ids, hazard ids, non-blocking ids) from blocks.json.""" + global _TABLES + try: + return _TABLES + except NameError: + pass + import json + from world.chunk_io import _find_blocks_json + fluids, full, hazards, passable, leaves = set(), set(), set(), set(), set() + partial_names = ("_slab", "_stairs", "carpet", "pressure_plate", "_wall", "fence", "_pane", "bars", + "snow", "cactus", "farmland", "dirt_path", "soul_sand", "honey_block", "bed", + "chest", "lantern", "cake", "candle", "head", "skull", "pot", "anvil", "hopper", + "cauldron", "lectern", "enchanting", "brewing", "dripstone", "amethyst_cluster", + "bud", "scaffolding", "door", "trapdoor", "chain", "rod", "rail", "button", "lever", + "torch", "sign", "banner", "campfire", "composter", "stonecutter", "grindstone", + "bell", "conduit", "sea_pickle", "turtle_egg", "sniffer_egg", "frogspawn") + hazard_names = ("lava", "fire", "magma_block", "campfire", "cactus", "sweet_berry_bush", + "powder_snow", "wither_rose", "pointed_dripstone") + with open(_find_blocks_json(), "r", encoding="utf-8") as f: + for block in json.load(f): + name = block["name"] + ids = range(block["minStateId"], block["maxStateId"] + 1) + if name in ("water", "lava", "bubble_column"): + fluids.update(ids) + if any(h in name for h in hazard_names): + hazards.update(ids) + if block.get("boundingBox") == "block" and not any(p in name for p in partial_names): + full.update(ids) + if block.get("boundingBox") == "empty" or name in ("snow",): + passable.update(ids) + if name.endswith("_leaves"): + leaves.update(ids) + fluids_f, full_f, hazards_f, passable_f = map(frozenset, (fluids, full, hazards, passable)) + _TABLES = (fluids_f, full_f, hazards_f, passable_f, frozenset(leaves)) + return _TABLES + + +def _column_block(chunk_blocks, x: int, y: int, z: int) -> int: + if y < -64 or y > 319: + return AIR + return int(chunk_blocks[y + 64][z & 15][x & 15]) + + +def overworld_respawn_pos(server, x: int, z: int, chunk_cache: dict | None = None, + allow_tree_tops: bool = False): + """ + PlayerRespawnLogic.getOverworldRespawnPos plus safety checks. + + Returns the block position the player's feet go into, or None when the + column's top is a fluid (ocean, lake, lava pool), when there is no full + block to stand on, or when the spot is next to something harmful. + """ + if chunk_cache is None: + chunk_cache = {} + chunk = _load_or_generate_spawn_chunk(server, x >> 4, z >> 4, chunk_cache) + if chunk is None: + return None + fluids, full, hazards, passable, leaves = _block_tables() + top = None + for y in range(319, -65, -1): + block = _column_block(chunk, x, y, z) + if block == AIR or block in passable and block not in fluids: + continue + if block in leaves and not allow_tree_tops: + continue # look for the ground below the canopy (MOTION_BLOCKING_NO_LEAVES) + top = y + break + if top is None or _column_block(chunk, x, top, z) in fluids: + return None + ground = _column_block(chunk, x, top, z) + if ground not in full or ground in hazards: + return None + feet, head = top + 1, top + 2 + if head > 319: + return None + for y in (feet, head): + block = _column_block(chunk, x, y, z) + if block in fluids or block in hazards or not (block == AIR or block in passable): + return None + # nothing harmful next to the player's body + for dx, dz in ((1, 0), (-1, 0), (0, 1), (0, -1)): + neighbour = _load_or_generate_spawn_chunk(server, (x + dx) >> 4, (z + dz) >> 4, chunk_cache) + if neighbour is None: + continue + for y in (top, feet, head): + if _column_block(neighbour, x + dx, y, z + dz) in hazards: + return None + return int(x), int(feet), int(z) + + +def spawn_pos_in_chunk(server, chunk_x: int, chunk_z: int, chunk_cache: dict | None = None, + allow_tree_tops: bool = False): + """PlayerRespawnLogic.getSpawnPosInChunk: first valid column, scanning x then z.""" + for x in range(chunk_x * 16, chunk_x * 16 + 16): + for z in range(chunk_z * 16, chunk_z * 16 + 16): + pos = overworld_respawn_pos(server, x, z, chunk_cache, allow_tree_tops) + if pos is not None: + return pos + return None + + +def _climate_spawn_column(server) -> tuple[int, int]: + """The column vanilla starts from: Climate.findSpawnPosition (native) or a land search.""" + terrain = getattr(server, "terrain_generator", None) + finder = getattr(terrain, "find_spawn", None) + if finder is not None: + try: + found = finder() + if found is not None: + return int(found[0]), int(found[1]) + except Exception as e: + logger.warning(f"Native spawn search failed: {e}") + # Fallback for the Python generators: nearest land on a coarse spiral. + height = getattr(terrain, "get_terrain_height", None) + if height is not None: + for radius in range(0, 2049, 64): + steps = max(1, radius // 16) + for i in range(steps * 4 if radius else 1): + angle = (i / (steps * 4)) * 6.283185307179586 if radius else 0.0 + x = int(math.sin(angle) * radius) + z = int(math.cos(angle) * radius) + try: + if height(x, z) > 64: + return x, z + except Exception: + break + return 0, 0 + + +def find_world_spawn(server) -> tuple[int, int, int]: + """ + Pick the spawn point of a new world like MinecraftServer.setInitialSpawn: + climate-based search for land, then an 11x11 chunk spiral for the first + column a player can safely stand on. + """ + x, z = _climate_spawn_column(server) + center_cx, center_cz = x >> 4, z >> 4 + cache: dict = {} + for allow_tree_tops in (False, True): + j = k = l = 0 + m = -1 + for _ in range(11 * 11): + if -5 <= j <= 5 and -5 <= k <= 5: + pos = spawn_pos_in_chunk(server, center_cx + j, center_cz + k, cache, allow_tree_tops) + if pos is not None: + return pos + if j == k or (j < 0 and j == -k) or (j > 0 and j == 1 - k): + l, m = -m, l + j += l + k += m + # nothing safe in 11x11 chunks (e.g. a mushroom island in the ocean): widen the search + pos = _search_safe_nearby(server, center_cx * 16 + 8, center_cz * 16 + 8, 256, cache) + if pos is not None: + return pos + return center_cx * 16 + 8, 100, center_cz * 16 + 8 + + +def _search_safe_nearby(server, x: int, z: int, radius: int, cache: dict): + for r in range(0, radius + 1, 4): + for dx in range(-r, r + 1, 4): + for dz in (-r, r) if abs(dx) != r else range(-r, r + 1, 4): + pos = overworld_respawn_pos(server, x + dx, z + dz, cache) + if pos is not None: + return pos + return None + + +def _spawn_radius(server) -> int: + rules = getattr(server, "gamerules", None) + try: + return max(0, int(rules.get("spawnRadius", 10))) if rules is not None else 10 + except (TypeError, ValueError): + return 10 + + +def fudge_spawn_location(server, base: tuple[int, int, int], radius: int | None = None): + """ + ServerPlayer.fudgeSpawnLocation: a random safe column within the + spawnRadius gamerule around the world spawn (visits every column once, + in a random coprime order, like vanilla). + """ + import random + bx, by, bz = (int(v) for v in base) + r = _spawn_radius(server) if radius is None else radius + if r <= 0: + r = 0 + side = r * 2 + 1 + total = side * side + step = _coprime(total) + start = random.randrange(total) + cache: dict = {} + for allow_tree_tops in (False, True): + for p in range(total): + q = (start + step * p) % total + x = bx + q % side - r + z = bz + q // side - r + pos = overworld_respawn_pos(server, x, z, cache, allow_tree_tops) + if pos is not None: + return pos + pos = overworld_respawn_pos(server, bx, bz, cache) or _search_safe_nearby(server, bx, bz, 128, cache) + return pos if pos is not None else (bx, by, bz) + + +def _coprime(n: int) -> int: + return 17 if n <= 16 else 17 if n % 17 else 31 if n % 31 else 1 + + def _resolve_initial_player_location(server, player_state: dict | None) -> tuple[int, int, int]: - """优先使用玩家存档位置,位置无效时回退到安全出生点。""" - if player_state is not None: - saved_x = math.floor(float(player_state.get("x", server.spawn_position[0]))) - saved_y = math.floor(float(player_state.get("y", server.spawn_position[1]))) - saved_z = math.floor(float(player_state.get("z", server.spawn_position[2]))) - if _is_safe_player_location(server, saved_x, saved_y, saved_z): - return saved_x, saved_y, saved_z + """ + Returning players: their saved position, unless it would trap them in a + solid block or below the world. New players: a random safe column near + the world spawn. + """ + if player_state is not None and all(k in player_state for k in ("x", "y", "z")): + saved_x = math.floor(float(player_state["x"])) + saved_y = math.floor(float(player_state["y"])) + saved_z = math.floor(float(player_state["z"])) + if -64 <= saved_y < 320: + cache: dict = {} + foot = _get_spawn_check_block(server, saved_x, saved_y, saved_z, cache) + head = _get_spawn_check_block(server, saved_x, min(319, saved_y + 1), saved_z, cache) + if (foot is not None and head is not None + and not _is_suffocating_block(foot) and not _is_suffocating_block(head)): + return saved_x, saved_y, saved_z return _resolve_spawn_location(server, saved_x, saved_z) - spawn_x, _, spawn_z = server.spawn_position - resolved = _resolve_spawn_location(server, spawn_x, spawn_z) - server.spawn_position = (int(resolved[0]), int(resolved[1]), int(resolved[2])) - return resolved + if not getattr(server, "_spawn_resolved", True): + server.spawn_position = find_world_spawn(server) + server._spawn_resolved = True + return fudge_spawn_location(server, server.spawn_position) def _resolve_player_respawn_location(conn: Connection, server) -> tuple[int, int, int]: - """优先使用玩家个人出生点,否则回退到世界出生点。""" + """Personal spawn point (bed / /spawnpoint) if still usable, else near world spawn.""" if conn.personal_spawn is not None: spawn_x, spawn_y, spawn_z = conn.personal_spawn if _is_safe_player_location(server, spawn_x, spawn_y, spawn_z): return spawn_x, spawn_y, spawn_z - return _resolve_spawn_location(server, spawn_x, spawn_z) - - spawn_x, _, spawn_z = server.spawn_position - respawn_x, respawn_y, respawn_z = _resolve_spawn_location(server, spawn_x, spawn_z) - server.spawn_position = (int(respawn_x), int(respawn_y), int(respawn_z)) - return respawn_x, respawn_y, respawn_z + return fudge_spawn_location(server, server.spawn_position) diff --git a/handlers/play/state.py b/handlers/play/state.py new file mode 100644 index 0000000..704e756 --- /dev/null +++ b/handlers/play/state.py @@ -0,0 +1,144 @@ +# ============================================================ +# PyMC - 玩家状态同步 +# 游戏模式、能力、难度、权限等级等客户端状态数据包 +# ============================================================ + +""" +玩家状态同步辅助函数 (1.21.1 原生路径)。 + + - send_abilities: Player Abilities (飞行/无敌/创造) + - send_difficulty: Change Difficulty + - send_op_level: Entity Event 24-28 (客户端据此显示命令补全/F3+F4) + - send_held_slot: Set Held Item + - send_ticking_state: Set Ticking State + Step Tick + - set_player_gamemode: 切换游戏模式并同步给所有相关客户端 +""" + +from __future__ import annotations + +import logging + +from protocol.data_types import ( + write_boolean, write_byte, write_float, write_int, write_ubyte, write_varint, +) +from protocol.packet_map import get_clientbound_packet + +logger = logging.getLogger("PyMC.游戏") + +GAMEMODE_IDS = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} +GAMEMODE_NAMES = {v: k for k, v in GAMEMODE_IDS.items()} +DIFFICULTY_IDS = {"peaceful": 0, "easy": 1, "normal": 2, "hard": 3} + +ABILITY_INVULNERABLE = 0x01 +ABILITY_FLYING = 0x02 +ABILITY_ALLOW_FLYING = 0x04 +ABILITY_CREATIVE = 0x08 + + +def normalize_gamemode(value, default: str = "survival") -> str: + """Accept names, vanilla abbreviations and numeric ids.""" + if isinstance(value, int): + return GAMEMODE_NAMES.get(value, default) + text = str(value or "").strip().lower() + if text in GAMEMODE_IDS: + return text + aliases = {"s": "survival", "c": "creative", "a": "adventure", "sp": "spectator", + "0": "survival", "1": "creative", "2": "adventure", "3": "spectator"} + return aliases.get(text, default) + + +def ability_flags(conn) -> int: + mode = getattr(conn, "gamemode", "survival") + flags = 0 + if mode == "creative": + flags = ABILITY_INVULNERABLE | ABILITY_ALLOW_FLYING | ABILITY_CREATIVE + elif mode == "spectator": + flags = ABILITY_INVULNERABLE | ABILITY_ALLOW_FLYING | ABILITY_FLYING + if getattr(conn, "flying", False) and flags & ABILITY_ALLOW_FLYING: + flags |= ABILITY_FLYING + return flags + + +async def _send(conn, name: str, payload: bytes) -> bool: + pid = get_clientbound_packet(conn.protocol_version, name) + if pid is None: + return False + await conn.send_packet(pid, payload) + return True + + +async def send_abilities(conn): + payload = bytearray() + payload.extend(write_byte(ability_flags(conn))) + payload.extend(write_float(0.05)) # flying speed + payload.extend(write_float(0.1)) # FOV modifier (walk speed) + await _send(conn, "player_abilities", bytes(payload)) + + +async def send_difficulty(conn, server): + difficulty = DIFFICULTY_IDS.get(str(server.config.get("difficulty", "normal")).lower(), 2) + payload = write_ubyte(difficulty) + write_boolean(False) + await _send(conn, "difficulty", payload) + + +def op_level(server, conn) -> int: + """Vanilla permission level (0-4) of a player.""" + permissions = getattr(server, "permissions", None) + if permissions is None: + return 0 + getter = getattr(permissions, "get_op_level", None) + if getter is not None: + return int(getter(conn.username)) + return 4 if permissions.has_permission(conn.username, "command.*") else 0 + + +async def send_op_level(conn, server): + """Entity Event 24 + level: tells the client its permission level.""" + level = max(0, min(4, op_level(server, conn))) + payload = write_int(conn.entity_id) + write_byte(24 + level) + await _send(conn, "entity_status", payload) + + +async def send_held_slot(conn): + await _send(conn, "held_item_change", write_byte(int(getattr(conn, "selected_hotbar_slot", 0)))) + + +async def send_ticking_state(conn, tick_rate: float = 20.0, frozen: bool = False): + await _send(conn, "set_ticking_state", write_float(tick_rate) + write_boolean(frozen)) + await _send(conn, "step_tick", write_varint(0)) + + +async def send_game_event(conn, event: int, value: float = 0.0): + await _send(conn, "game_event", write_ubyte(event) + write_float(value)) + + +async def send_simulation_distance(conn, distance: int): + await _send(conn, "simulation_distance", write_varint(distance)) + + +async def set_player_gamemode(server, conn, mode: str) -> bool: + """ + 切换玩家游戏模式并同步: + - Game Event 3 (Change game mode) 给玩家本人 + - Player Abilities 给玩家本人 + - Player Info Update (Update Game Mode) 给所有人 (Tab 列表/旁观者显示) + 返回游戏模式是否发生变化。 + """ + mode = normalize_gamemode(mode, getattr(conn, "gamemode", "survival")) + changed = getattr(conn, "gamemode", None) != mode + conn.gamemode = mode + if mode not in ("creative", "spectator"): + conn.flying = False + elif mode == "spectator": + conn.flying = True + + await send_game_event(conn, 3, float(GAMEMODE_IDS[mode])) + await send_abilities(conn) + + from handlers.play.chat import build_player_info_update, INFO_GAMEMODE + info = build_player_info_update(conn, INFO_GAMEMODE) + for other in server.get_online_players(): + pid = get_clientbound_packet(other.protocol_version, "player_info") + if pid is not None and other.protocol_version >= 761: + await other.send_packet(pid, info) + return changed diff --git a/handlers/play/weather.py b/handlers/play/weather.py index 4b3b9c3..31b5933 100644 --- a/handlers/play/weather.py +++ b/handlers/play/weather.py @@ -95,4 +95,4 @@ async def broadcast_weather_change(server, old_weather: str, new_weather: str): await _send_game_event(conn, GAME_EVENT_RAIN_LEVEL, rain_strength(new_weather)) await _send_game_event(conn, GAME_EVENT_THUNDER_LEVEL, thunder_strength(new_weather)) - logger.info(f"天气已变更: {old_weather} -> {new_weather}") + logger.debug(f"天气已变更: {old_weather} -> {new_weather}") diff --git a/handlers/status.py b/handlers/status.py index f4e3a2c..8c74cc8 100755 --- a/handlers/status.py +++ b/handlers/status.py @@ -29,52 +29,98 @@ async def handle_status(conn: Connection, packet_id: int, payload: bytes, logger.warning(f"状态阶段收到未知数据包: 0x{packet_id:02X}") -async def _handle_status_request(conn: Connection, server): +SERVER_ICON_FILE = "server-icon.png" +_icon_cache: tuple[float, str | None] | None = None + + +def load_server_icon(path: str = SERVER_ICON_FILE) -> str | None: """ - 处理 Status Request 数据包 (0x00)。 - 返回服务器信息 JSON,包含客户端的协议版本信息。 + 读取 server-icon.png (必须是 64x64 PNG) 并编码为 data URI。 + 与原版一样: 文件不存在或尺寸不对时不发送图标。 """ - # 构建服务器状态响应 - online_players = server.get_online_players() - - # Use the client's protocol version in the response - client_version = get_version_name(conn.protocol_version) - - # Build supported versions list for display - supported_versions = server.config.get("support-protocol-versions", "all") - if supported_versions == "all": - version_name = f"PyMC 1.8-1.21" - else: - version_name = f"PyMC Multi-Version" - + global _icon_cache + import base64 + import os + import struct + try: + mtime = os.path.getmtime(path) + except OSError: + _icon_cache = None + return None + if _icon_cache is not None and _icon_cache[0] == mtime: + return _icon_cache[1] + icon = None + try: + with open(path, "rb") as f: + data = f.read() + if data[:8] == b"\x89PNG\r\n\x1a\n" and data[12:16] == b"IHDR": + width, height = struct.unpack(">II", data[16:24]) + if (width, height) == (64, 64): + icon = "data:image/png;base64," + base64.b64encode(data).decode("ascii") + else: + logger.warning("Couldn't load server icon: Must be 64 pixels wide and 64 pixels high") + else: + logger.warning("Couldn't load server icon: not a PNG file") + except OSError as e: + logger.warning(f"Couldn't load server icon: {e}") + _icon_cache = (mtime, icon) + return icon + + +def build_status_response(server, client_protocol: int) -> dict: + """构建服务器列表 Ping 的 JSON 响应 (与原版字段一致)。""" + from protocol.text import to_component + from protocol.versions import filter_supported_versions, is_supported + + config = server.config + allowed = filter_supported_versions( + config.get("support-protocol-versions", "all"), + int(config.get("min-protocol-version", 47)), + int(config.get("max-protocol-version", 770)), + ) + # 客户端版本受支持时回显其协议号 (显示为兼容); 否则报告原生协议号, + # 客户端会显示 "过时的客户端/服务端" 并给出版本名。 + compatible = is_supported(client_protocol) and client_protocol in allowed + protocol = client_protocol if compatible else NATIVE_PROTOCOL_VERSION + response = { "version": { - "name": version_name, - "protocol": conn.protocol_version - }, - "players": { - "max": server.max_players, - "online": len(online_players), - "sample": [ - {"name": p.username, "id": str(p.uuid)} - for p in online_players[:10] - ] - }, - "description": { - "text": server.motd + "name": get_version_name(NATIVE_PROTOCOL_VERSION), + "protocol": protocol, }, + "description": to_component(server.motd), "enforcesSecureChat": False, - "previewsChat": False } - # 1.19+ clients expect optional fields - if conn.protocol_version >= 759: - response["enforcesSecureChat"] = False + online_players = server.get_online_players() + players = {"max": int(server.max_players), "online": len(online_players)} + if not config.get("hide-online-players", False): + listed = [p for p in online_players if getattr(p, "allow_server_listing", True)] + if listed: + import random + sample = random.sample(listed, min(12, len(listed))) + players["sample"] = [{"name": p.username, "id": str(p.uuid)} for p in sample] + response["players"] = players + + icon = load_server_icon() + if icon: + response["favicon"] = icon + return response + + +async def _handle_status_request(conn: Connection, server): + """ + 处理 Status Request 数据包 (0x00)。 + enable-status=false 时与原版一样不响应 (客户端显示无法连接)。 + """ + if not server.config.get("enable-status", True): + await conn.disconnect() + return + response = build_status_response(server, conn.protocol_version) json_str = json.dumps(response, ensure_ascii=False) - response_payload = write_string(json_str) - await conn.send_packet(0x00, response_payload) - logger.info(f"已发送状态响应给 {conn.address} (协议 {conn.protocol_version}, {client_version})") + await conn.send_packet(0x00, write_string(json_str)) + logger.debug(f"已发送状态响应给 {conn.address} (协议 {conn.protocol_version})") async def _handle_ping_request(conn: Connection, payload: bytes): @@ -88,4 +134,4 @@ async def _handle_ping_request(conn: Connection, payload: bytes): else: # 兼容处理 await conn.send_packet(0x01, payload) - await conn.disconnect("状态查询完成") + await conn.disconnect() diff --git a/handlers/versioned/base.py b/handlers/versioned/base.py index 328d0e4..00e9089 100755 --- a/handlers/versioned/base.py +++ b/handlers/versioned/base.py @@ -74,28 +74,33 @@ async def send_keep_alive(self, conn, keep_alive_id): await conn.send_packet(pid, write_long(keep_alive_id)) async def send_system_chat(self, conn, text, overlay=False): - """Send a system chat message in this version's format.""" - import json - from protocol.data_types import write_string, write_boolean + """Send a system chat message in this version's format. + + ``text`` may be a plain string or a text component (dict / JSON). + 1.20.3+ clients receive NBT, older clients a JSON string. + """ + from protocol.data_types import write_boolean, write_byte, write_varint + from protocol.text import encode_component pid = self.get_packet_id("system_chat") if pid is None: - # Fall back to old chat message format + # Pre-1.19: legacy Chat Message (JSON + position byte) pid = self.get_packet_id("chat_message") if pid is None: return - # Old chat format: JSON Chat + position byte - chat_json = json.dumps({"text": text}, ensure_ascii=False) payload = bytearray() - payload.extend(write_string(chat_json)) - payload.extend(write_byte(0 if not overlay else 2)) # 0=chat, 1=system, 2=action bar + payload.extend(encode_component(text, self.PROTOCOL_VERSION)) + payload.extend(write_byte(0 if not overlay else 2)) # 0=chat, 2=action bar + if self.PROTOCOL_VERSION >= 735: + payload.extend(bytes(16)) # 1.16+: sender UUID await conn.send_packet(pid, bytes(payload)) return - # 1.19+ system chat format - chat_json = json.dumps({"text": text}, ensure_ascii=False) payload = bytearray() - payload.extend(write_string(chat_json)) - payload.extend(write_boolean(overlay)) + payload.extend(encode_component(text, self.PROTOCOL_VERSION)) + if self.PROTOCOL_VERSION == 759: + payload.extend(write_varint(2 if overlay else 1)) # 1.19: chat type id + else: + payload.extend(write_boolean(overlay)) await conn.send_packet(pid, bytes(payload)) async def send_synchronize_position(self, conn): @@ -193,14 +198,16 @@ async def send_spawn_position(self, conn, x, y, z): payload.extend(write_float(0.0)) await conn.send_packet(pid, bytes(payload)) - async def send_update_time(self, conn, world_time): - """Send Update Time packet.""" + async def send_update_time(self, conn, world_age, day_time=None): + """Send Update Time packet (world age + time of day).""" from protocol.data_types import write_long + if day_time is None: + day_time = world_age pid = self.get_packet_id("update_time") if pid is not None: payload = bytearray() - payload.extend(write_long(world_time)) - payload.extend(write_long(world_time)) # time of day + payload.extend(write_long(int(world_age))) + payload.extend(write_long(int(day_time))) await conn.send_packet(pid, bytes(payload)) async def send_set_center_chunk(self, conn, chunk_x, chunk_z): diff --git a/handlers/versioned/v1_21.py b/handlers/versioned/v1_21.py index 87dfeef..4ee63cc 100755 --- a/handlers/versioned/v1_21.py +++ b/handlers/versioned/v1_21.py @@ -50,7 +50,7 @@ async def send_join_game(self, conn, server): payload.extend(write_int(conn.entity_id)) # Is Hardcore (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.config.get("hardcore", False)))) # Dimension Count + Dimension Names dimension_names = [ @@ -69,16 +69,16 @@ async def send_join_game(self, conn, server): payload.extend(write_varint(server.view_distance)) # Simulation Distance (VarInt) - payload.extend(write_varint(server.view_distance)) + payload.extend(write_varint(int(getattr(server, "simulation_distance", server.view_distance)))) # Reduced Debug Info (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.gamerules.get("reducedDebugInfo", False)))) # Enable Respawn Screen (Boolean) - payload.extend(write_boolean(True)) + payload.extend(write_boolean(not server.gamerules.get("doImmediateRespawn", False))) # Do Limited Crafting (Boolean) - payload.extend(write_boolean(False)) + payload.extend(write_boolean(bool(server.gamerules.get("doLimitedCrafting", False)))) # Dimension Type (VarInt - registry index) payload.extend(write_varint(0)) # 0 = overworld @@ -87,11 +87,12 @@ async def send_join_game(self, conn, server): payload.extend(write_identifier("minecraft:overworld")) # Hashed Seed (Long) - payload.extend(write_long(0)) + from handlers.play.join import hashed_seed + payload.extend(write_long(hashed_seed(server))) - # Game Mode (Unsigned Byte) + # Game Mode (Unsigned Byte) — 玩家自己的游戏模式, 而不是服务器默认值 gamemode_map = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} - payload.extend(write_ubyte(gamemode_map.get(server.config.get("gamemode", "creative"), 1))) + payload.extend(write_ubyte(gamemode_map.get(getattr(conn, "gamemode", "survival"), 0))) # Previous Game Mode (Byte) payload.extend(write_byte(-1)) diff --git a/main.py b/main.py index d8f0c7c..2788d81 100755 --- a/main.py +++ b/main.py @@ -6,182 +6,179 @@ """ PyMC: Python 实现的 Minecraft Java 版服务端,关键路径使用 C++ 原生组件加速。 -支持版本: 1.8 - 1.21+ (多版本协议兼容) -功能: - - 离线模式登录 - - 类原版 384 高度主世界生成 (C++ 原生优先,Python 回退) - - 玩家移动同步 - - 聊天消息 - - 基础命令 (/help, /list, /tp, /gamemode, /stop) - - 数据包压缩 - - KeepAlive 心跳 - - 多版本协议兼容 (1.8.9 - 1.21.4) +启动方式与原版服务端一致: + + python main.py [--nogui] [--port 25565] [--world world] + +工作目录下会生成原版风格的文件: + server.properties, ops.json, whitelist.json, banned-players.json, + banned-ips.json, usercache.json, logs/latest.log, /level.dat ... """ +import argparse import asyncio +import concurrent.futures import logging +import os import signal import sys -import os # 确保模块搜索路径正确 sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from config import load_config -from network.server import MinecraftServer +from serverlog import setup_logging +from network.server import MinecraftServer, MINECRAFT_VERSION from handlers.play import execute_server_command from commands import CommandManager, register_all_vanilla_commands -from watchdog import WatchdogManager, PlayerNetworkOptimizer -from plugins.bridge import init_plugin_system, shutdown_plugin_system - - -def setup_logging(): - """配置日志系统。""" - # 创建根日志记录器 - root_logger = logging.getLogger() - root_logger.setLevel(logging.DEBUG) - - # 控制台处理器 - console_handler = logging.StreamHandler(sys.stdout) - console_handler.setLevel(logging.INFO) - - # 日志格式 - formatter = logging.Formatter( - '[%(asctime)s] [%(name)s/%(levelname)s] %(message)s', - datefmt='%H:%M:%S' - ) - console_handler.setFormatter(formatter) - root_logger.addHandler(console_handler) - - # 文件处理器 (可选) - try: - file_handler = logging.FileHandler('pymc.log', encoding='utf-8') - file_handler.setLevel(logging.DEBUG) - file_handler.setFormatter(formatter) - root_logger.addHandler(file_handler) - except Exception: - pass # 如果无法创建日志文件则跳过 - - -def print_banner(): - """打印启动横幅。""" - banner = r""" - ____ __ __ ____ - | _ \ _ _| \/ |/ ___| - | |_) | | | | |\/| | | - | __/| |_| | | | | |___ - |_| \__, |_| |_|\____| - |___/ - """ - print(banner) - print(" Python Minecraft 服务端 - 多版本支持") - print(" 协议版本: 47-770 (1.8.9 - 1.21.4)") - print("=" * 50) - print() - - -async def main(): +from watchdog import WatchdogManager +from plugins.bridge import init_plugin_system + + +def parse_args(argv=None) -> argparse.Namespace: + parser = argparse.ArgumentParser( + prog="pymc", description=f"PyMC - Minecraft {MINECRAFT_VERSION} server") + parser.add_argument("--nogui", action="store_true", + help="accepted for compatibility with vanilla start scripts") + parser.add_argument("--port", type=int, default=None, help="override server-port") + parser.add_argument("--world", "--level-name", dest="world", default=None, + help="override level-name") + parser.add_argument("--universe", default=None, + help="directory that contains the world folder") + parser.add_argument("--config", default="server.properties", + help="path to server.properties") + args, _unknown = parser.parse_known_args(argv) + return args + + +async def main(argv=None) -> int: """主入口函数。""" - print_banner() - setup_logging() - - logger = logging.getLogger("PyMC") - logger.info("正在启动 PyMC 服务器...") - - # 加载配置 - config_path = "server.properties" + args = parse_args(argv) + + config_path = args.config + first_run = not os.path.exists(config_path) + # 先用 INFO 级别初始化日志, 读到配置后再按 debug 开关调整 + setup_logging(debug=False) + logger = logging.getLogger("minecraft.server") + + logger.info(f"Starting minecraft server version {MINECRAFT_VERSION}") + logger.info("Loading properties") + if first_run: + logger.warning(f"{config_path} does not exist") + logger.info(f"Generating new properties file") config = load_config(config_path) - logger.info(f"服务器地址: {config['server-ip']}:{config['server-port']}") + if args.port is not None: + config["server-port"] = args.port + if args.world is not None: + config["level-name"] = args.world + if args.universe is not None: + config["universe"] = args.universe + if config.get("debug", False): + for handler in logging.getLogger().handlers: + handler.setLevel(logging.DEBUG) + logging.getLogger().setLevel(logging.DEBUG) + + loop = asyncio.get_running_loop() + loop.set_default_executor(concurrent.futures.ThreadPoolExecutor( + max_workers=max(4, (os.cpu_count() or 2) + 2), thread_name_prefix="Worker-Main")) # 创建服务器实例 - server = MinecraftServer(config, config_path=config_path) + try: + server = MinecraftServer(config, config_path=config_path) + except Exception as e: + logger.error(f"Failed to start the minecraft server: {e}") + return 1 # 初始化命令框架 server.command_manager = CommandManager(server) register_all_vanilla_commands(server.command_manager) - cmd_count = len(server.command_manager.commands) - logger.info(f"命令框架已初始化: {cmd_count} 个命令已注册") # 初始化插件系统 (自动发现、加载、启用并注册命令) plugins_dir = config.get("plugins-directory", "plugins") init_plugin_system(server, plugins_dir) - logger.info(f"插件系统已初始化: {server.plugin_manager.plugin_count} 个插件已启用") # 初始化 Watchdog (如果配置启用) server.watchdog_manager = None if config.get("watchdog-enabled", False): server.watchdog_manager = WatchdogManager(server) await server.watchdog_manager.start() - logger.info("Watchdog 双进程保护已启动") - - console_task = None - - # 注册信号处理 (优雅关闭) - loop = asyncio.get_event_loop() + # 注册信号处理 (优雅关闭): Ctrl+C / SIGTERM 等同于控制台输入 stop def handle_shutdown(): - logger.info("收到关闭信号,正在停止服务器...") - asyncio.ensure_future(server.stop()) + if server.running: + server.request_stop() - # Windows 下信号处理 if sys.platform == 'win32': - # Windows 不支持 SIGTERM 信号 - signal.signal(signal.SIGINT, lambda s, f: handle_shutdown()) + signal.signal(signal.SIGINT, lambda s, f: loop.call_soon_threadsafe(handle_shutdown)) else: for sig in (signal.SIGINT, signal.SIGTERM): loop.add_signal_handler(sig, handle_shutdown) - # 启动服务器 + console_task = asyncio.create_task(console_input_loop(server)) + exit_code = 0 try: - console_task = asyncio.create_task(console_input_loop(server)) await server.start() - except KeyboardInterrupt: - logger.info("检测到键盘中断...") + except asyncio.CancelledError: + pass except Exception as e: - logger.error(f"服务器异常: {e}") - import traceback - traceback.print_exc() + logger.error(f"Failed to start the minecraft server: {e}", exc_info=True) + exit_code = 1 finally: - if console_task: - console_task.cancel() + console_task.cancel() await server.stop() + return exit_code async def console_input_loop(server: MinecraftServer): - """后台读取服务端控制台命令。""" - logger = logging.getLogger("PyMC.控制台") - await asyncio.sleep(0) - logger.info("控制台已就绪,可输入 help 查看命令") + """ + 后台读取服务端控制台命令 (带不带前导 "/" 均可, 与原版控制台一致)。 + 标准输入关闭 (nohup / systemd / Docker 无 TTY) 时静默退出, 服务器继续运行。 + """ + logger = logging.getLogger("minecraft.console") + loop = asyncio.get_running_loop() + reader = concurrent.futures.ThreadPoolExecutor(max_workers=1, thread_name_prefix="Console") while True: try: - line = await asyncio.to_thread(sys.stdin.readline) + line = await loop.run_in_executor(reader, sys.stdin.readline) except (asyncio.CancelledError, RuntimeError): + reader.shutdown(wait=False, cancel_futures=True) raise except Exception as e: - logger.warning(f"读取控制台输入失败: {e}") + logger.debug(f"Console input unavailable: {e}") return if line == "": - await asyncio.sleep(0.1) - if not server.running: - return - continue + # EOF: 没有可用的控制台 + reader.shutdown(wait=False) + return command = line.strip() + if command.startswith("/"): + command = command[1:] if not command: continue + # 启动完成前输入的命令排队等待 (与原版控制台一致) + await server.wait_until_ready() + if not server.running: + return - await execute_server_command(server, command) + try: + await execute_server_command(server, command) + except Exception as e: + logger.error(f"Unexpected exception while executing '{command}': {e}", exc_info=True) -if __name__ == "__main__": +def run() -> None: try: - asyncio.run(main()) + code = asyncio.run(main()) except KeyboardInterrupt: - print("\n服务器已停止。") - except Exception as e: - print(f"启动失败: {e}") - import traceback - traceback.print_exc() - sys.exit(1) + code = 0 + # 控制台读取线程可能仍阻塞在 stdin 上; 不等待它, 直接退出 + logging.shutdown() + sys.stdout.flush() + os._exit(code) + + +if __name__ == "__main__": + run() diff --git a/mods/__init__.py b/mods/__init__.py index 30a6c58..131537a 100755 --- a/mods/__init__.py +++ b/mods/__init__.py @@ -298,7 +298,7 @@ def discover_mods(self, mods_dir: Optional[str] = None) -> List[ModInfo]: search_path = Path(search_dir) if not search_path.is_dir(): - logger.warning(f"Mods directory does not exist: {search_dir}") + logger.debug(f"Mods directory does not exist: {search_dir}") return [] discovered = [] @@ -453,7 +453,7 @@ def shutdown_all(self): instance.state = ModState.UNLOADED except Exception as e: logger.exception(f"Error unloading mod {mod_id}: {e}") - logger.info("All mods shut down") + logger.debug("All mods shut down") # --- Event Dispatch --- diff --git a/mods/bridge.py b/mods/bridge.py index 9e4cb2e..e8a40ac 100755 --- a/mods/bridge.py +++ b/mods/bridge.py @@ -419,16 +419,16 @@ def init_mod_system(server, mods_dir: str = "mods") -> ModManager: # 2. Discover discovered = mm.discover_mods(mods_dir) - logger.info(f"Discovered {len(discovered)} mod(s) in {mods_dir}") + logger.debug(f"Discovered {len(discovered)} mod(s) in {mods_dir}") # 3. Load loaded = mm.load_all() - logger.info(f"Loaded {loaded} mod(s)") + logger.debug(f"Loaded {loaded} mod(s)") # 4. Enable mm.enable_all() enabled = mm.mod_count - logger.info(f"Enabled {enabled} mod(s)") + logger.debug(f"Enabled {enabled} mod(s)") # 6. Fire SERVER_START to mods + plugins hook_server_start(server) @@ -454,4 +454,4 @@ def shutdown_mod_system(server): # 2. Disable all mods (shutdown_all also calls on_unload) mm.shutdown_all() - logger.info("Mod system shut down") + logger.debug("Mod system shut down") diff --git a/native/__init__.py b/native/__init__.py index ae31f5c..e472a58 100755 --- a/native/__init__.py +++ b/native/__init__.py @@ -226,7 +226,7 @@ def _ensure_lib(self) -> bool: lib_path = _find_native_lib() if lib_path is None: - logger.info("pymc_native shared library not found; IPC native mode unavailable") + logger.debug("pymc_native shared library not found; IPC native mode unavailable") return False try: @@ -262,7 +262,7 @@ def start(self) -> bool: """Start the native server process and establish IPC.""" server_path = _find_native_server() if server_path is None: - logger.info("pymc_native_server not found; IPC native mode unavailable") + logger.debug("pymc_native_server not found; IPC native mode unavailable") return False if not self._ensure_lib(): @@ -920,7 +920,7 @@ def __init__(self, prefer_ipc: bool = True): except Exception as e: logger.debug(f"Direct mode unavailable: {e}") - logger.info("Native acceleration layer not available, using Python fallback") + logger.debug("Native acceleration layer not available, using Python fallback") def _init_ipc_mode(self): """Initialize IPC mode (separate process + shared memory).""" diff --git a/native/terrain_gen.cpp b/native/terrain_gen.cpp index ad1145d..ca9403d 100755 --- a/native/terrain_gen.cpp +++ b/native/terrain_gen.cpp @@ -1,2991 +1,80 @@ // ============================================================ -// PyMC - C++ 高性能地形生成器 -// 通过 stdin/stdout 二进制协议通信,作为 Python 服务端的子进程 -// 协议: -// 请求: 16 字节 (小端) -// [0:4] int32 chunk_x -// [4:8] int32 chunk_z -// [8:16] int64 seed -// 响应: 200192 字节 (小端) -// [0:4] uint32 数据长度 (固定 200192) -// [4:196612] uint16 方块数据 98304 个 (y*256+z*16+x 顺序) -// [196612:197124] int16 高度图 256 个 (z*16+x 顺序) -// [197124:200196] uint16 生物群系 1536 个 (section*64 + y*16 + z*4 + x) +// PyMC - Native overworld generator (Minecraft Java 1.21.1) +// +// Child process of the Python server, binary protocol on stdin/stdout: +// +// 'C' + int32 chunk_x + int32 chunk_z + int64 seed +// -> uint32 payload size + payload (one chunk) +// 'B' + int64 seed + uint32 count + count * (int32 x, int32 z) +// -> uint32 count + count * payload +// 'S' + int64 seed +// -> int32 x + int32 z (vanilla Climate.findSpawnPosition) +// +// payload (little endian): +// uint16[98304] block states (y*256 + z*16 + x, y from -64) +// int16[256] heightmap: highest solid block per column (z*16 + x) +// uint16[1536] biomes (section*64 + y*16 + z*4 + x) +// +// Terrain shape, caves, aquifers, ore veins, biomes and surface rules are +// the vanilla algorithms driven by the vanilla worldgen data in +// world/data/worldgen_overworld.json (see tools/gen_worldgen_data.py). +// +// Build: g++ -O2 -std=c++17 -ffp-contract=off -pthread -o terrain_gen terrain_gen.cpp +// (-ffp-contract=off keeps floating point bit-identical to Java.) // ============================================================ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#include -#endif - -// ============================================================ -// 方块 ID 常量 (与 Minecraft 1.21.1 全局调色板一致) -// ============================================================ -static constexpr int AIR = 0; -static constexpr int STONE = 1; -static constexpr int GRANITE = 2; -static constexpr int DIORITE = 4; -static constexpr int ANDESITE = 6; -static constexpr int GRASS_BLOCK = 9; -static constexpr int DIRT = 10; -static constexpr int COARSE_DIRT = 11; -static constexpr int PODZOL = 13; -static constexpr int BEDROCK = 79; -static constexpr int WATER = 80; -static constexpr int LAVA = 96; -static constexpr int SAND = 112; -static constexpr int RED_SAND = 117; -static constexpr int OAK_LOG = 131; -static constexpr int SPRUCE_LOG = 134; -static constexpr int BIRCH_LOG = 137; -static constexpr int JUNGLE_LOG = 140; -static constexpr int ACACIA_LOG = 143; -static constexpr int DARK_OAK_LOG = 149; -static constexpr int OAK_LEAVES = 264; -static constexpr int SPRUCE_LEAVES = 292; -static constexpr int BIRCH_LEAVES = 320; -static constexpr int JUNGLE_LEAVES = 348; -static constexpr int ACACIA_LEAVES = 376; -static constexpr int DARK_OAK_LEAVES = 432; -static constexpr int SANDSTONE = 535; -static constexpr int GRAVEL = 118; -static constexpr int WHITE_TERRACOTTA = 9356; -static constexpr int ORANGE_TERRACOTTA = 9357; -static constexpr int YELLOW_TERRACOTTA = 9360; -static constexpr int LIGHT_GRAY_TERRACOTTA = 9364; -static constexpr int BROWN_TERRACOTTA = 9368; -static constexpr int RED_TERRACOTTA = 9370; -static constexpr int TERRACOTTA = 10744; -static constexpr int RED_SANDSTONE = 11079; -static constexpr int SHORT_GRASS = 2005; -static constexpr int FERN = 2006; -static constexpr int DEAD_BUSH = 2007; -static constexpr int SEAGRASS = 2008; -static constexpr int DANDELION = 2075; -static constexpr int POPPY = 2077; -static constexpr int BROWN_MUSHROOM = 2089; -static constexpr int RED_MUSHROOM = 2090; -static constexpr int GOLD_ORE = 123; -static constexpr int DEEPSLATE_GOLD_ORE = 124; -static constexpr int IRON_ORE = 125; -static constexpr int DEEPSLATE_IRON_ORE = 126; -static constexpr int COAL_ORE = 127; -static constexpr int DEEPSLATE_COAL_ORE = 128; -static constexpr int LAPIS_ORE = 520; -static constexpr int DEEPSLATE_LAPIS_ORE = 521; -static constexpr int DIAMOND_ORE = 4274; -static constexpr int DEEPSLATE_DIAMOND_ORE = 4275; -static constexpr int REDSTONE_ORE = 5735; -static constexpr int DEEPSLATE_REDSTONE_ORE = 5737; -static constexpr int SNOW = 5772; -static constexpr int ICE = 5780; -static constexpr int SNOW_BLOCK = 5781; -static constexpr int CACTUS = 5782; -static constexpr int CLAY = 5798; -static constexpr int SUGAR_CANE = 5799; -static constexpr int PUMPKIN = 6811; -static constexpr int MELON = 6812; -static constexpr int EMERALD_ORE = 7511; -static constexpr int DEEPSLATE_EMERALD_ORE = 7512; -static constexpr int LARGE_FERN = 10758; -static constexpr int KELP = 12760; -static constexpr int KELP_PLANT = 12786; -static constexpr int TUFF = 21081; -static constexpr int CALCITE = 22316; -static constexpr int POWDER_SNOW = 22318; -static constexpr int COPPER_ORE = 22942; -static constexpr int DEEPSLATE_COPPER_ORE = 22943; -static constexpr int RAW_IRON_BLOCK = 26558; -static constexpr int RAW_COPPER_BLOCK = 26559; -static constexpr int DEEPSLATE = 24905; -static constexpr int MOSS_BLOCK = 24843; - -// ============================================================ -// 世界常量 -// ============================================================ -static constexpr int MIN_Y = -64; -static constexpr int MAX_Y = 319; -static constexpr int WORLD_HEIGHT = 384; // MAX_Y - MIN_Y + 1 -static constexpr int NUM_SECTIONS = WORLD_HEIGHT / 16; -static constexpr int SEA_LEVEL = 63; -static constexpr int CELL_WIDTH = 4; // NoiseSettings.create(-64, 384, 1, 2) -static constexpr int CELL_HEIGHT = 8; // QuartPos.toBlock(noiseSizeVertical) -static constexpr int CELL_COUNT_XZ = 16 / CELL_WIDTH; -static constexpr int CELL_COUNT_Y = WORLD_HEIGHT / CELL_HEIGHT; -static constexpr double GLOBAL_OFFSET = -0.50375; -static constexpr double SURFACE_DENSITY_THRESHOLD = 1.5625; -static constexpr double CHEESE_NOISE_TARGET = -0.703125; -static constexpr double PI = 3.14159265358979323846; -static constexpr uint64_t GOLDEN_RATIO_64 = 0x9E3779B97F4A7C15ULL; -static constexpr uint64_t SILVER_RATIO_64 = 0x6A09E667F3BCC909ULL; - -// Biome registry indices must match world/biomes.py registration order. -static constexpr uint16_t BIOME_BADLANDS = 0; -static constexpr uint16_t BIOME_BAMBOO_JUNGLE = 1; -static constexpr uint16_t BIOME_BEACH = 3; -static constexpr uint16_t BIOME_BIRCH_FOREST = 4; -static constexpr uint16_t BIOME_CHERRY_GROVE = 5; -static constexpr uint16_t BIOME_COLD_OCEAN = 6; -static constexpr uint16_t BIOME_DARK_FOREST = 8; -static constexpr uint16_t BIOME_DEEP_COLD_OCEAN = 9; -static constexpr uint16_t BIOME_DEEP_DARK = 10; -static constexpr uint16_t BIOME_DEEP_FROZEN_OCEAN = 11; -static constexpr uint16_t BIOME_DEEP_LUKEWARM_OCEAN = 12; -static constexpr uint16_t BIOME_DEEP_OCEAN = 13; -static constexpr uint16_t BIOME_DESERT = 14; -static constexpr uint16_t BIOME_DRIPSTONE_CAVES = 15; -static constexpr uint16_t BIOME_ERODED_BADLANDS = 19; -static constexpr uint16_t BIOME_FLOWER_FOREST = 20; -static constexpr uint16_t BIOME_FOREST = 21; -static constexpr uint16_t BIOME_FROZEN_OCEAN = 22; -static constexpr uint16_t BIOME_FROZEN_PEAKS = 23; -static constexpr uint16_t BIOME_FROZEN_RIVER = 24; -static constexpr uint16_t BIOME_GROVE = 25; -static constexpr uint16_t BIOME_ICE_SPIKES = 26; -static constexpr uint16_t BIOME_JAGGED_PEAKS = 27; -static constexpr uint16_t BIOME_JUNGLE = 28; -static constexpr uint16_t BIOME_LUKEWARM_OCEAN = 29; -static constexpr uint16_t BIOME_LUSH_CAVES = 30; -static constexpr uint16_t BIOME_MANGROVE_SWAMP = 31; -static constexpr uint16_t BIOME_MEADOW = 32; -static constexpr uint16_t BIOME_MUSHROOM_FIELDS = 33; -static constexpr uint16_t BIOME_OCEAN = 35; -static constexpr uint16_t BIOME_OLD_GROWTH_BIRCH_FOREST = 36; -static constexpr uint16_t BIOME_OLD_GROWTH_PINE_TAIGA = 37; -static constexpr uint16_t BIOME_OLD_GROWTH_SPRUCE_TAIGA = 38; -static constexpr uint16_t BIOME_PLAINS = 39; -static constexpr uint16_t BIOME_RIVER = 40; -static constexpr uint16_t BIOME_SAVANNA = 41; -static constexpr uint16_t BIOME_SAVANNA_PLATEAU = 42; -static constexpr uint16_t BIOME_SNOWY_BEACH = 44; -static constexpr uint16_t BIOME_SNOWY_PLAINS = 45; -static constexpr uint16_t BIOME_SNOWY_SLOPES = 46; -static constexpr uint16_t BIOME_SNOWY_TAIGA = 47; -static constexpr uint16_t BIOME_SPARSE_JUNGLE = 49; -static constexpr uint16_t BIOME_STONY_PEAKS = 50; -static constexpr uint16_t BIOME_STONY_SHORE = 51; -static constexpr uint16_t BIOME_SUNFLOWER_PLAINS = 52; -static constexpr uint16_t BIOME_SWAMP = 53; -static constexpr uint16_t BIOME_TAIGA = 54; -static constexpr uint16_t BIOME_WARM_OCEAN = 57; -static constexpr uint16_t BIOME_WINDSWEPT_FOREST = 59; -static constexpr uint16_t BIOME_WINDSWEPT_GRAVELLY_HILLS = 60; -static constexpr uint16_t BIOME_WINDSWEPT_HILLS = 61; -static constexpr uint16_t BIOME_WINDSWEPT_SAVANNA = 62; -static constexpr uint16_t BIOME_WOODED_BADLANDS = 63; - -// ============================================================ -// Perlin 排列表 -// ============================================================ -static const int PERLIN_PERM[256] = { - 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225, - 140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148, - 247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32, - 57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175, - 74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122, - 60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54, - 65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169, - 200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64, - 52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212, - 207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213, - 119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9, - 129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104, - 218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241, - 81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157, - 184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93, - 222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 -}; - -// ============================================================ -// Perlin Noise -// ============================================================ -static inline double fade(double t) { - return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); -} - -static inline double lerp(double t, double a, double b) { - return a + t * (b - a); -} - -static inline double grad(int hash_val, double x, double y, double z) { - int h = hash_val & 15; - double u = h < 8 ? x : y; - double v; - if (h < 4) v = y; - else if (h == 12 || h == 14) v = x; - else v = z; - return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); -} - -static inline uint64_t rotl64(uint64_t x, int k) { - return (x << k) | (x >> (64 - k)); -} - -static inline uint64_t mix_stafford13(uint64_t x) { - x = (x ^ (x >> 30)) * 0xBF58476D1CE4E5B9ULL; - x = (x ^ (x >> 27)) * 0x94D049BB133111EBULL; - return x ^ (x >> 31); -} - -static inline std::pair upgrade_seed_to_128(uint64_t seed) { - uint64_t lo = seed ^ SILVER_RATIO_64; - uint64_t hi = lo + GOLDEN_RATIO_64; - return {mix_stafford13(lo), mix_stafford13(hi)}; -} - -static inline uint64_t fnv1a64(std::string_view s, uint64_t basis) { - constexpr uint64_t prime = 1099511628211ULL; - uint64_t h = basis; - for (unsigned char c : s) { - h ^= (uint64_t)c; - h *= prime; - } - return h; -} - -static inline std::pair key_hash_128(std::string_view key, int octave = 0) { - auto left_rotate = [](uint32_t x, uint32_t c) -> uint32_t { - return (x << c) | (x >> (32 - c)); - }; - auto read_le32 = [](const uint8_t* p) -> uint32_t { - return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | - ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); - }; - auto write_le64 = [](std::vector& out, uint64_t v) { - for (int i = 0; i < 8; i++) { - out.push_back((uint8_t)((v >> (i * 8)) & 0xFF)); - } - }; - - static const uint32_t shifts[64] = { - 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, - 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, - 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, - 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 - }; - static const uint32_t table[64] = { - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 - }; - - std::string full_key = std::string(key) + ":octave_salt_" + std::to_string(octave); - std::vector msg(full_key.begin(), full_key.end()); - uint64_t bit_len = (uint64_t)msg.size() * 8ULL; - msg.push_back(0x80); - while ((msg.size() % 64) != 56) { - msg.push_back(0); - } - write_le64(msg, bit_len); - - uint32_t a0 = 0x67452301; - uint32_t b0 = 0xefcdab89; - uint32_t c0 = 0x98badcfe; - uint32_t d0 = 0x10325476; - - for (size_t offset = 0; offset < msg.size(); offset += 64) { - uint32_t m[16]; - for (int i = 0; i < 16; i++) { - m[i] = read_le32(&msg[offset + i * 4]); - } - - uint32_t a = a0, b = b0, c = c0, d = d0; - for (uint32_t i = 0; i < 64; i++) { - uint32_t f, g; - if (i < 16) { - f = (b & c) | (~b & d); - g = i; - } else if (i < 32) { - f = (d & b) | (~d & c); - g = (5 * i + 1) & 15; - } else if (i < 48) { - f = b ^ c ^ d; - g = (3 * i + 5) & 15; - } else { - f = c ^ (b | ~d); - g = (7 * i) & 15; - } - uint32_t tmp = d; - d = c; - c = b; - b = b + left_rotate(a + f + table[i] + m[g], shifts[i]); - a = tmp; - } - a0 += a; - b0 += b; - c0 += c; - d0 += d; - } - - uint8_t digest[16] = { - (uint8_t)(a0 & 0xFF), (uint8_t)((a0 >> 8) & 0xFF), - (uint8_t)((a0 >> 16) & 0xFF), (uint8_t)((a0 >> 24) & 0xFF), - (uint8_t)(b0 & 0xFF), (uint8_t)((b0 >> 8) & 0xFF), - (uint8_t)((b0 >> 16) & 0xFF), (uint8_t)((b0 >> 24) & 0xFF), - (uint8_t)(c0 & 0xFF), (uint8_t)((c0 >> 8) & 0xFF), - (uint8_t)((c0 >> 16) & 0xFF), (uint8_t)((c0 >> 24) & 0xFF), - (uint8_t)(d0 & 0xFF), (uint8_t)((d0 >> 8) & 0xFF), - (uint8_t)((d0 >> 16) & 0xFF), (uint8_t)((d0 >> 24) & 0xFF), - }; - uint64_t h0 = 0; - uint64_t h1 = 0; - for (int i = 0; i < 8; i++) { - h0 = (h0 << 8) | digest[i]; - h1 = (h1 << 8) | digest[i + 8]; - } - return {h0, h1}; -} - -// Xoroshiro128++ 风格随机源。原版 1.21.1 的 RandomSupport 会先把 -// world seed 升级到 128-bit,再通过噪声 key 派生各个 NormalNoise/Perlin octave。 -struct SimpleRNG { - uint64_t seed_lo = GOLDEN_RATIO_64; - uint64_t seed_hi = SILVER_RATIO_64; - - void seed(int64_t s) { - auto [lo, hi] = upgrade_seed_to_128((uint64_t)s); - seed_lo = lo; - seed_hi = hi; - if ((seed_lo | seed_hi) == 0ULL) { - seed_lo = GOLDEN_RATIO_64; - seed_hi = SILVER_RATIO_64; - } - } - - void seed_key(int64_t world_seed, std::string_view key, int octave = 0) { - auto [lo, hi] = upgrade_seed_to_128((uint64_t)world_seed); - auto [h0, h1] = key_hash_128(key, octave); - seed_lo = lo ^ h0; - seed_hi = hi ^ h1; - if ((seed_lo | seed_hi) == 0ULL) { - seed_lo = GOLDEN_RATIO_64; - seed_hi = SILVER_RATIO_64; - } - } - - uint64_t next_u64() { - const uint64_t s0 = seed_lo; - uint64_t s1 = seed_hi; - const uint64_t out = rotl64(s0 + s1, 17) + s0; - s1 ^= s0; - seed_lo = rotl64(s0, 49) ^ s1 ^ (s1 << 21); - seed_hi = rotl64(s1, 28); - return out; - } - - uint32_t next_u32() { - return (uint32_t)next_u64(); - } - - int randint(int lo, int hi) { - if (lo >= hi) return lo; - uint32_t bound = (uint32_t)(hi - lo + 1); - uint64_t u = (uint64_t)next_u32(); - uint64_t m = u * (uint64_t)bound; - uint64_t l = m & 0xFFFFFFFFULL; - if (l < (uint64_t)bound) { - const uint32_t threshold = (uint32_t)((0U - bound) % bound); - while (l < threshold) { - u = (uint64_t)next_u32(); - m = u * (uint64_t)bound; - l = m & 0xFFFFFFFFULL; - } - } - return lo + (int)(m >> 32); - } - - double random_double() { - return (double)(next_u64() >> 11) * (1.0 / 9007199254740992.0); - } - - // 三角分布 - double triangular(double lo, double hi, double mode) { - double u = random_double(); - double c = (mode - lo) / (hi - lo); - if (u <= c) { - return lo + std::sqrt(u * (hi - lo) * (mode - lo)); - } else { - return hi - std::sqrt((1.0 - u) * (hi - lo) * (hi - mode)); - } - } -}; - -struct ImprovedNoise { - int perm[512]; - double x_offset, y_offset, z_offset; - - void init(SimpleRNG& rng) { - x_offset = rng.random_double() * 256.0; - y_offset = rng.random_double() * 256.0; - z_offset = rng.random_double() * 256.0; - - int p[256]; - for (int i = 0; i < 256; i++) { - p[i] = i; - } - - // Vanilla ImprovedNoise initializes p[i]=i and shuffles forward with the source RNG. - for (int i = 0; i < 256; i++) { - int j = i + rng.randint(0, 255 - i); - std::swap(p[i], p[j]); - } - - for (int i = 0; i < 256; i++) { - perm[i] = p[i]; - perm[i + 256] = p[i]; - } - } - - double noise(double x, double y, double z, - double y_scale = 0.0, double y_max = 0.0) const { - x += x_offset; - y += y_offset; - z += z_offset; - - int xi = ((int)std::floor(x)) & 255; - int yi = ((int)std::floor(y)) & 255; - int zi = ((int)std::floor(z)) & 255; - - double xf = x - std::floor(x); - double yf = y - std::floor(y); - double zf = z - std::floor(z); - double y_grad = yf; - if (y_scale != 0.0) { - double limit = (y_max >= 0.0 && y_max < yf) ? y_max : yf; - y_grad = yf - std::floor(limit / y_scale + 1.0e-7) * y_scale; - } - - double u = fade(xf); - double v = fade(yf); - double w = fade(zf); - - int a = perm[xi] + yi; - int aa = perm[a] + zi; - int ab = perm[a + 1] + zi; - int b = perm[xi + 1] + yi; - int ba = perm[b] + zi; - int bb = perm[b + 1] + zi; - - return lerp(w, - lerp(v, - lerp(u, grad(perm[aa], xf, y_grad, zf), - grad(perm[ba], xf-1.0, y_grad, zf)), - lerp(u, grad(perm[ab], xf, y_grad-1.0, zf), - grad(perm[bb], xf-1.0, y_grad-1.0, zf))), - lerp(v, - lerp(u, grad(perm[aa+1], xf, y_grad, zf-1.0), - grad(perm[ba+1], xf-1.0, y_grad, zf-1.0)), - lerp(u, grad(perm[ab+1], xf, y_grad-1.0, zf-1.0), - grad(perm[bb+1], xf-1.0, y_grad-1.0, zf-1.0)))); - } - - double noise2d(double x, double z) const { - return noise(x, 0.0, z); - } -}; - -struct NoiseParameters { - int first_octave; - std::vector amplitudes; -}; - -struct VanillaPerlinNoise { - std::vector levels; - std::vector has_level; - std::vector amplitudes; - int first_octave = 0; - double lowest_freq_input_factor = 1.0; - double lowest_freq_value_factor = 1.0; - - void init(int64_t seed_val, std::string_view noise_key, - int first, const std::vector& amps, - std::string_view label) { - first_octave = first; - amplitudes = amps; - int count = (int)amplitudes.size(); - levels.resize(count); - has_level.assign(count, false); - - std::string base_key = std::string(noise_key) + ":" + std::string(label); - for (int i = 0; i < count; i++) { - if (amplitudes[i] == 0.0) { - continue; - } - int octave = first_octave + i; - SimpleRNG rng; - rng.seed_key(seed_val, base_key + ":octave_" + std::to_string(octave), octave); - levels[i].init(rng); - has_level[i] = true; - } - - int octave_shift = -first_octave; - lowest_freq_input_factor = std::pow(2.0, -octave_shift); - lowest_freq_value_factor = - std::pow(2.0, count - 1) / (std::pow(2.0, count) - 1.0); - } - - void init_legacy(int64_t seed_val, std::string_view noise_key, - int first, const std::vector& amps) { - first_octave = first; - amplitudes = amps; - int count = (int)amplitudes.size(); - levels.resize(count); - has_level.assign(count, false); - - SimpleRNG rng; - rng.seed_key(seed_val, noise_key, 0); - int octave_shift = -first_octave; - if (octave_shift >= 0 && octave_shift < count && amplitudes[octave_shift] != 0.0) { - levels[octave_shift].init(rng); - has_level[octave_shift] = true; - } - for (int i = octave_shift - 1; i >= 0; i--) { - if (i < count && amplitudes[i] != 0.0) { - levels[i].init(rng); - } else { - for (int skip = 0; skip < 262; skip++) { - rng.next_u32(); - } - } - if (i < count && amplitudes[i] != 0.0) { - has_level[i] = true; - } - } - - lowest_freq_input_factor = std::pow(2.0, -octave_shift); - lowest_freq_value_factor = - std::pow(2.0, count - 1) / (std::pow(2.0, count) - 1.0); - } - - static double wrap(double v) { - constexpr double wrap_range = 33554432.0; - return v - std::floor(v / wrap_range + 0.5) * wrap_range; - } - - double get_value(double x, double y, double z) const { - double value = 0.0; - double freq = lowest_freq_input_factor; - double amp = lowest_freq_value_factor; - for (size_t i = 0; i < levels.size(); i++) { - if (has_level[i]) { - value += amplitudes[i] * - levels[i].noise(wrap(x * freq), wrap(y * freq), wrap(z * freq)) * amp; - } - freq *= 2.0; - amp /= 2.0; - } - return value; - } -}; - -struct VanillaNormalNoise { - VanillaPerlinNoise first; - VanillaPerlinNoise second; - double value_factor = 1.0; - - void init(int64_t seed_val, std::string_view noise_key, const NoiseParameters& params) { - first.init(seed_val, std::string(noise_key) + ":a", - params.first_octave, params.amplitudes, "first"); - second.init(seed_val, std::string(noise_key) + ":b", - params.first_octave, params.amplitudes, "second"); - - int min_idx = std::numeric_limits::max(); - int max_idx = std::numeric_limits::min(); - for (int i = 0; i < (int)params.amplitudes.size(); i++) { - if (params.amplitudes[i] == 0.0) { - continue; - } - min_idx = std::min(min_idx, i); - max_idx = std::max(max_idx, i); - } - if (min_idx == std::numeric_limits::max()) { - min_idx = 0; - max_idx = 0; - } - double expected_deviation = 0.1 * (1.0 + 1.0 / (double)((max_idx - min_idx) + 1)); - value_factor = (1.0 / 6.0) / expected_deviation; - } - - double get_value(double x, double y, double z) const { - constexpr double input_factor = 1.0181268882175227; - return (first.get_value(x, y, z) + - second.get_value(x * input_factor, y * input_factor, z * input_factor)) * - value_factor; - } -}; - -static inline double clamp01(double v) { - return std::max(0.0, std::min(1.0, v)); -} - -static inline double clamped_lerp(double a, double b, double t) { - return lerp(clamp01(t), a, b); -} - -static inline double inverse_lerp(double a, double b, double v) { - if (a == b) return 0.0; - return clamp01((v - a) / (b - a)); -} - -static inline int floor_div(int a, int b) { - int q = a / b; - int r = a % b; - if (r != 0 && ((r < 0) != (b < 0))) { - q--; - } - return q; -} - -static inline double y_clamped_gradient(double y, double y0, double y1, - double v0, double v1) { - return clamped_lerp(v0, v1, inverse_lerp(y0, y1, y)); -} - -static inline double half_negative(double v) { - return v < 0.0 ? v * 0.5 : v; -} - -static inline double quarter_negative(double v) { - return v < 0.0 ? v * 0.25 : v; -} - -static inline double peaks_and_valleys(double v) { - return -(std::fabs(std::fabs(v) - 0.6666667) - 0.33333334) * 3.0; -} - -static inline double density_squeeze(double v) { - double x = std::max(-1.0, std::min(1.0, v)); - return x / 2.0 - x * x * x / 24.0; -} - -static inline double hermite(double t, double p0, double m0, double p1, double m1) { - double t2 = t * t; - double t3 = t2 * t; - return (2.0 * t3 - 3.0 * t2 + 1.0) * p0 + - (t3 - 2.0 * t2 + t) * m0 + - (-2.0 * t3 + 3.0 * t2) * p1 + - (t3 - t2) * m1; -} - -static inline double spline_value(double x, - std::initializer_list> points) { - std::vector> p(points); - if (p.empty()) return 0.0; - if (x <= p.front().first) return p.front().second; - if (x >= p.back().first) return p.back().second; - for (size_t i = 0; i + 1 < p.size(); i++) { - double x0 = p[i].first; - double x1 = p[i + 1].first; - if (x < x0 || x > x1) continue; - double t = (x - x0) / (x1 - x0); - double prev_slope = (i == 0) - ? (p[i + 1].second - p[i].second) / (x1 - x0) - : (p[i + 1].second - p[i - 1].second) / (p[i + 1].first - p[i - 1].first); - double next_slope = (i + 2 >= p.size()) - ? (p[i + 1].second - p[i].second) / (x1 - x0) - : (p[i + 2].second - p[i].second) / (p[i + 2].first - p[i].first); - return hermite(t, p[i].second, prev_slope * (x1 - x0), - p[i + 1].second, next_slope * (x1 - x0)); - } - return p.back().second; -} - -static inline double ridge_spline(double pv, - double base, - double low, - double mid, - double high, - double peak) { - return spline_value(pv, { - {-1.0, base}, - {-0.4, low}, - { 0.0, mid}, - { 0.4, high}, - { 1.0, peak}, - }); -} - -struct TerrainSample { - double continental; - double erosion; - double ridges; - double peaks_valleys; -}; - -enum class TerrainCoord { - Continental, - Erosion, - Ridges, - PeaksValleys, -}; - -struct TerrainSpline { - struct Point { - double location; - std::shared_ptr value; - double derivative; - }; - - bool is_constant = true; - double constant_value = 0.0; - TerrainCoord coord = TerrainCoord::Continental; - std::vector points; - - static std::shared_ptr constant(double value) { - auto spline = std::make_shared(); - spline->is_constant = true; - spline->constant_value = value; - return spline; - } - - static std::shared_ptr multipoint(TerrainCoord c, std::vector pts) { - auto spline = std::make_shared(); - spline->is_constant = false; - spline->coord = c; - spline->points = std::move(pts); - return spline; - } - - static double coord_value(TerrainCoord c, const TerrainSample& sample) { - switch (c) { - case TerrainCoord::Continental: return sample.continental; - case TerrainCoord::Erosion: return sample.erosion; - case TerrainCoord::Ridges: return sample.ridges; - case TerrainCoord::PeaksValleys: return sample.peaks_valleys; - } - return 0.0; - } - - double apply(const TerrainSample& sample) const { - if (is_constant) { - return constant_value; - } - if (points.empty()) { - return 0.0; - } - - double x = coord_value(coord, sample); - auto linear_extend = [&](size_t idx) { - return points[idx].value->apply(sample) + - points[idx].derivative * (x - points[idx].location); - }; - - if (x < points.front().location) { - return linear_extend(0); - } - size_t last = points.size() - 1; - if (x >= points[last].location) { - return linear_extend(last); - } - - size_t i = 0; - while (i + 1 < points.size() && x >= points[i + 1].location) { - i++; - } - - const Point& a = points[i]; - const Point& b = points[i + 1]; - double span = b.location - a.location; - if (span == 0.0) { - return a.value->apply(sample); - } - - double t = (x - a.location) / span; - double va = a.value->apply(sample); - double vb = b.value->apply(sample); - double da = a.derivative * span - (vb - va); - double db = -b.derivative * span + (vb - va); - return lerp(t, va, vb) + t * (1.0 - t) * lerp(t, da, db); - } -}; - -struct TerrainSplineBuilder { - TerrainCoord coord; - std::vector points; - - explicit TerrainSplineBuilder(TerrainCoord c) : coord(c) {} - - TerrainSplineBuilder& add(double location, double value, double derivative = 0.0) { - return add(location, TerrainSpline::constant(value), derivative); - } - - TerrainSplineBuilder& add(double location, std::shared_ptr value, - double derivative = 0.0) { - points.push_back({location, std::move(value), derivative}); - return *this; - } - - std::shared_ptr build() { - return TerrainSpline::multipoint(coord, std::move(points)); - } -}; - -static inline double terrain_calculate_slope(double v0, double v1, - double x0, double x1) { - return (v1 - v0) / (x1 - x0); -} - -static inline double terrain_mountain_continentalness(double weirdness, - double continentalness, - double floor_point) { - double scale = 1.0 - (1.0 - continentalness) * 0.5; - double bias = 0.5 * (1.0 - continentalness); - double shaped = (weirdness + 1.17) * 0.46082947 * scale - bias; - return std::max(shaped, weirdness < floor_point ? -0.2222 : 0.0); -} - -static inline double terrain_mountain_zero_point(double continentalness) { - double scale = 1.0 - (1.0 - continentalness) * 0.5; - double bias = 0.5 * (1.0 - continentalness); - return bias / (0.46082947 * scale) - 1.17; -} - -static std::shared_ptr build_mountain_ridge_spline_with_points( - TerrainCoord coord, double continentalness, bool force_plateau) { - TerrainSplineBuilder b(coord); - double y_neg1 = terrain_mountain_continentalness(-1.0, continentalness, -0.7); - double y_pos1 = terrain_mountain_continentalness(1.0, continentalness, -0.7); - double zero = terrain_mountain_zero_point(continentalness); - if (-0.65 < zero && zero < 1.0) { - double y_neg065 = terrain_mountain_continentalness(-0.65, continentalness, -0.7); - double y_neg075 = terrain_mountain_continentalness(-0.75, continentalness, -0.7); - double slope_left = terrain_calculate_slope(y_neg1, y_neg075, -1.0, -0.75); - b.add(-1.0, y_neg1, slope_left); - b.add(-0.75, y_neg075); - b.add(-0.65, y_neg065); - double y_zero = terrain_mountain_continentalness(zero, continentalness, -0.7); - double slope_right = terrain_calculate_slope(y_zero, y_pos1, zero, 1.0); - b.add(zero - 0.01, y_zero); - b.add(zero, y_zero, slope_right); - b.add(1.0, y_pos1, slope_right); - } else { - double slope = terrain_calculate_slope(y_neg1, y_pos1, -1.0, 1.0); - if (force_plateau) { - b.add(-1.0, std::max(0.2, y_neg1)); - b.add(0.0, lerp(0.5, y_neg1, y_pos1), slope); - } else { - b.add(-1.0, y_neg1, slope); - } - b.add(1.0, y_pos1, slope); - } - return b.build(); -} - -static std::shared_ptr build_ridge_spline( - TerrainCoord coord, double base, double low, double mid, - double high, double peak, double min_slope) { - double slope0 = std::max(0.5 * (low - base), min_slope); - double slope1 = 5.0 * (mid - low); - TerrainSplineBuilder b(coord); - b.add(-1.0, base, slope0); - b.add(-0.4, low, std::min(slope0, slope1)); - b.add(0.0, mid, slope1); - b.add(0.4, high, 2.0 * (high - mid)); - b.add(1.0, peak, 0.7 * (peak - high)); - return b.build(); -} - -static std::shared_ptr build_erosion_offset_spline( - TerrainCoord erosion_coord, TerrainCoord pv_coord, - double base, double low, double mid, double mountain, - double valley, double plateau, bool has_plateau_window, - bool force_plateau) { - double mountain_high = lerp(mountain, 0.6, 1.5); - double mountain_mid = lerp(mountain, 0.6, 1.0); - auto s14 = build_mountain_ridge_spline_with_points(pv_coord, mountain_high, force_plateau); - auto s15 = build_mountain_ridge_spline_with_points(pv_coord, mountain_mid, force_plateau); - auto s16 = build_mountain_ridge_spline_with_points(pv_coord, mountain, force_plateau); - auto s17 = build_ridge_spline(pv_coord, base - 0.15, 0.5 * mountain, - 0.5 * mountain, 0.5 * mountain, - 0.6 * mountain, 0.5); - auto s18 = build_ridge_spline(pv_coord, base, valley * mountain, - low * mountain, 0.5 * mountain, - 0.6 * mountain, 0.5); - auto s19 = build_ridge_spline(pv_coord, base, valley, valley, low, mid, 0.5); - auto s20 = build_ridge_spline(pv_coord, base, valley, valley, low, mid, 0.5); - auto s21 = TerrainSplineBuilder(pv_coord) - .add(-1.0, base) - .add(-0.4, s19) - .add(0.0, mid + 0.07) - .build(); - auto s22 = build_ridge_spline(pv_coord, -0.02, plateau, plateau, low, mid, 0.0); - - TerrainSplineBuilder b(erosion_coord); - b.add(-0.85, s14); - b.add(-0.7, s15); - b.add(-0.4, s16); - b.add(-0.35, s17); - b.add(-0.1, s18); - b.add(0.2, s19); - if (has_plateau_window) { - b.add(0.4, s20); - b.add(0.45, s21); - b.add(0.55, s21); - b.add(0.58, s20); - } - b.add(0.7, s22); - return b.build(); -} - -static std::shared_ptr build_overworld_offset_spline() { - auto s5 = build_erosion_offset_spline(TerrainCoord::Erosion, TerrainCoord::PeaksValleys, - -0.15, 0.0, 0.0, 0.1, 0.0, -0.03, false, false); - auto s6 = build_erosion_offset_spline(TerrainCoord::Erosion, TerrainCoord::PeaksValleys, - -0.1, 0.03, 0.1, 0.1, 0.01, -0.03, false, false); - auto s7 = build_erosion_offset_spline(TerrainCoord::Erosion, TerrainCoord::PeaksValleys, - -0.1, 0.03, 0.1, 0.7, 0.01, -0.03, true, true); - auto s8 = build_erosion_offset_spline(TerrainCoord::Erosion, TerrainCoord::PeaksValleys, - -0.05, 0.03, 0.1, 1.0, 0.01, 0.01, true, true); - TerrainSplineBuilder b(TerrainCoord::Continental); - b.add(-1.1, 0.044); - b.add(-1.02, -0.2222); - b.add(-0.51, -0.2222); - b.add(-0.44, -0.12); - b.add(-0.18, -0.12); - b.add(-0.16, s5); - b.add(-0.15, s5); - b.add(-0.1, s6); - b.add(0.25, s7); - b.add(1.0, s8); - return b.build(); -} - -static std::shared_ptr build_erosion_factor_spline( - double target, bool has_ridge_branch) { - auto ridge_base = TerrainSplineBuilder(TerrainCoord::Ridges) - .add(-0.2, 6.3) - .add(0.2, target) - .build(); - TerrainSplineBuilder erosion(TerrainCoord::Erosion); - erosion.add(-0.6, ridge_base); - erosion.add(-0.5, TerrainSplineBuilder(TerrainCoord::Ridges) - .add(-0.05, 6.3) - .add(0.05, 2.67) - .build()); - erosion.add(-0.35, ridge_base); - erosion.add(-0.25, ridge_base); - erosion.add(-0.1, TerrainSplineBuilder(TerrainCoord::Ridges) - .add(-0.05, 2.67) - .add(0.05, 6.3) - .build()); - erosion.add(0.03, ridge_base); - if (has_ridge_branch) { - auto gentle = TerrainSplineBuilder(TerrainCoord::Ridges) - .add(0.0, target) - .add(0.1, 0.625) - .build(); - auto pv = TerrainSplineBuilder(TerrainCoord::PeaksValleys) - .add(-0.9, target) - .add(-0.69, gentle) - .build(); - erosion.add(0.35, target); - erosion.add(0.45, pv); - erosion.add(0.55, pv); - erosion.add(0.62, target); - } else { - auto low_pv = TerrainSplineBuilder(TerrainCoord::PeaksValleys) - .add(-0.7, ridge_base) - .add(-0.15, 1.37) - .build(); - auto high_pv = TerrainSplineBuilder(TerrainCoord::PeaksValleys) - .add(0.45, ridge_base) - .add(0.7, 1.56) - .build(); - erosion.add(0.05, high_pv); - erosion.add(0.4, high_pv); - erosion.add(0.45, low_pv); - erosion.add(0.55, low_pv); - erosion.add(0.58, target); - } - return erosion.build(); -} - -static std::shared_ptr build_overworld_factor_spline() { - TerrainSplineBuilder b(TerrainCoord::Continental); - b.add(-0.19, 3.95); - b.add(-0.15, build_erosion_factor_spline(6.25, true)); - b.add(-0.1, build_erosion_factor_spline(5.47, true)); - b.add(0.03, build_erosion_factor_spline(5.08, true)); - b.add(0.06, build_erosion_factor_spline(4.69, false)); - return b.build(); -} - -static std::shared_ptr build_weirdness_jaggedness_spline(double amount) { - return TerrainSplineBuilder(TerrainCoord::Ridges) - .add(-0.01, 0.63 * amount) - .add(0.01, 0.3 * amount) - .build(); -} - -static std::shared_ptr build_ridge_jaggedness_spline( - double high_amount, double mid_amount) { - double pv0 = peaks_and_valleys(0.4); - double pv1 = peaks_and_valleys(0.56666666); - double middle = (pv0 + pv1) * 0.5; - TerrainSplineBuilder b(TerrainCoord::PeaksValleys); - b.add(pv0, 0.0); - b.add(middle, mid_amount > 0.0 ? build_weirdness_jaggedness_spline(mid_amount) - : TerrainSpline::constant(0.0)); - b.add(1.0, high_amount > 0.0 ? build_weirdness_jaggedness_spline(high_amount) - : TerrainSpline::constant(0.0)); - return b.build(); -} - -static std::shared_ptr build_erosion_jaggedness_spline( - double high_amount, double mid_amount, - double high_mid_amount, double mid_mid_amount) { - auto high = build_ridge_jaggedness_spline(high_amount, high_mid_amount); - auto mid = build_ridge_jaggedness_spline(mid_amount, mid_mid_amount); - TerrainSplineBuilder b(TerrainCoord::Erosion); - b.add(-1.0, high); - b.add(-0.78, mid); - b.add(-0.5775, mid); - b.add(-0.375, 0.0); - return b.build(); -} - -static std::shared_ptr build_overworld_jaggedness_spline() { - TerrainSplineBuilder b(TerrainCoord::Continental); - b.add(-0.11, 0.0); - b.add(0.03, build_erosion_jaggedness_spline(1.0, 0.5, 0.0, 0.0)); - b.add(0.65, build_erosion_jaggedness_spline(1.0, 1.0, 1.0, 0.0)); - return b.build(); -} - -// ============================================================ -// 地形生成器 -// ============================================================ -struct TerrainGenerator { - int64_t seed; - VanillaNormalNoise shift_vanilla; - VanillaNormalNoise continental_vanilla; - VanillaNormalNoise erosion_vanilla; - VanillaNormalNoise ridge_vanilla; - VanillaNormalNoise jagged_vanilla; - VanillaNormalNoise cave_cheese_vanilla; - VanillaNormalNoise cave_layer_vanilla; - VanillaNormalNoise cave_entrance_vanilla; - VanillaNormalNoise noodle_vanilla; - VanillaNormalNoise noodle_thickness_vanilla; - VanillaNormalNoise noodle_ridge_a_vanilla; - VanillaNormalNoise noodle_ridge_b_vanilla; - VanillaNormalNoise spaghetti_roughness_vanilla; - VanillaNormalNoise spaghetti_roughness_modulator_vanilla; - VanillaNormalNoise spaghetti_2d_vanilla; - VanillaNormalNoise spaghetti_2d_elevation_vanilla; - VanillaNormalNoise spaghetti_2d_modulator_vanilla; - VanillaNormalNoise spaghetti_2d_thickness_vanilla; - VanillaNormalNoise spaghetti_3d_1_vanilla; - VanillaNormalNoise spaghetti_3d_2_vanilla; - VanillaNormalNoise spaghetti_3d_rarity_vanilla; - VanillaNormalNoise spaghetti_3d_thickness_vanilla; - VanillaNormalNoise pillar_vanilla; - VanillaNormalNoise pillar_rareness_vanilla; - VanillaNormalNoise pillar_thickness_vanilla; - VanillaNormalNoise ore_veininess_vanilla; - VanillaNormalNoise ore_vein_a_vanilla; - VanillaNormalNoise ore_vein_b_vanilla; - VanillaNormalNoise ore_gap_vanilla; - VanillaNormalNoise aquifer_floodedness_vanilla; - VanillaNormalNoise aquifer_spread_vanilla; - VanillaNormalNoise aquifer_lava_vanilla; - VanillaPerlinNoise blended_min_limit_vanilla; - VanillaPerlinNoise blended_max_limit_vanilla; - VanillaPerlinNoise blended_main_vanilla; - VanillaNormalNoise surface_vanilla; - VanillaNormalNoise temperature_vanilla; - VanillaNormalNoise humidity_vanilla; - std::shared_ptr offset_spline; - std::shared_ptr factor_spline; - std::shared_ptr jaggedness_spline; - - void init(int64_t s) { - seed = s; - if (!offset_spline) { - offset_spline = build_overworld_offset_spline(); - factor_spline = build_overworld_factor_spline(); - jaggedness_spline = build_overworld_jaggedness_spline(); - } - // Ported from 1.21.1 NoiseData: first octave + amplitude lists used by - // NormalNoise. These are the authoritative seed/noise channels for - // climate and density routing in this clean-room native path. - shift_vanilla.init(s, "minecraft:shift", {-3, {1.0, 1.0, 1.0, 0.0}}); - temperature_vanilla.init(s, "minecraft:temperature", {-10, {1.5, 0.0, 1.0, 0.0, 0.0, 0.0}}); - humidity_vanilla.init(s, "minecraft:vegetation", {-8, {1.0, 1.0, 0.0, 0.0, 0.0, 0.0}}); - continental_vanilla.init(s, "minecraft:continentalness", {-9, {1.0, 1.0, 2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 1.0}}); - erosion_vanilla.init(s, "minecraft:erosion", {-9, {1.0, 1.0, 0.0, 1.0, 1.0}}); - ridge_vanilla.init(s, "minecraft:ridge", {-7, {1.0, 2.0, 1.0, 0.0, 0.0, 0.0}}); - jagged_vanilla.init(s, "minecraft:jagged", {-16, { - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 - }}); - cave_entrance_vanilla.init(s, "minecraft:cave_entrance", {-7, {0.4, 0.5, 1.0}}); - cave_layer_vanilla.init(s, "minecraft:cave_layer", {-8, {1.0}}); - cave_cheese_vanilla.init(s, "minecraft:cave_cheese", {-8, {0.5, 1.0, 2.0, 1.0, 2.0, 1.0, 0.0, 2.0, 0.0}}); - noodle_vanilla.init(s, "minecraft:noodle", {-8, {1.0}}); - noodle_thickness_vanilla.init(s, "minecraft:noodle_thickness", {-8, {1.0}}); - noodle_ridge_a_vanilla.init(s, "minecraft:noodle_ridge_a", {-7, {1.0}}); - noodle_ridge_b_vanilla.init(s, "minecraft:noodle_ridge_b", {-7, {1.0}}); - spaghetti_roughness_vanilla.init(s, "minecraft:spaghetti_roughness", {-5, {1.0}}); - spaghetti_roughness_modulator_vanilla.init(s, "minecraft:spaghetti_roughness_modulator", {-8, {1.0}}); - spaghetti_2d_vanilla.init(s, "minecraft:spaghetti_2d", {-7, {1.0}}); - spaghetti_2d_elevation_vanilla.init(s, "minecraft:spaghetti_2d_elevation", {-8, {1.0}}); - spaghetti_2d_modulator_vanilla.init(s, "minecraft:spaghetti_2d_modulator", {-11, {1.0}}); - spaghetti_2d_thickness_vanilla.init(s, "minecraft:spaghetti_2d_thickness", {-11, {1.0}}); - spaghetti_3d_1_vanilla.init(s, "minecraft:spaghetti_3d_1", {-7, {1.0}}); - spaghetti_3d_2_vanilla.init(s, "minecraft:spaghetti_3d_2", {-7, {1.0}}); - spaghetti_3d_rarity_vanilla.init(s, "minecraft:spaghetti_3d_rarity", {-11, {1.0}}); - spaghetti_3d_thickness_vanilla.init(s, "minecraft:spaghetti_3d_thickness", {-8, {1.0}}); - pillar_vanilla.init(s, "minecraft:pillar", {-7, {1.0, 1.0}}); - pillar_rareness_vanilla.init(s, "minecraft:pillar_rareness", {-8, {1.0}}); - pillar_thickness_vanilla.init(s, "minecraft:pillar_thickness", {-8, {1.0}}); - ore_veininess_vanilla.init(s, "minecraft:ore_veininess", {-8, {1.0}}); - ore_vein_a_vanilla.init(s, "minecraft:ore_vein_a", {-7, {1.0}}); - ore_vein_b_vanilla.init(s, "minecraft:ore_vein_b", {-7, {1.0}}); - ore_gap_vanilla.init(s, "minecraft:ore_gap", {-5, {1.0}}); - aquifer_floodedness_vanilla.init(s, "minecraft:aquifer_fluid_level_floodedness", {-7, {1.0}}); - aquifer_spread_vanilla.init(s, "minecraft:aquifer_fluid_level_spread", {-5, {1.0}}); - aquifer_lava_vanilla.init(s, "minecraft:aquifer_lava", {-1, {1.0}}); - blended_min_limit_vanilla.init_legacy(s, "minecraft:overworld/base_3d_noise/min_limit", -15, std::vector(16, 1.0)); - blended_max_limit_vanilla.init_legacy(s, "minecraft:overworld/base_3d_noise/max_limit", -15, std::vector(16, 1.0)); - blended_main_vanilla.init_legacy(s, "minecraft:overworld/base_3d_noise/main", -7, std::vector(8, 1.0)); - surface_vanilla.init(s, "minecraft:surface", {-6, {1.0, 1.0, 1.0}}); - } - - double block_hash(int x, int y, int z) const { - int64_t n = (int64_t)x * 374761393LL + (int64_t)y * 668265263LL - + (int64_t)z * 1274126177LL + seed; - n = (n ^ (n >> 13)) * 1103515245LL; - n = n ^ (n >> 16); - return (double)(n & 0x7FFFFFFF) / (double)0x7FFFFFFF; - } - - double position_chance(int x, int y, int z, uint64_t salt) const { - uint64_t h = (uint64_t)seed ^ salt; - h ^= mix_stafford13((uint64_t)(int64_t)x + 0x9E3779B97F4A7C15ULL); - h ^= rotl64(mix_stafford13((uint64_t)(int64_t)y + 0x6A09E667F3BCC909ULL), 21); - h ^= rotl64(mix_stafford13((uint64_t)(int64_t)z + 0xBB67AE8584CAA73BULL), 42); - h = mix_stafford13(h); - return (double)(h >> 11) * (1.0 / 9007199254740992.0); - } - - double shift_a(int wx, int wz) const { - return shift_vanilla.get_value((double)wx * 0.25, 0.0, (double)wz * 0.25) * 4.0; - } - - double shift_b(int wx, int wz) const { - return shift_vanilla.get_value((double)wz * 0.25, (double)wx * 0.25, 0.0) * 4.0; - } - - TerrainSample sample_terrain(int wx, int wz) const { - double sx = shift_a(wx, wz); - double sz = shift_b(wx, wz); - double x = wx + sx; - double z = wz + sz; - - TerrainSample t{}; - t.continental = std::max(-1.2, std::min(1.2, continental_vanilla.get_value(x * 0.25, 0.0, z * 0.25))); - t.erosion = std::max(-1.0, std::min(1.0, erosion_vanilla.get_value(x * 0.25, 0.0, z * 0.25))); - t.ridges = std::max(-1.0, std::min(1.0, ridge_vanilla.get_value(x * 0.25, 0.0, z * 0.25))); - t.peaks_valleys = peaks_and_valleys(t.ridges); - return t; - } - - double terrain_offset(const TerrainSample& t) const { - return offset_spline ? offset_spline->apply(t) : 0.0; - } - - double terrain_factor(const TerrainSample& t) const { - return factor_spline ? factor_spline->apply(t) : 4.69; - } - - double terrain_jaggedness(const TerrainSample& t) const { - return jaggedness_spline ? jaggedness_spline->apply(t) : 0.0; - } - - double blended_octave(const VanillaPerlinNoise& noise, int octave, - double x, double y, double z, - double y_scale, double y_max) const { - int idx = (int)noise.levels.size() - 1 - octave; - if (idx < 0 || idx >= (int)noise.levels.size() || !noise.has_level[idx]) { - return 0.0; - } - return noise.levels[idx].noise(VanillaPerlinNoise::wrap(x), - VanillaPerlinNoise::wrap(y), - VanillaPerlinNoise::wrap(z), - y_scale, - y_max); - } - - double blended_base_noise(int wx, int wy, int wz) const { - constexpr double xz_scale = 0.25; - constexpr double y_scale = 0.125; - constexpr double xz_factor = 80.0; - constexpr double y_factor = 160.0; - constexpr double smear_scale_multiplier = 8.0; - - double xz_multiplier = 684.412 * xz_scale; - double y_multiplier = 684.412 * y_scale; - double x = (double)wx * xz_multiplier; - double y = (double)wy * y_multiplier; - double z = (double)wz * xz_multiplier; - double main_x = x / xz_factor; - double main_y = y / y_factor; - double main_z = z / xz_factor; - double smear = y_multiplier * smear_scale_multiplier; - double main_smear = smear / y_factor; - - double main = 0.0; - double freq = 1.0; - for (int octave = 0; octave < 8; octave++) { - main += blended_octave(blended_main_vanilla, octave, - main_x * freq, main_y * freq, main_z * freq, - main_smear * freq, main_y * freq) / freq; - freq /= 2.0; - } - - double selector = (main / 10.0 + 1.0) * 0.5; - bool use_max_only = selector >= 1.0; - bool use_min_only = selector <= 0.0; - double min_limit = 0.0; - double max_limit = 0.0; - freq = 1.0; - for (int octave = 0; octave < 16; octave++) { - double nx = x * freq; - double ny = y * freq; - double nz = z * freq; - double y_smear = smear * freq; - if (!use_max_only) { - min_limit += blended_octave(blended_min_limit_vanilla, octave, - nx, ny, nz, y_smear, y * freq) / freq; - } - if (!use_min_only) { - max_limit += blended_octave(blended_max_limit_vanilla, octave, - nx, ny, nz, y_smear, y * freq) / freq; - } - freq /= 2.0; - } - return clamped_lerp(min_limit / 512.0, max_limit / 512.0, selector) / 128.0; - } - - double slide_overworld(double density, int wy) const { - double top = y_clamped_gradient(wy, 240.0, 256.0, 1.0, 0.0); - density = lerp(top, -0.078125, density); - double bottom = y_clamped_gradient(wy, -64.0, -40.0, 0.0, 1.0); - density = lerp(bottom, 0.1171875, density); - return density; - } - - static double map_from_unit(double v, double min_value, double max_value) { - return (min_value + max_value) * 0.5 + (max_value - min_value) * 0.5 * v; - } - - double noise3(const VanillaNormalNoise& noise, int wx, int wy, int wz, - double xz_scale = 1.0, double y_scale = 1.0) const { - return noise.get_value((double)wx * xz_scale, - (double)wy * y_scale, - (double)wz * xz_scale); - } - - double mapped_noise3(const VanillaNormalNoise& noise, int wx, int wy, int wz, - double xz_scale, double y_scale, - double min_value, double max_value) const { - return map_from_unit(noise3(noise, wx, wy, wz, xz_scale, y_scale), - min_value, max_value); - } - - static double spaghetti_rarity_2d(double v) { - if (v < -0.75) return 0.5; - if (v < -0.5) return 0.75; - if (v < 0.5) return 1.0; - if (v < 0.75) return 2.0; - return 3.0; - } - - static double spaghetti_rarity_3d(double v) { - if (v < -0.5) return 0.75; - if (v < 0.0) return 1.0; - if (v < 0.5) return 1.5; - return 2.0; - } - - double weird_scaled_sampler(const VanillaNormalNoise& noise, - double rarity, int wx, int wy, int wz) const { - return rarity * std::fabs(noise.get_value((double)wx / rarity, - (double)wy / rarity, - (double)wz / rarity)); - } - - double spaghetti_roughness(int wx, int wy, int wz) const { - double rough = std::fabs(noise3(spaghetti_roughness_vanilla, wx, wy, wz)) - 0.4; - double mod = mapped_noise3(spaghetti_roughness_modulator_vanilla, - wx, wy, wz, 1.0, 1.0, 0.0, -0.1); - return mod * rough; - } - - double cave_entrances(int wx, int wy, int wz) const { - double rarity_raw = noise3(spaghetti_3d_rarity_vanilla, wx, wy, wz, 2.0, 1.0); - double rarity = spaghetti_rarity_3d(rarity_raw); - double thickness = mapped_noise3(spaghetti_3d_thickness_vanilla, - wx, wy, wz, 1.0, 1.0, -0.065, -0.088); - double spaghetti = std::max( - weird_scaled_sampler(spaghetti_3d_1_vanilla, rarity, wx, wy, wz), - weird_scaled_sampler(spaghetti_3d_2_vanilla, rarity, wx, wy, wz) - ); - spaghetti = std::max(-1.0, std::min(1.0, spaghetti + thickness)); - - double entrance = noise3(cave_entrance_vanilla, wx, wy, wz, 0.75, 0.5) + - 0.37 + y_clamped_gradient(wy, -10.0, 30.0, 0.3, 0.0); - return std::min(entrance, spaghetti + spaghetti_roughness(wx, wy, wz)); - } - - double spaghetti_2d(int wx, int wy, int wz) const { - double mod = noise3(spaghetti_2d_modulator_vanilla, wx, wy, wz, 2.0, 1.0); - double rarity = spaghetti_rarity_2d(mod); - double spaghetti = weird_scaled_sampler(spaghetti_2d_vanilla, rarity, wx, wy, wz); - double elevation = mapped_noise3(spaghetti_2d_elevation_vanilla, - wx, wy, wz, 1.0, 1.0, -8.0, 8.0); - double thickness = mapped_noise3(spaghetti_2d_thickness_vanilla, - wx, wy, wz, 2.0, 1.0, -0.6, -1.3); - double vertical = std::fabs(elevation + y_clamped_gradient(wy, -64.0, 320.0, 8.0, -40.0)); - double floor = std::pow(vertical + thickness, 3.0); - double line = spaghetti + 0.083 * thickness; - return std::max(-1.0, std::min(1.0, std::max(line, floor))); - } - - double pillars(int wx, int wy, int wz) const { - double pillar = noise3(pillar_vanilla, wx, wy, wz, 25.0, 0.3); - double rareness = mapped_noise3(pillar_rareness_vanilla, wx, wy, wz, - 1.0, 1.0, 0.0, -2.0); - double thickness = mapped_noise3(pillar_thickness_vanilla, wx, wy, wz, - 1.0, 1.0, 0.0, 1.1); - return (pillar * 2.0 + rareness) * thickness * thickness * thickness; - } - - double noodle_density(int wx, int wy, int wz) const { - if (wy < -60 || wy > 320) { - return 64.0; - } - double gate = noise3(noodle_vanilla, wx, wy, wz, 1.0, 1.0); - if (gate < 0.0) { - return 64.0; - } - double thickness = mapped_noise3(noodle_thickness_vanilla, - wx, wy, wz, 1.0, 1.0, -0.05, -0.1); - double ridge_a = std::fabs(noise3(noodle_ridge_a_vanilla, wx, wy, wz, - 2.6666666667, 2.6666666667)); - double ridge_b = std::fabs(noise3(noodle_ridge_b_vanilla, wx, wy, wz, - 2.6666666667, 2.6666666667)); - return thickness + 1.5 * std::max(ridge_a, ridge_b); - } - - int aquifer_fluid_block(int wx, int wy, int wz) const { - if (wy < -54) { - return LAVA; - } - - double lava = aquifer_lava_vanilla.get_value((double)floor_div(wx, 64), - (double)floor_div(wy, 40), - (double)floor_div(wz, 64)); - if (wy <= -10 && std::fabs(lava) > 0.3) { - return LAVA; - } - - if (wy >= 30 && wy <= SEA_LEVEL) { - return WATER; - } - - double flood = std::max(-1.0, std::min(1.0, - aquifer_floodedness_vanilla.get_value((double)wx * 0.67, - (double)wy * 0.67, - (double)wz * 0.67))); - double depth_bias = y_clamped_gradient(wy, -20.0, 64.0, -0.35, 0.25); - if (flood + depth_bias < -0.45) { - return AIR; - } - - double spread = aquifer_spread_vanilla.get_value((double)wx * 0.7142857142857143, - (double)wy * 0.7142857142857143, - (double)wz * 0.7142857142857143) * 10.0; - int quantized_spread = (int)std::floor(spread / 3.0) * 3; - int local_level = SEA_LEVEL; - if (wy < SEA_LEVEL - 8) { - int band = (floor_div(wy, 40) * 40) + 20 + quantized_spread; - local_level = std::min(SEA_LEVEL, band); - } - - if (wy < local_level) { - return WATER; - } - return AIR; - } - - double cave_density(int wx, int wy, int wz, double sloped_cheese) const { - double entrances = cave_entrances(wx, wy, wz); - if (sloped_cheese < SURFACE_DENSITY_THRESHOLD) { - return std::min(sloped_cheese, entrances * 5.0); - } - - double layer = noise3(cave_layer_vanilla, wx, wy, wz, 1.0, 8.0); - double layer_term = 4.0 * layer * layer; - double cheese = noise3(cave_cheese_vanilla, wx, wy, wz, 1.0, 0.6666666667); - double cheese_term = std::max(-1.0, std::min(1.0, 0.27 + cheese)) + - std::max(0.0, std::min(0.5, 1.5 - 0.64 * sloped_cheese)); - double underground = std::min(std::min(layer_term + cheese_term, entrances), - spaghetti_2d(wx, wy, wz) + spaghetti_roughness(wx, wy, wz)); - double pillar = pillars(wx, wy, wz); - if (pillar > 0.03) { - underground = std::max(underground, pillar); - } - return underground; - } - - double sample_density(int wx, int wy, int wz) const { - TerrainSample t = sample_terrain(wx, wz); - double offset = GLOBAL_OFFSET + terrain_offset(t); - double depth = y_clamped_gradient(wy, -64.0, 320.0, 1.5, -1.5) + offset; - double jagged = terrain_jaggedness(t) * - half_negative(jagged_vanilla.get_value(wx / 1500.0, wy / 1500.0, wz / 1500.0)); - double gradient = 4.0 * quarter_negative((depth + jagged) * terrain_factor(t)); - double sloped_cheese = gradient + blended_base_noise(wx, wy, wz); - double density = cave_density(wx, wy, wz, sloped_cheese); - density = slide_overworld(density, wy); - density = density_squeeze(density * 0.64); - return std::min(density, noodle_density(wx, wy, wz)); - } - - struct ClimateSample { - double temperature; - double humidity; - double continental; - double erosion; - double weirdness; - double peaks_valleys; - }; - - ClimateSample sample_climate(int wx, int wz) const { - double sx = shift_a(wx, wz); - double sz = shift_b(wx, wz); - double qx = (double)wx * 0.25 + sx; - double qz = (double)wz * 0.25 + sz; - ClimateSample c{}; - c.temperature = temperature_vanilla.get_value(qx, 0.0, qz); - c.humidity = humidity_vanilla.get_value(qx, 0.0, qz); - c.continental = continental_vanilla.get_value(qx, 0.0, qz); - c.erosion = erosion_vanilla.get_value(qx, 0.0, qz); - c.weirdness = ridge_vanilla.get_value(qx, 0.0, qz); - c.peaks_valleys = peaks_and_valleys(c.weirdness); - return c; - } - - static int climate_index(double value, const std::array& ends) { - for (int i = 0; i < 4; i++) { - if (value < ends[i]) { - return i; - } - } - return 4; - } - - static int temperature_index(double value) { - return climate_index(value, {-0.45, -0.15, 0.2, 0.55}); - } - - static int humidity_index(double value) { - return climate_index(value, {-0.35, -0.1, 0.1, 0.3}); - } - - static int erosion_index(double value) { - const double ends[] = {-0.78, -0.375, -0.2225, 0.05, 0.45, 0.55}; - for (int i = 0; i < 6; i++) { - if (value < ends[i]) { - return i; - } - } - return 6; - } - - enum class WeirdnessSlice { - Valley, - Low, - Mid, - High, - Peak, - }; - - static WeirdnessSlice weirdness_slice(double w) { - if (-0.05 <= w && w < 0.05) return WeirdnessSlice::Valley; - double aw = std::fabs(w); - if (aw < 0.26666668) return WeirdnessSlice::Low; - if (aw < 0.4 || aw >= 0.93333334) return WeirdnessSlice::Mid; - if (aw < 0.56666666 || aw >= 0.7666667) return WeirdnessSlice::High; - return WeirdnessSlice::Peak; - } - - static uint16_t table_or(uint16_t value, uint16_t fallback) { - return value == 0xFFFF ? fallback : value; - } - - static uint16_t pick_middle_biome(int t, int h, bool positive_weirdness) { - static constexpr uint16_t base[5][5] = { - {BIOME_SNOWY_PLAINS, BIOME_SNOWY_PLAINS, BIOME_SNOWY_PLAINS, BIOME_SNOWY_TAIGA, BIOME_TAIGA}, - {BIOME_PLAINS, BIOME_PLAINS, BIOME_FOREST, BIOME_TAIGA, BIOME_OLD_GROWTH_SPRUCE_TAIGA}, - {BIOME_FLOWER_FOREST, BIOME_PLAINS, BIOME_FOREST, BIOME_BIRCH_FOREST, BIOME_DARK_FOREST}, - {BIOME_SAVANNA, BIOME_SAVANNA, BIOME_FOREST, BIOME_JUNGLE, BIOME_JUNGLE}, - {BIOME_DESERT, BIOME_DESERT, BIOME_DESERT, BIOME_DESERT, BIOME_DESERT}, - }; - static constexpr uint16_t variant[5][5] = { - {BIOME_ICE_SPIKES, 0xFFFF, BIOME_SNOWY_TAIGA, 0xFFFF, 0xFFFF}, - {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, BIOME_OLD_GROWTH_PINE_TAIGA}, - {BIOME_SUNFLOWER_PLAINS, 0xFFFF, 0xFFFF, BIOME_OLD_GROWTH_BIRCH_FOREST, 0xFFFF}, - {0xFFFF, 0xFFFF, BIOME_PLAINS, BIOME_SPARSE_JUNGLE, BIOME_BAMBOO_JUNGLE}, - {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - }; - return positive_weirdness ? table_or(variant[t][h], base[t][h]) : base[t][h]; - } - - static uint16_t pick_badlands_biome(int h, bool positive_weirdness) { - if (h < 2) { - return positive_weirdness ? BIOME_ERODED_BADLANDS : BIOME_BADLANDS; - } - if (h < 3) { - return BIOME_BADLANDS; - } - return BIOME_WOODED_BADLANDS; - } - - static uint16_t pick_middle_or_badlands(int t, int h, bool positive_weirdness) { - return t == 4 ? pick_badlands_biome(h, positive_weirdness) - : pick_middle_biome(t, h, positive_weirdness); - } - - static uint16_t pick_plateau_biome(int t, int h, bool positive_weirdness) { - static constexpr uint16_t base[5][5] = { - {BIOME_SNOWY_PLAINS, BIOME_SNOWY_PLAINS, BIOME_SNOWY_PLAINS, BIOME_SNOWY_TAIGA, BIOME_SNOWY_TAIGA}, - {BIOME_MEADOW, BIOME_MEADOW, BIOME_FOREST, BIOME_TAIGA, BIOME_OLD_GROWTH_SPRUCE_TAIGA}, - {BIOME_MEADOW, BIOME_MEADOW, BIOME_MEADOW, BIOME_MEADOW, BIOME_DARK_FOREST}, - {BIOME_SAVANNA_PLATEAU, BIOME_SAVANNA_PLATEAU, BIOME_FOREST, BIOME_FOREST, BIOME_JUNGLE}, - {BIOME_BADLANDS, BIOME_BADLANDS, BIOME_BADLANDS, BIOME_WOODED_BADLANDS, BIOME_WOODED_BADLANDS}, - }; - static constexpr uint16_t variant[5][5] = { - {BIOME_ICE_SPIKES, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - {BIOME_CHERRY_GROVE, 0xFFFF, BIOME_MEADOW, BIOME_MEADOW, BIOME_OLD_GROWTH_PINE_TAIGA}, - {BIOME_CHERRY_GROVE, BIOME_CHERRY_GROVE, BIOME_FOREST, BIOME_BIRCH_FOREST, 0xFFFF}, - {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - {BIOME_ERODED_BADLANDS, BIOME_ERODED_BADLANDS, 0xFFFF, 0xFFFF, 0xFFFF}, - }; - return positive_weirdness ? table_or(variant[t][h], base[t][h]) : base[t][h]; - } - - static uint16_t pick_slope_biome(int t, int h, bool positive_weirdness) { - if (t >= 3) { - return pick_plateau_biome(t, h, positive_weirdness); - } - return h <= 1 ? BIOME_SNOWY_SLOPES : BIOME_GROVE; - } - - static uint16_t pick_peak_biome(int t, int h, bool positive_weirdness) { - if (t <= 2) { - return positive_weirdness ? BIOME_FROZEN_PEAKS : BIOME_JAGGED_PEAKS; - } - if (t == 3) { - return BIOME_STONY_PEAKS; - } - return pick_badlands_biome(h, positive_weirdness); - } - - static uint16_t pick_shattered_biome(int t, int h, bool positive_weirdness) { - static constexpr uint16_t shattered[5][5] = { - {BIOME_WINDSWEPT_GRAVELLY_HILLS, BIOME_WINDSWEPT_GRAVELLY_HILLS, BIOME_WINDSWEPT_HILLS, BIOME_WINDSWEPT_FOREST, BIOME_WINDSWEPT_FOREST}, - {BIOME_WINDSWEPT_GRAVELLY_HILLS, BIOME_WINDSWEPT_GRAVELLY_HILLS, BIOME_WINDSWEPT_HILLS, BIOME_WINDSWEPT_FOREST, BIOME_WINDSWEPT_FOREST}, - {BIOME_WINDSWEPT_HILLS, BIOME_WINDSWEPT_HILLS, BIOME_WINDSWEPT_HILLS, BIOME_WINDSWEPT_FOREST, BIOME_WINDSWEPT_FOREST}, - {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - }; - return table_or(shattered[t][h], pick_middle_biome(t, h, positive_weirdness)); - } - - static uint16_t maybe_windswept_savanna(int t, int h, bool positive_weirdness, uint16_t fallback) { - return (t > 1 && h < 4 && positive_weirdness) ? BIOME_WINDSWEPT_SAVANNA : fallback; - } - - static uint16_t pick_beach_biome(int t) { - if (t == 0) return BIOME_SNOWY_BEACH; - if (t == 4) return BIOME_DESERT; - return BIOME_BEACH; - } - - static uint16_t pick_shattered_coast_biome(int t, int h, bool positive_weirdness) { - uint16_t base = positive_weirdness ? pick_middle_biome(t, h, positive_weirdness) - : pick_beach_biome(t); - return maybe_windswept_savanna(t, h, positive_weirdness, base); - } - - uint16_t sample_surface_biome(int wx, int wz, int surface_height) const { - ClimateSample c = sample_climate(wx, wz); - int t = temperature_index(c.temperature); - int h = humidity_index(c.humidity); - int e = erosion_index(c.erosion); - bool positive = c.weirdness >= 0.0; - WeirdnessSlice slice = weirdness_slice(c.weirdness); - - if (c.continental < -1.05) { - return BIOME_MUSHROOM_FIELDS; - } - if (c.continental < -0.455) { - static constexpr uint16_t oceans[5] = { - BIOME_DEEP_FROZEN_OCEAN, BIOME_DEEP_COLD_OCEAN, BIOME_DEEP_OCEAN, - BIOME_DEEP_LUKEWARM_OCEAN, BIOME_WARM_OCEAN - }; - return oceans[t]; - } - if (c.continental < -0.19) { - static constexpr uint16_t oceans[5] = { - BIOME_FROZEN_OCEAN, BIOME_COLD_OCEAN, BIOME_OCEAN, - BIOME_LUKEWARM_OCEAN, BIOME_WARM_OCEAN - }; - return oceans[t]; - } - - bool coast = c.continental < -0.11; - bool near_inland = -0.11 <= c.continental && c.continental < 0.03; - bool mid_inland = 0.03 <= c.continental && c.continental < 0.3; - bool far_inland = c.continental >= 0.3; - - if (slice == WeirdnessSlice::Valley) { - if (e == 6) { - if (t == 0) return BIOME_FROZEN_RIVER; - if (t == 1 || t == 2) return BIOME_SWAMP; - if (t == 3 || t == 4) return BIOME_MANGROVE_SWAMP; - } - if (coast || near_inland || e <= 5) { - return t == 0 ? BIOME_FROZEN_RIVER : BIOME_RIVER; - } - return pick_middle_or_badlands(t, h, positive); - } - - if (coast) { - if (slice == WeirdnessSlice::Mid && e <= 2) { - return BIOME_STONY_SHORE; - } - if (e == 5) { - return pick_shattered_coast_biome(t, h, positive); - } - if (e >= 3) { - return pick_beach_biome(t); - } - } - - if (e == 6) { - if (t == 1 || t == 2) return BIOME_SWAMP; - if (t == 3 || t == 4) return BIOME_MANGROVE_SWAMP; - } - - if (slice == WeirdnessSlice::Peak) { - if (e == 0 || (e == 1 && (mid_inland || far_inland))) { - return pick_peak_biome(t, h, positive); - } - if (e == 1 || (near_inland && (e == 2 || e == 3))) { - return t == 0 ? pick_slope_biome(t, h, positive) : pick_middle_or_badlands(t, h, positive); - } - if (e == 2 || (far_inland && e == 3)) { - return pick_plateau_biome(t, h, positive); - } - if (e == 5) { - return mid_inland || far_inland ? pick_shattered_biome(t, h, positive) - : maybe_windswept_savanna(t, h, positive, pick_middle_biome(t, h, positive)); - } - return pick_middle_biome(t, h, positive); - } - - if (slice == WeirdnessSlice::High) { - if (e == 0) { - if (near_inland) return pick_slope_biome(t, h, positive); - if (mid_inland || far_inland) return pick_peak_biome(t, h, positive); - } - if (e == 1) { - return near_inland ? pick_middle_or_badlands(t, h, positive) - : pick_slope_biome(t, h, positive); - } - if (e == 2 || (far_inland && e == 3)) { - return pick_plateau_biome(t, h, positive); - } - if (e == 5) { - return mid_inland || far_inland ? pick_shattered_biome(t, h, positive) - : maybe_windswept_savanna(t, h, positive, pick_middle_biome(t, h, positive)); - } - return pick_middle_or_badlands(t, h, positive); - } - - if (slice == WeirdnessSlice::Low) { - if (e <= 1) { - return near_inland ? pick_middle_or_badlands(t, h, positive) - : (t == 0 ? pick_slope_biome(t, h, positive) - : pick_middle_or_badlands(t, h, positive)); - } - if (e == 5 && near_inland) { - return maybe_windswept_savanna(t, h, positive, pick_middle_biome(t, h, positive)); - } - return pick_middle_or_badlands(t, h, positive); - } - - if (slice == WeirdnessSlice::Mid) { - if (e == 0) return pick_slope_biome(t, h, positive); - if (e == 1) return far_inland && t != 0 ? pick_plateau_biome(t, h, positive) - : pick_middle_or_badlands(t, h, positive); - if (e == 2) return near_inland ? pick_middle_biome(t, h, positive) - : (mid_inland ? pick_middle_or_badlands(t, h, positive) - : pick_plateau_biome(t, h, positive)); - if (e == 5) return mid_inland || far_inland ? pick_shattered_biome(t, h, positive) - : maybe_windswept_savanna(t, h, positive, pick_middle_biome(t, h, positive)); - return pick_middle_or_badlands(t, h, positive); - } - - return pick_middle_biome(t, h, positive); - } - - uint16_t sample_biome(int wx, int wy, int wz, int surface_height) const { - uint16_t surface = sample_surface_biome(wx, wz, surface_height); - ClimateSample c = sample_climate(wx, wz); - int depth = surface_height - wy; - if (wy < -48 && depth > 16 && c.erosion < -0.375) { - return BIOME_DEEP_DARK; - } - if (wy < 40 && depth > 12) { - if (c.humidity > 0.7) return BIOME_LUSH_CAVES; - if (c.continental > 0.8) return BIOME_DRIPSTONE_CAVES; - } - return surface; - } - - static bool biome_is_sandy(uint16_t biome) { - return biome == BIOME_DESERT || biome == BIOME_BADLANDS || - biome == BIOME_ERODED_BADLANDS || biome == BIOME_WOODED_BADLANDS; - } - - static bool biome_is_beach(uint16_t biome) { - return biome == BIOME_BEACH || biome == BIOME_SNOWY_BEACH || - biome == BIOME_STONY_SHORE; - } - - static bool biome_is_cold_surface(uint16_t biome) { - return biome == BIOME_SNOWY_PLAINS || biome == BIOME_SNOWY_TAIGA || - biome == BIOME_ICE_SPIKES || biome == BIOME_GROVE || - biome == BIOME_SNOWY_SLOPES || biome == BIOME_FROZEN_PEAKS || - biome == BIOME_JAGGED_PEAKS || biome == BIOME_FROZEN_OCEAN || - biome == BIOME_DEEP_FROZEN_OCEAN || biome == BIOME_FROZEN_RIVER; - } - - static bool biome_is_taiga_like(uint16_t biome) { - return biome == BIOME_TAIGA || biome == BIOME_SNOWY_TAIGA || - biome == BIOME_OLD_GROWTH_PINE_TAIGA || - biome == BIOME_OLD_GROWTH_SPRUCE_TAIGA || biome == BIOME_GROVE; - } - - static bool biome_is_forest_like(uint16_t biome) { - return biome == BIOME_FOREST || biome == BIOME_DARK_FOREST || - biome == BIOME_FLOWER_FOREST || biome == BIOME_BIRCH_FOREST || - biome == BIOME_OLD_GROWTH_BIRCH_FOREST || - biome == BIOME_WINDSWEPT_FOREST; - } - - static bool biome_is_jungle_like(uint16_t biome) { - return biome == BIOME_JUNGLE || biome == BIOME_SPARSE_JUNGLE || - biome == BIOME_BAMBOO_JUNGLE; - } - - static bool biome_is_grassy_open(uint16_t biome) { - return biome == BIOME_PLAINS || biome == BIOME_SUNFLOWER_PLAINS || - biome == BIOME_MEADOW || biome == BIOME_SAVANNA || - biome == BIOME_SAVANNA_PLATEAU || biome == BIOME_WINDSWEPT_SAVANNA; - } - - static bool biome_is_badlands(uint16_t biome) { - return biome == BIOME_BADLANDS || biome == BIOME_ERODED_BADLANDS || - biome == BIOME_WOODED_BADLANDS; - } - - static bool biome_is_stony_surface(uint16_t biome) { - return biome == BIOME_STONY_PEAKS || biome == BIOME_STONY_SHORE || - biome == BIOME_WINDSWEPT_HILLS || - biome == BIOME_WINDSWEPT_GRAVELLY_HILLS || - biome == BIOME_JAGGED_PEAKS || biome == BIOME_FROZEN_PEAKS; - } - - static bool biome_is_podzol_surface(uint16_t biome) { - return biome == BIOME_OLD_GROWTH_PINE_TAIGA || - biome == BIOME_OLD_GROWTH_SPRUCE_TAIGA; - } - - int badlands_band_block(int wx, int wy, int wz) const { - double band_noise = surface_vanilla.get_value((double)wx * 0.0625, - 0.0, - (double)wz * 0.0625) * 4.0; - int band = floor_div(wy + (int)std::floor(band_noise), 2) & 15; - switch (band) { - case 1: - case 2: - return ORANGE_TERRACOTTA; - case 4: - return YELLOW_TERRACOTTA; - case 6: - return BROWN_TERRACOTTA; - case 8: - return RED_TERRACOTTA; - case 10: - return WHITE_TERRACOTTA; - case 11: - return LIGHT_GRAY_TERRACOTTA; - default: - return TERRACOTTA; - } - } - - void build_chunk_biomes(int chunk_x, int chunk_z, int height_map[16][16], - uint16_t* biome_out) const { - if (biome_out == nullptr) { - return; - } - int base_x = chunk_x * 16; - int base_z = chunk_z * 16; - int out = 0; - for (int section = 0; section < NUM_SECTIONS; section++) { - for (int local_biome_y = 0; local_biome_y < 4; local_biome_y++) { - for (int biome_z = 0; biome_z < 4; biome_z++) { - for (int biome_x = 0; biome_x < 4; biome_x++) { - int sample_x = biome_x * 4 + 2; - int sample_z = biome_z * 4 + 2; - int wx = base_x + sample_x; - int wz = base_z + sample_z; - int wy = MIN_Y + section * 16 + local_biome_y * 4 + 2; - int surface_h = height_map[std::min(15, sample_z)][std::min(15, sample_x)]; - biome_out[out++] = sample_biome(wx, wy, wz, surface_h); - } - } - } - } - } - - static double trilerp(double tx, double ty, double tz, - double c000, double c100, double c010, double c110, - double c001, double c101, double c011, double c111) { - double x00 = lerp(tx, c000, c100); - double x10 = lerp(tx, c010, c110); - double x01 = lerp(tx, c001, c101); - double x11 = lerp(tx, c011, c111); - double y0 = lerp(ty, x00, x10); - double y1 = lerp(ty, x01, x11); - return lerp(tz, y0, y1); - } - - static bool can_carver_replace(int block_id) { - switch (block_id) { - case STONE: - case DEEPSLATE: - case DIRT: - case GRASS_BLOCK: - case SAND: - case SANDSTONE: - case GRAVEL: - case CLAY: - case SNOW_BLOCK: - case GRANITE: - case DIORITE: - case ANDESITE: - case TUFF: - case COAL_ORE: - case DEEPSLATE_COAL_ORE: - case IRON_ORE: - case DEEPSLATE_IRON_ORE: - case COPPER_ORE: - case DEEPSLATE_COPPER_ORE: - case GOLD_ORE: - case DEEPSLATE_GOLD_ORE: - case REDSTONE_ORE: - case DEEPSLATE_REDSTONE_ORE: - case LAPIS_ORE: - case DEEPSLATE_LAPIS_ORE: - case DIAMOND_ORE: - case DEEPSLATE_DIAMOND_ORE: - case EMERALD_ORE: - case DEEPSLATE_EMERALD_ORE: - return true; - default: - return false; - } - } - - void recompute_heightmap(int* blocks, int height_map[16][16]) const { - for (int lz = 0; lz < 16; lz++) { - for (int lx = 0; lx < 16; lx++) { - int h = MIN_Y + 1; - for (int yi = WORLD_HEIGHT - 1; yi >= 0; yi--) { - int block = blocks[yi * 256 + lz * 16 + lx]; - if (block != AIR && block != WATER && block != LAVA) { - h = yi + MIN_Y; - break; - } - } - height_map[lz][lx] = h; - } - } - } - - void carve_block(int* blocks, int lx, int yi, int lz, - int wx, int wy, int wz) const { - if (lx < 0 || lx >= 16 || lz < 0 || lz >= 16 || yi <= 0 || yi >= WORLD_HEIGHT) { - return; - } - int idx = yi * 256 + lz * 16 + lx; - if (!can_carver_replace(blocks[idx])) { - return; - } - if (wy <= MIN_Y + 8) { - blocks[idx] = LAVA; - return; - } - int fluid = aquifer_fluid_block(wx, wy, wz); - blocks[idx] = (fluid == AIR) ? AIR : fluid; - } - - void carve_ellipsoid(int* blocks, int base_x, int base_z, - double cx, double cy, double cz, - double horizontal_radius, double vertical_radius, - double floor_level, bool canyon_shape) const { - if (horizontal_radius <= 0.0 || vertical_radius <= 0.0) { - return; - } - double middle_x = base_x + 8.0; - double middle_z = base_z + 8.0; - double reach = 16.0 + horizontal_radius * 2.0; - if (std::fabs(cx - middle_x) > reach || std::fabs(cz - middle_z) > reach) { - return; - } - - int min_lx = std::max(0, (int)std::floor(cx - horizontal_radius) - base_x - 1); - int max_lx = std::min(15, (int)std::floor(cx + horizontal_radius) - base_x + 1); - int min_lz = std::max(0, (int)std::floor(cz - horizontal_radius) - base_z - 1); - int max_lz = std::min(15, (int)std::floor(cz + horizontal_radius) - base_z + 1); - int min_y = std::max(MIN_Y + 1, (int)std::floor(cy - vertical_radius) - 1); - int max_y = std::min(MAX_Y - 7, (int)std::floor(cy + vertical_radius) + 1); - - for (int lx = min_lx; lx <= max_lx; lx++) { - int wx = base_x + lx; - double nx = ((double)wx + 0.5 - cx) / horizontal_radius; - for (int lz = min_lz; lz <= max_lz; lz++) { - int wz = base_z + lz; - double nz = ((double)wz + 0.5 - cz) / horizontal_radius; - if (nx * nx + nz * nz >= 1.0) { - continue; - } - for (int wy = max_y; wy >= min_y; wy--) { - double ny = ((double)wy - 0.5 - cy) / vertical_radius; - bool skip = false; - if (canyon_shape) { - skip = (nx * nx + nz * nz) + (ny * ny / 6.0) >= 1.0; - } else { - skip = ny <= floor_level || (nx * nx + ny * ny + nz * nz) >= 1.0; - } - if (!skip) { - carve_block(blocks, lx, wy - MIN_Y, lz, wx, wy, wz); - } - } - } - } - } - - void carve_tunnel(int* blocks, int base_x, int base_z, SimpleRNG rng, - double x, double y, double z, - double horizontal_multiplier, double vertical_multiplier, - double thickness, double yaw, double pitch, - int step_start, int step_end, - double y_scale, double floor_level, - int branch_depth = 0) const { - if (step_end <= step_start) { - return; - } - int split_step = rng.randint(step_end / 4, std::max(step_end / 4, step_end / 2)); - bool gentle_pitch = rng.randint(0, 5) == 0; - double yaw_velocity = 0.0; - double pitch_velocity = 0.0; - - for (int step = step_start; step < step_end; step++) { - double progress = (double)step / (double)step_end; - double radius = 1.5 + std::sin(PI * progress) * thickness; - double horizontal_radius = radius * horizontal_multiplier; - double vertical_radius = radius * y_scale * vertical_multiplier; - - double cp = std::cos(pitch); - x += std::cos(yaw) * cp; - y += std::sin(pitch); - z += std::sin(yaw) * cp; - - pitch *= gentle_pitch ? 0.92 : 0.70; - pitch += pitch_velocity * 0.1; - yaw += yaw_velocity * 0.1; - pitch_velocity *= 0.9; - yaw_velocity *= 0.75; - pitch_velocity += (rng.random_double() - rng.random_double()) * rng.random_double() * 2.0; - yaw_velocity += (rng.random_double() - rng.random_double()) * rng.random_double() * 4.0; - - if (branch_depth < 1 && step == split_step && thickness > 1.0) { - SimpleRNG left = rng; - left.seed((int64_t)rng.next_u64()); - carve_tunnel(blocks, base_x, base_z, left, x, y, z, - horizontal_multiplier, vertical_multiplier, - rng.random_double() * 0.5 + 0.5, - yaw - PI * 0.5, pitch / 3.0, - step, step_end, 1.0, floor_level, branch_depth + 1); - SimpleRNG right = rng; - right.seed((int64_t)rng.next_u64()); - carve_tunnel(blocks, base_x, base_z, right, x, y, z, - horizontal_multiplier, vertical_multiplier, - rng.random_double() * 0.5 + 0.5, - yaw + PI * 0.5, pitch / 3.0, - step, step_end, 1.0, floor_level, branch_depth + 1); - return; - } - - if (rng.randint(0, 3) == 0) { - continue; - } - carve_ellipsoid(blocks, base_x, base_z, x, y, z, - horizontal_radius, vertical_radius, floor_level, false); - } - } - - void apply_cave_carver_from_start(int* blocks, int base_x, int base_z, - int start_chunk_x, int start_chunk_z, - bool extra_underground) const { - SimpleRNG rng; - const char* key = extra_underground ? "carver_cave_extra_underground" : "carver_cave"; - rng.seed_key(seed ^ ((int64_t)start_chunk_x * 341873128712LL - + (int64_t)start_chunk_z * 132897987541LL), - key); - - double probability = extra_underground ? 0.07 : 0.15; - if (rng.random_double() > probability) { - return; - } - - int cave_count = rng.randint(0, rng.randint(0, rng.randint(0, 14))); - int y_min = MIN_Y + 8; - int y_max = extra_underground ? 47 : 180; - int range_steps = (4 * 2 - 1) * 16; - - for (int i = 0; i < cave_count; i++) { - double x = (double)(start_chunk_x * 16 + rng.randint(0, 15)); - double y = (double)rng.randint(y_min, y_max); - double z = (double)(start_chunk_z * 16 + rng.randint(0, 15)); - double h_mult = 0.7 + rng.random_double() * 0.7; - double v_mult = 0.8 + rng.random_double() * 0.5; - double floor_level = -1.0 + rng.random_double() * 0.6; - int tunnel_count = 1; - - if (rng.randint(0, 3) == 0) { - double y_scale = 0.1 + rng.random_double() * 0.8; - double room_thickness = 1.0 + rng.random_double() * 6.0; - double radius = 1.5 + room_thickness; - carve_ellipsoid(blocks, base_x, base_z, x + 1.0, y, z, - radius, radius * y_scale, floor_level, false); - tunnel_count += rng.randint(0, 3); - } - - for (int t = 0; t < tunnel_count; t++) { - double yaw = rng.random_double() * PI * 2.0; - double pitch = (rng.random_double() - 0.5) / 4.0; - double thickness = rng.random_double() * 2.0 + rng.random_double(); - if (rng.randint(0, 9) == 0) { - thickness *= rng.random_double() * rng.random_double() * 3.0 + 1.0; - } - int steps = range_steps - rng.randint(0, range_steps / 4); - SimpleRNG tunnel_rng; - tunnel_rng.seed((int64_t)rng.next_u64()); - carve_tunnel(blocks, base_x, base_z, tunnel_rng, - x, y, z, h_mult, v_mult, thickness, - yaw, pitch, 0, steps, 1.0, floor_level); - } - } - } - - void apply_canyon_carver_from_start(int* blocks, int base_x, int base_z, - int start_chunk_x, int start_chunk_z) const { - SimpleRNG rng; - rng.seed_key(seed ^ ((int64_t)start_chunk_x * 6364136223846793005LL - + (int64_t)start_chunk_z * 1442695040888963407LL), - "carver_canyon"); - if (rng.random_double() > 0.01) { - return; - } - - double x = (double)(start_chunk_x * 16 + rng.randint(0, 15)); - double y = (double)rng.randint(10, 67); - double z = (double)(start_chunk_z * 16 + rng.randint(0, 15)); - double yaw = rng.random_double() * PI * 2.0; - double pitch = -0.125 + rng.random_double() * 0.25; - double thickness = rng.triangular(0.0, 6.0, 2.0); - double distance_factor = 0.75 + rng.random_double() * 0.25; - int steps = (int)((4 * 2 - 1) * 16 * distance_factor); - double yaw_velocity = 0.0; - double pitch_velocity = 0.0; - - for (int step = 0; step < steps; step++) { - double progress = (double)step / (double)std::max(1, steps); - double base_radius = 1.5 + std::sin(PI * progress) * thickness; - double horizontal_radius = base_radius * (0.75 + rng.random_double() * 0.25); - double center_factor = 1.0 - std::fabs(0.5 - progress) * 2.0; - double vertical_radius = base_radius * 3.0 * (1.0 + center_factor) * - (0.75 + rng.random_double() * 0.25); - - double cp = std::cos(pitch); - x += std::cos(yaw) * cp; - y += std::sin(pitch); - z += std::sin(yaw) * cp; - pitch *= 0.7; - pitch += pitch_velocity * 0.05; - yaw += yaw_velocity * 0.05; - pitch_velocity *= 0.8; - yaw_velocity *= 0.5; - pitch_velocity += (rng.random_double() - rng.random_double()) * rng.random_double() * 2.0; - yaw_velocity += (rng.random_double() - rng.random_double()) * rng.random_double() * 4.0; - - if (rng.randint(0, 3) == 0) { - continue; - } - carve_ellipsoid(blocks, base_x, base_z, x, y, z, - horizontal_radius, vertical_radius, -1.0, true); - } - } - - void apply_carvers(int* blocks, int chunk_x, int chunk_z, int base_x, int base_z) const { - for (int sx = chunk_x - 4; sx <= chunk_x + 4; sx++) { - for (int sz = chunk_z - 4; sz <= chunk_z + 4; sz++) { - apply_cave_carver_from_start(blocks, base_x, base_z, sx, sz, false); - apply_cave_carver_from_start(blocks, base_x, base_z, sx, sz, true); - apply_canyon_carver_from_start(blocks, base_x, base_z, sx, sz); - } - } - } - - // 主生成函数: 生成 384*16*16 的方块数据 - // blocks[y][z][x] => blocks[y * 256 + z * 16 + x] - void generate_chunk(int chunk_x, int chunk_z, int* blocks, - int16_t* heightmap_out = nullptr, - uint16_t* biome_out = nullptr) const { - const int total = WORLD_HEIGHT * 16 * 16; - memset(blocks, 0, total * sizeof(int)); // 全 AIR - - int base_x = chunk_x * 16; - int base_z = chunk_z * 16; - - int height_map[16][16]; - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - height_map[z][x] = MIN_Y; - } - } - - double density[CELL_COUNT_XZ + 1][CELL_COUNT_Y + 1][CELL_COUNT_XZ + 1]; - for (int cx = 0; cx <= CELL_COUNT_XZ; cx++) { - int wx = base_x + cx * CELL_WIDTH; - for (int cz = 0; cz <= CELL_COUNT_XZ; cz++) { - int wz = base_z + cz * CELL_WIDTH; - for (int cy = 0; cy <= CELL_COUNT_Y; cy++) { - int wy = MIN_Y + cy * CELL_HEIGHT; - density[cx][cy][cz] = sample_density(wx, wy, wz); - } - } - } - - // --- 第一步: 1.21.1 NoiseBasedChunkGenerator 风格的 cell 插值填充 --- - for (int cx = 0; cx < CELL_COUNT_XZ; cx++) { - for (int cz = 0; cz < CELL_COUNT_XZ; cz++) { - for (int cy = 0; cy < CELL_COUNT_Y; cy++) { - double c000 = density[cx][cy][cz]; - double c100 = density[cx + 1][cy][cz]; - double c010 = density[cx][cy + 1][cz]; - double c110 = density[cx + 1][cy + 1][cz]; - double c001 = density[cx][cy][cz + 1]; - double c101 = density[cx + 1][cy][cz + 1]; - double c011 = density[cx][cy + 1][cz + 1]; - double c111 = density[cx + 1][cy + 1][cz + 1]; - - for (int dy = 0; dy < CELL_HEIGHT; dy++) { - int yi = cy * CELL_HEIGHT + dy; - int wy = MIN_Y + yi; - double ty = (double)dy / (double)CELL_HEIGHT; - for (int dx = 0; dx < CELL_WIDTH; dx++) { - int lx = cx * CELL_WIDTH + dx; - int wx = base_x + lx; - double tx = (double)dx / (double)CELL_WIDTH; - for (int dz = 0; dz < CELL_WIDTH; dz++) { - int lz = cz * CELL_WIDTH + dz; - int wz = base_z + lz; - double tz = (double)dz / (double)CELL_WIDTH; - double d = trilerp(tx, ty, tz, c000, c100, c010, c110, c001, c101, c011, c111); - int idx = yi * 256 + lz * 16 + lx; - - if (yi == 0 || (yi < 5 && block_hash(wx, wy, wz) < (5 - yi) * 0.2)) { - blocks[idx] = BEDROCK; - } else if (d > 0.0) { - blocks[idx] = (wy < 0) ? DEEPSLATE : STONE; - if (wy > height_map[lz][lx]) { - height_map[lz][lx] = wy; - } - } else { - int fluid = aquifer_fluid_block(wx, wy, wz); - if (fluid != AIR) { - blocks[idx] = fluid; - } - } - } - } - } - } - } - } - - // --- 第二步: 原版 carver 阶段的轻量移植,额外切出洞穴/峡谷 --- - apply_carvers(blocks, chunk_x, chunk_z, base_x, base_z); - recompute_heightmap(blocks, height_map); - - for (int lz = 0; lz < 16; lz++) { - for (int lx = 0; lx < 16; lx++) { - if (height_map[lz][lx] < MIN_Y + 1) { - height_map[lz][lx] = MIN_Y + 1; - } - if (heightmap_out != nullptr) { - heightmap_out[lz * 16 + lx] = (int16_t)height_map[lz][lx]; - } - } - } - - build_chunk_biomes(chunk_x, chunk_z, height_map, biome_out); - - // --- 第三步: 地表规则 --- - apply_surface_rules(blocks, height_map, base_x, base_z); - - // --- 第四步: 矿石 --- - place_ores(blocks, base_x, base_z); - apply_ore_veins(blocks, base_x, base_z); - - // --- 第五步: 原版 Feature 流程的轻量地表装饰 --- - place_surface_features(blocks, height_map, base_x, base_z); - - // --- 第六步: 石头变种 --- - place_stone_variants(blocks, base_x, base_z); - } - - void apply_surface_rules(int* blocks, int height_map[16][16], - int base_x, int base_z) const { - for (int lx = 0; lx < 16; lx++) { - for (int lz = 0; lz < 16; lz++) { - int wx = base_x + lx; - int wz = base_z + lz; - int surface_h = height_map[lz][lx]; - - double surf_n = surface_vanilla.get_value((double)wx, 0.0, (double)wz); - uint16_t surface_biome = sample_surface_biome(wx, wz, surface_h); - - bool is_beach = biome_is_beach(surface_biome) || - (SEA_LEVEL - 2 <= surface_h && surface_h <= SEA_LEVEL + 2 && surf_n > -0.3); - bool is_desert = biome_is_sandy(surface_biome); - bool is_cold = biome_is_cold_surface(surface_biome); - bool is_gravel_beach = surface_biome == BIOME_STONY_SHORE || - (is_beach && surf_n > 0.4); - bool is_underwater = (surface_h < SEA_LEVEL); - bool is_badlands_surface = biome_is_badlands(surface_biome); - bool is_stony_surface = biome_is_stony_surface(surface_biome) || - (surface_h > 110 && surf_n > 0.45); - - int si = surface_h - MIN_Y; - if (si < 0 || si >= WORLD_HEIGHT) continue; - - // 检查地表是否被挖空 - int cur = blocks[si * 256 + lz * 16 + lx]; - if (cur == AIR || cur == WATER) { - bool found = false; - for (int sy = si; sy >= std::max(0, si - 20); sy--) { - int sc = blocks[sy * 256 + lz * 16 + lx]; - if (sc != AIR && sc != WATER) { - si = sy; - surface_h = si + MIN_Y; - found = true; - break; - } - } - if (!found) continue; - } - - auto set_block = [&](int yi, int lz_, int lx_, int bid) { - if (yi >= 0 && yi < WORLD_HEIGHT) - blocks[yi * 256 + lz_ * 16 + lx_] = bid; - }; - - auto get_block = [&](int yi, int lz_, int lx_) -> int { - if (yi >= 0 && yi < WORLD_HEIGHT) - return blocks[yi * 256 + lz_ * 16 + lx_]; - return AIR; - }; - - if (is_badlands_surface && !is_underwater) { - set_block(si, lz, lx, RED_SAND); - for (int d = 1; d < 5; d++) { - int idx = si - d; - if (idx >= 0) { - int cur_block = get_block(idx, lz, lx); - if (cur_block == STONE || cur_block == DEEPSLATE || cur_block == DIRT) { - set_block(idx, lz, lx, d < 2 ? RED_SAND : RED_SANDSTONE); - } - } - } - int terracotta_depth = 18 + (int)(std::fabs(surf_n) * 8.0); - for (int d = 5; d <= terracotta_depth; d++) { - int idx = si - d; - if (idx >= 0) { - int cur_block = get_block(idx, lz, lx); - if (cur_block == STONE || cur_block == DEEPSLATE) { - set_block(idx, lz, lx, badlands_band_block(wx, surface_h - d, wz)); - } - } - } - } else if (is_gravel_beach) { - set_block(si, lz, lx, GRAVEL); - for (int d = 1; d < 4; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, DIRT); - } - } else if (is_desert) { - set_block(si, lz, lx, SAND); - for (int d = 1; d < 5; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, d < 3 ? SAND : SANDSTONE); - } - } else if (is_beach && !is_underwater) { - set_block(si, lz, lx, SAND); - for (int d = 1; d < 4; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, d < 2 ? SAND : SANDSTONE); - } - } else if (is_stony_surface && !is_underwater) { - int top = (surface_biome == BIOME_WINDSWEPT_GRAVELLY_HILLS || surf_n > 0.65) ? GRAVEL : STONE; - if (surface_biome == BIOME_STONY_PEAKS && surf_n < -0.2) { - top = CALCITE; - } - set_block(si, lz, lx, top); - for (int d = 1; d < 4; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) { - set_block(idx, lz, lx, STONE); - } - } - } else if (is_cold && !is_underwater) { - bool snow_block_surface = - surface_biome == BIOME_FROZEN_PEAKS || - surface_biome == BIOME_JAGGED_PEAKS || - surface_biome == BIOME_SNOWY_SLOPES || - surface_biome == BIOME_GROVE || - surface_biome == BIOME_ICE_SPIKES; - int top = snow_block_surface ? SNOW_BLOCK : GRASS_BLOCK; - if (surface_biome == BIOME_GROVE && surf_n > 0.55) { - top = POWDER_SNOW; - } - set_block(si, lz, lx, top); - for (int d = 1; d < 4; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, DIRT); - } - if (si + 1 < WORLD_HEIGHT && get_block(si + 1, lz, lx) == AIR) - set_block(si + 1, lz, lx, SNOW); - int water_yi = SEA_LEVEL - MIN_Y; - if (water_yi >= 0 && water_yi < WORLD_HEIGHT && - get_block(water_yi, lz, lx) == WATER) - set_block(water_yi, lz, lx, ICE); - } else if (is_underwater) { - if (surf_n > 0.2) set_block(si, lz, lx, CLAY); - else if (surf_n > -0.2) set_block(si, lz, lx, SAND); - else set_block(si, lz, lx, GRAVEL); - for (int d = 1; d < 3; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, DIRT); - } - } else { - int top = GRASS_BLOCK; - int under = DIRT; - if (biome_is_podzol_surface(surface_biome)) { - top = PODZOL; - under = COARSE_DIRT; - } else if (surface_biome == BIOME_WINDSWEPT_SAVANNA && surf_n > 0.25) { - top = COARSE_DIRT; - under = COARSE_DIRT; - } else if ((surface_biome == BIOME_LUSH_CAVES || surface_biome == BIOME_SWAMP) && - surf_n > 0.45) { - top = MOSS_BLOCK; - } - set_block(si, lz, lx, top); - int dirt_depth = 3 + (int)(std::fabs(surf_n) * 2.0); - for (int d = 1; d <= dirt_depth; d++) { - int idx = si - d; - if (idx >= 0 && get_block(idx, lz, lx) == STONE) - set_block(idx, lz, lx, under); - } - } - - if (is_cold) { - int water_yi = SEA_LEVEL - MIN_Y; - if (water_yi >= 0 && water_yi < WORLD_HEIGHT && - get_block(water_yi, lz, lx) == WATER) { - set_block(water_yi, lz, lx, ICE); - } - } - - // 深层过渡 - int wy_start = std::max(0, MIN_Y + 5); - for (int wy = wy_start; wy < 8; wy++) { - int yi = wy - MIN_Y; - if (yi < WORLD_HEIGHT && get_block(yi, lz, lx) == STONE) { - if (wy < 0) { - set_block(yi, lz, lx, DEEPSLATE); - } else if (block_hash(wx, wy, wz) < 0.5) { - set_block(yi, lz, lx, DEEPSLATE); - } - } - } - } - } - } - - void place_stone_variants(int* blocks, int base_x, int base_z) const { - SimpleRNG rng; - rng.seed(seed ^ ((int64_t)base_x * 341873128712LL + (int64_t)base_z * 132897987541LL)); - - struct Variant { int block_id; int count; }; - Variant variants[] = { - {GRANITE, 80}, {DIORITE, 80}, {ANDESITE, 80}, {TUFF, 40} - }; - - for (auto& v : variants) { - for (int i = 0; i < v.count; i++) { - int lx = rng.randint(0, 15); - int ly_rel = rng.randint(0, 200); - int lz = rng.randint(0, 15); - - if (v.block_id == TUFF && ly_rel > 64) continue; - - int yi = ly_rel; // MIN_Y + ly_rel - MIN_Y - if (yi < 0 || yi >= WORLD_HEIGHT) continue; - - int cur = blocks[yi * 256 + lz * 16 + lx]; - if (cur == STONE || cur == DEEPSLATE) { - blocks[yi * 256 + lz * 16 + lx] = v.block_id; - - for (int dx = -1; dx <= 1; dx++) { - for (int dy = -1; dy <= 1; dy++) { - for (int dz = -1; dz <= 1; dz++) { - if (rng.random_double() < 0.4) { - int nx = lx + dx, ny = yi + dy, nz = lz + dz; - if (nx >= 0 && nx < 16 && nz >= 0 && nz < 16 && - ny >= 0 && ny < WORLD_HEIGHT) { - int c = blocks[ny * 256 + nz * 16 + nx]; - if (c == STONE || c == DEEPSLATE) - blocks[ny * 256 + nz * 16 + nx] = v.block_id; - } - } - } - } - } - } - } - } - } - - bool can_replace_feature(int block_id) const { - return block_id == AIR || block_id == SNOW || block_id == SHORT_GRASS || - block_id == FERN || block_id == DEAD_BUSH || block_id == SEAGRASS || - block_id == DANDELION || block_id == POPPY || - block_id == BROWN_MUSHROOM || block_id == RED_MUSHROOM; - } - - void set_if_replaceable(int* blocks, int yi, int lz, int lx, int block_id) const { - if (yi < 0 || yi >= WORLD_HEIGHT || lx < 0 || lx >= 16 || lz < 0 || lz >= 16) { - return; - } - int idx = yi * 256 + lz * 16 + lx; - if (can_replace_feature(blocks[idx])) { - blocks[idx] = block_id; - } - } - - void place_simple_tree(int* blocks, int lx, int si, int lz, int log_id, int leaves_id, - int height) const { - if (lx < 2 || lx > 13 || lz < 2 || lz > 13) { - return; - } - if (si + height + 2 >= WORLD_HEIGHT) { - return; - } - - for (int dy = 1; dy <= height; dy++) { - set_if_replaceable(blocks, si + dy, lz, lx, log_id); - } - - int top = si + height; - for (int dy = -2; dy <= 1; dy++) { - int radius = (dy <= -1) ? 2 : 1; - for (int dz = -radius; dz <= radius; dz++) { - for (int dx = -radius; dx <= radius; dx++) { - int manhattan = std::abs(dx) + std::abs(dz); - if (manhattan > radius + 1) { - continue; - } - if (std::abs(dx) == radius && std::abs(dz) == radius && dy >= 0) { - continue; - } - set_if_replaceable(blocks, top + dy, lz + dz, lx + dx, leaves_id); - } - } - } - set_if_replaceable(blocks, top + 2, lz, lx, leaves_id); - } - - bool has_adjacent_water(int* blocks, int yi, int lz, int lx) const { - static constexpr int dirs[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; - for (auto& d : dirs) { - int nx = lx + d[0]; - int nz = lz + d[1]; - if (nx < 0 || nx >= 16 || nz < 0 || nz >= 16 || yi < 0 || yi >= WORLD_HEIGHT) { - continue; - } - if (blocks[yi * 256 + nz * 16 + nx] == WATER) { - return true; - } - } - return false; - } - - void place_surface_features(int* blocks, int height_map[16][16], - int base_x, int base_z) const { - for (int lz = 0; lz < 16; lz++) { - for (int lx = 0; lx < 16; lx++) { - int surface_h = height_map[lz][lx]; - int si = surface_h - MIN_Y; - if (si < 0 || si + 1 >= WORLD_HEIGHT) { - continue; - } - - int surface = blocks[si * 256 + lz * 16 + lx]; - int above = blocks[(si + 1) * 256 + lz * 16 + lx]; - if (above != AIR && above != SNOW) { - continue; - } - - int wx = base_x + lx; - int wz = base_z + lz; - uint16_t biome = sample_surface_biome(wx, wz, surface_h); - double feature_roll = block_hash(wx, surface_h + 17, wz); - double detail_roll = block_hash(wx + 991, surface_h + 23, wz - 313); - - if (surface == GRASS_BLOCK) { - double tree_chance = 0.0015; - double grass_chance = 0.08; - double flower_chance = 0.012; - - if (biome_is_forest_like(biome)) { - tree_chance = (biome == BIOME_DARK_FOREST) ? 0.045 : 0.024; - grass_chance = 0.055; - flower_chance = (biome == BIOME_FLOWER_FOREST) ? 0.065 : 0.018; - } else if (biome_is_taiga_like(biome)) { - tree_chance = 0.030; - grass_chance = 0.045; - flower_chance = 0.006; - } else if (biome_is_jungle_like(biome)) { - tree_chance = biome == BIOME_BAMBOO_JUNGLE ? 0.040 : 0.032; - grass_chance = 0.100; - flower_chance = 0.010; - } else if (biome == BIOME_MEADOW || biome == BIOME_SUNFLOWER_PLAINS) { - tree_chance = 0.003; - grass_chance = 0.180; - flower_chance = 0.080; - } else if (biome_is_grassy_open(biome)) { - tree_chance = (biome == BIOME_SAVANNA || biome == BIOME_SAVANNA_PLATEAU) ? 0.010 : 0.0025; - grass_chance = 0.120; - flower_chance = 0.020; - } else if (biome_is_cold_surface(biome)) { - tree_chance = (biome == BIOME_SNOWY_TAIGA || biome == BIOME_GROVE) ? 0.020 : 0.001; - grass_chance = 0.020; - flower_chance = 0.002; - } - - if (feature_roll < tree_chance) { - int height = 4 + (int)(detail_roll * 3.0); - if (biome_is_taiga_like(biome) || biome_is_cold_surface(biome)) { - place_simple_tree(blocks, lx, si, lz, SPRUCE_LOG, SPRUCE_LEAVES, height + 1); - } else if (biome == BIOME_BIRCH_FOREST || biome == BIOME_OLD_GROWTH_BIRCH_FOREST) { - place_simple_tree(blocks, lx, si, lz, BIRCH_LOG, BIRCH_LEAVES, height); - } else if (biome_is_jungle_like(biome)) { - place_simple_tree(blocks, lx, si, lz, JUNGLE_LOG, JUNGLE_LEAVES, height + 2); - } else if (biome == BIOME_SAVANNA || biome == BIOME_SAVANNA_PLATEAU || - biome == BIOME_WINDSWEPT_SAVANNA) { - place_simple_tree(blocks, lx, si, lz, ACACIA_LOG, ACACIA_LEAVES, height); - } else if (biome == BIOME_DARK_FOREST) { - place_simple_tree(blocks, lx, si, lz, DARK_OAK_LOG, DARK_OAK_LEAVES, height + 1); - } else { - place_simple_tree(blocks, lx, si, lz, OAK_LOG, OAK_LEAVES, height); - } - } else if (feature_roll < tree_chance + grass_chance) { - int plant = SHORT_GRASS; - if (biome_is_taiga_like(biome) && detail_roll > 0.35) { - plant = detail_roll > 0.92 ? LARGE_FERN : FERN; - } - set_if_replaceable(blocks, si + 1, lz, lx, plant); - } else if (feature_roll < tree_chance + grass_chance + flower_chance) { - set_if_replaceable(blocks, si + 1, lz, lx, detail_roll < 0.5 ? DANDELION : POPPY); - } else if (feature_roll < tree_chance + grass_chance + flower_chance + 0.0018 && - biome_is_grassy_open(biome)) { - set_if_replaceable(blocks, si + 1, lz, lx, PUMPKIN); - } else if (feature_roll < tree_chance + grass_chance + flower_chance + 0.004 && - biome_is_jungle_like(biome)) { - set_if_replaceable(blocks, si + 1, lz, lx, MELON); - } - } else if ((surface == SAND || surface == RED_SAND) && surface_h >= SEA_LEVEL && - (biome == BIOME_DESERT || biome_is_badlands(biome))) { - if (feature_roll < 0.012) { - int cactus_height = 1 + (int)(detail_roll * 3.0); - for (int dy = 1; dy <= cactus_height && si + dy < WORLD_HEIGHT; dy++) { - if (blocks[(si + dy) * 256 + lz * 16 + lx] != AIR) { - break; - } - blocks[(si + dy) * 256 + lz * 16 + lx] = CACTUS; - } - } else if (feature_roll < 0.045) { - set_if_replaceable(blocks, si + 1, lz, lx, DEAD_BUSH); - } - } - - if ((surface == GRASS_BLOCK || surface == DIRT || surface == SAND) && - surface_h >= SEA_LEVEL - 1 && - feature_roll > 0.965 && - has_adjacent_water(blocks, si, lz, lx)) { - int cane_height = 1 + (int)(detail_roll * 3.0); - for (int dy = 1; dy <= cane_height && si + dy < WORLD_HEIGHT; dy++) { - if (blocks[(si + dy) * 256 + lz * 16 + lx] != AIR) { - break; - } - blocks[(si + dy) * 256 + lz * 16 + lx] = SUGAR_CANE; - } - } - - if (surface_h < SEA_LEVEL && si + 1 < WORLD_HEIGHT) { - int water_yi = -1; - for (int wy_scan = std::min(SEA_LEVEL - MIN_Y, WORLD_HEIGHT - 1); - wy_scan > si; wy_scan--) { - if (blocks[wy_scan * 256 + lz * 16 + lx] == WATER && - (wy_scan == si + 1 || - blocks[(wy_scan - 1) * 256 + lz * 16 + lx] != WATER)) { - water_yi = wy_scan; - break; - } - } - if (water_yi >= 0) { - double water_roll = block_hash(wx - 211, surface_h + 5, wz + 409); - if (water_roll < 0.080) { - blocks[water_yi * 256 + lz * 16 + lx] = SEAGRASS; - } else if (water_roll < 0.095 && surface_h < SEA_LEVEL - 4) { - int height = 2 + (int)(detail_roll * 5.0); - for (int dy = 0; dy < height && water_yi + dy < WORLD_HEIGHT; dy++) { - int idx = (water_yi + dy) * 256 + lz * 16 + lx; - if (blocks[idx] != WATER) { - break; - } - blocks[idx] = (dy == height - 1) ? KELP : KELP_PLANT; - } - } - } - } - } - } - } - - bool is_hidden_by_solid(int* blocks, int lx, int yi, int lz) const { - static constexpr int dirs[6][3] = { - {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1} - }; - for (auto& d : dirs) { - int nx = lx + d[0]; - int ny = yi + d[1]; - int nz = lz + d[2]; - if (nx < 0 || nx >= 16 || nz < 0 || nz >= 16 || ny < 0 || ny >= WORLD_HEIGHT) { - return false; - } - int block = blocks[ny * 256 + nz * 16 + nx]; - if (block == AIR || block == WATER || block == LAVA) { - return false; - } - } - return true; - } - - int column_surface_height(int* blocks, int lx, int lz) const { - for (int yi = WORLD_HEIGHT - 1; yi >= 0; yi--) { - int block = blocks[yi * 256 + lz * 16 + lx]; - if (block != AIR && block != WATER && block != LAVA) { - return yi + MIN_Y; - } - } - return MIN_Y; - } - - static bool biome_is_mountain_ore(uint16_t biome) { - return biome == BIOME_MEADOW || biome == BIOME_GROVE || - biome == BIOME_SNOWY_SLOPES || biome == BIOME_FROZEN_PEAKS || - biome == BIOME_JAGGED_PEAKS || biome == BIOME_STONY_PEAKS || - biome == BIOME_WINDSWEPT_HILLS || - biome == BIOME_WINDSWEPT_GRAVELLY_HILLS || - biome == BIOME_WINDSWEPT_FOREST; - } - - static bool is_vein_replaceable(int block_id) { - return block_id == STONE || block_id == DEEPSLATE; - } - - void apply_ore_veins(int* blocks, int base_x, int base_z) const { - struct VeinType { - int min_y; - int max_y; - int ore; - int raw_block; - int filler; - }; - static constexpr VeinType COPPER_VEIN = {0, 50, COPPER_ORE, RAW_COPPER_BLOCK, GRANITE}; - static constexpr VeinType IRON_VEIN = {-60, -8, DEEPSLATE_IRON_ORE, RAW_IRON_BLOCK, TUFF}; - static constexpr double VEININESS_THRESHOLD = 0.4; - static constexpr double EDGE_ROUNDOFF_BEGIN = 20.0; - static constexpr double MAX_EDGE_ROUNDOFF = 0.2; - static constexpr double VEIN_SOLIDNESS = 0.7; - static constexpr double MIN_RICHNESS = 0.1; - static constexpr double MAX_RICHNESS = 0.3; - static constexpr double MAX_RICHNESS_THRESHOLD = 0.6; - static constexpr double RAW_BLOCK_CHANCE = 0.02; - static constexpr double GAP_THRESHOLD = -0.3; - - for (int lz = 0; lz < 16; lz++) { - for (int lx = 0; lx < 16; lx++) { - int wx = base_x + lx; - int wz = base_z + lz; - for (int wy = IRON_VEIN.min_y; wy <= COPPER_VEIN.max_y; wy++) { - int yi = wy - MIN_Y; - if (yi < 0 || yi >= WORLD_HEIGHT) { - continue; - } - int idx = yi * 256 + lz * 16 + lx; - if (!is_vein_replaceable(blocks[idx])) { - continue; - } - - double veininess = noise3(ore_veininess_vanilla, wx, wy, wz, 1.5, 1.5); - const VeinType& type = (veininess > 0.0) ? COPPER_VEIN : IRON_VEIN; - if (wy < type.min_y || wy > type.max_y) { - continue; - } - - double abs_veininess = std::fabs(veininess); - double edge_distance = (double)std::min(wy - type.min_y, type.max_y - wy); - double edge_roundoff = - clamped_lerp(MAX_EDGE_ROUNDOFF, 0.0, edge_distance / EDGE_ROUNDOFF_BEGIN); - double vein_threshold = VEININESS_THRESHOLD + edge_roundoff; - if (abs_veininess <= vein_threshold) { - continue; - } - if (position_chance(wx, wy, wz, 0xD1B54A32D192ED03ULL) > VEIN_SOLIDNESS) { - continue; - } - - double vein_a = std::fabs(noise3(ore_vein_a_vanilla, wx, wy, wz, 4.0, 4.0)); - double vein_b = std::fabs(noise3(ore_vein_b_vanilla, wx, wy, wz, 4.0, 4.0)); - double ridged = -0.08 + std::max(vein_a, vein_b); - if (ridged >= 0.0) { - continue; - } - - double richness = - clamped_lerp(MIN_RICHNESS, MAX_RICHNESS, - inverse_lerp(vein_threshold, MAX_RICHNESS_THRESHOLD, - abs_veininess)); - double gap = noise3(ore_gap_vanilla, wx, wy, wz); - if (position_chance(wx, wy, wz, 0xC2B2AE3D27D4EB4FULL) >= richness || - gap <= GAP_THRESHOLD) { - blocks[idx] = type.filler; - } else if (position_chance(wx, wy, wz, 0x165667B19E3779F9ULL) < RAW_BLOCK_CHANCE) { - blocks[idx] = type.raw_block; - } else { - blocks[idx] = type.ore; - } - } - } - } - } - - void place_ores(int* blocks, int base_x, int base_z) const { - enum OreBiomeFilter { - ORE_ANY = 0, - ORE_MOUNTAIN = 1, - ORE_BADLANDS = 2, - }; - - struct OreConfig { - int ore; - int deep_ore; - int attempts; - int vein_size; - int y_min; - int y_max; - bool triangle; - double discard_chance; - OreBiomeFilter biome_filter; - const char* key; - }; - - OreConfig ores[] = { - {COAL_ORE, DEEPSLATE_COAL_ORE, 30, 17, 136, 320, false, 0.0, ORE_ANY, "ore_coal_upper"}, - {COAL_ORE, DEEPSLATE_COAL_ORE, 20, 17, 0, 192, true, 0.5, ORE_ANY, "ore_coal_lower"}, - {IRON_ORE, DEEPSLATE_IRON_ORE, 90, 9, 80, 320, true, 0.0, ORE_ANY, "ore_iron_upper"}, - {IRON_ORE, DEEPSLATE_IRON_ORE, 10, 9, -24, 56, true, 0.0, ORE_ANY, "ore_iron_middle"}, - {IRON_ORE, DEEPSLATE_IRON_ORE, 10, 4, -64, 72, false, 0.0, ORE_ANY, "ore_iron_small"}, - {COPPER_ORE, DEEPSLATE_COPPER_ORE, 16, 10, -16, 112, true, 0.0, ORE_ANY, "ore_copper"}, - {COPPER_ORE, DEEPSLATE_COPPER_ORE, 16, 20, -16, 112, true, 0.0, ORE_ANY, "ore_copper_large"}, - {GOLD_ORE, DEEPSLATE_GOLD_ORE, 50, 9, 32, 256, false, 0.5, ORE_BADLANDS, "ore_gold_extra"}, - {GOLD_ORE, DEEPSLATE_GOLD_ORE, 4, 9, -64, 32, true, 0.5, ORE_ANY, "ore_gold"}, - {GOLD_ORE, DEEPSLATE_GOLD_ORE, 1, 9, -64, -48, false, 0.5, ORE_ANY, "ore_gold_lower"}, - {REDSTONE_ORE, DEEPSLATE_REDSTONE_ORE, 4, 8, -64, 15, false, 0.0, ORE_ANY, "ore_redstone"}, - {REDSTONE_ORE, DEEPSLATE_REDSTONE_ORE, 8, 8, -64, 32, true, 0.0, ORE_ANY, "ore_redstone_lower"}, - {DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE, 7, 4, -64, 80, true, 0.5, ORE_ANY, "ore_diamond_small"}, - {DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE, 2, 8, -64, -4, false, 0.5, ORE_ANY, "ore_diamond_medium"}, - {DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE, 1, 12, -64, 80, true, 0.7, ORE_ANY, "ore_diamond_large"}, - {DIAMOND_ORE, DEEPSLATE_DIAMOND_ORE, 4, 8, -64, 80, true, 1.0, ORE_ANY, "ore_diamond_buried"}, - {LAPIS_ORE, DEEPSLATE_LAPIS_ORE, 2, 7, -32, 32, true, 0.0, ORE_ANY, "ore_lapis"}, - {LAPIS_ORE, DEEPSLATE_LAPIS_ORE, 4, 7, -64, 64, false, 1.0, ORE_ANY, "ore_lapis_buried"}, - {EMERALD_ORE, DEEPSLATE_EMERALD_ORE, 100, 3, -16, 320, true, 0.0, ORE_MOUNTAIN, "ore_emerald"}, - }; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include - for (auto& o : ores) { - SimpleRNG rng; - rng.seed_key(seed ^ ((int64_t)base_x * 6364136223846793005LL - + (int64_t)base_z * 1442695040888963407LL), - o.key); - for (int a = 0; a < o.attempts; a++) { - int lx = rng.randint(0, 15); - int lz = rng.randint(0, 15); - if (o.biome_filter != ORE_ANY) { - int wx = base_x + lx; - int wz = base_z + lz; - int surface_h = column_surface_height(blocks, lx, lz); - uint16_t biome = sample_surface_biome(wx, wz, surface_h); - if (o.biome_filter == ORE_MOUNTAIN && !biome_is_mountain_ore(biome)) { - continue; - } - if (o.biome_filter == ORE_BADLANDS && !biome_is_sandy(biome)) { - continue; - } - } - int wy; - if (o.triangle) { - wy = (int)rng.triangular((double)o.y_min, (double)o.y_max, - ((double)o.y_min + (double)o.y_max) * 0.5); - } else { - wy = rng.randint(o.y_min, o.y_max); - } - int yi = wy - MIN_Y; +#ifdef _WIN32 +// windows.h must not define min/max macros: they break std::min / std::max. +#ifndef NOMINMAX +#define NOMINMAX +#endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include +#else +#include +#endif - if (yi < 0 || yi >= WORLD_HEIGHT) continue; +#include "worldgen/features.h" +#include "worldgen/terrain.h" - int target = blocks[yi * 256 + lz * 16 + lx]; - int ore_block; - if (target == STONE) ore_block = o.ore; - else if (target == DEEPSLATE) ore_block = o.deep_ore; - else continue; - if (o.discard_chance > 0.0 && is_hidden_by_solid(blocks, lx, yi, lz) && - rng.random_double() < o.discard_chance) { - continue; - } +using namespace vgen; - blocks[yi * 256 + lz * 16 + lx] = ore_block; - for (int v = 0; v < o.vein_size - 1; v++) { - int dx = rng.randint(-1, 1); - int dy = rng.randint(-1, 1); - int dz = rng.randint(-1, 1); - int nx = lx + dx, ny = yi + dy, nz = lz + dz; - if (nx >= 0 && nx < 16 && nz >= 0 && nz < 16 && - ny >= 0 && ny < WORLD_HEIGHT) { - int c = blocks[ny * 256 + nz * 16 + nx]; - int placed = 0; - if (c == STONE) placed = o.ore; - else if (c == DEEPSLATE) placed = o.deep_ore; - if (placed != 0) { - if (o.discard_chance > 0.0 && is_hidden_by_solid(blocks, nx, ny, nz) && - rng.random_double() < o.discard_chance) { - continue; - } - blocks[ny * 256 + nz * 16 + nx] = placed; - } - } - } - } - } - } -}; +static const char* VERSION_STRING = "pymc-worldgen 2 (minecraft 1.21.1, vanilla noise router)"; -// ============================================================ -// 二进制 I/O 辅助函数 -// ============================================================ +static constexpr uint32_t BLOCKS_BYTES = BLOCKS_PER_CHUNK * 2; +static constexpr uint32_t HEIGHTMAP_BYTES = 256 * 2; +static constexpr uint32_t BIOME_BYTES = SECTIONS * 64 * 2; +static constexpr uint32_t PAYLOAD_SIZE = BLOCKS_BYTES + HEIGHTMAP_BYTES + BIOME_BYTES; -// 从 stdin 精确读取 n 字节,返回是否成功 static bool read_exact(void* buf, size_t n) { uint8_t* p = (uint8_t*)buf; while (n > 0) { size_t r = fread(p, 1, n, stdin); - if (r == 0) return false; // EOF 或错误 + if (r == 0) return false; p += r; n -= r; } return true; } -// 向 stdout 精确写入 n 字节 static bool write_exact(const void* buf, size_t n) { const uint8_t* p = (const uint8_t*)buf; while (n > 0) { @@ -2997,186 +86,230 @@ static bool write_exact(const void* buf, size_t n) { return true; } -// ============================================================ -// 响应常量 -// ============================================================ -// 方块数据: 98304 个 uint16 = 196608 字节 -// 高度图: 256 个 int16 = 512 字节 -// 生物群系: 1536 个 uint16 = 3072 字节 -// 总数据: 200192 字节 -static constexpr uint32_t BLOCKS_COUNT = WORLD_HEIGHT * 16 * 16; // 98304 -static constexpr uint32_t BLOCKS_BYTES = BLOCKS_COUNT * 2; // 196608 -static constexpr uint32_t HEIGHTMAP_COUNT = 256; -static constexpr uint32_t HEIGHTMAP_BYTES = HEIGHTMAP_COUNT * 2; // 512 -static constexpr uint32_t BIOME_COUNT = NUM_SECTIONS * 64; // 1536 -static constexpr uint32_t BIOME_BYTES = BIOME_COUNT * 2; // 3072 -static constexpr uint32_t PAYLOAD_SIZE = BLOCKS_BYTES + HEIGHTMAP_BYTES + BIOME_BYTES; - -struct ChunkResponse { - std::vector blocks; - std::array heightmap; - std::array biomes; +static std::string executable_dir(const char* argv0) { +#ifdef _WIN32 + char buf[4096]; + DWORD len = GetModuleFileNameA(nullptr, buf, sizeof(buf)); + std::string path = len ? std::string(buf, len) : std::string(argv0); +#else + char buf[4096]; + ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); + std::string path = len > 0 ? std::string(buf, (size_t)len) : std::string(argv0); +#endif + size_t slash = path.find_last_of("/\\"); + return slash == std::string::npos ? std::string(".") : path.substr(0, slash); +} - ChunkResponse() : blocks(BLOCKS_COUNT, 0) { - heightmap.fill(0); - biomes.fill(BIOME_PLAINS); +static std::string find_data(const std::string& explicit_path, const char* argv0) { + std::vector candidates; + if (!explicit_path.empty()) candidates.push_back(explicit_path); + std::string dir = executable_dir(argv0); + const char* rel = "world/data/worldgen_overworld.json"; + candidates.push_back(dir + "/../" + rel); + candidates.push_back(dir + "/" + rel); + candidates.push_back(dir + "/../../" + rel); + candidates.push_back(rel); + for (auto& c : candidates) { + std::ifstream f(c, std::ios::binary); + if (f.good()) return c; } + return ""; +} + +struct ChunkKey { + int x, z; + bool operator==(const ChunkKey& o) const { return x == o.x && z == o.z; } +}; +struct ChunkKeyHash { + size_t operator()(const ChunkKey& k) const { return std::hash()(((int64_t)k.x << 32) ^ (uint32_t)k.z); } }; -struct ChunkCoord { - int32_t chunk_x; - int32_t chunk_z; +class Generator { +public: + Json data; + int threads = 4; + int64_t seed = INT64_MIN; + std::unique_ptr terrain; + std::unique_ptr features; + std::unordered_map summaries; + std::mutex mutex; + + void set_seed(int64_t s) { + if (terrain && s == seed) return; + seed = s; + terrain = std::make_unique(); + terrain->init(data, seed); + features = std::make_unique(*terrain); + features->init(data); + summaries.clear(); + } + + template + void parallel(size_t n, F&& fn) { + if (n == 0) return; + unsigned workers = (unsigned)std::min((size_t)std::max(1, threads), n); + if (workers <= 1) { + for (size_t i = 0; i < n; i++) fn(i); + return; + } + std::atomic next(0); + std::vector pool; + for (unsigned w = 0; w < workers; w++) + pool.emplace_back([&]() { + size_t i; + while ((i = next.fetch_add(1)) < n) fn(i); + }); + for (auto& t : pool) t.join(); + } + + void generate(const std::vector& coords, std::vector& out) { + out.assign(coords.size(), TerrainChunk()); + parallel(coords.size(), [&](size_t i) { terrain->generate(coords[i].x, coords[i].z, out[i]); }); + + std::unordered_map requested; + for (size_t i = 0; i < coords.size(); i++) requested[coords[i]] = i; + { + std::lock_guard lock(mutex); + if (summaries.size() > 20000) summaries.clear(); + for (size_t i = 0; i < coords.size(); i++) summaries[coords[i]] = summarize(out[i]); + } + std::vector missing; + { + std::set> seen; + std::lock_guard lock(mutex); + for (auto& c : coords) + for (int dz = -1; dz <= 1; dz++) + for (int dx = -1; dx <= 1; dx++) { + ChunkKey k{c.x + dx, c.z + dz}; + if (summaries.count(k) || !seen.insert({k.x, k.z}).second) continue; + missing.push_back(k); + } + } + std::vector extra(missing.size()); + parallel(missing.size(), [&](size_t i) { + TerrainChunk tmp; + terrain->generate(missing[i].x, missing[i].z, tmp); + extra[i] = summarize(tmp); + }); + { + std::lock_guard lock(mutex); + for (size_t i = 0; i < missing.size(); i++) summaries[missing[i]] = extra[i]; + } + parallel(coords.size(), [&](size_t i) { + auto lookup = [&](int x, int z) -> const ChunkSummary& { return summaries.at(ChunkKey{x, z}); }; + features->decorate(out[i], lookup); + }); + } }; -// ============================================================ -// 主循环: 从 stdin 读取二进制请求,生成地形,写入二进制响应 -// ============================================================ +static void write_payload(const TerrainChunk& c, std::vector& buf) { + buf.resize(PAYLOAD_SIZE); + std::memcpy(buf.data(), c.blocks.data(), BLOCKS_BYTES); + int16_t* hm = (int16_t*)(buf.data() + BLOCKS_BYTES); + for (int z = 0; z < 16; z++) + for (int x = 0; x < 16; x++) { + int h = MIN_Y + 1; + for (int y = MAX_Y; y >= MIN_Y; y--) { + uint16_t b = c.blocks[block_index(x, y, z)]; + if (b != 0 && b != 80 && b != 96 && !(b >= 81 && b <= 95) && !(b >= 97 && b <= 111)) { h = y; break; } + } + hm[z * 16 + x] = (int16_t)h; + } + std::memcpy(buf.data() + BLOCKS_BYTES + HEIGHTMAP_BYTES, c.biomes.data(), BIOME_BYTES); +} + int main(int argc, char** argv) { #ifdef _WIN32 - // Windows: 将 stdin/stdout 设为二进制模式,避免 \n -> \r\n 转换 _setmode(_fileno(stdin), _O_BINARY); _setmode(_fileno(stdout), _O_BINARY); #endif - - // 禁用缓冲以确保即时通信 - setvbuf(stdin, nullptr, _IONBF, 0); - setvbuf(stdout, nullptr, _IONBF, 0); - - int thread_count = (int)std::thread::hardware_concurrency(); - if (thread_count <= 0) thread_count = 4; + std::string data_path; + int threads = (int)std::thread::hardware_concurrency(); + if (threads <= 0) threads = 4; for (int i = 1; i < argc; i++) { - if (std::strcmp(argv[i], "--threads") == 0 && i + 1 < argc) { - thread_count = std::max(1, std::atoi(argv[i + 1])); - i++; - } - } - - // 当前种子和生成器缓存 - int64_t current_seed = -1; - TerrainGenerator gen; - - // 方块数据缓冲区 - static int blocks[BLOCKS_COUNT]; - - // 二进制响应缓冲区 (4字节长度头 + 数据) - static uint8_t response_buf[4 + PAYLOAD_SIZE]; - - // 写入固定的长度头 - uint32_t payload_size_le = PAYLOAD_SIZE; - memcpy(response_buf, &payload_size_le, 4); - - while (true) { - uint8_t command = 0; - if (!read_exact(&command, 1)) { - break; - } - - if (command == 'C') { - uint8_t request_buf[16]; - if (!read_exact(request_buf, 16)) break; - - int32_t chunk_x, chunk_z; - int64_t seed; - memcpy(&chunk_x, request_buf + 0, 4); - memcpy(&chunk_z, request_buf + 4, 4); - memcpy(&seed, request_buf + 8, 8); - - if (seed != current_seed) { - gen.init(seed); - current_seed = seed; - } - - int16_t* heightmap_out = (int16_t*)(response_buf + 4 + BLOCKS_BYTES); - uint16_t* biomes_out = (uint16_t*)(response_buf + 4 + BLOCKS_BYTES + HEIGHTMAP_BYTES); - gen.generate_chunk(chunk_x, chunk_z, blocks, heightmap_out, biomes_out); - - uint16_t* blocks_out = (uint16_t*)(response_buf + 4); - for (uint32_t i = 0; i < BLOCKS_COUNT; i++) { - blocks_out[i] = (uint16_t)blocks[i]; - } - - if (!write_exact(response_buf, 4 + PAYLOAD_SIZE)) break; - fflush(stdout); - continue; - } - - if (command != 'B') { - break; - } - - int64_t seed = 0; - uint32_t chunk_count = 0; - if (!read_exact(&seed, sizeof(seed))) break; - if (!read_exact(&chunk_count, sizeof(chunk_count))) break; - - if (seed != current_seed) { - gen.init(seed); - current_seed = seed; - } - - if (chunk_count == 0) { - uint32_t zero = 0; - if (!write_exact(&zero, sizeof(zero))) break; - fflush(stdout); - continue; - } - - std::vector coords(chunk_count); - if (!read_exact(coords.data(), chunk_count * sizeof(coords[0]))) break; - - std::vector results(chunk_count); - unsigned worker_count = std::min((unsigned)thread_count, chunk_count); - if (worker_count == 0) worker_count = 1; - std::atomic next_index(0); - std::vector workers; - workers.reserve(worker_count); - - for (unsigned worker = 0; worker < worker_count; worker++) { - workers.emplace_back([&]() { - TerrainGenerator local_gen; - local_gen.init(seed); - std::vector local_blocks(BLOCKS_COUNT); - while (true) { - uint32_t idx = next_index.fetch_add(1); - if (idx >= chunk_count) break; - int32_t chunk_x = coords[idx].chunk_x; - int32_t chunk_z = coords[idx].chunk_z; - local_gen.generate_chunk( - chunk_x, - chunk_z, - local_blocks.data(), - results[idx].heightmap.data(), - results[idx].biomes.data() - ); - for (uint32_t i = 0; i < BLOCKS_COUNT; i++) { - results[idx].blocks[i] = (uint16_t)local_blocks[i]; - } + if (std::strcmp(argv[i], "--version") == 0) { + printf("%s\n", VERSION_STRING); + return 0; + } + if (std::strcmp(argv[i], "--threads") == 0 && i + 1 < argc) threads = std::max(1, std::atoi(argv[++i])); + else if (std::strcmp(argv[i], "--data") == 0 && i + 1 < argc) data_path = argv[++i]; + } + std::string path = find_data(data_path, argv[0]); + if (path.empty()) { + fprintf(stderr, "terrain_gen: cannot find world/data/worldgen_overworld.json (use --data)\n"); + return 2; + } + Generator gen; + gen.threads = threads; + try { + std::ifstream f(path, std::ios::binary); + std::stringstream ss; + ss << f.rdbuf(); + std::string text = ss.str(); + gen.data = JsonParser(text).parse(); + } catch (const std::exception& e) { + fprintf(stderr, "terrain_gen: failed to load %s: %s\n", path.c_str(), e.what()); + return 2; + } + + setvbuf(stdout, nullptr, _IOFBF, 1 << 20); + std::vector payload; + try { + while (true) { + uint8_t command = 0; + if (!read_exact(&command, 1)) break; + if (command == 'C') { + uint8_t req[16]; + if (!read_exact(req, 16)) break; + int32_t cx, cz; + int64_t seed; + std::memcpy(&cx, req, 4); + std::memcpy(&cz, req + 4, 4); + std::memcpy(&seed, req + 8, 8); + gen.set_seed(seed); + std::vector out; + gen.generate({ChunkKey{cx, cz}}, out); + write_payload(out[0], payload); + uint32_t size = PAYLOAD_SIZE; + if (!write_exact(&size, 4) || !write_exact(payload.data(), payload.size())) break; + fflush(stdout); + } else if (command == 'B') { + int64_t seed; + uint32_t count; + if (!read_exact(&seed, 8) || !read_exact(&count, 4)) break; + gen.set_seed(seed); + std::vector coords(count); + for (uint32_t i = 0; i < count; i++) { + int32_t xz[2]; + if (!read_exact(xz, 8)) return 0; + coords[i] = {xz[0], xz[1]}; } - }); - } - - for (auto& worker : workers) { - worker.join(); - } - - if (!write_exact(&chunk_count, sizeof(chunk_count))) break; - for (uint32_t idx = 0; idx < chunk_count; idx++) { - if (!write_exact(results[idx].blocks.data(), BLOCKS_BYTES)) { - chunk_count = 0; - break; - } - if (!write_exact(results[idx].heightmap.data(), HEIGHTMAP_BYTES)) { - chunk_count = 0; - break; - } - if (!write_exact(results[idx].biomes.data(), BIOME_BYTES)) { - chunk_count = 0; + std::vector out; + gen.generate(coords, out); + if (!write_exact(&count, 4)) break; + bool ok = true; + for (uint32_t i = 0; i < count && ok; i++) { + write_payload(out[i], payload); + ok = write_exact(payload.data(), payload.size()); + } + if (!ok) break; + fflush(stdout); + } else if (command == 'S') { + int64_t seed; + if (!read_exact(&seed, 8)) break; + gen.set_seed(seed); + int x = 0, z = 0; + gen.terrain->find_spawn(x, z); + int32_t out[2] = {x, z}; + if (!write_exact(out, 8)) break; + fflush(stdout); + } else { break; } } - if (chunk_count == 0) break; - fflush(stdout); + } catch (const std::exception& e) { + fprintf(stderr, "terrain_gen: %s\n", e.what()); + return 3; } - return 0; } diff --git a/native/worldgen/density.h b/native/worldgen/density.h new file mode 100644 index 0000000..d690fd9 --- /dev/null +++ b/native/worldgen/density.h @@ -0,0 +1,411 @@ +// ============================================================ +// PyMC - Density function graph (Minecraft Java 1.21.1 noise router) +// +// Compiles the vanilla density-function JSON into a node array and +// evaluates it with the same caching semantics as NoiseChunk: +// interpolated -> trilinear interpolation between 4x8x4 cell corners +// flat_cache -> value at the quart position (y = 0) inside the chunk +// cache_2d / cache_once / cache_all_in_cell -> pure caches +// blend_* -> no blending (no old chunks), beardifier -> 0 +// ============================================================ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "json.h" +#include "noise.h" +#include "random.h" + +namespace vgen { + +enum class DF : uint8_t { + Const, Add, Mul, Min, Max, Abs, Square, Cube, HalfNeg, QuarterNeg, Squeeze, Clamp, + YGradient, Noise, ShiftedNoise, ShiftA, ShiftB, Shift, RangeChoice, Interpolated, + FlatCache, Cache2D, CacheOnce, BlendAlpha, BlendOffset, BlendDensity, Beardifier, + OldBlended, WeirdScaled, Spline, +}; + +struct DFNode { + DF t = DF::Const; + int a = -1, b = -1, c = -1, d = -1; // children + double p0 = 0, p1 = 0, p2 = 0, p3 = 0; + int noise = -1; // NormalNoise index / BlendedNoise index + int spline = -1; + int slot = -1; // cache slot for cache nodes +}; + +struct SplineDef { + int coordinate = -1; + std::vector locations, derivatives, constants; + std::vector children; // -1 => constant value +}; + +struct NoiseDef { int first_octave; std::vector amplitudes; }; + +static constexpr int CHUNK_QUARTS = 5; // noiseSizeXZ + 1 +static constexpr int INTERP_X = 5, INTERP_Z = 5, INTERP_Y = 49; + +// Per-chunk evaluation state (one per generated chunk, not shared between threads). +struct ChunkEval { + bool active = false; + int min_x = 0, min_z = 0, min_y = -64; + int first_qx = 0, first_qz = 0; + std::vector> interp; + std::vector interp_ready; + std::vector> flat; + std::vector flat_ready; + std::vector> cache2d; + struct Once { int x = 0, y = 0, z = 0; double v = 0; bool valid = false; }; + std::vector once; + + void init(int slots_interp, int slots_flat, int slots_2d, int slots_once) { + interp.assign(slots_interp, std::vector()); + interp_ready.assign(slots_interp, 0); + flat.assign(slots_flat, {}); + flat_ready.assign(slots_flat, 0); + cache2d.assign(slots_2d, {}); + once.assign(slots_once, Once()); + } + void set_chunk(int chunk_x, int chunk_z) { + active = true; + min_x = chunk_x * 16; + min_z = chunk_z * 16; + first_qx = min_x >> 2; + first_qz = min_z >> 2; + std::fill(interp_ready.begin(), interp_ready.end(), 0); + std::fill(flat_ready.begin(), flat_ready.end(), 0); + for (auto& m : cache2d) m.clear(); + for (auto& o : once) o.valid = false; + } +}; + +class DensityGraph { +public: + std::vector nodes; + std::vector splines; + std::vector noises; + std::vector> blended; + std::map noise_index; + std::map noise_defs; + int slots_interp = 0, slots_flat = 0, slots_2d = 0, slots_once = 0; + int min_y = -64; + bool deepslate_compat = false; + + void load(const Json& data, const PositionalFactory& random, bool compat = false) { + deepslate_compat = compat; + random_ = random; + functions_ = &data["density_functions"]; + for (auto& kv : data["noises"].obj) { + NoiseDef def; + def.first_octave = kv.second["firstOctave"].as_int(); + for (auto& a : kv.second["amplitudes"].arr) def.amplitudes.push_back(a.as_double()); + noise_defs[kv.first] = def; + } + min_y = data["noise"]["min_y"].as_int(); + } + + int compile(const Json& node) { + if (node.is_number()) return add_const(node.num); + if (node.is_string()) return ref(node.str); + std::string type = node["type"].str; + if (type == "ref") return ref(node["name"].str); + DFNode n; + if (type == "constant") { n.t = DF::Const; n.p0 = node["argument"].as_double(); return push(n); } + if (type == "add" || type == "mul" || type == "min" || type == "max") { + n.t = type == "add" ? DF::Add : type == "mul" ? DF::Mul : type == "min" ? DF::Min : DF::Max; + n.a = compile(node["argument1"]); + n.b = compile(node["argument2"]); + return push(n); + } + static const std::map unary = { + {"abs", DF::Abs}, {"square", DF::Square}, {"cube", DF::Cube}, {"half_negative", DF::HalfNeg}, + {"quarter_negative", DF::QuarterNeg}, {"squeeze", DF::Squeeze}, {"interpolated", DF::Interpolated}, + {"flat_cache", DF::FlatCache}, {"cache_2d", DF::Cache2D}, {"cache_once", DF::CacheOnce}, + {"cache_all_in_cell", DF::CacheOnce}, {"blend_density", DF::BlendDensity}}; + auto u = unary.find(type); + if (u != unary.end()) { + n.t = u->second; + n.a = compile(node["argument"]); + if (n.t == DF::Interpolated) n.slot = slots_interp++; + else if (n.t == DF::FlatCache) n.slot = slots_flat++; + else if (n.t == DF::Cache2D) n.slot = slots_2d++; + else if (n.t == DF::CacheOnce) n.slot = slots_once++; + return push(n); + } + if (type == "clamp") { + n.t = DF::Clamp; n.a = compile(node["input"]); + n.p0 = node["min"].as_double(); n.p1 = node["max"].as_double(); + return push(n); + } + if (type == "y_clamped_gradient") { + n.t = DF::YGradient; + n.p0 = node["from_y"].as_double(); n.p1 = node["to_y"].as_double(); + n.p2 = node["from_value"].as_double(); n.p3 = node["to_value"].as_double(); + return push(n); + } + if (type == "noise") { + n.t = DF::Noise; n.noise = get_noise(node["noise"].str); + n.p0 = node.get("xz_scale", 1.0); n.p1 = node.get("y_scale", 1.0); + return push(n); + } + if (type == "shifted_noise") { + n.t = DF::ShiftedNoise; n.noise = get_noise(node["noise"].str); + n.p0 = node.get("xz_scale", 1.0); n.p1 = node.get("y_scale", 1.0); + n.a = compile(node["shift_x"]); n.b = compile(node["shift_y"]); n.c = compile(node["shift_z"]); + return push(n); + } + if (type == "shift_a" || type == "shift_b" || type == "shift") { + n.t = type == "shift_a" ? DF::ShiftA : type == "shift_b" ? DF::ShiftB : DF::Shift; + n.noise = get_noise(node["argument"].str); + return push(n); + } + if (type == "range_choice") { + n.t = DF::RangeChoice; + n.a = compile(node["input"]); + n.p0 = node["min_inclusive"].as_double(); n.p1 = node["max_exclusive"].as_double(); + n.b = compile(node["when_in_range"]); n.c = compile(node["when_out_of_range"]); + return push(n); + } + if (type == "blend_alpha") { n.t = DF::BlendAlpha; return push(n); } + if (type == "blend_offset") { n.t = DF::BlendOffset; return push(n); } + if (type == "beardifier") { n.t = DF::Beardifier; return push(n); } + if (type == "old_blended_noise") { + n.t = DF::OldBlended; + Xoroshiro r = random_.from_hash_of("minecraft:terrain"); + blended.push_back(std::make_unique( + r, node["xz_scale"].as_double(), node["y_scale"].as_double(), node["xz_factor"].as_double(), + node["y_factor"].as_double(), node["smear_scale_multiplier"].as_double(), deepslate_compat)); + n.noise = (int)blended.size() - 1; + return push(n); + } + if (type == "weird_scaled_sampler") { + n.t = DF::WeirdScaled; + n.a = compile(node["input"]); + n.noise = get_noise(node["noise"].str); + n.p0 = node["rarity_value_mapper"].str == "type_1" ? 1.0 : 2.0; + return push(n); + } + if (type == "spline") { + n.t = DF::Spline; + n.spline = compile_spline(node["spline"]); + return push(n); + } + throw std::runtime_error("unsupported density function type: " + type); + } + + int get_noise(const std::string& name) { + auto it = noise_index.find(name); + if (it != noise_index.end()) return it->second; + auto def = noise_defs.find(name); + if (def == noise_defs.end()) throw std::runtime_error("unknown noise: " + name); + noises.push_back(NormalNoise::create(random_.from_hash_of(name), def->second.first_octave, def->second.amplitudes)); + int idx = (int)noises.size() - 1; + noise_index[name] = idx; + return idx; + } + + // ---------------- evaluation ---------------- + + double eval(int idx, int x, int y, int z, ChunkEval* cc, bool fill) const { + const DFNode& n = nodes[idx]; + switch (n.t) { + case DF::Const: return n.p0; + case DF::Add: return eval(n.a, x, y, z, cc, fill) + eval(n.b, x, y, z, cc, fill); + case DF::Mul: { + double v = eval(n.a, x, y, z, cc, fill); + return v == 0.0 ? 0.0 : v * eval(n.b, x, y, z, cc, fill); + } + case DF::Min: return std::min(eval(n.a, x, y, z, cc, fill), eval(n.b, x, y, z, cc, fill)); + case DF::Max: return std::max(eval(n.a, x, y, z, cc, fill), eval(n.b, x, y, z, cc, fill)); + case DF::Abs: return std::fabs(eval(n.a, x, y, z, cc, fill)); + case DF::Square: { double v = eval(n.a, x, y, z, cc, fill); return v * v; } + case DF::Cube: { double v = eval(n.a, x, y, z, cc, fill); return v * v * v; } + case DF::HalfNeg: { double v = eval(n.a, x, y, z, cc, fill); return v > 0.0 ? v : v * 0.5; } + case DF::QuarterNeg: { double v = eval(n.a, x, y, z, cc, fill); return v > 0.0 ? v : v * 0.25; } + case DF::Squeeze: { + double e = clampd(eval(n.a, x, y, z, cc, fill), -1.0, 1.0); + return e / 2.0 - e * e * e / 24.0; + } + case DF::Clamp: return clampd(eval(n.a, x, y, z, cc, fill), n.p0, n.p1); + case DF::YGradient: return clamped_map((double)y, n.p0, n.p1, n.p2, n.p3); + case DF::Noise: + return noises[n.noise].value((double)x * n.p0, (double)y * n.p1, (double)z * n.p0); + case DF::ShiftedNoise: { + double d = (double)x * n.p0 + eval(n.a, x, y, z, cc, fill); + double e = (double)y * n.p1 + eval(n.b, x, y, z, cc, fill); + double f = (double)z * n.p0 + eval(n.c, x, y, z, cc, fill); + return noises[n.noise].value(d, e, f); + } + case DF::ShiftA: return shift(n.noise, (double)x, 0.0, (double)z); + case DF::ShiftB: return shift(n.noise, (double)z, (double)x, 0.0); + case DF::Shift: return shift(n.noise, (double)x, (double)y, (double)z); + case DF::RangeChoice: { + double v = eval(n.a, x, y, z, cc, fill); + return (v >= n.p0 && v < n.p1) ? eval(n.b, x, y, z, cc, fill) : eval(n.c, x, y, z, cc, fill); + } + case DF::Interpolated: { + if (fill && cc && cc->active) return interpolate(n, x, y, z, cc); + return eval(n.a, x, y, z, cc, false); + } + case DF::FlatCache: { + if (cc && cc->active) { + int qx = (x >> 2) - cc->first_qx, qz = (z >> 2) - cc->first_qz; + if (qx >= 0 && qz >= 0 && qx < CHUNK_QUARTS && qz < CHUNK_QUARTS) { + auto& grid = cc->flat[n.slot]; + if (!cc->flat_ready[n.slot]) { + for (int i = 0; i < CHUNK_QUARTS; i++) + for (int j = 0; j < CHUNK_QUARTS; j++) + grid[i * CHUNK_QUARTS + j] = + eval(n.a, (cc->first_qx + i) << 2, 0, (cc->first_qz + j) << 2, cc, false); + cc->flat_ready[n.slot] = 1; + } + return grid[qx * CHUNK_QUARTS + qz]; + } + } + return eval(n.a, x, y, z, cc, fill); + } + case DF::Cache2D: { + if (cc) { + int64_t key = ((int64_t)x << 32) ^ (int64_t)(uint32_t)z; + auto& m = cc->cache2d[n.slot]; + auto it = m.find(key); + if (it != m.end()) return it->second; + double v = eval(n.a, x, y, z, cc, fill); + m.emplace(key, v); + return v; + } + return eval(n.a, x, y, z, cc, fill); + } + case DF::CacheOnce: { + if (cc) { + auto& o = cc->once[n.slot]; + if (o.valid && o.x == x && o.y == y && o.z == z) return o.v; + double v = eval(n.a, x, y, z, cc, fill); + o.x = x; o.y = y; o.z = z; o.v = v; o.valid = true; + return v; + } + return eval(n.a, x, y, z, cc, fill); + } + case DF::BlendAlpha: return 1.0; + case DF::BlendOffset: return 0.0; + case DF::BlendDensity: return eval(n.a, x, y, z, cc, fill); + case DF::Beardifier: return 0.0; + case DF::OldBlended: return blended[n.noise]->compute(x, y, z); + case DF::WeirdScaled: { + double d = eval(n.a, x, y, z, cc, fill); + double e; + if (n.p0 == 1.0) e = d < -0.5 ? 0.75 : d < 0.0 ? 1.0 : d < 0.5 ? 1.5 : 2.0; + else e = d < -0.75 ? 0.5 : d < -0.5 ? 0.75 : d < 0.5 ? 1.0 : d < 0.75 ? 2.0 : 3.0; + return e * std::fabs(noises[n.noise].value((double)x / e, (double)y / e, (double)z / e)); + } + case DF::Spline: return (double)apply_spline(n.spline, x, y, z, cc, fill); + } + return 0.0; + } + +private: + PositionalFactory random_; + const Json* functions_ = nullptr; + std::map refs_; + + int push(const DFNode& n) { nodes.push_back(n); return (int)nodes.size() - 1; } + int add_const(double v) { DFNode n; n.t = DF::Const; n.p0 = v; return push(n); } + + int ref(const std::string& name) { + auto it = refs_.find(name); + if (it != refs_.end()) { + if (it->second < 0) throw std::runtime_error("cyclic density function: " + name); + return it->second; + } + refs_[name] = -1; + int idx = compile((*functions_)[name]); + refs_[name] = idx; + return idx; + } + + int compile_spline(const Json& s) { + SplineDef def; + def.coordinate = compile(s["coordinate"]); + for (auto& p : s["points"].arr) { + def.locations.push_back((float)p["location"].as_double()); + def.derivatives.push_back((float)p["derivative"].as_double()); + const Json& v = p["value"]; + if (v.is_number()) { def.children.push_back(-1); def.constants.push_back((float)v.num); } + else { def.children.push_back(compile_spline(v)); def.constants.push_back(0.0f); } + } + splines.push_back(std::move(def)); + return (int)splines.size() - 1; + } + + double shift(int noise, double d, double e, double f) const { + return noises[noise].value(d * 0.25, e * 0.25, f * 0.25) * 4.0; + } + + float spline_value(const SplineDef& s, int i, int x, int y, int z, ChunkEval* cc, bool fill) const { + return s.children[i] < 0 ? s.constants[i] : apply_spline(s.children[i], x, y, z, cc, fill); + } + + float apply_spline(int idx, int x, int y, int z, ChunkEval* cc, bool fill) const { + const SplineDef& s = splines[idx]; + float f = (float)eval(s.coordinate, x, y, z, cc, fill); + int count = (int)s.locations.size(); + int first_greater = count; + for (int k = 0; k < count; k++) if (f < s.locations[k]) { first_greater = k; break; } + int i = first_greater - 1; + int j = count - 1; + if (i < 0) { + float v = spline_value(s, 0, x, y, z, cc, fill); + float g = s.derivatives[0]; + return g == 0.0f ? v : v + g * (f - s.locations[0]); + } + if (i == j) { + float v = spline_value(s, j, x, y, z, cc, fill); + float g = s.derivatives[j]; + return g == 0.0f ? v : v + g * (f - s.locations[j]); + } + float g = s.locations[i], h = s.locations[i + 1]; + float k = (f - g) / (h - g); + float l = s.derivatives[i], m = s.derivatives[i + 1]; + float nv = spline_value(s, i, x, y, z, cc, fill); + float o = spline_value(s, i + 1, x, y, z, cc, fill); + float p = l * (h - g) - (o - nv); + float q = -m * (h - g) + (o - nv); + return lerpf(k, nv, o) + k * (1.0f - k) * lerpf(k, p, q); + } + + double interpolate(const DFNode& n, int x, int y, int z, ChunkEval* cc) const { + auto& grid = cc->interp[n.slot]; + if (!cc->interp_ready[n.slot]) { + grid.resize(INTERP_X * INTERP_Z * INTERP_Y); + for (int cx = 0; cx < INTERP_X; cx++) + for (int cz = 0; cz < INTERP_Z; cz++) + for (int cy = 0; cy < INTERP_Y; cy++) + grid[(cx * INTERP_Z + cz) * INTERP_Y + cy] = + eval(n.a, cc->min_x + cx * 4, cc->min_y + cy * 8, cc->min_z + cz * 4, cc, false); + cc->interp_ready[n.slot] = 1; + } + int lx = x - cc->min_x, lz = z - cc->min_z, ly = y - cc->min_y; + int cx = lx >> 2, cz = lz >> 2, cy = ly >> 3; + if (cx < 0 || cz < 0 || cy < 0 || cx >= 4 || cz >= 4 || cy >= INTERP_Y - 1) + return eval(n.a, x, y, z, cc, false); + double dx = (double)(lx & 3) / 4.0, dz = (double)(lz & 3) / 4.0, dy = (double)(ly & 7) / 8.0; + auto g = [&](int ix, int iy, int iz) { return grid[((cx + ix) * INTERP_Z + (cz + iz)) * INTERP_Y + cy + iy]; }; + double xz00 = lerp(dy, g(0, 0, 0), g(0, 1, 0)); + double xz10 = lerp(dy, g(1, 0, 0), g(1, 1, 0)); + double xz01 = lerp(dy, g(0, 0, 1), g(0, 1, 1)); + double xz11 = lerp(dy, g(1, 0, 1), g(1, 1, 1)); + double z0 = lerp(dx, xz00, xz10); + double z1 = lerp(dx, xz01, xz11); + return lerp(dz, z0, z1); + } +}; + +} // namespace vgen diff --git a/native/worldgen/features.h b/native/worldgen/features.h new file mode 100644 index 0000000..9d9c07a --- /dev/null +++ b/native/worldgen/features.h @@ -0,0 +1,1261 @@ +// ============================================================ +// PyMC - Overworld decoration (trees, plants, ores, snow) +// +// Vanilla-style feature stage on top of the vanilla noise stage. Shapes +// (trunk/foliage placers, ore blobs, ice spikes) and per-biome densities +// follow the vanilla 1.21.1 placed features; exact block-for-block +// placement is not reproduced (that would need the full feature registry). +// +// Trees may cross chunk borders: every tree is generated deterministically +// from its source chunk using only that chunk's terrain summary, and each +// chunk it touches draws its own part. Everything else stays inside the +// chunk it was placed from. +// ============================================================ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "terrain.h" + +namespace vgen { + +struct ChunkSummary { + int cx = 0, cz = 0; + std::array floor{}; // highest solid block + std::array surface{}; // highest non-air block (fluids included) + std::array ground{}; // block at floor + std::array biome{}; // biome above the floor +}; + +inline ChunkSummary summarize(const TerrainChunk& c) { + ChunkSummary s; + s.cx = c.chunk_x; + s.cz = c.chunk_z; + for (int z = 0; z < 16; z++) + for (int x = 0; x < 16; x++) { + int i = z * 16 + x; + s.floor[i] = c.ocean_floor[i]; + s.surface[i] = c.world_surface[i]; + s.ground[i] = c.get(x, c.ocean_floor[i], z); + s.biome[i] = (uint8_t)c.biome_at(x, c.ocean_floor[i] + 1, z); + } + return s; +} + +enum class Tree : uint8_t { + Oak, FancyOak, Birch, TallBirch, Spruce, Pine, MegaSpruce, MegaPine, Jungle, MegaJungle, JungleBush, + Acacia, DarkOak, SwampOak, Cherry, Mangrove, AzaleaLike +}; + +struct TreeChoice { Tree tree; float weight; }; + +struct BiomeDecoration { + float trees = 0.0f; // average trees per chunk + std::vector tree_types; + int grass = 0, tall_grass = 0, ferns = 0, large_ferns = 0, dead_bushes = 0, flowers = 0; + int flower_set = 0; // 0 default, 1 plains, 2 forest, 3 flower forest, 4 swamp, 5 meadow + int cacti = 0, sugar_cane = 0, pumpkins = 0, melons = 0, berries = 0, lily_pads = 0; + int seagrass = 0, kelp = 0, mushrooms = 0, bamboo = 0, sunflowers = 0, tall_flowers = 0, petals = 0; + int boulders = 0, huge_mushrooms = 0, ice_spikes = 0, sea_pickles = 0; + int disks_sand = 0, disks_clay = 0, disks_gravel = 0; + bool emeralds = false; + bool trees_on_snow = false; // grove: SPRUCE_ON_SNOW / PINE_ON_SNOW +}; + +class Features { +public: + explicit Features(const Terrain& t) : t_(t) {} + + void init(const Json& data) { + const Json& st = data["states"]; + auto S = [&](const std::string& key) { + std::string k = "minecraft:" + key; + if (!st.has(k)) throw std::runtime_error("missing block state " + k); + return (uint16_t)st[k].as_int(); + }; + AIR = S("air"); WATER = S("water"); STONE = S("stone"); DEEPSLATE = S("deepslate"); + GRANITE = S("granite"); DIORITE = S("diorite"); ANDESITE = S("andesite"); TUFF = S("tuff"); + DIRT = S("dirt"); GRAVEL = S("gravel"); CLAY = S("clay"); SAND = S("sand"); RED_SAND = S("red_sand"); + GRASS = S("grass_block"); GRASS_SNOWY = S("grass_block[snowy=true]"); + PODZOL = S("podzol"); PODZOL_SNOWY = S("podzol[snowy=true]"); + MYCELIUM = S("mycelium"); MYCELIUM_SNOWY = S("mycelium[snowy=true]"); + COARSE_DIRT = S("coarse_dirt"); ROOTED_DIRT = S("rooted_dirt"); MOSS = S("moss_block"); MUD = S("mud"); + SNOW_LAYER = S("snow[layers=1]"); SNOW_BLOCK = S("snow_block"); ICE = S("ice"); PACKED_ICE = S("packed_ice"); + BLUE_ICE = S("blue_ice"); POWDER_SNOW = S("powder_snow"); TERRACOTTA = S("terracotta"); + SHORT_GRASS = S("short_grass"); FERN = S("fern"); DEAD_BUSH = S("dead_bush"); + TALL_GRASS_L = S("tall_grass[half=lower]"); TALL_GRASS_U = S("tall_grass[half=upper]"); + LARGE_FERN_L = S("large_fern[half=lower]"); LARGE_FERN_U = S("large_fern[half=upper]"); + CACTUS = S("cactus[age=0]"); SUGAR_CANE = S("sugar_cane[age=0]"); PUMPKIN = S("pumpkin"); MELON = S("melon"); + BERRIES = S("sweet_berry_bush[age=3]"); LILY_PAD = S("lily_pad"); SEAGRASS = S("seagrass"); + TALL_SEAGRASS_L = S("tall_seagrass[half=lower]"); TALL_SEAGRASS_U = S("tall_seagrass[half=upper]"); + KELP = S("kelp[age=20]"); KELP_PLANT = S("kelp_plant"); + BROWN_MUSHROOM = S("brown_mushroom"); RED_MUSHROOM = S("red_mushroom"); + MOSSY_COBBLE = S("mossy_cobblestone"); SEA_PICKLE = S("sea_pickle[pickles=3,waterlogged=true]"); + BAMBOO = S("bamboo[age=0,leaves=none,stage=0]"); BAMBOO_SMALL = S("bamboo[age=0,leaves=small,stage=0]"); + BAMBOO_LARGE = S("bamboo[age=0,leaves=large,stage=0]"); + MANGROVE_ROOTS = S("mangrove_roots"); + const char* faces = "down=true,east=true,north=true,south=true,up=true,west=true"; + BROWN_CAP = S(std::string("brown_mushroom_block[") + faces + "]"); + RED_CAP = S(std::string("red_mushroom_block[") + faces + "]"); + STEM = S("mushroom_stem[down=false,east=true,north=true,south=true,up=true,west=true]"); + const char* vine_dirs[4] = {"north", "east", "south", "west"}; + for (int i = 0; i < 4; i++) { + std::string k = "vine["; + const char* order[5] = {"east", "north", "south", "up", "west"}; + for (int j = 0; j < 5; j++) { + if (j) k += ","; + k += std::string(order[j]) + "=" + (std::string(order[j]) == vine_dirs[i] ? "true" : "false"); + } + VINE[i] = S(k + "]"); + } + const char* tall[4] = {"sunflower", "lilac", "rose_bush", "peony"}; + for (int i = 0; i < 4; i++) { + TALL_FLOWER_L[i] = S(std::string(tall[i]) + "[half=lower]"); + TALL_FLOWER_U[i] = S(std::string(tall[i]) + "[half=upper]"); + } + const char* flowers[12] = {"dandelion", "poppy", "blue_orchid", "allium", "azure_bluet", "red_tulip", + "orange_tulip", "white_tulip", "pink_tulip", "oxeye_daisy", "cornflower", + "lily_of_the_valley"}; + for (int i = 0; i < 12; i++) FLOWER[i] = S(flowers[i]); + for (int a = 1; a <= 4; a++) PETALS[a - 1] = S("pink_petals[facing=north,flower_amount=" + std::to_string(a) + "]"); + const char* woods[8] = {"oak", "spruce", "birch", "jungle", "acacia", "dark_oak", "cherry", "mangrove"}; + for (int w = 0; w < 8; w++) { + LOG_Y[w] = S(std::string(woods[w]) + "_log[axis=y]"); + LOG_X[w] = S(std::string(woods[w]) + "_log[axis=x]"); + LOG_Z[w] = S(std::string(woods[w]) + "_log[axis=z]"); + for (int d = 1; d <= 7; d++) + LEAVES[w][d - 1] = S(std::string(woods[w]) + "_leaves[distance=" + std::to_string(d) + + ",persistent=false,waterlogged=false]"); + } + const char* ores[8] = {"coal", "iron", "copper", "gold", "redstone", "lapis", "diamond", "emerald"}; + for (int o = 0; o < 8; o++) { + std::string a = std::string(ores[o]) + "_ore", b = std::string("deepslate_") + ores[o] + "_ore"; + if (o == 4) { a += "[lit=false]"; b += "[lit=false]"; } + ORE[o] = S(a); + DEEP_ORE[o] = S(b); + } + for (int i = 0; i < 16; i++) terracotta_like_.insert((uint16_t)(TERRACOTTA)); + build_biome_table(); + for (auto& kv : data["states"].obj) { + if (kv.first.find("terracotta") != std::string::npos) terracotta_like_.insert((uint16_t)kv.second.as_int()); + } + terracotta_like_.insert(t_.TERRACOTTA); terracotta_like_.insert(t_.ORANGE_TC); terracotta_like_.insert(t_.YELLOW_TC); + terracotta_like_.insert(t_.BROWN_TC); terracotta_like_.insert(t_.RED_TC); terracotta_like_.insert(t_.WHITE_TC); + terracotta_like_.insert(t_.LIGHT_GRAY_TC); + for (int w = 0; w < 8; w++) { + for (int d = 0; d < 7; d++) leaves_set_.insert(LEAVES[w][d]); + logs_set_.insert(LOG_X[w]); logs_set_.insert(LOG_Y[w]); logs_set_.insert(LOG_Z[w]); + } + uint16_t plants[] = {SHORT_GRASS, FERN, DEAD_BUSH, TALL_GRASS_L, TALL_GRASS_U, LARGE_FERN_L, LARGE_FERN_U, + BROWN_MUSHROOM, RED_MUSHROOM, SNOW_LAYER, BERRIES, PETALS[0], PETALS[1], PETALS[2], PETALS[3]}; + for (auto p : plants) plants_set_.insert(p); + for (int i = 0; i < 12; i++) plants_set_.insert(FLOWER[i]); + for (int i = 0; i < 4; i++) { plants_set_.insert(TALL_FLOWER_L[i]); plants_set_.insert(TALL_FLOWER_U[i]); plants_set_.insert(VINE[i]); } + } + + // ------------------------------------------------------------------ + // Decorate one chunk. ``neighbor(cx, cz)`` returns terrain summaries of + // the 3x3 neighbourhood (including the chunk itself). + // ------------------------------------------------------------------ + void decorate(TerrainChunk& c, const std::function& neighbor) const { + const ChunkSummary& self = neighbor(c.chunk_x, c.chunk_z); + place_ores(c, self); + place_disks(c, self); + for (int dz = -1; dz <= 1; dz++) + for (int dx = -1; dx <= 1; dx++) + place_trees(c, neighbor(c.chunk_x + dx, c.chunk_z + dz)); + place_local_features(c, self); + place_vegetation(c, self); + freeze_top_layer(c); + } + +private: + const Terrain& t_; + std::map deco_; + BiomeDecoration empty_deco_; + std::set terracotta_like_, leaves_set_, logs_set_, plants_set_; + +public: + uint16_t AIR, WATER, STONE, DEEPSLATE, GRANITE, DIORITE, ANDESITE, TUFF, DIRT, GRAVEL, CLAY, SAND, RED_SAND; + uint16_t GRASS, GRASS_SNOWY, PODZOL, PODZOL_SNOWY, MYCELIUM, MYCELIUM_SNOWY, COARSE_DIRT, ROOTED_DIRT, MOSS, MUD; + uint16_t SNOW_LAYER, SNOW_BLOCK, ICE, PACKED_ICE, BLUE_ICE, POWDER_SNOW, TERRACOTTA; + uint16_t SHORT_GRASS, FERN, DEAD_BUSH, TALL_GRASS_L, TALL_GRASS_U, LARGE_FERN_L, LARGE_FERN_U; + uint16_t CACTUS, SUGAR_CANE, PUMPKIN, MELON, BERRIES, LILY_PAD, SEAGRASS, TALL_SEAGRASS_L, TALL_SEAGRASS_U; + uint16_t KELP, KELP_PLANT, BROWN_MUSHROOM, RED_MUSHROOM, MOSSY_COBBLE, SEA_PICKLE; + uint16_t BAMBOO, BAMBOO_SMALL, BAMBOO_LARGE, MANGROVE_ROOTS, BROWN_CAP, RED_CAP, STEM; + uint16_t VINE[4], TALL_FLOWER_L[4], TALL_FLOWER_U[4], FLOWER[12], PETALS[4]; + uint16_t LOG_X[8], LOG_Y[8], LOG_Z[8], LEAVES[8][7], ORE[8], DEEP_ORE[8]; + +private: + enum Wood { OAK = 0, SPRUCE, BIRCH, JUNGLE, ACACIA, DARK_OAK, CHERRY, MANGROVE }; + + // ---------------- helpers ---------------- + Xoroshiro rng(int cx, int cz, uint64_t salt) const { + uint64_t a = mix_stafford13((uint64_t)t_.seed ^ (salt * 0x9E3779B97F4A7C15ULL)); + uint64_t b = mix_stafford13(a ^ ((uint64_t)(uint32_t)cx << 32 | (uint32_t)cz)); + return Xoroshiro(a ^ 0x5DEECE66DULL, b); + } + bool is_dirt(uint16_t s) const { + return s == GRASS || s == DIRT || s == PODZOL || s == COARSE_DIRT || s == ROOTED_DIRT || s == MOSS || + s == MUD || s == MYCELIUM || s == GRASS_SNOWY || s == PODZOL_SNOWY || s == MYCELIUM_SNOWY; + } + bool is_sandy(uint16_t s) const { return s == SAND || s == RED_SAND; } + bool is_leaves(uint16_t s) const { return leaves_set_.count(s) > 0; } + bool is_log(uint16_t s) const { return logs_set_.count(s) > 0; } + bool is_plant(uint16_t s) const { return plants_set_.count(s) > 0; } + bool tree_replaceable(uint16_t s) const { return s == AIR || is_leaves(s) || is_plant(s); } + const BiomeDecoration& deco(int biome) const { + auto it = deco_.find(biome); + return it == deco_.end() ? empty_deco_ : it->second; + } + static int tri(Xoroshiro& r, int n) { return r.next_int(n + 1) - r.next_int(n + 1); } + + // ---------------- per-biome decoration table ---------------- + void build_biome_table() { + auto B = [&](const char* name) -> BiomeDecoration& { + int id = t_.biome_id(std::string("minecraft:") + name); + return deco_[id]; + }; + auto set_ocean = [&](const char* name, int seagrass, int kelp, int pickles) { + auto& d = B(name); d.seagrass = seagrass; d.kelp = kelp; d.sea_pickles = pickles; + d.disks_sand = 3; d.disks_clay = 1; d.disks_gravel = 1; + }; + { auto& d = B("plains"); d.trees = 0.05f; d.tree_types = {{Tree::Oak, 0.8f}, {Tree::FancyOak, 0.2f}}; + d.grass = 40; d.tall_grass = 7; d.flowers = 4; d.flower_set = 1; d.pumpkins = 1; d.sugar_cane = 10; } + { auto& d = B("sunflower_plains"); d = deco_[t_.biome_id("minecraft:plains")]; d.sunflowers = 10; } + { auto& d = B("meadow"); d.trees = 0.01f; d.tree_types = {{Tree::Birch, 0.5f}, {Tree::FancyOak, 0.5f}}; + d.grass = 60; d.tall_grass = 6; d.flowers = 12; d.flower_set = 5; } + { auto& d = B("forest"); d.trees = 10.1f; d.tree_types = {{Tree::Oak, 0.7f}, {Tree::Birch, 0.2f}, {Tree::FancyOak, 0.1f}}; + d.grass = 14; d.flowers = 3; d.flower_set = 2; d.mushrooms = 1; d.tall_flowers = 1; d.pumpkins = 1; d.sugar_cane = 6; } + { auto& d = B("flower_forest"); d.trees = 6.1f; d.tree_types = {{Tree::Oak, 0.6f}, {Tree::Birch, 0.2f}, {Tree::FancyOak, 0.2f}}; + d.grass = 10; d.flowers = 20; d.flower_set = 3; d.tall_flowers = 3; } + { auto& d = B("birch_forest"); d.trees = 10.1f; d.tree_types = {{Tree::Birch, 1.0f}}; + d.grass = 14; d.flowers = 3; d.flower_set = 2; d.tall_flowers = 1; } + { auto& d = B("old_growth_birch_forest"); d.trees = 10.1f; d.tree_types = {{Tree::TallBirch, 0.8f}, {Tree::Birch, 0.2f}}; + d.grass = 14; d.flowers = 3; d.flower_set = 2; d.tall_flowers = 1; } + { auto& d = B("dark_forest"); d.trees = 16.0f; + d.tree_types = {{Tree::DarkOak, 0.66f}, {Tree::Birch, 0.12f}, {Tree::FancyOak, 0.06f}, {Tree::Oak, 0.16f}}; + d.grass = 14; d.flowers = 2; d.flower_set = 2; d.mushrooms = 2; d.huge_mushrooms = 1; d.tall_flowers = 1; } + { auto& d = B("taiga"); d.trees = 10.1f; d.tree_types = {{Tree::Spruce, 0.66f}, {Tree::Pine, 0.34f}}; + d.grass = 8; d.ferns = 12; d.large_ferns = 2; d.berries = 1; d.mushrooms = 1; d.pumpkins = 1; d.sugar_cane = 4; } + { auto& d = B("snowy_taiga"); d = deco_[t_.biome_id("minecraft:taiga")]; } + { auto& d = B("old_growth_pine_taiga"); d.trees = 10.1f; + d.tree_types = {{Tree::MegaPine, 0.33f}, {Tree::Spruce, 0.33f}, {Tree::Pine, 0.34f}}; + d.grass = 8; d.ferns = 14; d.large_ferns = 4; d.berries = 1; d.mushrooms = 2; d.boulders = 1; } + { auto& d = B("old_growth_spruce_taiga"); d.trees = 10.1f; + d.tree_types = {{Tree::MegaSpruce, 0.33f}, {Tree::Spruce, 0.47f}, {Tree::Pine, 0.2f}}; + d.grass = 8; d.ferns = 14; d.large_ferns = 4; d.berries = 1; d.mushrooms = 2; d.boulders = 1; } + { auto& d = B("grove"); d.trees = 10.1f; d.tree_types = {{Tree::Spruce, 0.66f}, {Tree::Pine, 0.34f}}; d.trees_on_snow = true; } + { auto& d = B("snowy_plains"); d.trees = 0.1f; d.tree_types = {{Tree::Spruce, 1.0f}}; d.grass = 2; } + { auto& d = B("ice_spikes"); d.ice_spikes = 3; } + { auto& d = B("windswept_hills"); d.trees = 0.1f; d.tree_types = {{Tree::Spruce, 0.66f}, {Tree::Oak, 0.24f}, {Tree::FancyOak, 0.1f}}; d.grass = 6; d.emeralds = true; } + { auto& d = B("windswept_gravelly_hills"); d = deco_[t_.biome_id("minecraft:windswept_hills")]; } + { auto& d = B("windswept_forest"); d.trees = 3.1f; d.tree_types = {{Tree::Spruce, 0.66f}, {Tree::Oak, 0.24f}, {Tree::FancyOak, 0.1f}}; d.grass = 6; d.emeralds = true; } + { auto& d = B("jungle"); d.trees = 50.0f; + d.tree_types = {{Tree::FancyOak, 0.1f}, {Tree::JungleBush, 0.5f}, {Tree::MegaJungle, 0.13f}, {Tree::Jungle, 0.27f}}; + d.grass = 25; d.ferns = 8; d.flowers = 2; d.melons = 1; d.bamboo = 2; d.sugar_cane = 4; } + { auto& d = B("sparse_jungle"); d.trees = 2.1f; + d.tree_types = {{Tree::FancyOak, 0.1f}, {Tree::JungleBush, 0.5f}, {Tree::Jungle, 0.4f}}; + d.grass = 25; d.ferns = 8; d.flowers = 2; d.melons = 1; } + { auto& d = B("bamboo_jungle"); d.trees = 30.0f; + d.tree_types = {{Tree::FancyOak, 0.05f}, {Tree::JungleBush, 0.15f}, {Tree::MegaJungle, 0.33f}, {Tree::Jungle, 0.47f}}; + d.grass = 25; d.ferns = 8; d.melons = 1; d.bamboo = 20; } + { auto& d = B("savanna"); d.trees = 1.1f; d.tree_types = {{Tree::Acacia, 0.8f}, {Tree::Oak, 0.2f}}; + d.grass = 50; d.tall_grass = 7; d.flowers = 2; } + { auto& d = B("savanna_plateau"); d = deco_[t_.biome_id("minecraft:savanna")]; } + { auto& d = B("windswept_savanna"); d.trees = 2.1f; d.tree_types = {{Tree::Acacia, 0.8f}, {Tree::Oak, 0.2f}}; + d.grass = 20; d.tall_grass = 4; d.flowers = 2; } + { auto& d = B("desert"); d.cacti = 4; d.dead_bushes = 4; d.sugar_cane = 13; } + { auto& d = B("badlands"); d.cacti = 2; d.dead_bushes = 20; d.sugar_cane = 13; } + { auto& d = B("eroded_badlands"); d = deco_[t_.biome_id("minecraft:badlands")]; } + { auto& d = B("wooded_badlands"); d.trees = 5.1f; d.tree_types = {{Tree::Oak, 1.0f}}; d.grass = 10; d.dead_bushes = 10; d.cacti = 1; } + { auto& d = B("swamp"); d.trees = 2.1f; d.tree_types = {{Tree::SwampOak, 1.0f}}; + d.grass = 10; d.flowers = 2; d.flower_set = 4; d.lily_pads = 6; d.seagrass = 40; d.mushrooms = 3; + d.sugar_cane = 10; d.disks_clay = 1; d.disks_sand = 1; } + { auto& d = B("mangrove_swamp"); d.trees = 8.0f; d.tree_types = {{Tree::Mangrove, 1.0f}}; + d.grass = 4; d.lily_pads = 4; d.seagrass = 40; d.disks_clay = 1; } + { auto& d = B("cherry_grove"); d.trees = 10.1f; d.tree_types = {{Tree::Cherry, 1.0f}}; + d.grass = 20; d.petals = 6; d.flowers = 1; d.flower_set = 5; d.emeralds = true; } + { auto& d = B("mushroom_fields"); d.huge_mushrooms = 1; d.mushrooms = 3; } + { auto& d = B("river"); d.seagrass = 48; d.sugar_cane = 10; d.disks_sand = 3; d.disks_clay = 1; d.disks_gravel = 1; } + { auto& d = B("frozen_river"); d.disks_sand = 1; d.disks_gravel = 1; } + { auto& d = B("beach"); d.sugar_cane = 0; } + set_ocean("ocean", 48, 16, 0); + set_ocean("deep_ocean", 48, 16, 0); + set_ocean("cold_ocean", 32, 16, 0); + set_ocean("deep_cold_ocean", 40, 16, 0); + set_ocean("lukewarm_ocean", 80, 12, 0); + set_ocean("deep_lukewarm_ocean", 80, 12, 0); + set_ocean("warm_ocean", 80, 0, 2); + set_ocean("frozen_ocean", 0, 0, 0); + set_ocean("deep_frozen_ocean", 0, 0, 0); + for (const char* n : {"stony_peaks", "jagged_peaks", "frozen_peaks", "snowy_slopes", "meadow", "grove"}) + B(n).emeralds = true; + } + + // ---------------- ores ---------------- + struct OreConfig { int ore; int size; float discard; float count; int rarity; bool trapezoid; int lo, hi; }; + + void place_ores(TerrainChunk& c, const ChunkSummary& s) const { + // vanilla 1.21.1 overworld ore placements (size, discard on air exposure, count, height) + static const OreConfig ORES[] = { + {0, 17, 0.0f, 30, 0, false, 136, 320}, // ore_coal_upper + {0, 17, 0.5f, 20, 0, true, 0, 192}, // ore_coal_lower + {1, 9, 0.0f, 90, 0, true, 80, 384}, // ore_iron_upper + {1, 9, 0.0f, 10, 0, true, -24, 56}, // ore_iron_middle + {1, 4, 0.0f, 10, 0, false, -64, 72}, // ore_iron_small + {3, 9, 0.5f, 4, 0, true, -64, 32}, // ore_gold + {3, 9, 0.5f, 0.5f, 0, false, -64, -48}, // ore_gold_lower + {4, 8, 0.0f, 4, 0, false, -64, 15}, // ore_redstone + {4, 8, 0.0f, 8, 0, true, -96, -32}, // ore_redstone_lower + {6, 4, 0.5f, 7, 0, true, -144, 16}, // ore_diamond + {6, 12, 0.7f, 1, 9, true, -144, 16}, // ore_diamond_large + {6, 8, 1.0f, 4, 0, true, -144, 16}, // ore_diamond_buried + {5, 7, 0.0f, 2, 0, true, -32, 32}, // ore_lapis + {5, 7, 1.0f, 4, 0, false, -64, 64}, // ore_lapis_buried + {2, 10, 0.0f, 16, 0, true, -16, 112}, // ore_copper + }; + static const OreConfig STONES[] = { + {100, 33, 0.0f, 7, 0, false, 0, 160}, // ore_dirt + {101, 33, 0.0f, 14, 0, false, -64, 320}, // ore_gravel + {102, 64, 0.0f, 1, 6, false, 64, 128}, // ore_granite_upper + {102, 64, 0.0f, 2, 0, false, 0, 60}, // ore_granite_lower + {103, 64, 0.0f, 1, 6, false, 64, 128}, // ore_diorite_upper + {103, 64, 0.0f, 2, 0, false, 0, 60}, // ore_diorite_lower + {104, 64, 0.0f, 1, 6, false, 64, 128}, // ore_andesite_upper + {104, 64, 0.0f, 2, 0, false, 0, 60}, // ore_andesite_lower + {105, 64, 0.0f, 2, 0, false, -64, 0}, // ore_tuff + }; + Xoroshiro r = rng(c.chunk_x, c.chunk_z, 1); + for (const auto& o : STONES) place_ore_config(c, r, o); + for (const auto& o : ORES) place_ore_config(c, r, o); + // emeralds in mountain biomes (ore_emerald: size 3, count 100, trapezoid -16..480) + const BiomeDecoration& d = deco(s.biome[8 * 16 + 8]); + if (d.emeralds) place_ore_config(c, r, {7, 3, 0.0f, 100, 0, true, -16, 480}); + } + + void place_ore_config(TerrainChunk& c, Xoroshiro& r, const OreConfig& o) const { + int count = (int)o.count; + if (r.next_float() < o.count - (float)count) count++; + if (o.rarity > 0 && r.next_int(o.rarity) != 0) count = 0; + for (int i = 0; i < count; i++) { + int x = r.next_int(16), z = r.next_int(16), y; + if (o.trapezoid) { + int k = o.hi - o.lo, l = k / 2, m = k - l; + y = o.lo + r.next_int_between_inclusive(0, m) + r.next_int_between_inclusive(0, l); + } else { + y = r.next_int_between_inclusive(o.lo, o.hi); + } + if (y < MIN_Y || y > MAX_Y) continue; + ore_blob(c, r, x, y, z, o); + } + } + + bool replace_ore(TerrainChunk& c, int lx, int y, int lz, const OreConfig& o, Xoroshiro& r) const { + uint16_t cur = c.get(lx, y, lz); + uint16_t place = 0; + bool stone = cur == STONE || cur == GRANITE || cur == DIORITE || cur == ANDESITE; + bool deep = cur == DEEPSLATE || cur == TUFF; + if (o.ore >= 100) { + if (!stone) return false; + switch (o.ore) { + case 100: place = DIRT; break; + case 101: place = GRAVEL; break; + case 102: place = GRANITE; break; + case 103: place = DIORITE; break; + case 104: place = ANDESITE; break; + case 105: place = TUFF; break; + } + if (o.ore == 105 && !(cur == STONE || cur == DEEPSLATE)) return false; + } else if (stone) { + place = ORE[o.ore]; + } else if (deep) { + place = DEEP_ORE[o.ore]; + } else { + return false; + } + if (o.discard > 0.0f && exposed_to_air(c, lx, y, lz) && r.next_float() < o.discard) return false; + c.set(lx, y, lz, place); + return true; + } + + bool exposed_to_air(const TerrainChunk& c, int lx, int y, int lz) const { + static const int D[6][3] = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}; + for (auto& d : D) { + int x = lx + d[0], yy = y + d[1], z = lz + d[2]; + if (x < 0 || x > 15 || z < 0 || z > 15) continue; + uint16_t b = c.get(x, yy, z); + if (b == AIR) return true; + } + return false; + } + + // OreFeature: a chain of spheres along a random line segment + void ore_blob(TerrainChunk& c, Xoroshiro& r, int ox, int oy, int oz, const OreConfig& o) const { + float f = r.next_float() * 3.1415927f; + float g = (float)o.size / 8.0f; + double d = ox + std::sin(f) * g, e = ox - std::sin(f) * g; + double h = oz + std::cos(f) * g, j = oz - std::cos(f) * g; + double l = oy + r.next_int(3) - 2, m = oy + r.next_int(3) - 2; + std::vector> balls(o.size); + for (int k = 0; k < o.size; k++) { + float fl = (float)k / (float)o.size; + double w = r.next_double() * o.size / 16.0; + double rad = ((double)(std::sin(3.1415927f * fl) + 1.0f) * w + 1.0) / 2.0; + balls[k] = {lerp(fl, d, e), lerp(fl, l, m), lerp(fl, h, j), rad}; + } + std::set> done; + for (auto& b : balls) { + double radius = b[3] / 2.0 + 0.5; + int x0 = floor_int(b[0] - radius), x1 = floor_int(b[0] + radius); + int y0 = floor_int(b[1] - radius), y1 = floor_int(b[1] + radius); + int z0 = floor_int(b[2] - radius), z1 = floor_int(b[2] + radius); + for (int x = x0; x <= x1; x++) { + double dx = (x + 0.5 - b[0]) / (b[3] / 2.0); + if (dx * dx >= 1.0 || x < 0 || x > 15) continue; + for (int y = y0; y <= y1; y++) { + double dy = (y + 0.5 - b[1]) / (b[3] / 2.0); + if (dx * dx + dy * dy >= 1.0 || y < MIN_Y || y > MAX_Y) continue; + for (int z = z0; z <= z1; z++) { + double dz = (z + 0.5 - b[2]) / (b[3] / 2.0); + if (dx * dx + dy * dy + dz * dz >= 1.0 || z < 0 || z > 15) continue; + if (!done.insert({x, y, z}).second) continue; + replace_ore(c, x, y, z, o, r); + } + } + } + } + } + + // ---------------- disks (sand / clay / gravel on water bottoms) ---------------- + void place_disks(TerrainChunk& c, const ChunkSummary& s) const { + Xoroshiro r = rng(c.chunk_x, c.chunk_z, 2); + const BiomeDecoration& d = deco(s.biome[8 * 16 + 8]); + auto disk = [&](uint16_t block, int count, int rmin, int rmax, std::vector targets) { + for (int n = 0; n < count; n++) { + int x = r.next_int(16), z = r.next_int(16); + int radius = r.next_int_between_inclusive(rmin, rmax); + int y = s.floor[z * 16 + x]; + if (s.surface[z * 16 + x] <= y) continue; // must be under water + for (int dx = -radius; dx <= radius; dx++) + for (int dz = -radius; dz <= radius; dz++) { + if (dx * dx + dz * dz > radius * radius) continue; + int lx = x + dx, lz = z + dz; + if (lx < 0 || lx > 15 || lz < 0 || lz > 15) continue; + for (int dy = -2; dy <= 1; dy++) { + uint16_t cur = c.get(lx, y + dy, lz); + if (std::find(targets.begin(), targets.end(), cur) != targets.end()) + c.set(lx, y + dy, lz, block); + } + } + } + }; + disk(SAND, d.disks_sand, 2, 6, {DIRT, GRASS}); + disk(CLAY, d.disks_clay, 2, 3, {DIRT, CLAY}); + disk(GRAVEL, d.disks_gravel, 2, 5, {DIRT, GRASS}); + } + + // ---------------- trees ---------------- + struct TreeBlocks { + std::vector> logs; // x, y, z, state + std::vector> leaves; + std::vector> extras; // vines, roots, ... + std::vector> dirt; + int wood = OAK; + }; + + void place_trees(TerrainChunk& target, const ChunkSummary& src) const { + Xoroshiro r = rng(src.cx, src.cz, 3); + const BiomeDecoration& center = deco(src.biome[8 * 16 + 8]); + float avg = center.trees; + int count = (int)avg; + if (r.next_float() < avg - (float)count) count++; + for (int n = 0; n < count; n++) { + int x = r.next_int(15), z = r.next_int(15); // 0..14 keeps 2x2 trunks inside the chunk + int i = z * 16 + x; + const BiomeDecoration& d = deco(src.biome[i]); + Xoroshiro tr = rng(src.cx * 64 + x, src.cz * 64 + z, 1000 + n); + if (d.tree_types.empty()) continue; + Tree kind = pick_tree(tr, d); + int y = src.floor[i]; + uint16_t ground = src.ground[i]; + bool submerged = src.surface[i] > y; + if (kind == Tree::Mangrove) { + if (!(is_dirt(ground) || ground == MUD || ground == CLAY)) continue; + if (submerged && src.surface[i] - y > 3) continue; + } else { + bool snow_ok = d.trees_on_snow && (ground == SNOW_BLOCK || ground == POWDER_SNOW); + if (submerged || !(is_dirt(ground) || snow_ok)) continue; + } + bool two_by_two = kind == Tree::MegaSpruce || kind == Tree::MegaPine || kind == Tree::MegaJungle || kind == Tree::DarkOak; + if (two_by_two) { + bool ok = true; + for (int dz = 0; dz <= 1 && ok; dz++) + for (int dx = 0; dx <= 1 && ok; dx++) { + int j = (z + dz) * 16 + (x + dx); + if (src.floor[j] != y || src.surface[j] != y || !is_dirt(src.ground[j])) ok = false; + } + if (!ok) { + if (kind == Tree::DarkOak) kind = Tree::Oak; + else if (kind == Tree::MegaJungle) kind = Tree::Jungle; + else kind = Tree::Spruce; + } + } + TreeBlocks tb; + int wx = src.cx * 16 + x, wz = src.cz * 16 + z; + if (!grow_tree(kind, tr, wx, y + 1, wz, tb)) continue; + commit_tree(target, tb); + } + } + + Tree pick_tree(Xoroshiro& r, const BiomeDecoration& d) const { + float total = 0; + for (auto& c : d.tree_types) total += c.weight; + float v = r.next_float() * total; + for (auto& c : d.tree_types) { + if (v < c.weight) return c.tree; + v -= c.weight; + } + return d.tree_types.back().tree; + } + + void log(TreeBlocks& tb, int x, int y, int z, int axis = 1) const { + int s = axis == 0 ? LOG_X[tb.wood] : axis == 2 ? LOG_Z[tb.wood] : LOG_Y[tb.wood]; + tb.logs.push_back({x, y, z, s}); + } + void leaf(TreeBlocks& tb, int x, int y, int z) const { tb.leaves.push_back({x, y, z}); } + + // FoliagePlacer.placeLeavesRow with a skip predicate + template + void leaves_row(TreeBlocks& tb, int cx, int cy, int cz, int radius, int y_off, bool two, Skip&& skip) const { + int k = two ? 1 : 0; + for (int dx = -radius; dx <= radius + k; dx++) + for (int dz = -radius; dz <= radius + k; dz++) { + int ax = two ? std::min(std::abs(dx), std::abs(dx - 1)) : std::abs(dx); + int az = two ? std::min(std::abs(dz), std::abs(dz - 1)) : std::abs(dz); + if (skip(ax, y_off, az, radius)) continue; + leaf(tb, cx + dx, cy + y_off, cz + dz); + } + } + + void blob_foliage(TreeBlocks& tb, Xoroshiro& r, int x, int top, int z, int radius, int height) const { + for (int j = 0; j >= -height; --j) { + int k = std::max(radius - 1 - j / 2, 0); + leaves_row(tb, x, top, z, k, j, false, [&](int ax, int y, int az, int rad) { + return ax == rad && az == rad && (r.next_int(2) == 0 || y == 0); + }); + } + } + + bool grow_tree(Tree kind, Xoroshiro& r, int x, int y, int z, TreeBlocks& tb) const { + auto straight = [&](int base, int ra, int rb) { return base + r.next_int(ra + 1) + r.next_int(rb + 1); }; + int h = 0; + switch (kind) { + case Tree::Oak: case Tree::Birch: case Tree::TallBirch: case Tree::SwampOak: case Tree::Jungle: { + tb.wood = kind == Tree::Birch || kind == Tree::TallBirch ? BIRCH : kind == Tree::Jungle ? JUNGLE : OAK; + if (kind == Tree::Oak) h = straight(4, 2, 0); + else if (kind == Tree::Birch) h = straight(5, 2, 0); + else if (kind == Tree::TallBirch) h = straight(5, 2, 6); + else if (kind == Tree::SwampOak) h = straight(5, 3, 0); + else h = straight(4, 8, 0); + if (y + h + 2 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + for (int i = 0; i < h; i++) log(tb, x, y + i, z); + blob_foliage(tb, r, x, y + h, z, kind == Tree::SwampOak ? 3 : 2, 3); + if (kind == Tree::SwampOak || kind == Tree::Jungle) add_vines(tb, r, kind == Tree::SwampOak ? 4 : 2); + return true; + } + case Tree::FancyOak: { + tb.wood = OAK; + h = 5 + r.next_int(8); + if (y + h + 4 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + for (int i = 0; i < h; i++) log(tb, x, y + i, z); + int branches = 2 + r.next_int(3); + std::vector> ends = {{x, y + h, z}}; + for (int b = 0; b < branches; b++) { + double ang = r.next_double() * 6.283185307179586; + int len = 2 + r.next_int(3); + int by = y + h / 2 + r.next_int(std::max(1, h / 2)); + int ex = x, ez = z, ey = by; + for (int s = 1; s <= len; s++) { + ex = x + (int)std::lround(std::cos(ang) * s); + ez = z + (int)std::lround(std::sin(ang) * s); + ey = by + s / 2; + log(tb, ex, ey, ez, std::abs(std::cos(ang)) > std::abs(std::sin(ang)) ? 0 : 2); + } + ends.push_back({ex, ey, ez}); + } + for (auto& e : ends) + for (int dy = -1; dy <= 2; dy++) { + int rad = dy == -1 || dy == 2 ? 2 : 3; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) + if (dx * dx + dz * dz <= rad * rad - (dy == 2 ? 1 : 0)) leaf(tb, e[0] + dx, e[1] + dy, e[2] + dz); + } + return true; + } + case Tree::Spruce: { + tb.wood = SPRUCE; + h = straight(5, 2, 1); + if (y + h + 2 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + int trunk_cut = 1 + r.next_int(2); + for (int i = 0; i < h - trunk_cut + 1 && i < h; i++) log(tb, x, y + i, z); + for (int i = h - trunk_cut + 1; i < h; i++) log(tb, x, y + i, z); + int radius = 2 + r.next_int(2), offset = r.next_int(3); + int fh = std::max(4, h - (1 + r.next_int(2))); + int top = y + h; + int l = r.next_int(2), m = 1, nn = 0; + for (int o = offset; o >= -fh; --o) { + leaves_row(tb, x, top, z, l, o, false, [](int ax, int, int az, int rad) { + return ax == rad && az == rad && rad > 0; + }); + if (l >= m) { l = nn; nn = 1; m = std::min(m + 1, radius); } + else ++l; + } + return true; + } + case Tree::Pine: { + tb.wood = SPRUCE; + h = straight(6, 4, 0); + if (y + h + 2 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + for (int i = 0; i < h; i++) log(tb, x, y + i, z); + int fh = 3 + r.next_int(2), offset = 1, radius = 1; + int top = y + h, l = 0; + for (int m = offset; m >= offset - fh; --m) { + leaves_row(tb, x, top, z, l, m, false, [](int ax, int, int az, int rad) { + return ax == rad && az == rad && rad > 0; + }); + if (l >= 1 && m == offset - fh + 1) --l; + else if (l < radius) ++l; + } + return true; + } + case Tree::MegaSpruce: case Tree::MegaPine: { + tb.wood = SPRUCE; + h = straight(13, 2, 14); + if (y + h + 2 > MAX_Y) return false; + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) tb.dirt.push_back({x + dx, y - 1, z + dz}); + for (int i = 0; i < h; i++) + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) log(tb, x + dx, y + i, z + dz); + int crown = kind == Tree::MegaSpruce ? 13 + r.next_int(5) : 3 + r.next_int(5); + int top = y + h, prev = 0; + for (int n = top - crown; n <= top; ++n) { + int o = top - n; + int p = floor_int((double)((float)o / (float)crown * 3.5f)); + int q = (o > 0 && p == prev && (n & 1) == 0) ? p + 1 : p; + leaves_row(tb, x, n, z, q, 0, true, [](int ax, int, int az, int rad) { + return ax + az >= 7 || ax * ax + az * az > rad * rad; + }); + prev = p; + } + return true; + } + case Tree::MegaJungle: { + tb.wood = JUNGLE; + h = straight(10, 2, 19); + if (y + h + 3 > MAX_Y) return false; + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) tb.dirt.push_back({x + dx, y - 1, z + dz}); + for (int i = 0; i < h; i++) + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) log(tb, x + dx, y + i, z + dz); + for (int i = h - 2 - r.next_int(4); i > h / 2; i -= 2 + r.next_int(4)) { + double ang = r.next_double() * 6.283185307179586; + int bx = x, bz = z; + for (int s = 0; s < 5; s++) { + bx = x + (int)(1.5 + std::cos(ang) * s); + bz = z + (int)(1.5 + std::sin(ang) * s); + log(tb, bx, y + i - 3 + s / 2, bz, std::abs(std::cos(ang)) > std::abs(std::sin(ang)) ? 0 : 2); + } + int ty = y + i - 3 + 2; + for (int dy = 0; dy >= -1; dy--) { + int rad = 2 - dy; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) + if (dx * dx + dz * dz <= rad * rad) leaf(tb, bx + dx, ty + dy + 1, bz + dz); + } + } + for (int dy = 0; dy >= -2; dy--) { + int rad = 3 - dy / 2 + (dy == 0 ? 0 : 1); + for (int dx = -rad; dx <= rad + 1; dx++) + for (int dz = -rad; dz <= rad + 1; dz++) { + int ax = std::min(std::abs(dx), std::abs(dx - 1)), az = std::min(std::abs(dz), std::abs(dz - 1)); + if (ax * ax + az * az <= rad * rad) leaf(tb, x + dx, y + h + dy, z + dz); + } + } + add_vines(tb, r, 3); + return true; + } + case Tree::JungleBush: { + tb.wood = JUNGLE; + tb.dirt.push_back({x, y - 1, z}); + log(tb, x, y, z); + for (int dy = 0; dy <= 2; dy++) { + int rad = 2 - dy; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) + if (!(std::abs(dx) == rad && std::abs(dz) == rad && rad > 0 && r.next_int(2) == 0)) + leaf(tb, x + dx, y + dy, z + dz); + } + tb.wood = JUNGLE; + tb.extras.push_back({x, y, z, -OAK - 1}); // marker: bush uses oak leaves + return true; + } + case Tree::Acacia: { + tb.wood = ACACIA; + h = straight(5, 2, 2); + if (y + h + 2 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + static const int DIRS[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; + int d1 = r.next_int(4); + int j = h - r.next_int(4) - 1, k = 3 - r.next_int(3); + int l = x, m = z, top1 = -1000; + for (int o = 0; o < h; ++o) { + int p = y + o; + if (o >= j && k > 0) { l += DIRS[d1][0]; m += DIRS[d1][1]; --k; } + log(tb, l, p, m); + top1 = p + 1; + } + std::vector> attach = {{l, top1, m, 1}}; + l = x; m = z; + int d2 = r.next_int(4); + if (d2 != d1) { + int p = j - r.next_int(2) - 1, q = 1 + r.next_int(3), top2 = -1000; + for (int rr = p; rr < h && q > 0; ++rr, --q) { + if (rr < 1) continue; + int s = y + rr; + l += DIRS[d2][0]; m += DIRS[d2][1]; + log(tb, l, s, m); + top2 = s + 1; + } + if (top2 > -1000) attach.push_back({l, top2, m, 0}); + } + for (auto& a : attach) { + int rad = 2 + a[3]; + auto skip = [](int ax, int yo, int az, int rr) { + if (yo == 0) return (ax > 1 || az > 1) && ax != 0 && az != 0; + return ax == rr && az == rr && rr > 0; + }; + leaves_row(tb, a[0], a[1], a[2], rad, -1, false, skip); + leaves_row(tb, a[0], a[1], a[2], rad - 1, 0, false, skip); + } + return true; + } + case Tree::DarkOak: { + tb.wood = DARK_OAK; + h = straight(6, 2, 1); + if (y + h + 2 > MAX_Y) return false; + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) tb.dirt.push_back({x + dx, y - 1, z + dz}); + int lean_dir = r.next_int(4); + static const int DIRS[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; + int lean_start = h - r.next_int(4), lean = 2 - r.next_int(3); + int cx = x, cz = z; + for (int i = 0; i < h; i++) { + if (i >= lean_start && lean > 0) { cx += DIRS[lean_dir][0]; cz += DIRS[lean_dir][1]; --lean; } + for (int dx = 0; dx <= 1; dx++) for (int dz = 0; dz <= 1; dz++) log(tb, cx + dx, y + i, cz + dz); + } + int top = y + h; + for (int dy = -2; dy <= 0; dy++) { + int rad = dy == 0 ? 2 : 3; + for (int dx = -rad; dx <= rad + 1; dx++) + for (int dz = -rad; dz <= rad + 1; dz++) { + int ax = std::min(std::abs(dx), std::abs(dx - 1)), az = std::min(std::abs(dz), std::abs(dz - 1)); + if (ax == rad && az == rad) continue; + if (dy == -2 && ax + az > 3 && r.next_int(3) == 0) continue; + leaf(tb, cx + dx, top + dy, cz + dz); + } + } + for (int b = 0; b < 2 + r.next_int(3); b++) { + int bx = cx + r.next_int(6) - 2, bz = cz + r.next_int(6) - 2; + int bl = 1 + r.next_int(3); + for (int i = 0; i < bl; i++) log(tb, bx, top - 2 - i, bz); + for (int dx = -1; dx <= 1; dx++) for (int dz = -1; dz <= 1; dz++) leaf(tb, bx + dx, top - 1, bz + dz); + } + return true; + } + case Tree::Cherry: { + tb.wood = CHERRY; + h = 7 + r.next_int(2); + if (y + h + 3 > MAX_Y) return false; + tb.dirt.push_back({x, y - 1, z}); + int trunk = std::max(3, h - 3 - r.next_int(2)); + for (int i = 0; i < trunk; i++) log(tb, x, y + i, z); + int branches = 1 + r.next_int(2); + std::vector> tops; + int d0 = r.next_int(4); + static const int DIRS[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; + for (int b = 0; b < branches; b++) { + int d = (d0 + b * 2) % 4; + int len = 2 + r.next_int(2); + int bx = x, bz = z, by = y + trunk - 1; + for (int s = 1; s <= len; s++) { + bx += DIRS[d][0]; bz += DIRS[d][1]; + log(tb, bx, by, bz, DIRS[d][0] != 0 ? 0 : 2); + } + for (int s = 1; s <= h - trunk; s++) log(tb, bx, by + s, bz); + tops.push_back({bx, by + h - trunk + 1, bz}); + } + if (branches == 1) { + for (int i = trunk; i < h; i++) log(tb, x, y + i, z); + tops.push_back({x, y + h, z}); + } + for (auto& tp : tops) + for (int dy = -3; dy <= 1; dy++) { + int rad = dy == 1 ? 2 : dy == -3 ? 3 : 4; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) { + double dd = dx * dx + dz * dz; + if (dd > rad * rad + 1) continue; + if (dd > (rad - 1) * (rad - 1) && r.next_int(4) == 0) continue; + leaf(tb, tp[0] + dx, tp[1] + dy, tp[2] + dz); + if (dy == -3 && dd > (rad - 1) * (rad - 1) && r.next_int(6) == 0) + leaf(tb, tp[0] + dx, tp[1] + dy - 1, tp[2] + dz); + } + } + return true; + } + case Tree::Mangrove: { + tb.wood = MANGROVE; + int lift = 1 + r.next_int(3); + h = 4 + r.next_int(4); + if (y + lift + h + 3 > MAX_Y) return false; + int base = y + lift; + for (int i = 0; i < h; i++) log(tb, x, base + i, z); + static const int DIRS[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; + for (int d = 0; d < 4; d++) { + if (r.next_int(4) == 0) continue; + int rx = x, rz = z; + for (int s = lift; s >= -1; s--) { + if (s < lift - 1 || r.next_int(2) == 0) { rx += DIRS[d][0]; rz += DIRS[d][1]; } + tb.extras.push_back({rx, y + s, rz, MANGROVE_ROOTS}); + } + } + for (int s = 0; s < lift; s++) tb.extras.push_back({x, y + s, z, MANGROVE_ROOTS}); + int top = base + h; + for (int dy = -2; dy <= 1; dy++) { + int rad = dy == 1 ? 2 : 3; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) { + if (dx * dx + dz * dz > rad * rad) continue; + if (std::abs(dx) == rad && std::abs(dz) == rad) continue; + leaf(tb, x + dx, top + dy, z + dz); + } + } + add_vines(tb, r, 2); + return true; + } + case Tree::AzaleaLike: + return false; + } + return false; + } + + void add_vines(TreeBlocks& tb, Xoroshiro& r, int chance) const { + std::set> occupied; + for (auto& l : tb.leaves) occupied.insert({l[0], l[1], l[2]}); + for (auto& l : tb.logs) occupied.insert({l[0], l[1], l[2]}); + static const int D[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; + std::vector> sources(tb.leaves.begin(), tb.leaves.end()); + for (auto& l : sources) { + for (int d = 0; d < 4; d++) { + if (r.next_int(chance) != 0) continue; + int vx = l[0] + D[d][0], vz = l[2] + D[d][1]; + if (occupied.count({vx, l[1], vz})) continue; + // the vine attaches to the face of the leaves it hangs from + int facing = (d + 2) % 4; + int len = 1 + r.next_int(4); + for (int s = 0; s < len; s++) { + if (occupied.count({vx, l[1] - s, vz})) break; + tb.extras.push_back({vx, l[1] - s, vz, VINE[facing]}); + } + } + } + } + + void commit_tree(TerrainChunk& c, const TreeBlocks& tb) const { + const int minx = c.chunk_x * 16, minz = c.chunk_z * 16; + auto inside = [&](int x, int z) { return x >= minx && x < minx + 16 && z >= minz && z < minz + 16; }; + bool bush_oak = false; + for (auto& e : tb.extras) if (e[3] == -OAK - 1) bush_oak = true; + int leaf_wood = bush_oak ? OAK : tb.wood; + + // leaf distance to the nearest log (vanilla updates leaves this way) + std::unordered_map dist; + auto key = [](int x, int y, int z) { return ((int64_t)(x & 0xFFFFF) << 40) | ((int64_t)(z & 0xFFFFF) << 20) | (int64_t)(y & 0xFFFFF); }; + std::set leaf_keys; + for (auto& l : tb.leaves) leaf_keys.insert(key(l[0], l[1], l[2])); + std::vector> queue; + for (auto& l : tb.logs) queue.push_back({l[0], l[1], l[2], 0}); + size_t head = 0; + static const int D[6][3] = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}; + while (head < queue.size()) { + auto q = queue[head++]; + if (q[3] >= 7) continue; + for (auto& d : D) { + int nx = q[0] + d[0], ny = q[1] + d[1], nz = q[2] + d[2]; + int64_t k = key(nx, ny, nz); + if (!leaf_keys.count(k) || dist.count(k)) continue; + dist[k] = q[3] + 1; + queue.push_back({nx, ny, nz, q[3] + 1}); + } + } + for (auto& d : tb.dirt) { + if (!inside(d[0], d[2])) continue; + uint16_t cur = c.get(d[0] - minx, d[1], d[2] - minz); + if (cur == GRASS || cur == MYCELIUM || cur == PODZOL || cur == GRASS_SNOWY) c.set(d[0] - minx, d[1], d[2] - minz, DIRT); + } + for (auto& l : tb.logs) { + if (!inside(l[0], l[2])) continue; + uint16_t cur = c.get(l[0] - minx, l[1], l[2] - minz); + if (tree_replaceable(cur) || cur == WATER) c.set(l[0] - minx, l[1], l[2] - minz, (uint16_t)l[3]); + } + for (auto& l : tb.leaves) { + if (!inside(l[0], l[2])) continue; + uint16_t cur = c.get(l[0] - minx, l[1], l[2] - minz); + if (!(cur == AIR || is_plant(cur))) continue; + auto it = dist.find(key(l[0], l[1], l[2])); + int d = it == dist.end() ? 7 : it->second; + c.set(l[0] - minx, l[1], l[2] - minz, LEAVES[leaf_wood][d - 1]); + } + for (auto& e : tb.extras) { + if (e[3] < 0 || !inside(e[0], e[2])) continue; + uint16_t cur = c.get(e[0] - minx, e[1], e[2] - minz); + if (cur == AIR || (e[3] == MANGROVE_ROOTS && (cur == WATER || is_plant(cur)))) + c.set(e[0] - minx, e[1], e[2] - minz, (uint16_t)e[3]); + } + } + + // ---------------- in-chunk large features ---------------- + void place_local_features(TerrainChunk& c, const ChunkSummary& s) const { + Xoroshiro r = rng(c.chunk_x, c.chunk_z, 4); + const BiomeDecoration& d = deco(s.biome[8 * 16 + 8]); + for (int n = 0; n < d.huge_mushrooms; n++) { + if (d.trees > 0 && r.next_int(3) != 0) continue; // dark forest: rarer than trees + int x = 3 + r.next_int(10), z = 3 + r.next_int(10); + huge_mushroom(c, r, x, z); + } + for (int n = 0; n < d.boulders; n++) { + int x = 2 + r.next_int(12), z = 2 + r.next_int(12); + boulder(c, r, x, z); + } + for (int n = 0; n < d.ice_spikes; n++) { + int x = 4 + r.next_int(8), z = 4 + r.next_int(8); + ice_spike(c, r, x, z); + } + } + + int top_solid(const TerrainChunk& c, int x, int z) const { + for (int y = MAX_Y; y > MIN_Y; y--) { + uint16_t b = c.get(x, y, z); + if (b != AIR && !is_plant(b) && !is_leaves(b)) return y; + } + return MIN_Y; + } + + void huge_mushroom(TerrainChunk& c, Xoroshiro& r, int x, int z) const { + int y = top_solid(c, x, z); + uint16_t ground = c.get(x, y, z); + if (!is_dirt(ground) || c.get(x, y + 1, z) != AIR) return; + bool red = r.next_int(2) == 0; + int h = 4 + r.next_int(3) + (r.next_int(12) == 0 ? 3 : 0); + if (y + h + 2 > MAX_Y) return; + for (int i = 1; i <= h; i++) c.set(x, y + i, z, STEM); + int top = y + h; + if (red) { + for (int dy = -3; dy <= 0; dy++) { + int rad = dy == 0 ? 1 : 2; + for (int dx = -rad; dx <= rad; dx++) + for (int dz = -rad; dz <= rad; dz++) { + bool edge = std::abs(dx) == rad || std::abs(dz) == rad; + if (dy < 0 && !edge) continue; + if (dy < 0 && std::abs(dx) == rad && std::abs(dz) == rad) continue; + int px = x + dx, pz = z + dz; + if (px < 0 || px > 15 || pz < 0 || pz > 15) continue; + if (c.get(px, top + dy, pz) == AIR) c.set(px, top + dy, pz, RED_CAP); + } + } + if (c.get(x, top + 1, z) == AIR) c.set(x, top + 1, z, RED_CAP); + } else { + for (int dx = -3; dx <= 3; dx++) + for (int dz = -3; dz <= 3; dz++) { + if (std::abs(dx) == 3 && std::abs(dz) == 3) continue; + int px = x + dx, pz = z + dz; + if (px < 0 || px > 15 || pz < 0 || pz > 15) continue; + if (c.get(px, top + 1, pz) == AIR) c.set(px, top + 1, pz, BROWN_CAP); + } + } + } + + void boulder(TerrainChunk& c, Xoroshiro& r, int x, int z) const { + int y = top_solid(c, x, z); + if (!is_dirt(c.get(x, y, z)) && c.get(x, y, z) != STONE) return; + for (int n = 0; n < 3; n++) { + int rx = r.next_int(2), ry = r.next_int(2), rz = r.next_int(2); + float radius = (float)(rx + ry + rz) * 0.333f + 0.5f; + for (int dx = -rx - 1; dx <= rx + 1; dx++) + for (int dy = -ry - 1; dy <= ry + 1; dy++) + for (int dz = -rz - 1; dz <= rz + 1; dz++) { + if ((float)(dx * dx + dy * dy + dz * dz) > radius * radius) continue; + int px = x + dx, pz = z + dz; + if (px < 0 || px > 15 || pz < 0 || pz > 15) continue; + c.set(px, y + 1 + dy, pz, MOSSY_COBBLE); + } + x += r.next_int(3) - 1; z += r.next_int(3) - 1; y += r.next_int(2) - 1; + x = std::max(1, std::min(14, x)); z = std::max(1, std::min(14, z)); + } + } + + void ice_spike(TerrainChunk& c, Xoroshiro& r, int x, int z) const { + int y = top_solid(c, x, z); + if (c.get(x, y, z) != SNOW_BLOCK) return; + y += r.next_int(4); + int i = r.next_int(4) + 7, j = i / 4 + r.next_int(2); + if (j > 1 && r.next_int(60) == 0) y += 10 + r.next_int(30); + if (y + i > MAX_Y) return; + auto ok = [&](uint16_t b) { return b == AIR || is_dirt(b) || b == SNOW_BLOCK || b == ICE; }; + for (int k = 0; k < i; ++k) { + float f = (1.0f - (float)k / (float)i) * (float)j; + int l = (int)std::ceil(f); + for (int m = -l; m <= l; ++m) { + float g = (float)std::abs(m) - 0.25f; + for (int n = -l; n <= l; ++n) { + float h = (float)std::abs(n) - 0.25f; + if (((m == 0 && n == 0) || !(g * g + h * h > f * f)) && + ((m != -l && m != l && n != -l && n != l) || !(r.next_float() > 0.75f))) { + int px = x + m, pz = z + n; + if (px < 0 || px > 15 || pz < 0 || pz > 15) continue; + if (ok(c.get(px, y + k, pz))) c.set(px, y + k, pz, PACKED_ICE); + if (k != 0 && l > 1 && ok(c.get(px, y - k, pz))) c.set(px, y - k, pz, PACKED_ICE); + } + } + } + } + } + + // ---------------- small vegetation (stays inside the chunk) ---------------- + void place_vegetation(TerrainChunk& c, const ChunkSummary& s) const { + Xoroshiro r = rng(c.chunk_x, c.chunk_z, 5); + // Patches are attempted from biome-specific settings sampled at their centre. + auto patch = [&](int tries, int spread, const std::function& place) { + int ox = r.next_int(16), oz = r.next_int(16); + for (int n = 0; n < tries; n++) { + int x = ox + tri(r, spread), z = oz + tri(r, spread); + if (x < 0 || x > 15 || z < 0 || z > 15) continue; + place(x, z, s.biome[z * 16 + x]); + } + }; + auto surface_y = [&](int x, int z) { + int y = s.floor[z * 16 + x]; + // trees may have covered the column: stay on the terrain floor + return y; + }; + auto on_dirt = [&](int x, int z, uint16_t plant) { + int y = surface_y(x, z); + if (s.surface[z * 16 + x] != y) return false; + if (!is_dirt(c.get(x, y, z)) || c.get(x, y + 1, z) != AIR) return false; + c.set(x, y + 1, z, plant); + return true; + }; + auto tall_on_dirt = [&](int x, int z, uint16_t lower, uint16_t upper) { + int y = surface_y(x, z); + if (s.surface[z * 16 + x] != y) return; + if (!is_dirt(c.get(x, y, z)) || c.get(x, y + 1, z) != AIR || c.get(x, y + 2, z) != AIR) return; + c.set(x, y + 1, z, lower); + c.set(x, y + 2, z, upper); + }; + const BiomeDecoration& d = deco(s.biome[8 * 16 + 8]); + auto flower_for = [&](int set, int x, int z) -> uint16_t { + // flower selection, loosely following vanilla's flower_* features + double n = t_.graph.noises[t_.n_surface].value((c.chunk_x * 16 + x) / 48.0, 0.0, (c.chunk_z * 16 + z) / 48.0); + switch (set) { + case 1: return n > 0.2 ? FLOWER[4 + r.next_int(6)] : FLOWER[r.next_int(2)]; + case 2: return FLOWER[r.next_int(2)] ; + case 3: { static const int F[] = {0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11}; return FLOWER[F[r.next_int(11)]]; } + case 4: return FLOWER[2]; + case 5: { static const int F[] = {4, 9, 10, 3, 1, 0}; return FLOWER[F[r.next_int(6)]]; } + default: return FLOWER[r.next_int(2)]; + } + }; + + for (int i = 0; i < d.grass; i++) patch(1, 0, [&](int x, int z, int b) { + const BiomeDecoration& bd = deco(b); + on_dirt(x, z, (bd.ferns > 0 && r.next_int(4) == 0) ? FERN : SHORT_GRASS); + }); + for (int i = 0; i < d.ferns; i++) patch(1, 0, [&](int x, int z, int) { on_dirt(x, z, FERN); }); + for (int i = 0; i < d.tall_grass; i++) patch(1, 0, [&](int x, int z, int) { tall_on_dirt(x, z, TALL_GRASS_L, TALL_GRASS_U); }); + for (int i = 0; i < d.large_ferns; i++) patch(1, 0, [&](int x, int z, int) { tall_on_dirt(x, z, LARGE_FERN_L, LARGE_FERN_U); }); + for (int i = 0; i < d.flowers; i++) { + int set = d.flower_set; + patch(12, 3, [&](int x, int z, int) { on_dirt(x, z, flower_for(set, x, z)); }); + } + for (int i = 0; i < d.tall_flowers; i++) { + int kind = 1 + r.next_int(3); + patch(8, 3, [&](int x, int z, int) { tall_on_dirt(x, z, TALL_FLOWER_L[kind], TALL_FLOWER_U[kind]); }); + } + for (int i = 0; i < d.sunflowers; i++) patch(4, 2, [&](int x, int z, int) { tall_on_dirt(x, z, TALL_FLOWER_L[0], TALL_FLOWER_U[0]); }); + for (int i = 0; i < d.petals; i++) patch(10, 3, [&](int x, int z, int) { on_dirt(x, z, PETALS[r.next_int(4)]); }); + for (int i = 0; i < d.mushrooms; i++) { + if (r.next_int(4) != 0) continue; + uint16_t m = r.next_int(2) ? BROWN_MUSHROOM : RED_MUSHROOM; + patch(8, 3, [&](int x, int z, int) { on_dirt(x, z, m); }); + } + if (d.berries && r.next_int(8) == 0) patch(12, 3, [&](int x, int z, int) { on_dirt(x, z, BERRIES); }); + if (d.pumpkins && r.next_int(32) == 0) patch(12, 3, [&](int x, int z, int) { on_dirt(x, z, PUMPKIN); }); + if (d.melons && r.next_int(6) == 0) patch(12, 3, [&](int x, int z, int) { on_dirt(x, z, MELON); }); + + for (int i = 0; i < d.dead_bushes; i++) patch(1, 0, [&](int x, int z, int) { + int y = surface_y(x, z); + uint16_t g = c.get(x, y, z); + if (s.surface[z * 16 + x] != y || c.get(x, y + 1, z) != AIR) return; + if (is_sandy(g) || terracotta_like_.count(g) || is_dirt(g)) c.set(x, y + 1, z, DEAD_BUSH); + }); + for (int i = 0; i < d.cacti; i++) patch(4, 2, [&](int x, int z, int) { + int y = surface_y(x, z); + if (s.surface[z * 16 + x] != y || !is_sandy(c.get(x, y, z))) return; + int h = 1 + r.next_int(r.next_int(3) + 1); + for (int k = 1; k <= h; k++) { + if (c.get(x, y + k, z) != AIR) break; + bool free = true; + static const int D[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; + for (auto& dd : D) { + int nx = x + dd[0], nz = z + dd[1]; + if (nx >= 0 && nx < 16 && nz >= 0 && nz < 16 && c.get(nx, y + k, nz) != AIR) free = false; + } + if (!free) break; + c.set(x, y + k, z, CACTUS); + } + }); + for (int i = 0; i < d.sugar_cane; i++) patch(2, 2, [&](int x, int z, int) { + int y = surface_y(x, z); + uint16_t g = c.get(x, y, z); + if (s.surface[z * 16 + x] != y || !(is_dirt(g) || is_sandy(g))) return; + bool water = false; + static const int D[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; + for (auto& dd : D) { + int nx = x + dd[0], nz = z + dd[1]; + if (nx >= 0 && nx < 16 && nz >= 0 && nz < 16 && c.get(nx, y, nz) == WATER) water = true; + } + if (!water) return; + int h = 2 + r.next_int(r.next_int(3) + 1); + for (int k = 1; k <= h && c.get(x, y + k, z) == AIR; k++) c.set(x, y + k, z, SUGAR_CANE); + }); + for (int i = 0; i < d.bamboo; i++) patch(6, 3, [&](int x, int z, int) { + int y = surface_y(x, z); + uint16_t g = c.get(x, y, z); + if (s.surface[z * 16 + x] != y || !(is_dirt(g) || is_sandy(g) || g == GRAVEL)) return; + int h = 5 + r.next_int(10); + for (int k = 1; k <= h; k++) { + if (c.get(x, y + k, z) != AIR) return; + } + for (int k = 1; k <= h; k++) c.set(x, y + k, z, k >= h - 1 ? BAMBOO_LARGE : k == h - 2 ? BAMBOO_SMALL : BAMBOO); + if (g == GRASS || g == DIRT) c.set(x, y, z, PODZOL); + }); + for (int i = 0; i < d.lily_pads; i++) patch(10, 3, [&](int x, int z, int) { + int sy = s.surface[z * 16 + x]; + if (sy <= s.floor[z * 16 + x] || c.get(x, sy, z) != WATER || c.get(x, sy + 1, z) != AIR) return; + c.set(x, sy + 1, z, LILY_PAD); + }); + int seagrass = d.seagrass; + for (int i = 0; i < seagrass; i++) patch(1, 0, [&](int x, int z, int) { + int y = s.floor[z * 16 + x], sy = s.surface[z * 16 + x]; + if (sy <= y + 1 || c.get(x, y + 1, z) != WATER) return; + uint16_t g = c.get(x, y, z); + if (!(is_sandy(g) || g == GRAVEL || is_dirt(g) || g == CLAY)) return; + if (sy > y + 2 && r.next_int(4) == 0 && c.get(x, y + 2, z) == WATER) { + c.set(x, y + 1, z, TALL_SEAGRASS_L); + c.set(x, y + 2, z, TALL_SEAGRASS_U); + } else { + c.set(x, y + 1, z, SEAGRASS); + } + }); + for (int i = 0; i < d.kelp; i++) patch(1, 0, [&](int x, int z, int) { + int y = s.floor[z * 16 + x], sy = s.surface[z * 16 + x]; + if (sy - y < 4 || c.get(x, y + 1, z) != WATER) return; + int h = 1 + r.next_int(std::max(1, sy - y - 2)); + h = std::min(h, 1 + r.next_int(10)); + for (int k = 1; k <= h; k++) { + if (c.get(x, y + k, z) != WATER) break; + c.set(x, y + k, z, k == h ? KELP : KELP_PLANT); + } + }); + for (int i = 0; i < d.sea_pickles; i++) patch(6, 3, [&](int x, int z, int) { + int y = s.floor[z * 16 + x]; + if (s.surface[z * 16 + x] <= y + 1 || c.get(x, y + 1, z) != WATER) return; + if (r.next_int(3) == 0) c.set(x, y + 1, z, SEA_PICKLE); + }); + } + + // ---------------- freeze_top_layer ---------------- + bool blocks_motion(uint16_t b) const { + if (b == AIR || is_plant(b) || b == SUGAR_CANE || b == LILY_PAD || b == SEAGRASS || b == TALL_SEAGRASS_L || + b == TALL_SEAGRASS_U) + return false; + return true; + } + + bool snow_can_survive_on(uint16_t below) const { + if (below == ICE || below == PACKED_ICE || below == BLUE_ICE || below == WATER || below == AIR) return false; + if (below == CACTUS || below == SNOW_LAYER || below == BAMBOO || below == BAMBOO_SMALL || below == BAMBOO_LARGE) + return false; + if (is_plant(below) || below == SUGAR_CANE || below == LILY_PAD || below == SEAGRASS || below == KELP || + below == KELP_PLANT || below == MANGROVE_ROOTS || below == SEA_PICKLE) + return false; + for (int i = 0; i < 4; i++) if (below == VINE[i]) return false; + if (below == t_.LAVA) return false; + return true; + } + + void freeze_top_layer(TerrainChunk& c) const { + std::unordered_map biome_cache; + ChunkEval ev; + t_.new_eval(ev); + ev.set_chunk(c.chunk_x, c.chunk_z); + const int minx = c.chunk_x * 16, minz = c.chunk_z * 16; + for (int z = 0; z < 16; z++) + for (int x = 0; x < 16; x++) { + int k = MIN_Y; + for (int y = MAX_Y; y >= MIN_Y; y--) { + if (blocks_motion(c.get(x, y, z))) { k = y + 1; break; } + } + if (k > MAX_Y) continue; + int wx = minx + x, wz = minz + z; + int biome = t_.zoomed_biome(wx, k, wz, [&](int qx, int qy, int qz) { + int lqx = qx - (minx >> 2), lqz = qz - (minz >> 2); + int cqy = std::max(MIN_Y >> 2, std::min(((MAX_Y + 1) >> 2) - 1, qy)); + if (lqx >= 0 && lqx < 4 && lqz >= 0 && lqz < 4) { + int sec = (cqy - (MIN_Y >> 2)) >> 2, iy = (cqy - (MIN_Y >> 2)) & 3; + return (int)c.biomes[sec * 64 + iy * 16 + lqz * 4 + lqx]; + } + int64_t key = ((int64_t)(qx & 0x3FFFFF) << 42) | ((int64_t)(qz & 0x3FFFFF) << 20) | (int64_t)(cqy & 0xFFFFF); + auto it = biome_cache.find(key); + if (it != biome_cache.end()) return it->second; + int b = t_.noise_biome(qx, cqy, qz, &ev); + biome_cache.emplace(key, b); + return b; + }); + uint16_t below = c.get(x, k - 1, z); + if (below == WATER && t_.cold_enough_to_snow(biome, wx, k - 1, wz)) { + c.set(x, k - 1, z, ICE); + below = ICE; + } + if (t_.cold_enough_to_snow(biome, wx, k, wz) && c.get(x, k, z) == AIR && snow_can_survive_on(below)) { + c.set(x, k, z, SNOW_LAYER); + if (below == GRASS) c.set(x, k - 1, z, GRASS_SNOWY); + else if (below == PODZOL) c.set(x, k - 1, z, PODZOL_SNOWY); + else if (below == MYCELIUM) c.set(x, k - 1, z, MYCELIUM_SNOWY); + } + } + } +}; + +} // namespace vgen diff --git a/native/worldgen/json.h b/native/worldgen/json.h new file mode 100644 index 0000000..403e136 --- /dev/null +++ b/native/worldgen/json.h @@ -0,0 +1,149 @@ +// ============================================================ +// PyMC - Minimal JSON reader (for world/data/worldgen_overworld.json) +// ============================================================ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace vgen { + +struct Json { + enum Kind { Null, Bool, Number, String, Array, Object } kind = Null; + bool b = false; + double num = 0.0; + std::string str; + std::vector arr; + std::map obj; + + bool is_object() const { return kind == Object; } + bool is_array() const { return kind == Array; } + bool is_number() const { return kind == Number; } + bool is_string() const { return kind == String; } + bool has(const std::string& k) const { return kind == Object && obj.count(k) > 0; } + + const Json& operator[](const std::string& k) const { + auto it = obj.find(k); + if (it == obj.end()) throw std::runtime_error("missing JSON key: " + k); + return it->second; + } + const Json& operator[](size_t i) const { return arr.at(i); } + size_t size() const { return kind == Array ? arr.size() : obj.size(); } + + double as_double(double def = 0.0) const { + if (kind == Number) return num; + if (kind == Bool) return b ? 1.0 : 0.0; + return def; + } + int as_int(int def = 0) const { return kind == Number ? (int)num : def; } + bool as_bool(bool def = false) const { return kind == Bool ? b : (kind == Number ? num != 0.0 : def); } + double get(const std::string& k, double def) const { return has(k) ? (*this)[k].as_double(def) : def; } + bool get_bool(const std::string& k, bool def) const { return has(k) ? (*this)[k].as_bool(def) : def; } + std::string get_str(const std::string& k, const std::string& def = "") const { + return has(k) && (*this)[k].kind == String ? (*this)[k].str : def; + } +}; + +class JsonParser { +public: + explicit JsonParser(const std::string& text) : s(text) {} + + Json parse() { + Json v = value(); + ws(); + if (i != s.size()) throw std::runtime_error("trailing data in JSON"); + return v; + } + +private: + const std::string& s; + size_t i = 0; + + void ws() { while (i < s.size() && (s[i] == ' ' || s[i] == '\n' || s[i] == '\r' || s[i] == '\t')) i++; } + char peek() { ws(); if (i >= s.size()) throw std::runtime_error("unexpected end of JSON"); return s[i]; } + void expect(char c) { if (peek() != c) throw std::runtime_error(std::string("expected '") + c + "' in JSON"); i++; } + + Json value() { + char c = peek(); + Json v; + if (c == '{') { + v.kind = Json::Object; + i++; + if (peek() == '}') { i++; return v; } + while (true) { + std::string key = string_lit(); + expect(':'); + v.obj.emplace(std::move(key), value()); + char d = peek(); + i++; + if (d == '}') break; + if (d != ',') throw std::runtime_error("expected ',' in JSON object"); + } + } else if (c == '[') { + v.kind = Json::Array; + i++; + if (peek() == ']') { i++; return v; } + while (true) { + v.arr.push_back(value()); + char d = peek(); + i++; + if (d == ']') break; + if (d != ',') throw std::runtime_error("expected ',' in JSON array"); + } + } else if (c == '"') { + v.kind = Json::String; + v.str = string_lit(); + } else if (s.compare(i, 4, "true") == 0) { + v.kind = Json::Bool; v.b = true; i += 4; + } else if (s.compare(i, 5, "false") == 0) { + v.kind = Json::Bool; v.b = false; i += 5; + } else if (s.compare(i, 4, "null") == 0) { + i += 4; + } else { + v.kind = Json::Number; + const char* start = s.c_str() + i; + char* end = nullptr; + v.num = std::strtod(start, &end); + if (end == start) throw std::runtime_error("bad JSON number"); + i += (size_t)(end - start); + } + return v; + } + + std::string string_lit() { + expect('"'); + std::string out; + while (i < s.size() && s[i] != '"') { + if (s[i] == '\\') { + i++; + char e = s[i++]; + switch (e) { + case 'n': out += '\n'; break; + case 't': out += '\t'; break; + case 'r': out += '\r'; break; + case 'b': out += '\b'; break; + case 'f': out += '\f'; break; + case 'u': { + unsigned cp = (unsigned)std::strtoul(s.substr(i, 4).c_str(), nullptr, 16); + i += 4; + if (cp < 0x80) out += (char)cp; + else if (cp < 0x800) { out += (char)(0xC0 | (cp >> 6)); out += (char)(0x80 | (cp & 0x3F)); } + else { out += (char)(0xE0 | (cp >> 12)); out += (char)(0x80 | ((cp >> 6) & 0x3F)); out += (char)(0x80 | (cp & 0x3F)); } + break; + } + default: out += e; + } + } else { + out += s[i++]; + } + } + i++; + return out; + } +}; + +} // namespace vgen diff --git a/native/worldgen/noise.h b/native/worldgen/noise.h new file mode 100644 index 0000000..e1fd2d4 --- /dev/null +++ b/native/worldgen/noise.h @@ -0,0 +1,340 @@ +// ============================================================ +// PyMC - Vanilla noise generators (Minecraft Java 1.21.1) +// +// ImprovedNoise, PerlinNoise (new and legacy octave initialisation), +// NormalNoise, BlendedNoise ("old_blended_noise"), SimplexNoise and +// PerlinSimplexNoise. Arithmetic follows the Java code operation by +// operation so results are bit-identical (build without FMA contraction). +// ============================================================ +#pragma once + +#include +#include +#include +#include +#include + +#include "random.h" + +namespace vgen { + +inline int floor_int(double d) { + int i = (int)d; + return d < (double)i ? i - 1 : i; +} +inline int64_t lfloor(double d) { + int64_t l = (int64_t)d; + return d < (double)l ? l - 1 : l; +} +inline double lerp(double t, double a, double b) { return a + t * (b - a); } +inline float lerpf(float t, float a, float b) { return a + t * (b - a); } +inline double lerp2(double dx, double dy, double a, double b, double c, double d) { + return lerp(dy, lerp(dx, a, b), lerp(dx, c, d)); +} +inline double lerp3(double dx, double dy, double dz, double a, double b, double c, double d, + double e, double f, double g, double h) { + return lerp(dz, lerp2(dx, dy, a, b, c, d), lerp2(dx, dy, e, f, g, h)); +} +inline double smoothstep(double d) { return d * d * d * (d * (d * 6.0 - 15.0) + 10.0); } +inline double clampd(double v, double lo, double hi) { return v < lo ? lo : (v > hi ? hi : v); } +inline double inverse_lerp(double d, double e, double f) { return (d - e) / (f - e); } +inline double clamped_lerp(double a, double b, double t) { return t < 0.0 ? a : (t > 1.0 ? b : lerp(t, a, b)); } +inline double clamped_map(double d, double e, double f, double g, double h) { + return clamped_lerp(g, h, inverse_lerp(d, e, f)); +} +inline double map_range(double d, double e, double f, double g, double h) { + return lerp(inverse_lerp(d, e, f), g, h); +} +inline int floor_div(int a, int b) { + int q = a / b; + if ((a % b != 0) && ((a < 0) != (b < 0))) q--; + return q; +} +inline int floor_mod(int a, int b) { return a - floor_div(a, b) * b; } + +static const int GRADIENT[16][3] = { + {1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, + {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}, {1, 1, 0}, {0, -1, 1}, {-1, 1, 0}, {0, -1, -1}}; + +inline double grad_dot(int hash, double x, double y, double z) { + const int* g = GRADIENT[hash & 15]; + return (double)g[0] * x + (double)g[1] * y + (double)g[2] * z; +} + +// ---------------- ImprovedNoise ---------------- +struct ImprovedNoise { + uint8_t p[256]; + double xo, yo, zo; + + template + explicit ImprovedNoise(R& random) { + xo = random.next_double() * 256.0; + yo = random.next_double() * 256.0; + zo = random.next_double() * 256.0; + for (int i = 0; i < 256; i++) p[i] = (uint8_t)i; + for (int i = 0; i < 256; i++) { + int j = random.next_int(256 - i); + uint8_t b = p[i]; + p[i] = p[i + j]; + p[i + j] = b; + } + } + + inline int P(int i) const { return p[i & 0xFF]; } + + double noise(double d, double e, double f, double y_scale = 0.0, double y_max = 0.0) const { + double i = d + xo, j = e + yo, k = f + zo; + int l = floor_int(i), m = floor_int(j), n = floor_int(k); + double o = i - (double)l, q = j - (double)m, r = k - (double)n; + double s = 0.0; + if (y_scale != 0.0) { + double t = (y_max >= 0.0 && y_max < q) ? y_max : q; + s = (double)floor_int(t / y_scale + (double)1.0E-7f) * y_scale; + } + return sample_and_lerp(l, m, n, o, q - s, r, q); + } + + double sample_and_lerp(int i, int j, int k, double d, double e, double f, double g) const { + int l = P(i), m = P(i + 1); + int n = P(l + j), o = P(l + j + 1); + int q = P(m + j), r = P(m + j + 1); + double h = grad_dot(P(n + k), d, e, f); + double s = grad_dot(P(q + k), d - 1.0, e, f); + double t = grad_dot(P(o + k), d, e - 1.0, f); + double u = grad_dot(P(r + k), d - 1.0, e - 1.0, f); + double v = grad_dot(P(n + k + 1), d, e, f - 1.0); + double w = grad_dot(P(q + k + 1), d - 1.0, e, f - 1.0); + double x = grad_dot(P(o + k + 1), d, e - 1.0, f - 1.0); + double y = grad_dot(P(r + k + 1), d - 1.0, e - 1.0, f - 1.0); + return lerp3(smoothstep(d), smoothstep(g), smoothstep(f), h, s, t, u, v, w, x, y); + } +}; + +inline double perlin_wrap(double d) { + return d - (double)lfloor(d / 3.3554432E7 + 0.5) * 3.3554432E7; +} + +// ---------------- PerlinNoise ---------------- +struct PerlinNoise { + std::vector> levels; + std::vector amplitudes; + int first_octave = 0; + double lowest_freq_input_factor = 1.0; + double lowest_freq_value_factor = 1.0; + + PerlinNoise() = default; + + // new factory (XoroshiroRandomSource): octave noises from positional hashes + static PerlinNoise create(Xoroshiro& random, int first_octave, const std::vector& amps) { + PerlinNoise n; + n.init_factors(first_octave, amps); + PositionalFactory pf = fork_positional(random); + for (size_t l = 0; l < amps.size(); l++) { + if (amps[l] != 0.0) { + int octave = first_octave + (int)l; + Xoroshiro r = pf.from_hash_of("octave_" + std::to_string(octave)); + n.levels[l] = std::make_unique(r); + } + } + return n; + } + + // legacy initialisation (PerlinNoise(..., useNewFactory=false)) + template + static PerlinNoise create_legacy(R& random, int first_octave, const std::vector& amps) { + PerlinNoise n; + n.init_factors(first_octave, amps); + int j = (int)amps.size(); + int k = -first_octave; + auto first = std::make_unique(random); + if (k >= 0 && k < j && amps[k] != 0.0) n.levels[k] = std::move(first); + for (int l = k - 1; l >= 0; --l) { + if (l < j && amps[l] != 0.0) n.levels[l] = std::make_unique(random); + else random.consume(262); + } + return n; + } + + void init_factors(int first, const std::vector& amps) { + first_octave = first; + amplitudes = amps; + levels.clear(); + levels.resize(amps.size()); + int j = (int)amps.size(); + lowest_freq_input_factor = std::pow(2.0, (double)first); + lowest_freq_value_factor = std::pow(2.0, (double)(j - 1)) / (std::pow(2.0, (double)j) - 1.0); + } + + const ImprovedNoise* octave(int i) const { return levels[levels.size() - 1 - i].get(); } + + double value(double x, double y, double z) const { + double d = 0.0, e = lowest_freq_input_factor, f = lowest_freq_value_factor; + for (size_t l = 0; l < levels.size(); l++) { + const ImprovedNoise* n = levels[l].get(); + if (n) { + double g = n->noise(perlin_wrap(x * e), perlin_wrap(y * e), perlin_wrap(z * e), 0.0, 0.0); + d += amplitudes[l] * g * f; + } + e *= 2.0; + f /= 2.0; + } + return d; + } +}; + +// ---------------- NormalNoise ---------------- +struct NormalNoise { + PerlinNoise first, second; + double value_factor = 0.0; + + static NormalNoise create(Xoroshiro random, int first_octave, const std::vector& amps) { + NormalNoise n; + n.first = PerlinNoise::create(random, first_octave, amps); + n.second = PerlinNoise::create(random, first_octave, amps); + int lo = 1 << 30, hi = -(1 << 30); + for (size_t i = 0; i < amps.size(); i++) { + if (amps[i] != 0.0) { + lo = std::min(lo, (int)i); + hi = std::max(hi, (int)i); + } + } + double expected = 0.1 * (1.0 + 1.0 / (double)(hi - lo + 1)); + n.value_factor = 0.16666666666666666 / expected; + return n; + } + + double value(double x, double y, double z) const { + double d = x * 1.0181268882175227, e = y * 1.0181268882175227, f = z * 1.0181268882175227; + return (first.value(x, y, z) + second.value(d, e, f)) * value_factor; + } +}; + +// ---------------- BlendedNoise ---------------- +struct BlendedNoise { + PerlinNoise min_limit, max_limit, main; + double xz_scale, y_scale, xz_factor, y_factor, smear; + double xz_multiplier, y_multiplier; + + BlendedNoise(Xoroshiro& random, double xz, double y, double xzf, double yf, double sm, bool deepslate_compat = false) + : xz_scale(xz), y_scale(y), xz_factor(xzf), y_factor(yf), smear(sm) { + if (deepslate_compat) { + // Only for cross-checking against deepslate, which uses the new + // octave factory and truncated octave lists here. + std::vector lim = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; + std::vector mn = {1, 1, 1, 1, 1, 0, 0, 0}; + min_limit = PerlinNoise::create(random, -15, lim); + max_limit = PerlinNoise::create(random, -15, lim); + main = PerlinNoise::create(random, -7, mn); + } else { + std::vector lim(16, 1.0), mn(8, 1.0); + min_limit = PerlinNoise::create_legacy(random, -15, lim); + max_limit = PerlinNoise::create_legacy(random, -15, lim); + main = PerlinNoise::create_legacy(random, -7, mn); + } + xz_multiplier = 684.412 * xz_scale; + y_multiplier = 684.412 * y_scale; + } + + double compute(int bx, int by, int bz) const { + double d = (double)bx * xz_multiplier, e = (double)by * y_multiplier, f = (double)bz * xz_multiplier; + double g = d / xz_factor, h = e / y_factor, l = f / xz_factor; + double m = y_multiplier * smear, n = m / y_factor; + double o = 0.0, p = 0.0, q = 0.0, r = 1.0; + for (int s = 0; s < 8; s++) { + const ImprovedNoise* noise = main.octave(s); + if (noise) q += noise->noise(perlin_wrap(g * r), perlin_wrap(h * r), perlin_wrap(l * r), n * r, h * r) / r; + r /= 2.0; + } + double t = (q / 10.0 + 1.0) / 2.0; + bool bl2 = t >= 1.0, bl3 = t <= 0.0; + r = 1.0; + for (int u = 0; u < 16; u++) { + double v = perlin_wrap(d * r), w = perlin_wrap(e * r), x = perlin_wrap(f * r), y = m * r; + if (!bl2) { + const ImprovedNoise* noise = min_limit.octave(u); + if (noise) o += noise->noise(v, w, x, y, e * r) / r; + } + if (!bl3) { + const ImprovedNoise* noise = max_limit.octave(u); + if (noise) p += noise->noise(v, w, x, y, e * r) / r; + } + r /= 2.0; + } + return clamped_lerp(o / 512.0, p / 512.0, t) / 128.0; + } +}; + +// ---------------- SimplexNoise (2D, used by biome temperature noise) ---------------- +struct SimplexNoise { + int p[512]; + double xo, yo, zo; + static constexpr double SQRT3 = 1.7320508075688772; + + template + explicit SimplexNoise(R& random) { + xo = random.next_double() * 256.0; + yo = random.next_double() * 256.0; + zo = random.next_double() * 256.0; + for (int i = 0; i < 256; i++) p[i] = i; + for (int i = 0; i < 256; i++) { + int j = random.next_int(256 - i); + int k = p[i]; + p[i] = p[j + i]; + p[j + i] = k; + } + } + int P(int i) const { return p[i & 0xFF]; } + static double corner(int i, double d, double e, double f, double g) { + double h = g - d * d - e * e - f * f; + if (h < 0.0) return 0.0; + h *= h; + return h * h * grad_dot(i, d, e, f); + } + double value2(double d, double e) const { + const double F2 = 0.5 * (SQRT3 - 1.0); + const double G2 = (3.0 - SQRT3) / 6.0; + double f = (d + e) * F2; + int i = floor_int(d + f), j = floor_int(e + f); + double g = (double)(i + j) * G2; + double h = (double)i - g, k = (double)j - g; + double l = d - h, m = e - k; + int n, o; + if (l > m) { n = 1; o = 0; } else { n = 0; o = 1; } + double q = l - (double)n + G2, r = m - (double)o + G2; + double s = l - 1.0 + 2.0 * G2, t = m - 1.0 + 2.0 * G2; + int u = i & 0xFF, v = j & 0xFF; + int w = P(u + P(v)) % 12, x = P(u + n + P(v + o)) % 12, y = P(u + 1 + P(v + 1)) % 12; + return 70.0 * (corner(w, l, m, 0.0, 0.5) + corner(x, q, r, 0.0, 0.5) + corner(y, s, t, 0.0, 0.5)); + } +}; + +struct PerlinSimplexNoise { + std::vector> levels; + double input_factor = 1.0, value_factor = 1.0; + + PerlinSimplexNoise(LegacyRandom& random, const std::vector& octaves) { + int i = -octaves.front(), j = octaves.back(), k = i + j + 1; + auto has = [&](int o) { for (int v : octaves) if (v == o) return true; return false; }; + auto first = std::make_unique(random); + levels.resize(k); + int l = j; + if (l >= 0 && l < k && has(0)) levels[l] = std::move(first); + for (int m = l + 1; m < k; m++) { + if (m >= 0 && has(l - m)) levels[m] = std::make_unique(random); + else random.consume(262); + } + input_factor = std::pow(2.0, (double)j); + value_factor = 1.0 / (std::pow(2.0, (double)k) - 1.0); + } + double value(double d, double e, bool offsets) const { + double f = 0.0, g = input_factor, h = value_factor; + for (auto& s : levels) { + if (s) f += s->value2(d * g + (offsets ? s->xo : 0.0), e * g + (offsets ? s->yo : 0.0)) * h; + g /= 2.0; + h *= 2.0; + } + return f; + } +}; + +} // namespace vgen diff --git a/native/worldgen/random.h b/native/worldgen/random.h new file mode 100644 index 0000000..f73e6c7 --- /dev/null +++ b/native/worldgen/random.h @@ -0,0 +1,184 @@ +// ============================================================ +// PyMC - Vanilla random sources (Minecraft Java 1.21.1) +// +// Bit-exact ports of the random number generators used by world +// generation: Xoroshiro128++ (XoroshiroRandomSource and its positional +// factory), the MD5 based "seedFromHashOf" key derivation, and the +// java.util.Random LCG (LegacyRandomSource / WorldgenRandom). +// ============================================================ +#pragma once + +#include +#include +#include +#include + +namespace vgen { + +static constexpr uint64_t GOLDEN_RATIO_64 = 0x9E3779B97F4A7C15ULL; +static constexpr uint64_t SILVER_RATIO_64 = 0x6A09E667F3BCC909ULL; + +inline uint64_t rotl64(uint64_t x, int k) { return (x << k) | (x >> (64 - k)); } + +inline uint64_t mix_stafford13(uint64_t z) { + z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9ULL; + z = (z ^ (z >> 27)) * 0x94D049BB133111EBULL; + return z ^ (z >> 31); +} + +struct Seed128 { uint64_t lo, hi; }; + +inline Seed128 upgrade_seed_to_128(int64_t seed) { + uint64_t lo = (uint64_t)seed ^ SILVER_RATIO_64; + uint64_t hi = lo + GOLDEN_RATIO_64; + return {mix_stafford13(lo), mix_stafford13(hi)}; +} + +// ---------------- MD5 (RFC 1321) ---------------- +inline void md5(const uint8_t* msg, size_t len, uint8_t out[16]) { + static const uint32_t K[64] = { + 0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501, + 0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,0x6b901122,0xfd987193,0xa679438e,0x49b40821, + 0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,0xd62f105d,0x02441453,0xd8a1e681,0xe7d3fbc8, + 0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a, + 0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70, + 0x289b7ec6,0xeaa127fa,0xd4ef3085,0x04881d05,0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665, + 0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1, + 0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391}; + static const int R[64] = {7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20, + 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21}; + uint32_t h0 = 0x67452301, h1 = 0xefcdab89, h2 = 0x98badcfe, h3 = 0x10325476; + size_t padded = ((len + 8) / 64 + 1) * 64; + std::string buf((const char*)msg, len); + buf.push_back((char)0x80); + buf.resize(padded - 8, 0); + uint64_t bits = (uint64_t)len * 8; + for (int i = 0; i < 8; i++) buf.push_back((char)((bits >> (8 * i)) & 0xFF)); + for (size_t off = 0; off < padded; off += 64) { + uint32_t w[16]; + for (int i = 0; i < 16; i++) { + const uint8_t* p = (const uint8_t*)buf.data() + off + i * 4; + w[i] = (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); + } + uint32_t a = h0, b = h1, c = h2, d = h3; + for (int i = 0; i < 64; i++) { + uint32_t f; int g; + if (i < 16) { f = (b & c) | (~b & d); g = i; } + else if (i < 32) { f = (d & b) | (~d & c); g = (5 * i + 1) % 16; } + else if (i < 48) { f = b ^ c ^ d; g = (3 * i + 5) % 16; } + else { f = c ^ (b | ~d); g = (7 * i) % 16; } + uint32_t tmp = d; d = c; c = b; + uint32_t x = a + f + K[i] + w[g]; + b = b + ((x << R[i]) | (x >> (32 - R[i]))); + a = tmp; + } + h0 += a; h1 += b; h2 += c; h3 += d; + } + uint32_t hs[4] = {h0, h1, h2, h3}; + for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) out[i * 4 + j] = (uint8_t)((hs[i] >> (8 * j)) & 0xFF); +} + +// RandomSupport.seedFromHashOf: MD5 of the UTF-8 string, two big-endian longs. +inline Seed128 seed_from_hash_of(std::string_view s) { + uint8_t d[16]; + md5((const uint8_t*)s.data(), s.size(), d); + uint64_t lo = 0, hi = 0; + for (int i = 0; i < 8; i++) lo = (lo << 8) | d[i]; + for (int i = 8; i < 16; i++) hi = (hi << 8) | d[i]; + return {lo, hi}; +} + +// ---------------- Xoroshiro128++ ---------------- +struct Xoroshiro { + uint64_t lo, hi; + + Xoroshiro(uint64_t l, uint64_t h) : lo(l), hi(h) { + if ((lo | hi) == 0) { lo = GOLDEN_RATIO_64; hi = SILVER_RATIO_64; } + } + explicit Xoroshiro(int64_t seed) : Xoroshiro(upgrade_seed_to_128(seed).lo, upgrade_seed_to_128(seed).hi) {} + + uint64_t next_long() { + uint64_t l = lo, m = hi; + uint64_t n = rotl64(l + m, 17) + l; + m ^= l; + lo = rotl64(l, 49) ^ m ^ (m << 21); + hi = rotl64(m, 28); + return n; + } + int32_t next_int() { return (int32_t)next_long(); } + int32_t next_int(int32_t bound) { + uint64_t l = (uint64_t)(uint32_t)next_int(); + uint64_t m = l * (uint64_t)(int64_t)bound; + uint64_t n = m & 0xFFFFFFFFULL; + if (n < (uint64_t)bound) { + uint32_t j = (uint32_t)(~bound + 1) % (uint32_t)bound; + while (n < j) { + l = (uint64_t)(uint32_t)next_int(); + m = l * (uint64_t)(int64_t)bound; + n = m & 0xFFFFFFFFULL; + } + } + return (int32_t)(int64_t)(m >> 32); + } + int32_t next_int_between_inclusive(int32_t a, int32_t b) { return next_int(b - a + 1) + a; } + uint64_t next_bits(int bits) { return next_long() >> (64 - bits); } + double next_double() { return (double)next_bits(53) * 1.1102230246251565E-16; } + float next_float() { return (float)next_bits(24) * 5.9604645E-8f; } + bool next_boolean() { return (next_long() & 1ULL) != 0; } + void consume(int n) { for (int i = 0; i < n; i++) next_long(); } +}; + +// Mth.getSeed(x, y, z) +inline int64_t position_seed(int32_t x, int32_t y, int32_t z) { + int64_t l = (int64_t)(int32_t)((uint32_t)x * 3129871u) ^ ((int64_t)z * 116129781LL) ^ (int64_t)y; + l = (int64_t)((uint64_t)l * (uint64_t)l * 42317861ULL + (uint64_t)l * 11ULL); + return l >> 16; +} + +struct PositionalFactory { + uint64_t lo = 0, hi = 0; + PositionalFactory() = default; + PositionalFactory(uint64_t l, uint64_t h) : lo(l), hi(h) {} + + Xoroshiro at(int32_t x, int32_t y, int32_t z) const { + return Xoroshiro((uint64_t)position_seed(x, y, z) ^ lo, hi); + } + Xoroshiro from_hash_of(std::string_view key) const { + Seed128 s = seed_from_hash_of(key); + return Xoroshiro(s.lo ^ lo, s.hi ^ hi); + } +}; + +inline PositionalFactory fork_positional(Xoroshiro& r) { + uint64_t a = r.next_long(); + uint64_t b = r.next_long(); + return PositionalFactory(a, b); +} + +// ---------------- java.util.Random (LegacyRandomSource) ---------------- +struct LegacyRandom { + int64_t seed; + explicit LegacyRandom(int64_t s) { set_seed(s); } + void set_seed(int64_t s) { seed = (s ^ 0x5DEECE66DLL) & ((1LL << 48) - 1); } + int32_t next(int bits) { + seed = (int64_t)(((uint64_t)seed * 0x5DEECE66DULL + 0xBULL) & ((1ULL << 48) - 1)); + return (int32_t)(seed >> (48 - bits)); + } + int32_t next_int() { return next(32); } + int32_t next_int(int32_t bound) { + if ((bound & -bound) == bound) return (int32_t)(((int64_t)bound * (int64_t)next(31)) >> 31); + int32_t j, k; + do { j = next(31); k = j % bound; } while (j - k + (bound - 1) < 0); + return k; + } + int64_t next_long() { return ((int64_t)next(32) << 32) + (int64_t)next(32); } + double next_double() { + int64_t l = ((int64_t)next(26) << 27) + (int64_t)next(27); + return (double)l * 1.1102230246251565E-16; + } + float next_float() { return (float)next(24) * 5.9604645E-8f; } + bool next_boolean() { return next(1) != 0; } + void consume(int n) { for (int i = 0; i < n; i++) next_int(); } +}; + +} // namespace vgen diff --git a/native/worldgen/terrain.h b/native/worldgen/terrain.h new file mode 100644 index 0000000..878ca0c --- /dev/null +++ b/native/worldgen/terrain.h @@ -0,0 +1,1058 @@ +// ============================================================ +// PyMC - Vanilla overworld terrain (Minecraft Java 1.21.1) +// +// Noise stage of NoiseBasedChunkGenerator: biomes (multi-noise climate + +// parameter tree), terrain fill with cell interpolation, aquifers, ore +// veins, and the surface system (surface rules, badlands pillars, +// icebergs). Ported from the vanilla algorithms; the data (density +// functions, noises, surface rule, biome tree) comes from +// world/data/worldgen_overworld.json. +// ============================================================ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "density.h" +#include "json.h" +#include "noise.h" +#include "random.h" + +namespace vgen { + +static constexpr int MIN_Y = -64; +static constexpr int HEIGHT = 384; +static constexpr int MAX_Y = MIN_Y + HEIGHT - 1; +static constexpr int SECTIONS = HEIGHT / 16; +static constexpr int WAY_BELOW_MIN_Y = -2032; +static constexpr int BLOCKS_PER_CHUNK = HEIGHT * 256; + +inline int block_index(int lx, int y, int lz) { return (y - MIN_Y) * 256 + lz * 16 + lx; } + +// ---------------- SHA-256 (BiomeManager.obfuscateSeed) ---------------- +inline void sha256(const uint8_t* msg, size_t len, uint8_t out[32]) { + static const uint32_t k[64] = { + 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01, + 0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc, + 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147, + 0x06ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, + 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08, + 0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208, + 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2}; + uint32_t h[8] = {0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19}; + std::vector m(msg, msg + len); + m.push_back(0x80); + while (m.size() % 64 != 56) m.push_back(0); + uint64_t bits = (uint64_t)len * 8; + for (int i = 7; i >= 0; i--) m.push_back((uint8_t)(bits >> (8 * i))); + auto rotr = [](uint32_t x, int n) { return (x >> n) | (x << (32 - n)); }; + for (size_t off = 0; off < m.size(); off += 64) { + uint32_t w[64]; + for (int i = 0; i < 16; i++) + w[i] = ((uint32_t)m[off + 4 * i] << 24) | ((uint32_t)m[off + 4 * i + 1] << 16) | + ((uint32_t)m[off + 4 * i + 2] << 8) | (uint32_t)m[off + 4 * i + 3]; + for (int i = 16; i < 64; i++) { + uint32_t s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >> 3); + uint32_t s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >> 10); + w[i] = w[i - 16] + s0 + w[i - 7] + s1; + } + uint32_t a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7]; + for (int i = 0; i < 64; i++) { + uint32_t S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25); + uint32_t ch = (e & f) ^ (~e & g); + uint32_t t1 = hh + S1 + ch + k[i] + w[i]; + uint32_t S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22); + uint32_t mj = (a & b) ^ (a & c) ^ (b & c); + uint32_t t2 = S0 + mj; + hh = g; g = f; f = e; e = d + t1; d = c; c = b; b = a; a = t1 + t2; + } + h[0] += a; h[1] += b; h[2] += c; h[3] += d; h[4] += e; h[5] += f; h[6] += g; h[7] += hh; + } + for (int i = 0; i < 8; i++) for (int j = 0; j < 4; j++) out[i * 4 + j] = (uint8_t)(h[i] >> (24 - 8 * j)); +} + +// Guava Hashing.sha256().hashLong(seed).asLong(): little-endian in and out. +inline int64_t obfuscate_seed(int64_t seed) { + uint8_t in[8], out[32]; + for (int i = 0; i < 8; i++) in[i] = (uint8_t)((uint64_t)seed >> (8 * i)); + sha256(in, 8, out); + uint64_t v = 0; + for (int i = 7; i >= 0; i--) v = (v << 8) | out[i]; + return (int64_t)v; +} + +// ---------------- Biome parameter tree (cubiomes btree20 encoding) ---------------- +struct BiomeTree { + int order = 6; + std::vector steps; + std::vector params; // [min, max] pairs + std::vector nodes; + + void load(const Json& j) { + order = j["order"].as_int(); + for (auto& v : j["steps"].arr) steps.push_back((uint32_t)v.as_int()); + for (auto& p : j["params"].arr) { params.push_back((int32_t)p[0].as_int()); params.push_back((int32_t)p[1].as_int()); } + for (auto& n : j["nodes"].arr) nodes.push_back(std::stoull(n.str)); + } + uint64_t dist(const uint64_t np[6], int idx) const { + uint64_t ds = 0, node = nodes[idx]; + for (int i = 0; i < 6; i++) { + int p = (int)((node >> (8 * i)) & 0xFF); + uint64_t a = np[i] - (uint64_t)(int64_t)params[2 * p + 1]; + uint64_t b = (uint64_t)(int64_t)params[2 * p] - np[i]; + uint64_t d = (int64_t)a > 0 ? a : (int64_t)b > 0 ? b : 0; + ds += d * d; + } + return ds; + } + int resulting_node(const uint64_t np[6], int idx, int alt, uint64_t ds, int depth) const { + if (steps[depth] == 0) return idx; + uint32_t step; + do { step = steps[depth]; depth++; } while ((size_t)(idx + step) >= nodes.size()); + uint64_t node = nodes[idx]; + uint32_t inner = (uint32_t)(node >> 48); + int leaf = alt; + for (int i = 0; i < order; i++) { + uint64_t ds_inner = dist(np, (int)inner); + if (ds_inner < ds) { + int leaf2 = resulting_node(np, (int)inner, leaf, ds, depth); + uint64_t ds_leaf2 = ((int)inner == leaf2) ? ds_inner : dist(np, leaf2); + if (ds_leaf2 < ds) { ds = ds_leaf2; leaf = leaf2; } + } + inner += step; + if (inner >= nodes.size()) break; + } + return leaf; + } + int lookup(const int64_t target[6]) const { + uint64_t np[6]; + for (int i = 0; i < 6; i++) np[i] = (uint64_t)target[i]; + int idx = resulting_node(np, 0, 0, (uint64_t)-1, 0); + return (int)((nodes[idx] >> 48) & 0xFF); + } +}; + +// ---------------- Surface rules ---------------- +struct VerticalAnchor { + int kind = 0; // 0 absolute, 1 above_bottom, 2 below_top + int value = 0; + int resolve() const { return kind == 0 ? value : kind == 1 ? MIN_Y + value : MAX_Y - value; } + static VerticalAnchor parse(const Json& j) { + VerticalAnchor a; + if (j.has("absolute")) { a.kind = 0; a.value = j["absolute"].as_int(); } + else if (j.has("above_bottom")) { a.kind = 1; a.value = j["above_bottom"].as_int(); } + else if (j.has("below_top")) { a.kind = 2; a.value = j["below_top"].as_int(); } + return a; + } +}; + +enum class SC : uint8_t { Biome, NoiseThreshold, VerticalGradient, YAbove, Water, Temperature, Steep, Not, Hole, + AbovePreliminary, StoneDepth }; +enum class SR : uint8_t { Block, Sequence, Condition, Bandlands }; + +struct SurfaceCondition { + SC t; + std::vector biomes; // biome mask ids + int noise = -1; + double min = 0, max = 0; + int random = -1; // vertical gradient random factory index + VerticalAnchor a1, a2; + int mult = 0; + bool add_stone_depth = false; + int offset = 0; + bool add_surface_depth = false; + int secondary_range = 0; + bool ceiling = false; + int inner = -1; // for Not + uint64_t biome_mask = 0; +}; + +struct SurfaceRule { + SR t; + int state = 0; + std::vector children; + int condition = -1; + int then = -1; +}; + +struct BiomeClimate { float temperature = 0.8f; bool frozen = false; bool precipitation = true; }; + +// Column produced by the noise stage +struct TerrainChunk { + int chunk_x = 0, chunk_z = 0; + std::vector blocks; // y*256 + z*16 + x + std::array biomes{}; + std::array world_surface{}; // highest non-air y (incl. fluids), MIN_Y-1 if none + std::array ocean_floor{}; // highest solid (non-fluid) y + + uint16_t get(int lx, int y, int lz) const { + if (y < MIN_Y || y > MAX_Y) return 0; + return blocks[block_index(lx, y, lz)]; + } + void set(int lx, int y, int lz, uint16_t s) { + if (y < MIN_Y || y > MAX_Y) return; + blocks[block_index(lx, y, lz)] = s; + } + uint16_t biome_at(int lx, int y, int lz) const { + int qy = (std::max(MIN_Y, std::min(MAX_Y, y)) - MIN_Y) >> 2; + return biomes[(qy >> 2) * 64 + (qy & 3) * 16 + (lz >> 2) * 4 + (lx >> 2)]; + } +}; + +class Terrain { +public: + // block state ids + int AIR = 0, WATER = 80, LAVA = 96, STONE = 1, DEFAULT_BLOCK = 1, DEFAULT_FLUID = 80; + int GRANITE, TUFF, COPPER_ORE, DEEPSLATE_IRON_ORE, RAW_COPPER_BLOCK, RAW_IRON_BLOCK; + int TERRACOTTA, ORANGE_TC, YELLOW_TC, BROWN_TC, RED_TC, WHITE_TC, LIGHT_GRAY_TC; + int PACKED_ICE, SNOW_BLOCK, ICE; + + int64_t seed = 0; + int sea_level = 63; + bool aquifers_enabled = true, ore_veins_enabled = true; + DensityGraph graph; + PositionalFactory random; // RandomState.random + PositionalFactory aquifer_random, ore_random; + int r_final, r_initial, r_barrier, r_flood, r_spread, r_lava, r_vein_toggle, r_vein_ridged, r_vein_gap; + int r_temperature, r_vegetation, r_continents, r_erosion, r_depth, r_ridges; + BiomeTree biome_tree; + int64_t biome_zoom_seed = 0; + std::vector climates; + std::vector conditions; + std::vector rules; + int surface_root = -1; + std::vector gradient_randoms; + int n_surface, n_surface_secondary, n_clay_offset, n_badlands_pillar, n_badlands_roof, n_badlands_surface; + int n_iceberg_pillar, n_iceberg_roof, n_iceberg_surface; + std::array clay_bands{}; + std::unique_ptr temperature_noise, frozen_temperature_noise, biome_info_noise; + std::vector> spawn_target; // 6 [min,max] + offset + + void init(const Json& data, int64_t world_seed, bool deepslate_compat = false) { + seed = world_seed; + Xoroshiro base(seed); + random = fork_positional(base); + { + Xoroshiro r = random.from_hash_of("minecraft:aquifer"); + aquifer_random = fork_positional(r); + Xoroshiro o = random.from_hash_of("minecraft:ore"); + ore_random = fork_positional(o); + } + sea_level = data["sea_level"].as_int(); + aquifers_enabled = data["aquifers_enabled"].as_bool(); + ore_veins_enabled = data["ore_veins_enabled"].as_bool(); + DEFAULT_BLOCK = data["default_block"].as_int(); + DEFAULT_FLUID = data["default_fluid"].as_int(); + const Json& b = data["blocks"]; + auto blk = [&](const char* n) { return b[std::string("minecraft:") + n].as_int(); }; + AIR = blk("air"); WATER = blk("water"); LAVA = blk("lava"); STONE = blk("stone"); + GRANITE = blk("granite"); TUFF = blk("tuff"); COPPER_ORE = blk("copper_ore"); + DEEPSLATE_IRON_ORE = blk("deepslate_iron_ore"); RAW_COPPER_BLOCK = blk("raw_copper_block"); + RAW_IRON_BLOCK = blk("raw_iron_block"); TERRACOTTA = blk("terracotta"); ORANGE_TC = blk("orange_terracotta"); + YELLOW_TC = blk("yellow_terracotta"); BROWN_TC = blk("brown_terracotta"); RED_TC = blk("red_terracotta"); + WHITE_TC = blk("white_terracotta"); LIGHT_GRAY_TC = blk("light_gray_terracotta"); + PACKED_ICE = blk("packed_ice"); SNOW_BLOCK = blk("snow_block"); ICE = blk("ice"); + + graph.load(data, random, deepslate_compat); + const Json& router = data["router"]; + r_final = graph.compile(router["final_density"]); + r_initial = graph.compile(router["initial_density_without_jaggedness"]); + r_barrier = graph.compile(router["barrier"]); + r_flood = graph.compile(router["fluid_level_floodedness"]); + r_spread = graph.compile(router["fluid_level_spread"]); + r_lava = graph.compile(router["lava"]); + r_vein_toggle = graph.compile(router["vein_toggle"]); + r_vein_ridged = graph.compile(router["vein_ridged"]); + r_vein_gap = graph.compile(router["vein_gap"]); + r_temperature = graph.compile(router["temperature"]); + r_vegetation = graph.compile(router["vegetation"]); + r_continents = graph.compile(router["continents"]); + r_erosion = graph.compile(router["erosion"]); + r_depth = graph.compile(router["depth"]); + r_ridges = graph.compile(router["ridges"]); + + biome_tree.load(data["biome_tree"]); + biome_zoom_seed = obfuscate_seed(seed); + for (auto& kv : data["biomes"].obj) { + int id = std::stoi(kv.first); + if ((int)climates.size() <= id) climates.resize(id + 1); + climates[id].temperature = (float)kv.second["temperature"].as_double(); + climates[id].frozen = kv.second["frozen"].as_bool(); + climates[id].precipitation = kv.second["precipitation"].as_bool(true); + } + for (auto& p : data["spawn_target"].arr) { + std::array t{}; + const char* keys[6] = {"temperature", "humidity", "continentalness", "erosion", "depth", "weirdness"}; + for (int i = 0; i < 6; i++) { + const Json& v = p[keys[i]]; + double lo = v.is_array() ? v[0].as_double() : v.as_double(); + double hi = v.is_array() ? v[1].as_double() : v.as_double(); + t[2 * i] = quantize((float)lo); + t[2 * i + 1] = quantize((float)hi); + } + t[12] = quantize((float)p.get("offset", 0.0)); + spawn_target.push_back(t); + } + + n_surface = graph.get_noise("minecraft:surface"); + n_surface_secondary = graph.get_noise("minecraft:surface_secondary"); + n_clay_offset = graph.get_noise("minecraft:clay_bands_offset"); + n_badlands_pillar = graph.get_noise("minecraft:badlands_pillar"); + n_badlands_roof = graph.get_noise("minecraft:badlands_pillar_roof"); + n_badlands_surface = graph.get_noise("minecraft:badlands_surface"); + n_iceberg_pillar = graph.get_noise("minecraft:iceberg_pillar"); + n_iceberg_roof = graph.get_noise("minecraft:iceberg_pillar_roof"); + n_iceberg_surface = graph.get_noise("minecraft:iceberg_surface"); + generate_clay_bands(); + { + LegacyRandom r1(1234), r2(3456), r3(2345); + temperature_noise = std::make_unique(r1, std::vector{0}); + frozen_temperature_noise = std::make_unique(r2, std::vector{-2, -1, 0}); + biome_info_noise = std::make_unique(r3, std::vector{0}); + } + surface_root = compile_rule(data["surface_rule"]); + const Json& ids = data["biome_ids"]; + eroded_badlands_id = ids["minecraft:eroded_badlands"].as_int(); + frozen_ocean_id = ids["minecraft:frozen_ocean"].as_int(); + deep_frozen_ocean_id = ids["minecraft:deep_frozen_ocean"].as_int(); + for (auto& kv : ids.obj) biome_ids[kv.first] = kv.second.as_int(); + } + + std::map biome_ids; + int biome_id(const std::string& name) const { + auto it = biome_ids.find(name); + return it == biome_ids.end() ? -1 : it->second; + } + + static int64_t quantize(float f) { return (int64_t)(f * 10000.0f); } + + void new_eval(ChunkEval& ev) const { + ev.init(graph.slots_interp, graph.slots_flat, graph.slots_2d, graph.slots_once); + ev.min_y = MIN_Y; + } + + // ---------------- biomes ---------------- + void climate(int qx, int qy, int qz, ChunkEval* cc, int64_t out[6]) const { + int x = qx << 2, y = qy << 2, z = qz << 2; + out[0] = quantize((float)graph.eval(r_temperature, x, y, z, cc, false)); + out[1] = quantize((float)graph.eval(r_vegetation, x, y, z, cc, false)); + out[2] = quantize((float)graph.eval(r_continents, x, y, z, cc, false)); + out[3] = quantize((float)graph.eval(r_erosion, x, y, z, cc, false)); + out[4] = quantize((float)graph.eval(r_depth, x, y, z, cc, false)); + out[5] = quantize((float)graph.eval(r_ridges, x, y, z, cc, false)); + } + int noise_biome(int qx, int qy, int qz, ChunkEval* cc) const { + qy = std::max(MIN_Y >> 2, std::min(((MAX_Y + 1) >> 2) - 1, qy)); + int64_t t[6]; + climate(qx, qy, qz, cc, t); + return biome_tree.lookup(t); + } + + // BiomeManager.getBiome (fuzzy zoom) + static int64_t lcg_next(int64_t l, int64_t m) { + return (int64_t)((uint64_t)l * ((uint64_t)l * 6364136223846793005ULL + 1442695040888963407ULL) + (uint64_t)m); + } + static double fiddle(int64_t l) { + double d = (double)floor_mod((int)(l >> 24), 1024) / 1024.0; + return (d - 0.5) * 0.9; + } + double fiddled_distance(int i, int j, int k, double d, double e, double f) const { + int64_t s = biome_zoom_seed; + int64_t m = lcg_next(s, i); + m = lcg_next(m, j); m = lcg_next(m, k); m = lcg_next(m, i); m = lcg_next(m, j); m = lcg_next(m, k); + double g = fiddle(m); + m = lcg_next(m, s); + double h = fiddle(m); + m = lcg_next(m, s); + double n = fiddle(m); + return (f + n) * (f + n) + (e + h) * (e + h) + (d + g) * (d + g); + } + template + int zoomed_biome(int x, int y, int z, Lookup&& lookup) const { + int i = x - 2, j = y - 2, k = z - 2; + int l = i >> 2, m = j >> 2, n = k >> 2; + double d = (double)(i & 3) / 4.0, e = (double)(j & 3) / 4.0, f = (double)(k & 3) / 4.0; + int best = 0; + double best_dist = INFINITY; + for (int p = 0; p < 8; p++) { + bool bx = (p & 4) == 0, by = (p & 2) == 0, bz = (p & 1) == 0; + int q = bx ? l : l + 1, r = by ? m : m + 1, s = bz ? n : n + 1; + double h = bx ? d : d - 1.0, t = by ? e : e - 1.0, u = bz ? f : f - 1.0; + double v = fiddled_distance(q, r, s, h, t, u); + if (best_dist > v) { best = p; best_dist = v; } + } + int qx = (best & 4) == 0 ? l : l + 1; + int qy = (best & 2) == 0 ? m : m + 1; + int qz = (best & 1) == 0 ? n : n + 1; + return lookup(qx, qy, qz); + } + + // ---------------- biome temperature ---------------- + float base_temperature(int biome) const { return biome < (int)climates.size() ? climates[biome].temperature : 0.8f; } + float temperature(int biome, int x, int y, int z) const { + float f = base_temperature(biome); + if (biome < (int)climates.size() && climates[biome].frozen) { + double d = frozen_temperature_noise->value((double)x * 0.05, (double)z * 0.05, false) * 7.0; + double e = biome_info_noise->value((double)x * 0.2, (double)z * 0.2, false); + if (d + e < 0.3) { + double h = biome_info_noise->value((double)x * 0.09, (double)z * 0.09, false); + if (h < 0.8) f = 0.2f; + } + } + if (y > 80) { + float g = (float)(temperature_noise->value((double)((float)x / 8.0f), (double)((float)z / 8.0f), false) * 8.0); + return f - (g + (float)y - 80.0f) * 0.05f / 40.0f; + } + return f; + } + bool cold_enough_to_snow(int biome, int x, int y, int z) const { return !(temperature(biome, x, y, z) >= 0.15f); } + + // ---------------- spawn finder (Climate.findSpawnPosition) ---------------- + int64_t spawn_fitness(int x, int z) const { + double d = 2500.0 * 2500.0; + int64_t sq = (int64_t)x * x + (int64_t)z * z; + int64_t l = (int64_t)((double)(10000.0f * 10000.0f) * std::pow((double)sq / d, 2.0)); + int64_t t[6]; + climate(x >> 2, 0, z >> 2, nullptr, t); + t[4] = 0; + int64_t best = INT64_MAX; + for (auto& p : spawn_target) { + int64_t f = 0; + for (int i = 0; i < 6; i++) { + int64_t lo = p[2 * i], hi = p[2 * i + 1], v = t[i]; + int64_t dist = v - hi > 0 ? v - hi : (lo - v > 0 ? lo - v : 0); + f += dist * dist; + } + f += p[12] * p[12]; + best = std::min(best, f); + } + return l + best; + } + void find_spawn(int& out_x, int& out_z) const { + int bx = 0, bz = 0; + int64_t best = spawn_fitness(0, 0); + auto radial = [&](float max_r, float step) { + float h = 0.0f, i = step; + int cx = bx, cz = bz; + while (i <= max_r) { + int j = cx + (int)(std::sin((double)h) * (double)i); + int k = cz + (int)(std::cos((double)h) * (double)i); + int64_t f = spawn_fitness(j, k); + if (f < best) { best = f; bx = j; bz = k; } + h += step / i; + if (h > 6.2831855f) { h = 0.0f; i += step; } + } + }; + radial(2048.0f, 512.0f); + radial(512.0f, 32.0f); + out_x = bx; + out_z = bz; + } + + // ---------------- noise stage ---------------- + void generate(int chunk_x, int chunk_z, TerrainChunk& out) const { + out.chunk_x = chunk_x; + out.chunk_z = chunk_z; + out.blocks.assign(BLOCKS_PER_CHUNK, (uint16_t)AIR); + ChunkEval ev; + new_eval(ev); + ev.set_chunk(chunk_x, chunk_z); + const int min_x = chunk_x * 16, min_z = chunk_z * 16; + + // biomes + for (int sec = 0; sec < SECTIONS; sec++) + for (int qy = 0; qy < 4; qy++) + for (int qz = 0; qz < 4; qz++) + for (int qx = 0; qx < 4; qx++) + out.biomes[sec * 64 + qy * 16 + qz * 4 + qx] = (uint16_t)noise_biome( + (min_x >> 2) + qx, (MIN_Y >> 2) + sec * 4 + qy, (min_z >> 2) + qz, &ev); + + Aquifer aquifer(*this, chunk_x, chunk_z, ev); + for (int lx = 0; lx < 16; lx++) { + for (int lz = 0; lz < 16; lz++) { + int x = min_x + lx, z = min_z + lz; + for (int y = MAX_Y; y >= MIN_Y; y--) { + double density = graph.eval(r_final, x, y, z, &ev, true); + int state = aquifer.compute(x, y, z, density); + if (state < 0 && ore_veins_enabled) state = ore_vein(x, y, z, ev); + if (state < 0) state = DEFAULT_BLOCK; + out.blocks[block_index(lx, y, lz)] = (uint16_t)state; + } + } + } + update_heightmaps(out); + build_surface(out, ev, aquifer); + update_heightmaps(out); + } + + bool is_fluid(int s) const { return s == WATER || s == LAVA; } + + void update_heightmaps(TerrainChunk& c) const { + for (int lz = 0; lz < 16; lz++) + for (int lx = 0; lx < 16; lx++) { + int ws = MIN_Y - 1, of = MIN_Y - 1; + for (int y = MAX_Y; y >= MIN_Y; y--) { + int s = c.blocks[block_index(lx, y, lz)]; + if (s == AIR) continue; + if (ws == MIN_Y - 1) ws = y; + if (!is_fluid(s)) { of = y; break; } + } + c.world_surface[lz * 16 + lx] = (int16_t)ws; + c.ocean_floor[lz * 16 + lx] = (int16_t)of; + } + } + + // ---------------- ore veins ---------------- + int ore_vein(int x, int y, int z, ChunkEval& ev) const { + double d = graph.eval(r_vein_toggle, x, y, z, &ev, true); + bool copper = d > 0.0; + int max_y = copper ? 50 : -8, min_y = copper ? 0 : -60; + double e = std::fabs(d); + int j = max_y - y, k = y - min_y; + if (k < 0 || j < 0) return -1; + int l = std::min(j, k); + double f = clamped_map((double)l, 0.0, 20.0, -0.2, 0.0); + if (e + f < (double)0.4f) return -1; + Xoroshiro rs = ore_random.at(x, y, z); + if (rs.next_float() > 0.7f) return -1; + if (graph.eval(r_vein_ridged, x, y, z, &ev, true) >= 0.0) return -1; + double g = clamped_map(e, (double)0.4f, (double)0.6f, (double)0.1f, (double)0.3f); + if ((double)rs.next_float() < g && graph.eval(r_vein_gap, x, y, z, &ev, true) > (double)-0.3f) { + bool raw = rs.next_float() < 0.02f; + if (copper) return raw ? RAW_COPPER_BLOCK : COPPER_ORE; + return raw ? RAW_IRON_BLOCK : DEEPSLATE_IRON_ORE; + } + return copper ? GRANITE : TUFF; + } + + // ---------------- aquifer (NoiseBasedAquifer) ---------------- + struct FluidStatus { int level; int type; }; + + FluidStatus global_fluid(int x, int y, int z) const { + (void)x; (void)z; + if (y < std::min(-54, sea_level)) return {-54, LAVA}; + return {sea_level, DEFAULT_FLUID}; + } + + // NoiseChunk.preliminarySurfaceLevel + int preliminary_surface_level(int x, int z, ChunkEval& ev, std::unordered_map& cache) const { + int qx = (x >> 2) << 2, qz = (z >> 2) << 2; + int64_t key = ((int64_t)qx << 32) ^ (int64_t)(uint32_t)qz; + auto it = cache.find(key); + if (it != cache.end()) return it->second; + int result = INT_MAX; + for (int y = MIN_Y + HEIGHT; y >= MIN_Y; y -= 8) { + if (graph.eval(r_initial, qx, y, qz, &ev, false) > 0.390625) { result = y; break; } + } + cache.emplace(key, result); + return result; + } + + class Aquifer { + public: + Aquifer(const Terrain& t, int chunk_x, int chunk_z, ChunkEval& ev) : t_(t), ev_(ev) { + min_gx = floor_div(chunk_x * 16, 16) - 1; + int max_gx = floor_div(chunk_x * 16 + 15, 16) + 1; + size_x = max_gx - min_gx + 1; + min_gy = floor_div(MIN_Y, 12) - 1; + int max_gy = floor_div(MIN_Y + HEIGHT, 12) + 1; + size_y = max_gy - min_gy + 1; + min_gz = floor_div(chunk_z * 16, 16) - 1; + int max_gz = floor_div(chunk_z * 16 + 15, 16) + 1; + size_z = max_gz - min_gz + 1; + int n = size_x * size_y * size_z; + status_cache.assign(n, FluidStatus{0, -1}); + status_ready.assign(n, 0); + location_cache.assign(n, 0); + location_ready.assign(n, 0); + } + + std::unordered_map preliminary; + + int compute(int i, int j, int k, double density) { + if (density > 0.0) return -1; + if (!t_.aquifers_enabled) { + FluidStatus g = t_.global_fluid(i, j, k); + return j < g.level ? g.type : t_.AIR; + } + FluidStatus global = t_.global_fluid(i, j, k); + if (j < global.level && global.type == t_.LAVA) return t_.LAVA; + int l = floor_div(i - 5, 16), m = floor_div(j + 1, 12), n = floor_div(k - 5, 16); + int o = INT_MAX, p = INT_MAX, q = INT_MAX; + int r = 0, s = 0, tt = 0; // cache indices of the three closest centres + for (int u = 0; u <= 1; u++) + for (int v = -1; v <= 1; v++) + for (int w = 0; w <= 1; w++) { + int x = l + u, y = m + v, z = n + w; + int idx = index(x, y, z); + if (!location_ready[idx]) { + Xoroshiro rs = t_.aquifer_random.at(x, y, z); + int lx = x * 16 + rs.next_int(10); + int ly = y * 12 + rs.next_int(9); + int lz = z * 16 + rs.next_int(10); + location_cache[idx] = pack(lx, ly, lz); + location_ready[idx] = 1; + } + int64_t loc = location_cache[idx]; + int dx = unpack_x(loc) - i, dy = unpack_y(loc) - j, dz = unpack_z(loc) - k; + int dist = dx * dx + dy * dy + dz * dz; + if (o >= dist) { tt = s; s = r; r = idx; q = p; p = o; o = dist; } + else if (p >= dist) { tt = s; s = idx; q = p; p = dist; } + else if (q >= dist) { tt = idx; q = dist; } + } + FluidStatus st1 = status(r); + double e = similarity(o, p); + int bs = at(st1, j); + if (e <= 0.0) return bs; + if (bs == t_.WATER) { + FluidStatus below = t_.global_fluid(i, j - 1, k); + if (j - 1 < below.level && below.type == t_.LAVA) return bs; + } + double barrier = NAN; + FluidStatus st2 = status(s); + double f = e * pressure(i, j, k, barrier, st1, st2); + if (density + f > 0.0) return -1; + FluidStatus st3 = status(tt); + double g = similarity(o, q); + if (g > 0.0) { + double h = e * g * pressure(i, j, k, barrier, st1, st3); + if (density + h > 0.0) return -1; + } + double h = similarity(p, q); + if (h > 0.0) { + double a = e * h * pressure(i, j, k, barrier, st2, st3); + if (density + a > 0.0) return -1; + } + return bs; + } + + private: + const Terrain& t_; + ChunkEval& ev_; + int min_gx, min_gy, min_gz, size_x, size_y, size_z; + std::vector status_cache; + std::vector status_ready; + std::vector location_cache; + std::vector location_ready; + + static int64_t pack(int x, int y, int z) { + return (((int64_t)x & 0x3FFFFFF) << 38) | (((int64_t)z & 0x3FFFFFF) << 12) | ((int64_t)y & 0xFFF); + } + static int unpack_x(int64_t p) { return (int)(p >> 38); } + static int unpack_y(int64_t p) { return (int)((p << 52) >> 52); } + static int unpack_z(int64_t p) { return (int)((p << 26) >> 38); } + + int index(int x, int y, int z) const { + return ((y - min_gy) * size_z + (z - min_gz)) * size_x + (x - min_gx); + } + static double similarity(int a, int b) { return 1.0 - (double)std::abs(b - a) / 25.0; } + int at(const FluidStatus& s, int y) const { return y < s.level ? s.type : t_.AIR; } + + double pressure(int x, int y, int z, double& barrier, const FluidStatus& a, const FluidStatus& b) { + int sa = at(a, y), sb = at(b, y); + if ((sa == t_.LAVA && sb == t_.WATER) || (sa == t_.WATER && sb == t_.LAVA)) return 2.0; + int j = std::abs(a.level - b.level); + if (j == 0) return 0.0; + double d = 0.5 * (double)(a.level + b.level); + double e = (double)y + 0.5 - d; + double f = (double)j / 2.0; + double o = f - std::fabs(e); + double q; + if (e > 0.0) { double p = 0.0 + o; q = p > 0.0 ? p / 1.5 : p / 2.5; } + else { double p = 3.0 + o; q = p > 0.0 ? p / 3.0 : p / 10.0; } + double r; + if (q < -2.0 || q > 2.0) r = 0.0; + else { + if (std::isnan(barrier)) barrier = t_.graph.eval(t_.r_barrier, x, y, z, &ev_, true); + r = barrier; + } + return 2.0 * (r + q); + } + + FluidStatus status(int idx) { + if (status_ready[idx]) return status_cache[idx]; + int64_t loc = location_cache[idx]; + FluidStatus s = compute_fluid(unpack_x(loc), unpack_y(loc), unpack_z(loc)); + status_cache[idx] = s; + status_ready[idx] = 1; + return s; + } + + FluidStatus compute_fluid(int i, int j, int k) { + static const int OFFSETS[13][2] = {{0, 0}, {-2, -1}, {-1, -1}, {0, -1}, {1, -1}, {-3, 0}, {-2, 0}, + {-1, 0}, {1, 0}, {-2, 1}, {-1, 1}, {0, 1}, {1, 1}}; + FluidStatus fs = t_.global_fluid(i, j, k); + int l = INT_MAX, m = j + 12, n = j - 12; + bool bl = false; + for (auto& off : OFFSETS) { + int o = i + off[0] * 16, p = k + off[1] * 16; + int q = t_.preliminary_surface_level(o, p, ev_, preliminary); + int r = q + 8; + bool center = off[0] == 0 && off[1] == 0; + if (center && n > r) return fs; + bool bl3 = m > r; + if (bl3 || center) { + FluidStatus fs2 = t_.global_fluid(o, r, p); + if (at(fs2, r) != t_.AIR) { + if (center) bl = true; + if (bl3) return fs2; + } + } + l = std::min(l, q); + } + int s = surface_level(i, j, k, fs, l, bl); + return {s, fluid_type(i, j, k, fs, s)}; + } + + int surface_level(int i, int j, int k, const FluidStatus& fs, int l, bool bl) { + double d, e; + double erosion = t_.graph.eval(t_.r_erosion, i, j, k, &ev_, false); + double depth = t_.graph.eval(t_.r_depth, i, j, k, &ev_, false); + if (erosion < (double)-0.225f && depth > (double)0.9f) { d = -1.0; e = -1.0; } + else { + int m = l + 8 - j; + double f = bl ? clamped_map((double)m, 0.0, 64.0, 1.0, 0.0) : 0.0; + double g = clampd(t_.graph.eval(t_.r_flood, i, j, k, &ev_, false), -1.0, 1.0); + double h = map_range(f, 1.0, 0.0, -0.3, 0.8); + double nn = map_range(f, 1.0, 0.0, -0.8, 0.4); + d = g - nn; + e = g - h; + } + if (e > 0.0) return fs.level; + if (d > 0.0) return randomized_level(i, j, k, l); + return WAY_BELOW_MIN_Y; + } + + int randomized_level(int i, int j, int k, int l) { + int o = floor_div(i, 16), p = floor_div(j, 40), q = floor_div(k, 16); + int r = p * 40 + 20; + double d = t_.graph.eval(t_.r_spread, o, p, q, nullptr, false) * 10.0; + int tq = (int)std::floor(d / 3.0) * 3; + return std::min(l, r + tq); + } + + int fluid_type(int i, int j, int k, const FluidStatus& fs, int l) { + int b = fs.type; + if (l <= -10 && l != WAY_BELOW_MIN_Y && fs.type != t_.LAVA) { + int o = floor_div(i, 64), p = floor_div(j, 40), q = floor_div(k, 64); + double d = t_.graph.eval(t_.r_lava, o, p, q, nullptr, false); + if (std::fabs(d) > 0.3) b = t_.LAVA; + } + return b; + } + }; + + // ---------------- surface system ---------------- + void generate_clay_bands() { + Xoroshiro r = random.from_hash_of("minecraft:clay_bands"); + auto& b = clay_bands; + b.fill(TERRACOTTA); + for (int i = 0; i < 192; ++i) { + i += r.next_int(5) + 1; + if (i < 192) b[i] = ORANGE_TC; + } + auto bands = [&](int min_width, int state) { + int i = r.next_int_between_inclusive(6, 15); + for (int j = 0; j < i; ++j) { + int k = min_width + r.next_int(3); + int l = r.next_int(192); + for (int m = 0; l + m < 192 && m < k; ++m) b[l + m] = state; + } + }; + bands(1, YELLOW_TC); + bands(2, BROWN_TC); + bands(1, RED_TC); + int j = r.next_int_between_inclusive(9, 15); + int k = 0; + for (int l = 0; k < j && l < 192; l += r.next_int(16) + 4) { + b[l] = WHITE_TC; + if (l - 1 > 0 && r.next_boolean()) b[l - 1] = LIGHT_GRAY_TC; + if (l + 1 < 192 && r.next_boolean()) b[l + 1] = LIGHT_GRAY_TC; + ++k; + } + } + + int band(int x, int y, int z) const { + int i = (int)std::floor(graph.noises[n_clay_offset].value((double)x, 0.0, (double)z) * 4.0 + 0.5); + return clay_bands[floor_mod(y + i + 192, 192)]; + } + + int surface_depth(int x, int z) const { + double d = graph.noises[n_surface].value((double)x, 0.0, (double)z); + Xoroshiro r = random.at(x, 0, z); + return (int)(d * 2.75 + 3.0 + r.next_double() * 0.25); + } + + int compile_condition(const Json& j) { + SurfaceCondition c; + std::string t = j["type"].str; + if (t == "biome") { + c.t = SC::Biome; + for (auto& b : j["biome_is"].arr) c.biome_mask |= (1ULL << b.as_int()); + } else if (t == "noise_threshold") { + c.t = SC::NoiseThreshold; c.noise = graph.get_noise(j["noise"].str); + c.min = j["min_threshold"].as_double(); c.max = j["max_threshold"].as_double(); + } else if (t == "vertical_gradient") { + c.t = SC::VerticalGradient; + Xoroshiro r = random.from_hash_of(j["random_name"].str); + gradient_randoms.push_back(fork_positional(r)); + c.random = (int)gradient_randoms.size() - 1; + c.a1 = VerticalAnchor::parse(j["true_at_and_below"]); + c.a2 = VerticalAnchor::parse(j["false_at_and_above"]); + } else if (t == "y_above") { + c.t = SC::YAbove; c.a1 = VerticalAnchor::parse(j["anchor"]); + c.mult = j["surface_depth_multiplier"].as_int(); c.add_stone_depth = j["add_stone_depth"].as_bool(); + } else if (t == "water") { + c.t = SC::Water; c.offset = j["offset"].as_int(); + c.mult = j["surface_depth_multiplier"].as_int(); c.add_stone_depth = j["add_stone_depth"].as_bool(); + } else if (t == "temperature") { + c.t = SC::Temperature; + } else if (t == "steep") { + c.t = SC::Steep; + } else if (t == "not") { + c.t = SC::Not; c.inner = compile_condition(j["invert"]); + } else if (t == "hole") { + c.t = SC::Hole; + } else if (t == "above_preliminary_surface") { + c.t = SC::AbovePreliminary; + } else if (t == "stone_depth") { + c.t = SC::StoneDepth; c.offset = j["offset"].as_int(); + c.add_surface_depth = j["add_surface_depth"].as_bool(); + c.secondary_range = j["secondary_depth_range"].as_int(); + c.ceiling = j["surface_type"].str == "ceiling"; + } else { + throw std::runtime_error("unsupported surface condition: " + t); + } + conditions.push_back(c); + return (int)conditions.size() - 1; + } + + int compile_rule(const Json& j) { + SurfaceRule r; + std::string t = j["type"].str; + if (t == "block") { r.t = SR::Block; r.state = j["result_state"].as_int(); } + else if (t == "sequence") { + r.t = SR::Sequence; + for (auto& c : j["sequence"].arr) r.children.push_back(compile_rule(c)); + } else if (t == "condition") { + r.t = SR::Condition; + r.condition = compile_condition(j["if_true"]); + r.then = compile_rule(j["then_run"]); + } else if (t == "bandlands") { r.t = SR::Bandlands; } + else throw std::runtime_error("unsupported surface rule: " + t); + rules.push_back(r); + return (int)rules.size() - 1; + } + + struct SurfaceContext { + const Terrain* t; + TerrainChunk* chunk; + ChunkEval* ev; + std::unordered_map* preliminary; + std::unordered_map* biome_cache; + int block_x = 0, block_z = 0, block_y = 0; + int surface_depth = 0; + bool secondary_ready = false; double secondary = 0; + bool min_surface_ready = false; int min_surface = 0; + int water_height = INT_MIN, stone_depth_below = 0, stone_depth_above = 0; + bool biome_ready = false; int biome = 0; + + int get_biome() { + if (!biome_ready) { + biome = t->zoomed_biome(block_x, block_y, block_z, [&](int qx, int qy, int qz) { + qy = std::max(MIN_Y >> 2, std::min(((MAX_Y + 1) >> 2) - 1, qy)); + int64_t key = ((int64_t)(qx & 0x3FFFFF) << 42) | ((int64_t)(qz & 0x3FFFFF) << 20) | (int64_t)(qy & 0xFFFFF); + auto it = biome_cache->find(key); + if (it != biome_cache->end()) return it->second; + int b = t->noise_biome(qx, qy, qz, ev); + biome_cache->emplace(key, b); + return b; + }); + biome_ready = true; + } + return biome; + } + double get_secondary() { + if (!secondary_ready) { + secondary = t->graph.noises[t->n_surface_secondary].value((double)block_x, 0.0, (double)block_z); + secondary_ready = true; + } + return secondary; + } + int get_min_surface() { + if (!min_surface_ready) { + int i = block_x >> 4, j = block_z >> 4; + int c0 = t->preliminary_surface_level(i * 16, j * 16, *ev, *preliminary); + int c1 = t->preliminary_surface_level((i + 1) * 16, j * 16, *ev, *preliminary); + int c2 = t->preliminary_surface_level(i * 16, (j + 1) * 16, *ev, *preliminary); + int c3 = t->preliminary_surface_level((i + 1) * 16, (j + 1) * 16, *ev, *preliminary); + double fx = (double)((float)(block_x & 15) / 16.0f), fz = (double)((float)(block_z & 15) / 16.0f); + int k = floor_int(lerp2(fx, fz, (double)c0, (double)c1, (double)c2, (double)c3)); + min_surface = k + surface_depth - 8; + min_surface_ready = true; + } + return min_surface; + } + }; + + bool test(int ci, SurfaceContext& c) const { + const SurfaceCondition& k = conditions[ci]; + switch (k.t) { + case SC::Biome: return (k.biome_mask >> c.get_biome()) & 1ULL; + case SC::NoiseThreshold: { + double d = graph.noises[k.noise].value((double)c.block_x, 0.0, (double)c.block_z); + return d >= k.min && d <= k.max; + } + case SC::VerticalGradient: { + int i = k.a1.resolve(), j = k.a2.resolve(); + int y = c.block_y; + if (y <= i) return true; + if (y >= j) return false; + double d = map_range((double)y, (double)i, (double)j, 1.0, 0.0); + Xoroshiro r = gradient_randoms[k.random].at(c.block_x, y, c.block_z); + return (double)r.next_float() < d; + } + case SC::YAbove: + return c.block_y + (k.add_stone_depth ? c.stone_depth_above : 0) >= k.a1.resolve() + c.surface_depth * k.mult; + case SC::Water: + return c.water_height == INT_MIN || + c.block_y + (k.add_stone_depth ? c.stone_depth_above : 0) >= c.water_height + k.offset + c.surface_depth * k.mult; + case SC::Temperature: + return cold_enough_to_snow(c.get_biome(), c.block_x, c.block_y, c.block_z); + case SC::Steep: { + int i = c.block_x & 15, j = c.block_z & 15; + auto h = [&](int x, int z) { return (int)c.chunk->world_surface[z * 16 + x] + 1; }; + int kz = std::max(j - 1, 0), lz = std::min(j + 1, 15); + int m = h(i, kz), n = h(i, lz); + if (n >= m + 4) return true; + int o = std::max(i - 1, 0), p = std::min(i + 1, 15); + int q = h(o, j), r = h(p, j); + return q >= r + 4; + } + case SC::Not: return !test(k.inner, c); + case SC::Hole: return c.surface_depth <= 0; + case SC::AbovePreliminary: return c.block_y >= c.get_min_surface(); + case SC::StoneDepth: { + int i = k.ceiling ? c.stone_depth_below : c.stone_depth_above; + int j = k.add_surface_depth ? c.surface_depth : 0; + int kk = k.secondary_range == 0 ? 0 : + (int)map_range(c.get_secondary(), -1.0, 1.0, 0.0, (double)k.secondary_range); + return i <= 1 + k.offset + j + kk; + } + } + return false; + } + + int apply(int ri, SurfaceContext& c) const { + const SurfaceRule& r = rules[ri]; + switch (r.t) { + case SR::Block: return r.state; + case SR::Sequence: + for (int ch : r.children) { int s = apply(ch, c); if (s >= 0) return s; } + return -1; + case SR::Condition: return test(r.condition, c) ? apply(r.then, c) : -1; + case SR::Bandlands: return band(c.block_x, c.block_y, c.block_z); + } + return -1; + } + + bool is_stone(int s) const { return s != AIR && !is_fluid(s); } + + void build_surface(TerrainChunk& chunk, ChunkEval& ev, Aquifer& aquifer) const { + std::unordered_map biome_cache; + auto& prelim = aquifer.preliminary; + const int min_x = chunk.chunk_x * 16, min_z = chunk.chunk_z * 16; + for (int lx = 0; lx < 16; lx++) { + for (int lz = 0; lz < 16; lz++) { + int m = min_x + lx, n = min_z + lz; + int o = chunk.world_surface[lz * 16 + lx] + 2; // getHeight(WORLD_SURFACE_WG) + 1 + SurfaceContext probe{this, &chunk, &ev, &prelim, &biome_cache}; + probe.block_x = m; probe.block_z = n; probe.block_y = o; + int column_biome = probe.get_biome(); + if (column_biome == eroded_badlands_id) eroded_badlands(chunk, lx, lz, m, n, o); + int p = chunk.world_surface[lz * 16 + lx] + 2; + + SurfaceContext c{this, &chunk, &ev, &prelim, &biome_cache}; + c.block_x = m; c.block_z = n; + c.surface_depth = surface_depth(m, n); + int q = 0, r = INT_MIN, s = INT_MAX; + for (int u = std::min(p, MAX_Y + 1); u >= MIN_Y; --u) { + int bs = chunk.get(lx, u, lz); + if (bs == AIR) { q = 0; r = INT_MIN; continue; } + if (is_fluid(bs)) { if (r == INT_MIN) r = u + 1; continue; } + if (s >= u) { + s = WAY_BELOW_MIN_Y; + for (int v = u - 1; v >= MIN_Y - 1; --v) { + int b2 = v < MIN_Y ? AIR : chunk.get(lx, v, lz); + if (!is_stone(b2)) { s = v + 1; break; } + } + } + int v = u - s + 1; + c.stone_depth_above = ++q; + c.stone_depth_below = v; + c.water_height = r; + c.block_y = u; + c.biome_ready = false; + if (bs != DEFAULT_BLOCK) continue; + int st = apply(surface_root, c); + if (st >= 0) chunk.set(lx, u, lz, (uint16_t)st); + } + if (column_biome == frozen_ocean_id || column_biome == deep_frozen_ocean_id) + frozen_ocean(chunk, c.get_min_surface(), column_biome, lx, lz, m, n, o); + } + } + } + + int eroded_badlands_id = -1, frozen_ocean_id = -1, deep_frozen_ocean_id = -1; + + void eroded_badlands(TerrainChunk& chunk, int lx, int lz, int x, int z, int surface_y) const { + double e = std::min(std::fabs(graph.noises[n_badlands_surface].value((double)x, 0.0, (double)z) * 8.25), + graph.noises[n_badlands_pillar].value((double)x * 0.2, 0.0, (double)z * 0.2) * 15.0); + if (e <= 0.0) return; + double h = std::fabs(graph.noises[n_badlands_roof].value((double)x * 0.75, 0.0, (double)z * 0.75) * 1.5); + double l = 64.0 + std::min(e * e * 2.5, std::ceil(h * 50.0) + 24.0); + int m = floor_int(l); + if (surface_y > m) return; + for (int n = m; n >= MIN_Y; --n) { + int bs = chunk.get(lx, n, lz); + if (bs == DEFAULT_BLOCK) break; + if (bs == WATER) return; + } + for (int n = m; n >= MIN_Y && chunk.get(lx, n, lz) == AIR; --n) chunk.set(lx, n, lz, (uint16_t)DEFAULT_BLOCK); + if (chunk.world_surface[lz * 16 + lx] < m) chunk.world_surface[lz * 16 + lx] = (int16_t)m; + } + + void frozen_ocean(TerrainChunk& chunk, int min_surface, int biome, int lx, int lz, int x, int z, int surface_y) const { + double e = std::min(std::fabs(graph.noises[n_iceberg_surface].value((double)x, 0.0, (double)z) * 8.25), + graph.noises[n_iceberg_pillar].value((double)x * 1.28, 0.0, (double)z * 1.28) * 15.0); + if (e <= 1.8) return; + double h = std::fabs(graph.noises[n_iceberg_roof].value((double)x * 1.17, 0.0, (double)z * 1.17) * 1.5); + double i = std::min(e * e * 1.2, std::ceil(h * 40.0) + 14.0); + if (temperature(biome, x, 63, z) > 0.1f) i -= 2.0; + double j; + if (i > 2.0) { j = (double)sea_level - i - 7.0; i += (double)sea_level; } + else { i = 0.0; j = 0.0; } + double k = i; + Xoroshiro rs = random.at(x, 0, z); + int l = 2 + rs.next_int(4); + int m = sea_level + 18 + rs.next_int(10); + int n = 0; + for (int o = std::max(surface_y, (int)k + 1); o >= min_surface; --o) { + int bs = chunk.get(lx, o, lz); + bool place = (bs == AIR && o < (int)k && rs.next_double() > 0.01) || + (bs == WATER && o > (int)j && o < sea_level && j != 0.0 && rs.next_double() > 0.15); + if (!place) continue; + if (n <= l && o > m) { chunk.set(lx, o, lz, (uint16_t)SNOW_BLOCK); ++n; continue; } + chunk.set(lx, o, lz, (uint16_t)PACKED_ICE); + } + } +}; + +} // namespace vgen diff --git a/network/connection.py b/network/connection.py index 0063a0c..fd9bbe5 100755 --- a/network/connection.py +++ b/network/connection.py @@ -94,8 +94,27 @@ def __init__(self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter, self.keepalive_sent_at: float = 0.0 self.keepalive_rtt_ms: float | None = None self.teleport_id: int = 0 - - logger.info(f"新连接来自 {self.address}") + self.disconnect_reason: str = "" + self._cipher = None # StreamCipher (online-mode) + self.verify_token: bytes = b"" + self.profile_properties: list[dict] = [] # 皮肤等 (online-mode) + self.joined: bool = False # 已完成进服流程 (已广播加入消息) + + # 客户端设置 (Client Information) + self.locale: str = "en_us" + self.client_view_distance: int = 0 + self.skin_parts: int = 0x7F + self.main_hand: int = 1 + self.client_brand: str = "" + self.allow_server_listing: bool = True + + # 实体姿态标志 (潜行/疾跑), 用于同步给其他玩家 + self.sneaking: bool = False + self.sprinting: bool = False + self.flying: bool = False + self.last_active: float = 0.0 + + logger.debug(f"新连接来自 {self.address}") async def send_packet(self, packet_id: int, payload: bytes = b''): """发送数据包给客户端。""" @@ -103,28 +122,69 @@ async def send_packet(self, packet_id: int, payload: bytes = b''): return try: frame = pack_packet(packet_id, payload, self.compression_threshold) + if self._cipher is not None: + frame = self._cipher.encrypt(frame) self.writer.write(frame) await self.writer.drain() except (ConnectionError, OSError) as e: - logger.warning(f"发送数据包失败 [{self.address}]: {e}") + logger.debug(f"发送数据包失败 [{self.address}]: {e}") self.alive = False + def enable_encryption(self, shared_secret: bytes): + """启用 AES/CFB8 加密 (此后收发的所有字节都加密)。""" + from network.encryption import DecryptingReader, StreamCipher + self._cipher = StreamCipher(shared_secret) + self.reader = DecryptingReader(self.reader, self._cipher) + async def read_packet(self) -> tuple[int, bytes]: """读取一个数据包。返回 (数据包ID, 负载)。""" return await read_packet_async(self.reader, self.compression_threshold) - async def disconnect(self, reason: str = ""): - """断开连接。""" + async def disconnect(self, reason="", log: bool = True): + """ + 断开连接。 + + 登录/配置/游戏阶段会先发送对应状态的 Disconnect 数据包, + 客户端才能显示断开原因 (而不是 "Connection lost")。 + ``reason`` 可以是字符串或文本组件 dict。 + """ if not self.alive: return + from protocol.text import plain_text + reason_text = plain_text(reason) if reason else "" + if reason: + try: + await self._send_disconnect_packet(reason) + except Exception as e: # pragma: no cover - best effort + logger.debug(f"发送 Disconnect 数据包失败 [{self.address}]: {e}") self.alive = False - logger.info(f"断开连接 [{self.address}] {self.username or ''}: {reason}") + self.disconnect_reason = reason_text + if log and self.state in (ConnectionState.LOGIN, ConnectionState.CONFIGURATION, + ConnectionState.PLAY): + who = self.username or self.address + logger.info(f"Disconnecting {who} ({self.address}): {reason_text}") try: self.writer.close() await self.writer.wait_closed() except Exception: pass + async def _send_disconnect_packet(self, reason): + """按当前协议状态发送 Disconnect 数据包。""" + from protocol.text import component_to_json, encode_component + from protocol.data_types import write_string + if self.state == ConnectionState.LOGIN: + # Login Disconnect 始终是 JSON 文本组件 + await self.send_packet(0x00, write_string(component_to_json(reason))) + elif self.state == ConnectionState.CONFIGURATION: + pid = 0x02 if self.protocol_version >= 766 else 0x01 + await self.send_packet(pid, encode_component(reason, self.protocol_version)) + elif self.state == ConnectionState.PLAY: + from protocol.packet_map import get_clientbound_packet + pid = get_clientbound_packet(self.protocol_version, "disconnect") + if pid is not None: + await self.send_packet(pid, encode_component(reason, self.protocol_version)) + def generate_offline_uuid(self) -> uuid.UUID: """根据用户名生成离线模式 UUID。""" # 与 Java 版一致: UUID.nameUUIDFromBytes("OfflinePlayer:" + name) diff --git a/network/encryption.py b/network/encryption.py new file mode 100644 index 0000000..0fead79 --- /dev/null +++ b/network/encryption.py @@ -0,0 +1,133 @@ +# ============================================================ +# PyMC - 协议加密与正版验证 (online-mode=true) +# ============================================================ + +""" +Protocol encryption and Mojang session authentication. + +Login sequence when ``online-mode=true`` (identical to the vanilla server): + + C -> S Login Start (name) + S -> C Encryption Request (server id "", RSA public key, verify token) + C -> S Encryption Response (shared secret + verify token, RSA encrypted) + -- both directions switch to AES-128/CFB8 keyed with the secret -- + S GET sessionserver .../hasJoined?username=..&serverId= + S -> C Set Compression, Login Success (real UUID + signed skin textures) + +Requires the ``cryptography`` package; it is only imported when online mode +is enabled so offline servers have no extra dependency. +""" + +from __future__ import annotations + +import asyncio +import hashlib +import json +import logging +import os +import urllib.error +import urllib.parse +import urllib.request + +logger = logging.getLogger("minecraft.auth") + +SESSION_SERVER = "https://sessionserver.mojang.com/session/minecraft/hasJoined" + + +def available() -> bool: + try: + import cryptography # noqa: F401 + return True + except ImportError: + return False + + +class ServerKeyPair: + """The 1024-bit RSA key pair a vanilla server generates on startup.""" + + def __init__(self): + from cryptography.hazmat.primitives import serialization + from cryptography.hazmat.primitives.asymmetric import rsa + + self._private = rsa.generate_private_key(public_exponent=65537, key_size=1024) + self.public_der = self._private.public_key().public_bytes( + serialization.Encoding.DER, + serialization.PublicFormat.SubjectPublicKeyInfo, + ) + + def decrypt(self, data: bytes) -> bytes: + from cryptography.hazmat.primitives.asymmetric import padding + return self._private.decrypt(data, padding.PKCS1v15()) + + +class StreamCipher: + """AES-128/CFB8 in both directions, IV = shared secret.""" + + def __init__(self, shared_secret: bytes): + from cryptography.hazmat.primitives.ciphers import Cipher, algorithms + try: # cryptography >= 43 moved CFB8 to the "decrepit" namespace + from cryptography.hazmat.decrepit.ciphers.modes import CFB8 + except ImportError: + from cryptography.hazmat.primitives.ciphers.modes import CFB8 + cipher = Cipher(algorithms.AES(shared_secret), CFB8(shared_secret)) + self._encryptor = cipher.encryptor() + self._decryptor = cipher.decryptor() + + def encrypt(self, data: bytes) -> bytes: + return self._encryptor.update(data) + + def decrypt(self, data: bytes) -> bytes: + return self._decryptor.update(data) + + +class DecryptingReader: + """Wraps an asyncio StreamReader, decrypting everything read from it.""" + + def __init__(self, reader, cipher: StreamCipher): + self._reader = reader + self._cipher = cipher + + async def readexactly(self, n: int) -> bytes: + return self._cipher.decrypt(await self._reader.readexactly(n)) + + +def server_id_hash(server_id: str, shared_secret: bytes, public_key_der: bytes) -> str: + """Minecraft's signed-hex SHA-1 digest (two's complement, no zero padding).""" + digest = hashlib.sha1() + digest.update(server_id.encode("iso-8859-1")) + digest.update(shared_secret) + digest.update(public_key_der) + number = int.from_bytes(digest.digest(), byteorder="big", signed=True) + return format(number, "x") + + +def _fetch_profile(url: str) -> dict | None: + request = urllib.request.Request(url, headers={"User-Agent": "PyMC"}) + try: + with urllib.request.urlopen(request, timeout=10) as response: + if response.status != 200: + return None + body = response.read() + except urllib.error.HTTPError as e: + if e.code == 204: + return None + raise + if not body: + return None + return json.loads(body) + + +async def has_joined(username: str, server_hash: str, ip: str | None = None) -> dict | None: + """ + Ask the session server whether ``username`` authenticated for this login. + + Returns the game profile ``{"id", "name", "properties": [...]}`` or None + when the session is invalid. Raises OSError when the service is unreachable. + """ + base = os.environ.get("PYMC_SESSION_SERVER", SESSION_SERVER) + query = {"username": username, "serverId": server_hash} + if ip: + query["ip"] = ip + url = f"{base}?{urllib.parse.urlencode(query)}" + loop = asyncio.get_running_loop() + return await loop.run_in_executor(None, _fetch_profile, url) diff --git a/network/managers/gamerule.py b/network/managers/gamerule.py index 58c344c..0f4fbc5 100755 --- a/network/managers/gamerule.py +++ b/network/managers/gamerule.py @@ -93,7 +93,7 @@ def set(self, name: str, value: Any) -> bool: if name not in self._rules: return False self._rules[name] = self._coerce(name, value) - logger.info(f"游戏规则 {name} 已设置为 {self._rules[name]}") + logger.debug(f"游戏规则 {name} 已设置为 {self._rules[name]}") return True def has(self, name: str) -> bool: diff --git a/network/managers/time.py b/network/managers/time.py index 8bf09fc..1d9dd73 100755 --- a/network/managers/time.py +++ b/network/managers/time.py @@ -11,6 +11,7 @@ """ import logging +import random logger = logging.getLogger("PyMC.时间") @@ -30,26 +31,56 @@ class TimeManager: """ 世界时间管理器。 - - 管理游戏内时间 (0-23999 ticks)、昼夜循环和天气状态。 + + 与原版 level.dat 的字段对应: + - ``age`` Time: 世界总刻数, 始终递增 + - ``day_time_total`` DayTime: 昼夜时间, 受 doDaylightCycle 控制, 不取模 + - ``time`` DayTime % 24000 (向后兼容的一天内时间) + - 天气: raining / thundering + rainTime / thunderTime / clearWeatherTime + 倒计时, doWeatherCycle 开启时按原版的随机区间自然切换。 """ + RAIN_DURATION = (12000, 24000) + RAIN_DELAY = (12000, 180000) + THUNDER_DURATION = (3600, 15600) + THUNDER_DELAY = (12000, 180000) + def __init__(self, initial_time: int = 1000, do_daylight_cycle: bool = True): - self._time: int = initial_time % MAX_TIME + self._day_time: int = int(initial_time) + self._age: int = 0 self._do_daylight_cycle = do_daylight_cycle self._do_weather_cycle: bool = True self._weather: str = "clear" - self._weather_duration: int = 0 # ticks remaining + self._weather_duration: int = 0 # 当前天气剩余 tick (0 = 由自然循环决定) self._thunder_duration: int = 0 + self._natural_delay: int = random.randint(*self.RAIN_DELAY) @property def time(self) -> int: - """当前世界时间 (ticks)。""" - return self._time + """一天内的时间 (0-23999 ticks)。""" + return self._day_time % MAX_TIME @time.setter def time(self, value: int): - self._time = value % MAX_TIME + self._day_time = int(value) % MAX_TIME + + @property + def day_time_total(self) -> int: + """level.dat 的 DayTime (不取模, 含天数)。""" + return self._day_time + + @day_time_total.setter + def day_time_total(self, value: int): + self._day_time = max(0, int(value)) + + @property + def age(self) -> int: + """世界总刻数 (level.dat 的 Time)。""" + return self._age + + @age.setter + def age(self, value: int): + self._age = max(0, int(value)) @property def weather(self) -> str: @@ -86,20 +117,40 @@ def tick(self): 每游戏 tick 调用。 推进时间并更新天气。 """ + self._age += 1 if self._do_daylight_cycle: - self._time = (self._time + 1) % MAX_TIME + self._day_time += 1 # 天气持续计时 (doWeatherCycle=false 时天气保持不变) if not self._do_weather_cycle: return - if self._weather_duration > 0: - self._weather_duration -= 1 - if self._weather_duration == 0: - self._weather = "clear" if self._thunder_duration > 0: self._thunder_duration -= 1 if self._thunder_duration == 0 and self._weather == "thunder": self._weather = "rain" + if self._weather_duration > 0: + self._weather_duration -= 1 + if self._weather_duration == 0: + if self._weather == "clear": + self._start_natural_weather() + else: + self._weather = "clear" + self._thunder_duration = 0 + self._natural_delay = random.randint(*self.RAIN_DELAY) + return + if self._weather == "clear": + # 自然天气循环: 倒计时结束后开始下雨 (小概率雷暴) + self._natural_delay -= 1 + if self._natural_delay <= 0: + self._start_natural_weather() + + def _start_natural_weather(self): + self._weather = "rain" + self._weather_duration = random.randint(*self.RAIN_DURATION) + if random.random() < 0.25: + self._weather = "thunder" + self._thunder_duration = min( + self._weather_duration, random.randint(*self.THUNDER_DURATION)) def set_time(self, value) -> int: """ @@ -107,55 +158,60 @@ def set_time(self, value) -> int: 支持预设名称和数字值。 """ if isinstance(value, str): - value = TIME_PRESETS.get(value.lower()) - if value is None: + preset = TIME_PRESETS.get(value.lower()) + if preset is None: try: - value = int(value) + preset = int(value) except ValueError: logger.warning(f"无效的时间值: {value}") - return self._time - self._time = int(value) % MAX_TIME - return self._time + return self.time + value = preset + self._day_time = max(0, int(value)) + return self.time def add_time(self, ticks: int) -> int: """增加世界时间。""" - self._time = (self._time + ticks) % MAX_TIME - return self._time + self._day_time = max(0, self._day_time + int(ticks)) + return self.time def get_day_time(self) -> float: """获取以小时表示的游戏时间。""" - return (self._time / MAX_TIME) * 24.0 + return (self.time / MAX_TIME) * 24.0 def get_day_count(self) -> int: - """获取当前是第几天 (基于总时间)。""" - return self._time // MAX_TIME + """获取当前是第几天。""" + return self._day_time // MAX_TIME def is_daytime(self) -> bool: """判断是否为白天。""" - return 0 <= self._time < 12000 or self._time >= 23000 + return 0 <= self.time < 12000 or self.time >= 23000 def is_nighttime(self) -> bool: """判断是否为夜晚。""" - return 12000 <= self._time < 23000 + return 12000 <= self.time < 23000 def set_weather(self, weather: str, duration: int = 0): """ 设置天气。 - duration: 天气持续的 tick 数 (0 = 无限)。 + duration: 天气持续的 tick 数 (0 = 无限, 直到手动变更)。 """ if weather not in ("clear", "rain", "thunder"): return self._weather = weather - self._weather_duration = duration - if weather == "thunder": - self._thunder_duration = duration + self._weather_duration = max(0, int(duration)) + self._thunder_duration = self._weather_duration if weather == "thunder" else 0 + if weather == "clear" and self._weather_duration == 0: + self._natural_delay = random.randint(*self.RAIN_DELAY) def serialize(self) -> dict: """序列化时间状态。""" return { - "time": self._time, + "time": self.time, + "day_time": self._day_time, + "age": self._age, "weather": self._weather, "weather_duration": self._weather_duration, + "thunder_duration": self._thunder_duration, "do_daylight_cycle": self._do_daylight_cycle, "do_weather_cycle": self._do_weather_cycle, } @@ -164,10 +220,41 @@ def serialize(self) -> dict: def deserialize(cls, data: dict) -> 'TimeManager': """从字典反序列化。""" mgr = cls( - initial_time=data.get("time", 1000), + initial_time=data.get("day_time", data.get("time", 1000)), do_daylight_cycle=data.get("do_daylight_cycle", True), ) + mgr._age = int(data.get("age", 0)) mgr._weather = data.get("weather", "clear") mgr._weather_duration = data.get("weather_duration", 0) + mgr._thunder_duration = data.get("thunder_duration", 0) mgr._do_weather_cycle = data.get("do_weather_cycle", True) return mgr + + # ---- level.dat 互转 ---- + + def apply_level_data(self, level) -> None: + self._age = int(level.game_time) + self._day_time = int(level.day_time) + if level.raining and level.thundering: + self._weather = "thunder" + elif level.raining: + self._weather = "rain" + else: + self._weather = "clear" + if self._weather == "clear": + self._weather_duration = 0 + if level.rain_time > 0: + self._natural_delay = int(level.rain_time) + else: + self._weather_duration = int(level.rain_time) + self._thunder_duration = int(level.thunder_time) if level.thundering else 0 + + def write_level_data(self, level) -> None: + level.game_time = self._age + level.day_time = self._day_time + level.raining = self._weather in ("rain", "thunder") + level.thundering = self._weather == "thunder" + level.rain_time = (self._weather_duration if level.raining + else max(0, self._natural_delay)) + level.thunder_time = self._thunder_duration + level.clear_weather_time = 0 diff --git a/network/rcon.py b/network/rcon.py new file mode 100644 index 0000000..661a1ed --- /dev/null +++ b/network/rcon.py @@ -0,0 +1,133 @@ +# ============================================================ +# PyMC - RCON (Source RCON 协议) +# ============================================================ + +""" +Remote console, wire-compatible with the vanilla server's RCON +(``enable-rcon`` / ``rcon.port`` / ``rcon.password`` in server.properties). + +Packet layout (little endian): + int32 length | int32 request id | int32 type | payload (ASCII/UTF-8) | 0x00 0x00 + +Types: 3 = login, 2 = command (client -> server) / auth response, + 0 = command response. +""" + +from __future__ import annotations + +import asyncio +import hmac +import logging +import struct + +logger = logging.getLogger("minecraft.rcon") + +TYPE_RESPONSE = 0 +TYPE_COMMAND = 2 +TYPE_LOGIN = 3 +MAX_PAYLOAD = 4096 # vanilla splits responses at 4096 bytes +MAX_REQUEST = 1460 + 14 # vanilla rejects larger request packets + + +class RconServer: + def __init__(self, server, host: str, port: int, password: str): + self.server = server + self.host = host + self.port = port + self.password = password + self._listener: asyncio.AbstractServer | None = None + self._clients: set[asyncio.StreamWriter] = set() + + async def start(self) -> None: + try: + self._listener = await asyncio.start_server(self._handle, self.host, self.port) + except OSError as e: + logger.warning(f"Unable to initialise RCON on {self.host}:{self.port}: {e}") + return + logger.info(f"RCON running on {self.host}:{self.port}") + + async def stop(self) -> None: + if self._listener is not None: + self._listener.close() + self._listener = None + for writer in list(self._clients): + try: + writer.close() + except Exception: + pass + self._clients.clear() + + @staticmethod + def _pack(request_id: int, packet_type: int, payload: bytes) -> bytes: + body = struct.pack(" MAX_REQUEST: + break + body = await reader.readexactly(length) + request_id, packet_type = struct.unpack_from(" str: + """Run a command as the RCON source and return everything it printed.""" + from commands.framework import capture_console_output + from handlers.play.chat import execute_server_command + + command = command.strip() + if command.startswith("/"): + command = command[1:] + if not command: + return "" + logger.debug(f"[Rcon: /{address}] {command}") + with capture_console_output(source="Rcon") as lines: + try: + await execute_server_command(self.server, command) + except Exception as e: + logger.error(f"Error executing RCON command '{command}': {e}", exc_info=True) + lines.append(f"Error executing: {command} ({e})") + return "\n".join(lines) diff --git a/network/server.py b/network/server.py index 265475f..f24f4d9 100755 --- a/network/server.py +++ b/network/server.py @@ -10,7 +10,7 @@ from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from typing import Optional from config import save_config -from admin.permissions import PermissionManager +from admin.permissions import PermissionManager, UserCache from admin.web import WebAdminServer from .connection import Connection, ConnectionState from handlers.handshake import handle_handshake @@ -19,6 +19,7 @@ from handlers.configuration import handle_configuration from handlers.play import handle_play from world.storage import WorldStorage +from world.level_data import LevelData, SessionLock, SessionLockError from world.terrain import TerrainGenerator from world.terrain_native import NativeTerrainGenerator, _find_native_binary from world.chunk import build_chunk_column_from_terrain, build_heightmap_from_terrain @@ -37,6 +38,9 @@ from .managers.protocol import PacketCache, PacketBatcher logger = logging.getLogger("PyMC.服务器") +mc_logger = logging.getLogger("minecraft.server") + +MINECRAFT_VERSION = "1.21.1" def parse_vanilla_seed(seed_value) -> int: @@ -77,27 +81,16 @@ class MinecraftServer: def __init__(self, config: dict, config_path: str = "server.properties"): self.config = config self.config_path = config_path - self.host = config.get("server-ip", "0.0.0.0") + self.host = str(config.get("server-ip", "") or "") self.port = config.get("server-port", 25565) - self.motd = config.get("motd", "PyMC - Python Minecraft 服务器") + self.motd = config.get("motd", "A Minecraft Server") self.max_players = config.get("max-players", 20) self.online_mode = config.get("online-mode", False) self.compression_threshold = config.get("network-compression-threshold", 256) - self.view_distance = config.get("view-distance", 10) + self.view_distance = max(2, min(32, int(config.get("view-distance", 10)))) + self.simulation_distance = max( + 2, min(self.view_distance, int(config.get("simulation-distance", 10)))) self.autosave_enabled = True - # 使用 TimeManager 管理世界时间和天气 - self._time_manager = TimeManager(initial_time=1000) - self._gamerule_manager = GameruleManager() - - # 向后兼容属性 - self.world_time = 1000 - self.weather = "clear" - self.gamerules = self._gamerule_manager - self.spawn_position = ( - int(config.get("level-spawn-x", 0)), - int(config.get("level-spawn-y", 100)), - int(config.get("level-spawn-z", 0)), - ) self.chunk_generation_multithreading = config.get( "chunk-generation-multithreading", False ) @@ -107,11 +100,59 @@ def __init__(self, config: dict, config_path: str = "server.properties"): ) self.join_immediate_radius = max(0, int(config.get("join-immediate-radius", 2))) - # 世界存储 - world_name = config.get("level-name", "world") - self.world_storage = WorldStorage(world_name) - self.permissions = PermissionManager(config.get("permissions-file", "permissions.json")) + # 世界存储: // + world_name = str(config.get("level-name", "world") or "world") + universe = str(config.get("universe", "") or "") + self.level_name = world_name + world_path = os.path.join(universe, world_name) if universe else world_name + self.world_storage = WorldStorage( + world_path, region_format=str(config.get("region-file-format", "anvil"))) + self.session_lock = SessionLock(self.world_storage.world_dir) + + # level.dat: 出生点、世界时间、天气、游戏规则、种子 + self.level_data = LevelData.load(self.world_storage.world_dir) + self.level_data.level_name = world_name + self.seed = self._resolve_seed() + self.level_data.seed = self.seed + + self._time_manager = TimeManager(initial_time=0) + self._gamerule_manager = GameruleManager(self.level_data.gamerules or None) + if self.level_data.existed: + self._time_manager.apply_level_data(self.level_data) + if self.level_data.difficulty: + config["difficulty"] = self.level_data.difficulty + self.gamerules = self._gamerule_manager + + if self.level_data.spawn is not None: + self.spawn_position = tuple(int(v) for v in self.level_data.spawn) + self._spawn_resolved = True + else: + # 旧版本 PyMC 把出生点写在 server.properties 里 + self.spawn_position = ( + int(config.get("level-spawn-x", 0)), + int(config.get("level-spawn-y", 100)), + int(config.get("level-spawn-z", 0)), + ) + self._spawn_resolved = False + + # 权限 / OP / 封禁 / 白名单 (原版 JSON 文件) 与玩家名缓存 + permissions_file = config.get("permissions-file", "permissions.json") + base_dir = os.path.dirname(permissions_file) + self.usercache = UserCache(os.path.join(base_dir, "usercache.json")) + self.permissions = PermissionManager( + permissions_file, + default_op_level=int(config.get("op-permission-level", 4)), + usercache=self.usercache, + ) + whitelist = self.permissions.data["whitelist"] + if whitelist.get("enabled") and not config.get("white-list", False): + config["white-list"] = True # 迁移旧 permissions.json 的开关 + save_config(config, config_path) + whitelist["enabled"] = bool(config.get("white-list", False)) + self.permissions.on_whitelist_toggle = self._on_whitelist_toggle + self.web_admin: WebAdminServer | None = None + self.rcon = None self.loop: asyncio.AbstractEventLoop | None = None # 在线玩家列表 @@ -120,7 +161,11 @@ def __init__(self, config: dict, config_path: str = "server.properties"): # 服务器状态 self.running = False + self.accepting_players = False self.start_time = 0 + self._stopped = False + self._stop_event: asyncio.Event | None = None + self._ready_event = asyncio.Event() self._server: Optional[asyncio.Server] = None self._tick_task: Optional[asyncio.Task] = None self.terrain_generator = None @@ -156,6 +201,72 @@ def __init__(self, config: dict, config_path: str = "server.properties"): # 命令框架 self.command_manager = None # Initialized in main.py + # ------------------------------------------------------------------ + # 世界时间 / 天气 (委托给 TimeManager, 保证 /time /weather 修改持久生效) + # ------------------------------------------------------------------ + + @property + def world_time(self) -> int: + return self._time_manager.time + + @world_time.setter + def world_time(self, value: int): + self._time_manager.set_time(int(value)) + + @property + def weather(self) -> str: + return self._time_manager.weather + + @weather.setter + def weather(self, value: str): + self._time_manager.weather = value + + def _resolve_seed(self) -> int: + """ + 世界种子的来源优先级 (与原版一致: 已有世界以 level.dat 为准): + 1. level.dat 中记录的种子 + 2. server.properties 的 level-seed + 3. 旧存档 (有区域文件但没有 level.dat): 沿用旧行为 0 + 4. 全新世界: 随机种子 + """ + if self.level_data.existed: + return int(self.level_data.seed) + configured = str(self.config.get("level-seed", "") or "").strip() + if configured: + return parse_vanilla_seed(configured) + region_dir = self.world_storage.region_dir + try: + has_regions = any(region_dir.iterdir()) + except OSError: + has_regions = False + if has_regions: + return 0 + import random + return random.SystemRandom().randint(-(1 << 63), (1 << 63) - 1) + + def _on_whitelist_toggle(self, enabled: bool): + self.config["white-list"] = bool(enabled) + save_config(self.config, self.config_path) + + def save_level_data(self): + """把世界元数据写入 level.dat。""" + level = self.level_data + level.level_name = self.level_name + level.seed = self.seed + level.spawn = tuple(int(v) for v in self.spawn_position) + level.difficulty = str(self.config.get("difficulty", "easy")).lower() + level.gamemode = str(self.config.get("gamemode", "survival")).lower() + level.hardcore = bool(self.config.get("hardcore", False)) + level.gamerules = { + name: (str(value).lower() if isinstance(value, bool) else str(value)) + for name, value in self.gamerules.all_rules().items() + } + self._time_manager.write_level_data(level) + try: + level.save(self.world_storage.world_dir) + except OSError as e: + mc_logger.error(f"Failed to save level.dat: {e}") + def get_next_entity_id(self) -> int: """获取下一个可用的实体 ID。""" eid = self.next_entity_id @@ -195,8 +306,12 @@ def broadcast_packet(self, packet_id: int, payload: bytes, if conn != exclude: asyncio.ensure_future(conn.send_packet(packet_id, payload)) - def broadcast_system_message(self, text: str, exclude: Connection = None): - """向所有在线玩家广播系统聊天消息。""" + def broadcast_system_message(self, text, exclude: Connection = None, + log: bool = False): + """向所有在线玩家广播系统聊天消息 (字符串或文本组件)。""" + if log: + from protocol.text import plain_text + logging.getLogger("minecraft.server").info(plain_text(text)) for conn in self.get_online_players(): if conn != exclude and conn.version_handler is not None: asyncio.ensure_future(conn.version_handler.send_system_chat(conn, text)) @@ -253,6 +368,8 @@ def save_player_state(self, conn: Connection): "air_supply": conn.air_supply, "fire_ticks": conn.fire_ticks, "freeze_ticks": conn.freeze_ticks, + "flying": bool(getattr(conn, "flying", False)), + "selected_slot": int(getattr(conn, "selected_hotbar_slot", 0)), "personal_spawn": list(conn.personal_spawn) if conn.personal_spawn is not None else None, } @@ -268,41 +385,80 @@ def save_all_player_states(self): self.save_player_state(conn) async def start(self): - """启动服务器。""" + """ + 启动服务器并一直运行到 stop() 被调用。 + + 控制台输出顺序与原版专用服务端一致: + Default game type -> Starting Minecraft server on -> Preparing level + -> Preparing spawn area -> Done (N s)! For help, type "help" + """ if self.online_mode: - raise RuntimeError( - "online-mode=true is not supported yet: encryption and Mojang " - "session authentication are not implemented" - ) + from network import encryption + if not encryption.available(): + raise RuntimeError( + "online-mode=true requires the 'cryptography' package " + "(pip install cryptography), or set online-mode=false" + ) self.running = True + self._stopped = False self.start_time = time.time() self.loop = asyncio.get_running_loop() + self._stop_event = asyncio.Event() + + gamemode = str(self.config.get("gamemode", "survival")).upper() + mc_logger.info(f"Default game type: {gamemode}") + + if self.online_mode: + from network import encryption + mc_logger.info("Generating keypair") + self.keypair = encryption.ServerKeyPair() + + # --- 绑定端口 (与原版一样在加载世界之前) --- + bind_host = self.host or None + shown_host = self.host or "*" + mc_logger.info(f"Starting Minecraft server on {shown_host}:{self.port}") + try: + self._server = await asyncio.start_server( + self._handle_client, bind_host, self.port + ) + except OSError as e: + mc_logger.warning("**** FAILED TO BIND TO PORT!") + mc_logger.warning(f"The exception was: {e}") + mc_logger.warning("Perhaps a server is already running on that port?") + self.running = False + raise RuntimeError(f"Failed to bind to port {self.port}") from e + + if not self.online_mode: + mc_logger.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!") + mc_logger.warning("The server will make no attempt to authenticate usernames. Beware.") + mc_logger.warning( + "While this makes the game possible to play without internet access, " + "it also opens up the ability for hackers to connect with any username they choose.") + mc_logger.warning('To change this, set "online-mode" to "true" in the server.properties file.') + + # --- 加载世界 --- + mc_logger.info(f'Preparing level "{self.level_name}"') + try: + self.session_lock.acquire() + except SessionLockError as e: + self.running = False + self._server.close() + raise RuntimeError(str(e)) from e # 初始化世界存储 (Anvil -> Linear 自动转换) self.world_storage.initialize() container_manager.load(str(self.world_storage.world_dir)) self._initialize_terrain_generator() await self._pregenerate_spawn_area() - - self._server = await asyncio.start_server( - self._handle_client, - self.host, - self.port - ) + self.save_level_data() # 初始化红石引擎 if self.config.get("redstone-enabled", True): self.redstone_engine = RedstoneEngine(self) - logger.info("红石引擎已初始化") - else: - logger.info("红石引擎已禁用 (redstone-enabled=false)") # 初始化流体系统 if self.config.get("fluid-flow-enabled", True): self.fluid_system = FluidSystem(self) - logger.info("流体系统已初始化") - else: - logger.info("流体系统已禁用 (fluid-flow-enabled=false)") # 初始化网络优化器 self.network_optimizer = PlayerNetworkOptimizer(self) @@ -313,22 +469,18 @@ async def start(self): from commands import CommandManager, register_all_vanilla_commands self.command_manager = CommandManager(self) register_all_vanilla_commands(self.command_manager) - cmd_count = len(self.command_manager.commands) - logger.info(f"命令框架已初始化: {cmd_count} 个命令已注册") # Mod 管理器集成 (如果 main.py 没有提前初始化) if self.mod_manager is None: from mods.bridge import init_mod_system mods_dir = self.config.get("mods-directory", "mods") init_mod_system(self, mods_dir) - logger.info(f"Mod 管理器已初始化: {self.mod_manager.mod_count} 个 Mod 已启用") # 插件管理器集成 (如果 main.py 没有提前初始化) if self.plugin_manager is None: from plugins.bridge import init_plugin_system plugins_dir = self.config.get("plugins-directory", "plugins") init_plugin_system(self, plugins_dir) - logger.info(f"插件管理器已初始化: {self.plugin_manager.plugin_count} 个插件已启用") # 启动游戏循环 (20 TPS) self._tick_task = asyncio.create_task(self._game_loop()) @@ -346,33 +498,55 @@ async def start(self): logger.error(f"启动 Web 管理台失败: {e}") self.web_admin = None - addr = self._server.sockets[0].getsockname() - logger.info(f"服务器已启动,监听 {addr[0]}:{addr[1]}") - logger.info(f"游戏版本: 1.21.1 | 协议版本: 767 | 多版本支持: 1.8-1.21") - logger.info(f"支持协议版本: {self.config.get('min-protocol-version', 47)} - {self.config.get('max-protocol-version', 770)}") - logger.info(f"最大玩家数: {self.max_players}") - logger.info(f"在线模式: {'开启' if self.online_mode else '关闭 (离线模式)'}") - logger.info(f"数据包压缩阈值: {self.compression_threshold} 字节") - if self.should_use_multithreaded_generation(): - logger.info(f"区块生成模式: 多线程 ({self.chunk_generation_workers} 线程)") - else: - mode = "单线程" - if self._use_native_terrain: - mode = f"原生生成器内部并行 ({max(2, os.cpu_count() or 2)} 线程)" - logger.info(f"区块生成模式: {mode}") + if self.config.get("enable-rcon", False): + from network.rcon import RconServer + password = str(self.config.get("rcon.password", "") or "") + if not password: + mc_logger.warning("No rcon password set in server.properties, rcon disabled!") + else: + self.rcon = RconServer(self, self.host or "0.0.0.0", + int(self.config.get("rcon.port", 25575)), password) + await self.rcon.start() + + logger.debug( + f"协议 767 (原生) | 兼容协议 {self.config.get('min-protocol-version', 47)}-" + f"{self.config.get('max-protocol-version', 770)} | 压缩阈值 " + f"{self.compression_threshold} | 地形引擎 " + f"{'C++ 原生' if self._use_native_terrain else 'Python'}" + ) + self.accepting_players = True + self._ready_event.set() startup_time = time.time() - self.start_time - logger.info(f"启动完成,用时 {startup_time:.1f}s") + mc_logger.info(f'Done ({startup_time:.3f}s)! For help, type "help"') - async with self._server: - await self._server.serve_forever() + from mods.bridge import hook_server_start + try: + hook_server_start(self) + except Exception as e: + logger.debug(f"hook_server_start failed: {e}") + + # 注意: 不能用 ``async with self._server`` —— 3.12+ 的 wait_closed() + # 会一直等到所有玩家连接关闭, /stop 就永远停不下来。 + await self._stop_event.wait() + + async def wait_until_ready(self): + """等待服务器完成启动 (控制台命令在此之前排队)。""" + await self._ready_event.wait() + + def request_stop(self): + """请求停止服务器 (/stop、Ctrl+C、SIGTERM、RCON 均走这里)。""" + if self._stop_event is not None and not self._stop_event.is_set(): + mc_logger.info("Stopping the server") + self._stop_event.set() + self.accepting_players = False def _initialize_terrain_generator(self): """初始化地形生成器,并计算出生点高度。""" if self.terrain_generator is not None: return - seed = parse_vanilla_seed(self.config.get("level-seed", 0)) + seed = int(getattr(self, "seed", parse_vanilla_seed(self.config.get("level-seed", 0)))) # 与 world.terrain_native 共用跨平台查找逻辑,避免选中仓库中 # 已提交的其它平台二进制(例如 macOS 上误选 Linux ELF)。 @@ -390,22 +564,24 @@ def _initialize_terrain_generator(self): if native_gen.available: self.terrain_generator = native_gen self._use_native_terrain = True - logger.info(f"使用 C++ 原生地形生成器 (种子: {seed})") + logger.debug(f"使用 C++ 原生地形生成器 (种子: {seed})") elif use_vanilla: try: self.terrain_generator = VanillaTerrainGenerator(seed) self._use_native_terrain = False - logger.info(f"使用 Vanilla 地形生成器 (种子: {seed})") + logger.info("Native terrain generator unavailable, using the (slow) Python generator") except Exception as e: logger.warning(f"Vanilla 地形生成器初始化失败: {e},回退到基础生成器") self.terrain_generator = TerrainGenerator(seed) self._use_native_terrain = False - logger.info(f"使用纯 Python 地形生成器 (种子: {seed})") + logger.debug(f"使用纯 Python 地形生成器 (种子: {seed})") else: self.terrain_generator = TerrainGenerator(seed) self._use_native_terrain = False - logger.info(f"使用纯 Python 地形生成器 (种子: {seed})") + logger.debug(f"使用纯 Python 地形生成器 (种子: {seed})") + if getattr(self, "_spawn_resolved", False): + return # 出生点来自 level.dat, 不重新计算 spawn_x, _, spawn_z = self.spawn_position if self._use_native_terrain: _, hmap = self.terrain_generator.generate_chunk_with_heightmap( @@ -419,15 +595,13 @@ def _initialize_terrain_generator(self): def save_runtime_config(self): """将运行时配置写回 server.properties。""" self.config["difficulty"] = self.config.get("difficulty", "normal") - self.config["gamemode"] = self.config.get("gamemode", "creative") + self.config["gamemode"] = self.config.get("gamemode", "survival") self.config["chunk-generation-multithreading"] = self.chunk_generation_multithreading self.config["chunk-generation-workers"] = self.config.get("chunk-generation-workers", 0) self.config["join-immediate-radius"] = self.join_immediate_radius self.config["level-name"] = self.config.get("level-name", "world") - self.config["level-spawn-x"] = int(self.spawn_position[0]) - self.config["level-spawn-y"] = int(self.spawn_position[1]) - self.config["level-spawn-z"] = int(self.spawn_position[2]) save_config(self.config, self.config_path) + self.save_level_data() # 出生点保存在 level.dat def should_use_multithreaded_generation(self) -> bool: """是否启用 Python 侧多线程区块生成。""" @@ -491,7 +665,16 @@ def generate_chunk_results(self, chunk_coords: list[tuple[int, int]]): chunk_record_map = {} missing_coords: list[tuple[int, int]] = [] + built_cache = getattr(storage, "get_built_chunk", None) for cx, cz in chunk_coords: + built = built_cache(cx, cz) if built_cache is not None else None + if built is not None: + motion_blocking, world_surface, chunk_data = built + chunk_record_map[(cx, cz)] = ( + cx, cz, motion_blocking, world_surface, chunk_data, True, + storage.lazy_chunk_blocks(cx, cz), None + ) + continue loaded_chunk = storage.load_generated_chunk_with_biomes(cx, cz) if loaded_chunk is not None: chunk_blocks, chunk_biomes = loaded_chunk @@ -500,6 +683,8 @@ def generate_chunk_results(self, chunk_coords: list[tuple[int, int]]): motion_blocking = build_heightmap_from_terrain(chunk_blocks, include_water=False) world_surface = build_heightmap_from_terrain(chunk_blocks, include_water=True) chunk_data = build_chunk_column_from_terrain(chunk_blocks, chunk_biomes) + if built_cache is not None: + storage.put_built_chunk(cx, cz, motion_blocking, world_surface, chunk_data) chunk_record_map[(cx, cz)] = ( cx, cz, motion_blocking, world_surface, chunk_data, True, chunk_blocks, chunk_biomes ) @@ -548,11 +733,12 @@ def generate_chunk_results(self, chunk_coords: list[tuple[int, int]]): loaded += 1 continue self.world_storage.save_generated_chunk(cx, cz, chunk_blocks, chunk_biomes) + if built_cache is not None: + self.world_storage.put_built_chunk(cx, cz, motion_blocking, world_surface, chunk_data) generated += 1 if generated: self.world_storage.flush() - return results, loaded, generated def pregenerate_chunks(self, chunk_coords: list[tuple[int, int]]): @@ -613,49 +799,112 @@ def pregenerate_chunks(self, chunk_coords: list[tuple[int, int]]): return loaded, generated async def _pregenerate_spawn_area(self): - """服务器启动时预生成出生点周围的少量关键区块,确保玩家能进服。 - - 只预生成 join_immediate_radius 范围内的区块(默认 2 = 5x5 = 25 个), - 而不是完整视距范围。其余区块在玩家加入后按需流式加载。 - 这样纯 Python 地形生成器也能在几秒内完成。 """ + 服务器启动时准备出生点周围的区块, 并解析出安全的世界出生点。 + + 只准备 join_immediate_radius 范围内的区块 (默认 5x5), 其余区块在玩家 + 加入后按需流式加载。进度按原版格式输出 (Preparing spawn area: N%)。 + """ + mc_logger.info("Preparing start region for dimension minecraft:overworld") + if not getattr(self, "_spawn_resolved", False): + # New world: vanilla picks the spawn from the climate (land, not ocean) + from handlers.play.spawn import _climate_spawn_column + sx, sz = await asyncio.get_running_loop().run_in_executor(None, _climate_spawn_column, self) + self.spawn_position = (int(sx), int(self.spawn_position[1]), int(sz)) spawn_x, _, spawn_z = self.spawn_position center_cx = int(spawn_x) >> 4 center_cz = int(spawn_z) >> 4 - - # 只预生成小范围,确保玩家加入时有地面可站 + pregen_radius = min(self.join_immediate_radius, 3) # 最多 7x7 = 49 个 chunk_coords = [ (cx, cz) for cx in range(center_cx - pregen_radius, center_cx + pregen_radius + 1) for cz in range(center_cz - pregen_radius, center_cz + pregen_radius + 1) ] - - logger.info( - f"正在预生成出生点核心区块 {len(chunk_coords)} 个 " - f"(中心={center_cx},{center_cz} 半径={pregen_radius})..." - ) + total = len(chunk_coords) + progress = {"done": 0} def _generate_spawn_chunks(): - loaded, generated = self.pregenerate_chunks(chunk_coords) - return loaded, generated + # 分小批生成, 以便汇报进度 + batch = max(1, total // 8) + for index in range(0, total, batch): + if not self.running: + break + self.pregenerate_chunks(chunk_coords[index:index + batch]) + progress["done"] = min(total, index + batch) start = time.time() - loaded, generated = await asyncio.get_running_loop().run_in_executor( - None, _generate_spawn_chunks - ) - logger.info( - f"出生点核心区块预生成完成: 已缓存 {loaded} 个, 新生成 {generated} 个, " - f"耗时 {time.time() - start:.1f}s" - ) + future = asyncio.get_running_loop().run_in_executor(None, _generate_spawn_chunks) + worker_log = logging.getLogger("minecraft.worldgen") + last_report = 0.0 + while not future.done(): + await asyncio.wait([future], timeout=0.25) + now = time.time() + if not future.done() and now - last_report >= 0.5: + last_report = now + worker_log.info(f"Preparing spawn area: {progress['done'] * 100 // total}%") + await future + mc_logger.info(f"Time elapsed: {int((time.time() - start) * 1000)} ms") + + if not getattr(self, "_spawn_resolved", False): + # 首次创建世界: 在出生点附近寻找安全的落脚点并写入 level.dat + from handlers.play.spawn import find_world_spawn + try: + resolved = await asyncio.get_running_loop().run_in_executor(None, find_world_spawn, self) + self.spawn_position = tuple(int(v) for v in resolved) + logger.debug(f"World spawn: {self.spawn_position}") + except Exception as e: + logger.warning(f"无法解析安全出生点, 使用地表高度: {e}") + self._spawn_resolved = True async def stop(self): - """停止服务器。""" - logger.info("正在关闭服务器...") + """停止服务器: 踢出玩家、保存玩家与世界、释放资源 (可重复调用)。""" + if self._stopped: + return + self._stopped = True + was_running = self.running self.running = False + self.accepting_players = False + self._ready_event.set() # 释放仍在等待启动完成的控制台 + if self._stop_event is not None: + self._stop_event.set() + if not was_running: + return - self.save_all_player_states() - container_manager.save(str(self.world_storage.world_dir)) + mc_logger.info("Stopping server") + + from mods.bridge import hook_server_stop + try: + hook_server_stop(self) + except Exception as e: + logger.debug(f"hook_server_stop failed: {e}") + + if self.rcon is not None: + await self.rcon.stop() + self.rcon = None + + # 停止 TCP 监听, 不再接受新连接 + if self._server: + self._server.close() + + mc_logger.info("Saving players") + from protocol.text import translate + for conn in list(self.connections): + if conn.state == ConnectionState.PLAY and conn.username: + self.save_player_state(conn) + await conn.disconnect(translate("multiplayer.disconnect.server_shutdown"), log=False) + # 让各连接的收尾逻辑 (离开消息等) 先跑完 + await asyncio.sleep(0) + self.connections.clear() + + # 停止游戏循环 + if self._tick_task: + self._tick_task.cancel() + try: + await self._tick_task + except (asyncio.CancelledError, Exception): + pass + self._tick_task = None # 停止 Watchdog if self.watchdog_manager is not None: @@ -680,16 +929,20 @@ async def stop(self): self.network_optimizer = None # 保存世界数据 - logger.info("正在保存世界数据...") + mc_logger.info("Saving worlds") + mc_logger.info( + f"Saving chunks for level 'ServerLevel[{self.level_name}]'/minecraft:overworld") + container_manager.save(str(self.world_storage.world_dir)) + self.save_level_data() self.world_storage.close() - logger.info("世界数据已保存") + mc_logger.info(f"ThreadedAnvilChunkStorage ({self.level_name}): All chunks are saved") if self.web_admin: self.web_admin.stop() self.web_admin = None if self._chunk_executor: - self._chunk_executor.shutdown(wait=False, cancel_futures=False) + self._chunk_executor.shutdown(wait=False, cancel_futures=True) self._chunk_executor = None if self.terrain_generator is not None and hasattr(self.terrain_generator, "shutdown"): @@ -697,21 +950,7 @@ async def stop(self): self.terrain_generator = None self.entity_manager.shutdown() - - # 断开所有连接 - for conn in list(self.connections): - await conn.disconnect("服务器关闭") - self.connections.clear() - - # 停止游戏循环 - if self._tick_task: - self._tick_task.cancel() - - # 停止 TCP 监听 - if self._server: - self._server.close() - - logger.info("服务器已关闭") + self.session_lock.release() async def _handle_client(self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter): @@ -726,8 +965,10 @@ async def _handle_client(self, reader: asyncio.StreamReader, except asyncio.IncompleteReadError: # 客户端断开连接 break + except (ConnectionError, OSError): + break except ValueError as e: - logger.warning(f"数据包读取错误 [{conn.address}]: {e}") + logger.debug(f"数据包读取错误 [{conn.address}]: {e}") break # 根据连接状态分发数据包 @@ -744,9 +985,9 @@ async def _handle_client(self, reader: asyncio.StreamReader, await handle_play(conn, packet_id, payload, self) except Exception as e: logger.error(f"处理数据包异常 [{conn.address}] " - f"状态={conn.state.name} ID=0x{packet_id:02X}: {e}") - import traceback - traceback.print_exc() + f"状态={conn.state.name} ID=0x{packet_id:02X}: {e}", + exc_info=True) + await conn.disconnect({"translate": "multiplayer.disconnect.generic"}) break finally: # 清理连接 @@ -754,14 +995,26 @@ async def _handle_client(self, reader: asyncio.StreamReader, if conn in self.connections: self.connections.remove(conn) - # 如果玩家已登录,通知其他玩家 + # 已进入游戏的玩家: 保存、广播离开消息、通知其他客户端 if conn.username and conn.state == ConnectionState.PLAY: - self.save_player_state(conn) - # Plugin hook: fire PlayerQuitEvent - from mods.bridge import hook_player_quit - hook_player_quit(self, conn) - logger.info(f"玩家 {conn.username} 离开了游戏") - await self._handle_player_leave(conn) + reason = conn.disconnect_reason or "Disconnected" + mc_logger.info(f"{conn.username} lost connection: {reason}") + if conn.joined: + conn.joined = False + self.save_player_state(conn) + from mods.bridge import hook_player_quit + hook_player_quit(self, conn) + from protocol.text import translate, player_name + self.broadcast_system_message( + translate("multiplayer.player.left", player_name(conn), color="yellow"), + exclude=conn, log=True, + ) + await self._handle_player_leave(conn) + elif conn.username and conn.state in (ConnectionState.LOGIN, + ConnectionState.CONFIGURATION): + reason = conn.disconnect_reason or "Disconnected" + logging.getLogger("minecraft.auth").debug( + f"{conn.username} ({conn.address}) lost connection: {reason}") try: writer.close() @@ -793,108 +1046,146 @@ async def _handle_player_leave(self, conn: Connection): async def _game_loop(self): """ 服务器主游戏循环。 - 目标: 20 TPS (每 tick 50ms)。 + 目标: 20 TPS (每 tick 50ms)。落后过多时与原版一样输出 + "Can't keep up!" 警告并跳过积压的 tick。 """ tick_interval = 0.05 # 50ms per tick tick_count = 0 - keepalive_interval = 200 # 每 200 tick (10秒) 发一次心跳 + keepalive_interval = 300 # 每 300 tick (15秒) 发一次心跳 (与原版一致) world_flush_interval = 200 # 每 10 秒尝试落盘一次脏区块 autosave_interval = 6000 # 每 6000 tick (5分钟) 自动保存 + next_tick = time.monotonic() + last_overload_warning = 0.0 while self.running: - tick_start = time.time() tick_count += 1 + try: + await self._run_tick(tick_count, keepalive_interval, + world_flush_interval, autosave_interval) + except asyncio.CancelledError: + raise + except Exception as e: + logger.error(f"Exception in server tick loop: {e}", exc_info=True) + + # 固定步长调度: 落后时追赶, 落后超过 2 秒则放弃积压的 tick + next_tick += tick_interval + now = time.monotonic() + behind = now - next_tick + if behind > 2.0: + if now - last_overload_warning >= 15.0: + last_overload_warning = now + mc_logger.warning( + f"Can't keep up! Is the server overloaded? Running " + f"{int(behind * 1000)}ms or {int(behind / tick_interval)} ticks behind") + next_tick = now + await asyncio.sleep(max(0.0, next_tick - now)) + + async def _run_tick(self, tick_count: int, keepalive_interval: int, + world_flush_interval: int, autosave_interval: int): + """执行一个游戏刻。""" + # 使用 TimeManager 推进时间 + self._time_manager.do_daylight_cycle = self.gamerules.get("doDaylightCycle", True) + self._time_manager.do_weather_cycle = self.gamerules.get("doWeatherCycle", True) + old_weather = self.weather + old_time = self.world_time + self._time_manager.tick() + + # Plugin hooks + client sync: weather/time change + if self.weather != old_weather: + from handlers.play.weather import broadcast_weather_change + await broadcast_weather_change(self, old_weather, self.weather) + from plugins.bridge import hook_weather_change + hook_weather_change(self, old_weather, self.weather) + if self.world_time != old_time and tick_count % 200 == 0: + from plugins.bridge import hook_time_change + hook_time_change(self, old_time, self.world_time) + + # 更新指标 + self.metrics.tick() + + # 执行调度任务 + await self.scheduler.tick() + + # Plugin/mod tick hook + from plugins.bridge import hook_server_tick + hook_server_tick(self) + if self.mod_manager is not None: + from mods.bridge import hook_tick + hook_tick(self) + + # Process active furnace-like containers. + from world.block_behavior import container_manager + container_manager.tick_furnaces(self) - # 使用 TimeManager 推进时间 - self._time_manager.do_daylight_cycle = self.gamerules.get("doDaylightCycle", True) - self._time_manager.do_weather_cycle = self.gamerules.get("doWeatherCycle", True) - old_weather = self.weather - old_time = self.world_time - self._time_manager.tick() - self.world_time = self._time_manager.time - self.weather = self._time_manager.weather - - # Plugin hooks + client sync: weather/time change - if self.weather != old_weather: - from handlers.play.weather import broadcast_weather_change - await broadcast_weather_change(self, old_weather, self.weather) - from plugins.bridge import hook_weather_change - hook_weather_change(self, old_weather, self.weather) - if self.world_time != old_time and tick_count % 200 == 0: - from plugins.bridge import hook_time_change - hook_time_change(self, old_time, self.world_time) - - # 更新指标 - self.metrics.tick() - - # 执行调度任务 - await self.scheduler.tick() - - # Plugin/mod tick hook - from plugins.bridge import hook_server_tick - hook_server_tick(self) - if self.mod_manager is not None: - from mods.bridge import hook_tick - hook_tick(self) - - # Process active furnace-like containers. - from world.block_behavior import container_manager - container_manager.tick_furnaces(self) - - # 发送 KeepAlive 心跳 - if tick_count % keepalive_interval == 0: - await self._send_keepalive() - - # 自动保存世界数据 - if self.autosave_enabled and tick_count % autosave_interval == 0: - self.save_all_player_states() + # 发送 KeepAlive 心跳 + if tick_count % keepalive_interval == 0: + await self._send_keepalive() + + # 自动保存世界数据 (原版同样静默进行) + if self.autosave_enabled and tick_count % autosave_interval == 0: + self.save_all_player_states() + self.world_storage.flush() + container_manager.save(str(self.world_storage.world_dir)) + self.save_level_data() + + if self.autosave_enabled and tick_count % world_flush_interval == 0: + if self.world_storage.has_dirty_regions(): self.world_storage.flush() - container_manager.save(str(self.world_storage.world_dir)) - if self.autosave_enabled and tick_count % world_flush_interval == 0: - if self.world_storage.has_dirty_regions(): - self.world_storage.flush() + # 清理无效连接 + self.connections = [c for c in self.connections if c.alive] - # 清理无效连接 - self.connections = [c for c in self.connections if c.alive] + # 基础玩家生存规则 + await self._tick_players(tick_count) + self.entity_manager.tick() + if self.gamerules.get("doMobSpawning", True) and tick_count % 200 == 0: + self.entity_manager.spawn_natural_mobs() + await self._tick_entity_interactions() + if tick_count % 10 == 0: + await self._tick_entity_sync() - # 基础玩家生存规则 - await self._tick_players(tick_count) - self.entity_manager.tick() - if self.gamerules.get("doMobSpawning", True) and tick_count % 200 == 0: - self.entity_manager.spawn_natural_mobs() - await self._tick_entity_interactions() - if tick_count % 10 == 0: - await self._tick_entity_sync() + # Redstone tick (every 2 game ticks = 0.1s) + if tick_count % 2 == 0: + await self._tick_redstone() - # Redstone tick (every 2 game ticks = 0.1s) - if tick_count % 2 == 0: - await self._tick_redstone() + # 雷暴落雷 (每 5 秒一次判定) + if tick_count % 100 == 0: + await self._tick_lightning() - # 雷暴落雷 (每 5 秒一次判定) - if tick_count % 100 == 0: - await self._tick_lightning() + # Fluid system tick + if self.fluid_system is not None: + await self._tick_fluids(tick_count) - # Fluid system tick - if self.fluid_system is not None: - await self._tick_fluids(tick_count) + # Watchdog heartbeat (every second = every 20 ticks) + if self.watchdog_manager is not None and tick_count % 20 == 0: + await self.watchdog_manager.send_heartbeat() - # Watchdog heartbeat (every second = every 20 ticks) - if self.watchdog_manager is not None and tick_count % 20 == 0: - await self.watchdog_manager.send_heartbeat() + # Network optimizer flush + if self.network_optimizer is not None: + await self.network_optimizer.flush_all() - # Network optimizer flush - if self.network_optimizer is not None: - await self.network_optimizer.flush_all() + # Tab 列表延迟 (每 30 秒刷新一次) + if tick_count % 600 == 0: + await self._broadcast_latency() - # 定期输出服务器指标 - if self.metrics.should_report(): - logger.info(self.metrics.report()) + # 定期输出服务器指标 (仅调试) + if self.metrics.should_report(): + report = self.metrics.report() + logger.debug(report) - # 计算 tick 用时,补偿延迟 - elapsed = time.time() - tick_start - sleep_time = max(0, tick_interval - elapsed) - await asyncio.sleep(sleep_time) + async def _broadcast_latency(self): + """Player Info Update (Update Latency): 刷新 Tab 列表里的信号格。""" + from handlers.play.chat import build_player_info_update, INFO_LATENCY + from protocol.packet_map import get_clientbound_packet + players = self.get_online_players() + for player in players: + info = build_player_info_update(player, INFO_LATENCY) + for other in players: + if other.protocol_version < 761: + continue + pid = get_clientbound_packet(other.protocol_version, "player_info") + if pid is not None: + await other.send_packet(pid, info) async def _tick_lightning(self): """雷暴天气时在随机玩家附近落雷, 伤害落点附近的生物和玩家。""" @@ -913,7 +1204,7 @@ async def _tick_lightning(self): bolt = self.entity_manager.create_lightning(lx, ly, lz) from handlers.play import broadcast_entity_spawn await broadcast_entity_spawn(self, bolt) - logger.info( + logger.debug( f"闪电击中 ({lx:.1f}, {ly:.1f}, {lz:.1f}) " f"附近玩家 {target_player.username}" ) @@ -999,7 +1290,7 @@ async def _send_keepalive(self): for conn in self.get_online_players(): if (conn.keepalive_pending and time.monotonic() - conn.keepalive_sent_at > 30.0): - await conn.disconnect("KeepAlive timeout") + await conn.disconnect({"translate": "disconnect.timeout"}) continue conn.keepalive_id = keepalive_id conn.keepalive_pending = True @@ -1010,18 +1301,30 @@ async def _send_keepalive(self): await conn.send_packet(pid, payload) async def _tick_players(self, tick_count: int): - """处理最基础的玩家伤害与时间同步。""" + """处理最基础的玩家伤害、挂机超时与时间同步。""" from handlers.play import _damage_player, _send_time_update, _tick_damage_effects + idle_minutes = int(self.config.get("player-idle-timeout", 0) or 0) + now = time.monotonic() + for conn in self.get_online_players(): - if conn.y < -80: - await _damage_player(conn, 20.0, "虚空", self) + if not conn.joined: + continue + if getattr(conn, "_dead", False): + continue + if conn.y < -128: + await _damage_player(conn, 4.0, "虚空", self) await _tick_damage_effects(conn, self, tick_count) - if tick_count % 40 == 0: + if tick_count % 20 == 0: await _send_time_update(conn, self) + if (idle_minutes > 0 and tick_count % 20 == 0 and conn.last_active + and now - conn.last_active > idle_minutes * 60 + and not self.permissions.is_op(conn.username)): + await conn.disconnect({"translate": "multiplayer.disconnect.idling"}) + async def _tick_entity_interactions(self): """处理实体与玩家的基础交互:拾取、经验、近战伤害。""" from handlers.play import ( @@ -1038,7 +1341,11 @@ async def _tick_entity_interactions(self): for entity in list(self.entity_manager.list_entities()): if entity.kind in {"orb", "item"}: for player in players: - if entity.distance_squared_to(player.x, player.y, player.z) > 2.25: + # 原版拾取范围: 玩家碰撞箱水平外扩 1 格、垂直外扩 0.5 格 + if (abs(entity.x - player.x) > 1.425 or abs(entity.z - player.z) > 1.425 + or not (-0.75 <= entity.y - player.y <= 2.3)): + continue + if getattr(player, "_dead", False) or getattr(player, "gamemode", "") == "spectator": continue if entity.kind == "item" and getattr(entity, "pickup_delay", 0) > 0: continue @@ -1068,9 +1375,6 @@ async def _tick_entity_interactions(self): entity.count = leftover entity.metadata["count"] = leftover await send_inventory_sync(player) - await send_system_message( - player, f"[PyMC] 拾取 {item_name} x{accepted}" - ) break if entity.kind == "mob" and entity.metadata.get("category") == "hostile": diff --git a/plugins/__init__.py b/plugins/__init__.py index 72b0c8c..68536c9 100755 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -446,7 +446,7 @@ def discover_plugins(self, plugins_dir: Optional[str] = None) -> List[PluginInfo search_path = Path(search_dir) if not search_path.is_dir(): - logger.warning(f"Plugins directory does not exist: {search_dir}") + logger.debug(f"Plugins directory does not exist: {search_dir}") return [] discovered = [] @@ -601,7 +601,7 @@ def shutdown_all(self): """Disable all plugins in reverse load order.""" for plugin_id in reversed(self._load_order): self.disable_plugin(plugin_id) - logger.info("All plugins shut down") + logger.debug("All plugins shut down") # --- Event System --- diff --git a/plugins/bridge.py b/plugins/bridge.py index 2c2f90c..dd105d4 100755 --- a/plugins/bridge.py +++ b/plugins/bridge.py @@ -897,14 +897,14 @@ def init_plugin_system(server, plugins_dir: str = "plugins") -> 'PluginManager': # Discover and load plugins discovered = pm.discover_plugins(plugins_dir) - logger.info(f"Discovered {len(discovered)} plugins in {plugins_dir}") + logger.debug(f"Discovered {len(discovered)} plugins in {plugins_dir}") loaded = pm.load_all() - logger.info(f"Loaded {loaded} plugins") + logger.debug(f"Loaded {loaded} plugins") pm.enable_all() enabled = pm.plugin_count - logger.info(f"Enabled {enabled} plugins") + logger.debug(f"Enabled {enabled} plugins") # Register plugin commands into CommandManager register_plugin_commands(server) @@ -963,4 +963,4 @@ def shutdown_plugin_system(server): cm.unregister(cmd_name) logger.debug(f"Unregistered plugin command: /{cmd_name}") - logger.info("Plugin system shut down") + logger.debug("Plugin system shut down") diff --git a/protocol/data/commands_767.json b/protocol/data/commands_767.json new file mode 100644 index 0000000..5959598 --- /dev/null +++ b/protocol/data/commands_767.json @@ -0,0 +1 @@ +{"parsers":{"brigadier:bool":0,"brigadier:float":1,"brigadier:double":2,"brigadier:integer":3,"brigadier:long":4,"brigadier:string":5,"minecraft:entity":6,"minecraft:game_profile":7,"minecraft:block_pos":8,"minecraft:column_pos":9,"minecraft:vec3":10,"minecraft:vec2":11,"minecraft:block_state":12,"minecraft:block_predicate":13,"minecraft:item_stack":14,"minecraft:item_predicate":15,"minecraft:color":16,"minecraft:component":17,"minecraft:style":18,"minecraft:message":19,"minecraft:nbt":20,"minecraft:nbt_tag":21,"minecraft:nbt_path":22,"minecraft:objective":23,"minecraft:objective_criteria":24,"minecraft:operation":25,"minecraft:particle":26,"minecraft:angle":27,"minecraft:rotation":28,"minecraft:scoreboard_slot":29,"minecraft:score_holder":30,"minecraft:swizzle":31,"minecraft:team":32,"minecraft:item_slot":33,"minecraft:item_slots":34,"minecraft:resource_location":35,"minecraft:function":36,"minecraft:entity_anchor":37,"minecraft:int_range":38,"minecraft:float_range":39,"minecraft:dimension":40,"minecraft:gamemode":41,"minecraft:time":42,"minecraft:resource_or_tag":43,"minecraft:resource_or_tag_key":44,"minecraft:resource":45,"minecraft:resource_key":46,"minecraft:template_mirror":47,"minecraft:template_rotation":48,"minecraft:heightmap":49,"minecraft:loot_table":50,"minecraft:loot_predicate":51,"minecraft:loot_modifier":52,"minecraft:uuid":53},"tree":{"type":"root","children":{"advancement":{"type":"literal","children":{"grant":{"type":"literal","children":{"targets":{"type":"argument","children":{"everything":{"type":"literal","executable":true},"from":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"only":{"type":"literal","children":{"advancement":{"type":"argument","children":{"criterion":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"greedy"}}},"executable":true,"parser":"minecraft:resource_location"}}},"through":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"until":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"revoke":{"type":"literal","children":{"targets":{"type":"argument","children":{"everything":{"type":"literal","executable":true},"from":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"only":{"type":"literal","children":{"advancement":{"type":"argument","children":{"criterion":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"greedy"}}},"executable":true,"parser":"minecraft:resource_location"}}},"through":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"until":{"type":"literal","children":{"advancement":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}}}},"attribute":{"type":"literal","children":{"target":{"type":"argument","children":{"attribute":{"type":"argument","children":{"base":{"type":"literal","children":{"get":{"type":"literal","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true},"set":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:double"}}}}},"get":{"type":"literal","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true},"modifier":{"type":"literal","children":{"add":{"type":"literal","children":{"id":{"type":"argument","children":{"value":{"type":"argument","children":{"add_multiplied_base":{"type":"literal","executable":true},"add_multiplied_total":{"type":"literal","executable":true},"add_value":{"type":"literal","executable":true}},"parser":"brigadier:double"}},"parser":"minecraft:resource_location"}}},"remove":{"type":"literal","children":{"id":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"value":{"type":"literal","children":{"get":{"type":"literal","children":{"id":{"type":"argument","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true,"parser":"minecraft:resource_location"}}}}}}}},"parser":"minecraft:resource","properties":{"registry":"minecraft:attribute"}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"ban":{"type":"literal","children":{"targets":{"type":"argument","children":{"reason":{"type":"argument","executable":true,"parser":"minecraft:message"}},"executable":true,"parser":"minecraft:game_profile"}}},"ban-ip":{"type":"literal","children":{"target":{"type":"argument","children":{"reason":{"type":"argument","executable":true,"parser":"minecraft:message"}},"executable":true,"parser":"brigadier:string","properties":{"type":"word"}}}},"banlist":{"type":"literal","children":{"ips":{"type":"literal","executable":true},"players":{"type":"literal","executable":true}},"executable":true},"bossbar":{"type":"literal","children":{"add":{"type":"literal","children":{"id":{"type":"argument","children":{"name":{"type":"argument","executable":true,"parser":"minecraft:component"}},"parser":"minecraft:resource_location"}}},"get":{"type":"literal","children":{"id":{"type":"argument","children":{"max":{"type":"literal","executable":true},"players":{"type":"literal","executable":true},"value":{"type":"literal","executable":true},"visible":{"type":"literal","executable":true}},"parser":"minecraft:resource_location"}}},"list":{"type":"literal","executable":true},"remove":{"type":"literal","children":{"id":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"set":{"type":"literal","children":{"id":{"type":"argument","children":{"color":{"type":"literal","children":{"blue":{"type":"literal","executable":true},"green":{"type":"literal","executable":true},"pink":{"type":"literal","executable":true},"purple":{"type":"literal","executable":true},"red":{"type":"literal","executable":true},"white":{"type":"literal","executable":true},"yellow":{"type":"literal","executable":true}}},"max":{"type":"literal","children":{"max":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":1}}}},"name":{"type":"literal","children":{"name":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"players":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"style":{"type":"literal","children":{"notched_10":{"type":"literal","executable":true},"notched_12":{"type":"literal","executable":true},"notched_20":{"type":"literal","executable":true},"notched_6":{"type":"literal","executable":true},"progress":{"type":"literal","executable":true}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}}},"visible":{"type":"literal","children":{"visible":{"type":"argument","executable":true,"parser":"brigadier:bool"}}}},"parser":"minecraft:resource_location"}}}}},"clear":{"type":"literal","children":{"targets":{"type":"argument","children":{"item":{"type":"argument","children":{"maxCount":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"executable":true,"parser":"minecraft:item_predicate"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"clone":{"type":"literal","children":{"begin":{"type":"argument","children":{"end":{"type":"argument","children":{"destination":{"type":"argument","children":{"filtered":{"type":"literal","children":{"filter":{"type":"argument","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:block_predicate"}}},"masked":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true},"replace":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true}},"executable":true,"parser":"minecraft:block_pos"},"to":{"type":"literal","children":{"targetDimension":{"type":"argument","children":{"destination":{"type":"argument","children":{"filtered":{"type":"literal","children":{"filter":{"type":"argument","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:block_predicate"}}},"masked":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true},"replace":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:dimension"}}}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"},"from":{"type":"literal","children":{"sourceDimension":{"type":"argument","children":{"begin":{"type":"argument","children":{"end":{"type":"argument","children":{"destination":{"type":"argument","children":{"filtered":{"type":"literal","children":{"filter":{"type":"argument","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:block_predicate"}}},"masked":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true},"replace":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true}},"executable":true,"parser":"minecraft:block_pos"},"to":{"type":"literal","children":{"targetDimension":{"type":"argument","children":{"destination":{"type":"argument","children":{"filtered":{"type":"literal","children":{"filter":{"type":"argument","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:block_predicate"}}},"masked":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true},"replace":{"type":"literal","children":{"force":{"type":"literal","executable":true},"move":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true}},"executable":true}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:dimension"}}}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}},"parser":"minecraft:dimension"}}}}},"damage":{"type":"literal","children":{"target":{"type":"argument","children":{"amount":{"type":"argument","children":{"damageType":{"type":"argument","children":{"at":{"type":"literal","children":{"location":{"type":"argument","executable":true,"parser":"minecraft:vec3"}}},"by":{"type":"literal","children":{"entity":{"type":"argument","children":{"from":{"type":"literal","children":{"cause":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}}},"executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:damage_type"}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"data":{"type":"literal","children":{"get":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"path":{"type":"argument","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"scale":{"type":"argument","executable":true,"parser":"brigadier:double"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"merge":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"nbt":{"type":"argument","executable":true,"parser":"minecraft:nbt_compound_tag"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"nbt":{"type":"argument","executable":true,"parser":"minecraft:nbt_compound_tag"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"nbt":{"type":"argument","executable":true,"parser":"minecraft:nbt_compound_tag"}},"parser":"minecraft:resource_location"}}}}},"modify":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"targetPath":{"type":"argument","children":{"append":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"insert":{"type":"literal","children":{"index":{"type":"argument","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}},"parser":"brigadier:integer"}}},"merge":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"prepend":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"set":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"targetPath":{"type":"argument","children":{"append":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"insert":{"type":"literal","children":{"index":{"type":"argument","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}},"parser":"brigadier:integer"}}},"merge":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"prepend":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"set":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"targetPath":{"type":"argument","children":{"append":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"insert":{"type":"literal","children":{"index":{"type":"argument","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}},"parser":"brigadier:integer"}}},"merge":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"prepend":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}},"set":{"type":"literal","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"string":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"sourcePath":{"type":"argument","children":{"start":{"type":"argument","children":{"end":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"value":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:nbt_tag"}}}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:resource_location"}}}}},"remove":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"parser":"minecraft:resource_location"}}}}}}},"datapack":{"type":"literal","children":{"disable":{"type":"literal","children":{"name":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"phrase"}}}},"enable":{"type":"literal","children":{"name":{"type":"argument","children":{"after":{"type":"literal","children":{"existing":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"phrase"}}}},"before":{"type":"literal","children":{"existing":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"phrase"}}}},"first":{"type":"literal","executable":true},"last":{"type":"literal","executable":true}},"executable":true,"parser":"brigadier:string","properties":{"type":"phrase"}}}},"list":{"type":"literal","children":{"available":{"type":"literal","executable":true},"enabled":{"type":"literal","executable":true}},"executable":true}}},"debug":{"type":"literal","children":{"function":{"type":"literal","children":{"name":{"type":"argument","executable":true,"parser":"minecraft:function"}}},"start":{"type":"literal","executable":true},"stop":{"type":"literal","executable":true}}},"defaultgamemode":{"type":"literal","children":{"gamemode":{"type":"argument","executable":true,"parser":"minecraft:gamemode"}}},"deop":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:game_profile"}}},"difficulty":{"type":"literal","children":{"easy":{"type":"literal","executable":true},"hard":{"type":"literal","executable":true},"normal":{"type":"literal","executable":true},"peaceful":{"type":"literal","executable":true}},"executable":true},"effect":{"type":"literal","children":{"clear":{"type":"literal","children":{"targets":{"type":"argument","children":{"effect":{"type":"argument","executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:mob_effect"}}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}},"executable":true},"give":{"type":"literal","children":{"targets":{"type":"argument","children":{"effect":{"type":"argument","children":{"infinite":{"type":"literal","children":{"amplifier":{"type":"argument","children":{"hideParticles":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:integer","properties":{"max":255,"min":0}}},"executable":true},"seconds":{"type":"argument","children":{"amplifier":{"type":"argument","children":{"hideParticles":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:integer","properties":{"max":255,"min":0}}},"executable":true,"parser":"brigadier:integer","properties":{"max":1000000,"min":1}}},"executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:mob_effect"}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}},"enchant":{"type":"literal","children":{"targets":{"type":"argument","children":{"enchantment":{"type":"argument","children":{"level":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:enchantment"}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}},"execute":{"type":"literal","children":{"align":{"type":"literal","children":{"axes":{"type":"argument","parser":"minecraft:swizzle","redirect":["execute"]}}},"anchored":{"type":"literal","children":{"anchor":{"type":"argument","parser":"minecraft:entity_anchor","redirect":["execute"]}}},"as":{"type":"literal","children":{"targets":{"type":"argument","parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"at":{"type":"literal","children":{"targets":{"type":"argument","parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"facing":{"type":"literal","children":{"entity":{"type":"literal","children":{"targets":{"type":"argument","children":{"anchor":{"type":"argument","parser":"minecraft:entity_anchor","redirect":["execute"]}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}},"pos":{"type":"argument","parser":"minecraft:vec3","redirect":["execute"]}}},"if":{"type":"literal","children":{"biome":{"type":"literal","children":{"pos":{"type":"argument","children":{"biome":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag","properties":{"registry":"minecraft:worldgen/biome"},"redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"block":{"type":"argument","executable":true,"parser":"minecraft:block_predicate","redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"blocks":{"type":"literal","children":{"start":{"type":"argument","children":{"end":{"type":"argument","children":{"destination":{"type":"argument","children":{"all":{"type":"literal","executable":true,"redirect":["execute"]},"masked":{"type":"literal","executable":true,"redirect":["execute"]}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}}},"data":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:resource_location"}}}}},"dimension":{"type":"literal","children":{"dimension":{"type":"argument","executable":true,"parser":"minecraft:dimension","redirect":["execute"]}}},"entity":{"type":"literal","children":{"entities":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"function":{"type":"literal","children":{"name":{"type":"argument","parser":"minecraft:function","redirect":["execute"]}}},"items":{"type":"literal","children":{"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"slots":{"type":"argument","children":{"item_predicate":{"type":"argument","executable":true,"parser":"minecraft:item_predicate","redirect":["execute"]}},"parser":"minecraft:item_slots"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"entities":{"type":"argument","children":{"slots":{"type":"argument","children":{"item_predicate":{"type":"argument","executable":true,"parser":"minecraft:item_predicate","redirect":["execute"]}},"parser":"minecraft:item_slots"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}},"loaded":{"type":"literal","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:block_pos","redirect":["execute"]}}},"predicate":{"type":"literal","children":{"predicate":{"type":"argument","executable":true,"parser":"minecraft:loot_predicate","redirect":["execute"]}}},"score":{"type":"literal","children":{"target":{"type":"argument","children":{"targetObjective":{"type":"argument","children":{"<":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"<=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},">":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},">=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"matches":{"type":"literal","children":{"range":{"type":"argument","executable":true,"parser":"minecraft:int_range","redirect":["execute"]}}}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}}}},"in":{"type":"literal","children":{"dimension":{"type":"argument","parser":"minecraft:dimension","redirect":["execute"]}}},"on":{"type":"literal","children":{"attacker":{"type":"literal","redirect":["execute"]},"controller":{"type":"literal","redirect":["execute"]},"leasher":{"type":"literal","redirect":["execute"]},"origin":{"type":"literal","redirect":["execute"]},"owner":{"type":"literal","redirect":["execute"]},"passengers":{"type":"literal","redirect":["execute"]},"target":{"type":"literal","redirect":["execute"]},"vehicle":{"type":"literal","redirect":["execute"]}}},"positioned":{"type":"literal","children":{"as":{"type":"literal","children":{"targets":{"type":"argument","parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"over":{"type":"literal","children":{"heightmap":{"type":"argument","parser":"minecraft:heightmap","redirect":["execute"]}}},"pos":{"type":"argument","parser":"minecraft:vec3","redirect":["execute"]}}},"rotated":{"type":"literal","children":{"as":{"type":"literal","children":{"targets":{"type":"argument","parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"rot":{"type":"argument","parser":"minecraft:rotation","redirect":["execute"]}}},"run":{"type":"literal"},"store":{"type":"literal","children":{"result":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:block_pos"}}},"bossbar":{"type":"literal","children":{"id":{"type":"argument","children":{"max":{"type":"literal","redirect":["execute"]},"value":{"type":"literal","redirect":["execute"]}},"parser":"minecraft:resource_location"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"score":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:resource_location"}}}}},"success":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:block_pos"}}},"bossbar":{"type":"literal","children":{"id":{"type":"argument","children":{"max":{"type":"literal","redirect":["execute"]},"value":{"type":"literal","redirect":["execute"]}},"parser":"minecraft:resource_location"}}},"entity":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"score":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"storage":{"type":"literal","children":{"target":{"type":"argument","children":{"path":{"type":"argument","children":{"byte":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"double":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"float":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"int":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"long":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}},"short":{"type":"literal","children":{"scale":{"type":"argument","parser":"brigadier:double","redirect":["execute"]}}}},"parser":"minecraft:nbt_path"}},"parser":"minecraft:resource_location"}}}}}}},"summon":{"type":"literal","children":{"entity":{"type":"argument","parser":"minecraft:resource","properties":{"registry":"minecraft:entity_type"},"redirect":["execute"]}}},"unless":{"type":"literal","children":{"biome":{"type":"literal","children":{"pos":{"type":"argument","children":{"biome":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag","properties":{"registry":"minecraft:worldgen/biome"},"redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"block":{"type":"argument","executable":true,"parser":"minecraft:block_predicate","redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"blocks":{"type":"literal","children":{"start":{"type":"argument","children":{"end":{"type":"argument","children":{"destination":{"type":"argument","children":{"all":{"type":"literal","executable":true,"redirect":["execute"]},"masked":{"type":"literal","executable":true,"redirect":["execute"]}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}}},"data":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path","redirect":["execute"]}},"parser":"minecraft:resource_location"}}}}},"dimension":{"type":"literal","children":{"dimension":{"type":"argument","executable":true,"parser":"minecraft:dimension","redirect":["execute"]}}},"entity":{"type":"literal","children":{"entities":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"},"redirect":["execute"]}}},"function":{"type":"literal","children":{"name":{"type":"argument","parser":"minecraft:function","redirect":["execute"]}}},"items":{"type":"literal","children":{"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"slots":{"type":"argument","children":{"item_predicate":{"type":"argument","executable":true,"parser":"minecraft:item_predicate","redirect":["execute"]}},"parser":"minecraft:item_slots"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"entities":{"type":"argument","children":{"slots":{"type":"argument","children":{"item_predicate":{"type":"argument","executable":true,"parser":"minecraft:item_predicate","redirect":["execute"]}},"parser":"minecraft:item_slots"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}},"loaded":{"type":"literal","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:block_pos","redirect":["execute"]}}},"predicate":{"type":"literal","children":{"predicate":{"type":"argument","executable":true,"parser":"minecraft:loot_predicate","redirect":["execute"]}}},"score":{"type":"literal","children":{"target":{"type":"argument","children":{"targetObjective":{"type":"argument","children":{"<":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"<=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},">":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},">=":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective","redirect":["execute"]}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"matches":{"type":"literal","children":{"range":{"type":"argument","executable":true,"parser":"minecraft:int_range","redirect":["execute"]}}}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}}}}}},"experience":{"type":"literal","children":{"add":{"type":"literal","children":{"targets":{"type":"argument","children":{"amount":{"type":"argument","children":{"levels":{"type":"literal","executable":true},"points":{"type":"literal","executable":true}},"executable":true,"parser":"brigadier:integer"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"query":{"type":"literal","children":{"targets":{"type":"argument","children":{"levels":{"type":"literal","executable":true},"points":{"type":"literal","executable":true}},"parser":"minecraft:entity","properties":{"type":"players","amount":"single"}}}},"set":{"type":"literal","children":{"targets":{"type":"argument","children":{"amount":{"type":"argument","children":{"levels":{"type":"literal","executable":true},"points":{"type":"literal","executable":true}},"executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}}}},"fill":{"type":"literal","children":{"from":{"type":"argument","children":{"to":{"type":"argument","children":{"block":{"type":"argument","children":{"destroy":{"type":"literal","executable":true},"hollow":{"type":"literal","executable":true},"keep":{"type":"literal","executable":true},"outline":{"type":"literal","executable":true},"replace":{"type":"literal","children":{"filter":{"type":"argument","executable":true,"parser":"minecraft:block_predicate"}},"executable":true}},"executable":true,"parser":"minecraft:block_state"}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}}},"fillbiome":{"type":"literal","children":{"from":{"type":"argument","children":{"to":{"type":"argument","children":{"biome":{"type":"argument","children":{"replace":{"type":"literal","children":{"filter":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag","properties":{"registry":"minecraft:worldgen/biome"}}}}},"executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:worldgen/biome"}}},"parser":"minecraft:block_pos"}},"parser":"minecraft:block_pos"}}},"forceload":{"type":"literal","children":{"add":{"type":"literal","children":{"from":{"type":"argument","children":{"to":{"type":"argument","executable":true,"parser":"minecraft:column_pos"}},"executable":true,"parser":"minecraft:column_pos"}}},"query":{"type":"literal","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:column_pos"}},"executable":true},"remove":{"type":"literal","children":{"all":{"type":"literal","executable":true},"from":{"type":"argument","children":{"to":{"type":"argument","executable":true,"parser":"minecraft:column_pos"}},"executable":true,"parser":"minecraft:column_pos"}}}}},"function":{"type":"literal","children":{"name":{"type":"argument","children":{"arguments":{"type":"argument","executable":true,"parser":"minecraft:nbt_compound_tag"},"with":{"type":"literal","children":{"block":{"type":"literal","children":{"sourcePos":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"storage":{"type":"literal","children":{"source":{"type":"argument","children":{"path":{"type":"argument","executable":true,"parser":"minecraft:nbt_path"}},"executable":true,"parser":"minecraft:resource_location"}}}}}},"executable":true,"parser":"minecraft:function"}}},"gamemode":{"type":"literal","children":{"gamemode":{"type":"argument","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true,"parser":"minecraft:gamemode"}}},"gamerule":{"type":"literal","children":{"announceAdvancements":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"blockExplosionDropDecay":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"commandBlockOutput":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"commandModificationBlockLimit":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"disableElytraMovementCheck":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"disableRaids":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doDaylightCycle":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doEntityDrops":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doFireTick":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doImmediateRespawn":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doInsomnia":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doLimitedCrafting":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doMobLoot":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doMobSpawning":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doPatrolSpawning":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doTileDrops":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doTraderSpawning":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doVinesSpread":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doWardenSpawning":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"doWeatherCycle":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"drowningDamage":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"enderPearlsVanishOnDeath":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"fallDamage":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"fireDamage":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"forgiveDeadPlayers":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"freezeDamage":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"globalSoundEvents":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"keepInventory":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"lavaSourceConversion":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"logAdminCommands":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"maxCommandChainLength":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"maxCommandForkCount":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"maxEntityCramming":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"mobExplosionDropDecay":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"mobGriefing":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"naturalRegeneration":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"playersNetherPortalCreativeDelay":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"playersNetherPortalDefaultDelay":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"playersSleepingPercentage":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"projectilesCanBreakBlocks":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"randomTickSpeed":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"reducedDebugInfo":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"sendCommandFeedback":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"showDeathMessages":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"snowAccumulationHeight":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"spawnChunkRadius":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"max":32,"min":0}}},"executable":true},"spawnRadius":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true},"spectatorsGenerateChunks":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"tntExplosionDropDecay":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"universalAnger":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true},"waterSourceConversion":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true}}},"give":{"type":"literal","children":{"targets":{"type":"argument","children":{"item":{"type":"argument","children":{"count":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":1}}},"executable":true,"parser":"minecraft:item_stack"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"help":{"type":"literal","children":{"command":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"greedy"}}},"executable":true},"item":{"type":"literal","children":{"modify":{"type":"literal","children":{"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"slot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"parser":"minecraft:item_slot"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"targets":{"type":"argument","children":{"slot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"parser":"minecraft:item_slot"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}},"replace":{"type":"literal","children":{"block":{"type":"literal","children":{"pos":{"type":"argument","children":{"slot":{"type":"argument","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceSlot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"executable":true,"parser":"minecraft:item_slot"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceSlot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"executable":true,"parser":"minecraft:item_slot"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}}}},"with":{"type":"literal","children":{"item":{"type":"argument","children":{"count":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"max":99,"min":1}}},"executable":true,"parser":"minecraft:item_stack"}}}},"parser":"minecraft:item_slot"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"targets":{"type":"argument","children":{"slot":{"type":"argument","children":{"from":{"type":"literal","children":{"block":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceSlot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"executable":true,"parser":"minecraft:item_slot"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"source":{"type":"argument","children":{"sourceSlot":{"type":"argument","children":{"modifier":{"type":"argument","executable":true,"parser":"minecraft:loot_modifier"}},"executable":true,"parser":"minecraft:item_slot"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}}}},"with":{"type":"literal","children":{"item":{"type":"argument","children":{"count":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"max":99,"min":1}}},"executable":true,"parser":"minecraft:item_stack"}}}},"parser":"minecraft:item_slot"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}}}},"jfr":{"type":"literal","children":{"start":{"type":"literal","executable":true},"stop":{"type":"literal","executable":true}}},"kick":{"type":"literal","children":{"targets":{"type":"argument","children":{"reason":{"type":"argument","executable":true,"parser":"minecraft:message"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"kill":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}},"executable":true},"list":{"type":"literal","children":{"uuids":{"type":"literal","executable":true}},"executable":true},"locate":{"type":"literal","children":{"biome":{"type":"literal","children":{"biome":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag","properties":{"registry":"minecraft:worldgen/biome"}}}},"poi":{"type":"literal","children":{"poi":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag","properties":{"registry":"minecraft:point_of_interest_type"}}}},"structure":{"type":"literal","children":{"structure":{"type":"argument","executable":true,"parser":"minecraft:resource_or_tag_key","properties":{"registry":"minecraft:worldgen/structure"}}}}}},"loot":{"type":"literal","children":{"give":{"type":"literal","children":{"players":{"type":"argument","children":{"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"insert":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"minecraft:block_pos"}}},"replace":{"type":"literal","children":{"block":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"slot":{"type":"argument","children":{"count":{"type":"argument","children":{"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"brigadier:integer","properties":{"min":0}},"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"minecraft:item_slot"}},"parser":"minecraft:block_pos"}}},"entity":{"type":"literal","children":{"entities":{"type":"argument","children":{"slot":{"type":"argument","children":{"count":{"type":"argument","children":{"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"brigadier:integer","properties":{"min":0}},"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"minecraft:item_slot"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}}}},"spawn":{"type":"literal","children":{"targetPos":{"type":"argument","children":{"fish":{"type":"literal","children":{"loot_table":{"type":"argument","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}},"parser":"minecraft:loot_table"}}},"kill":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"loot":{"type":"literal","children":{"loot_table":{"type":"argument","executable":true,"parser":"minecraft:loot_table"}}},"mine":{"type":"literal","children":{"pos":{"type":"argument","children":{"mainhand":{"type":"literal","executable":true},"offhand":{"type":"literal","executable":true},"tool":{"type":"argument","executable":true,"parser":"minecraft:item_stack"}},"executable":true,"parser":"minecraft:block_pos"}}}},"parser":"minecraft:vec3"}}}}},"me":{"type":"literal","children":{"action":{"type":"argument","executable":true,"parser":"minecraft:message"}}},"msg":{"type":"literal","children":{"targets":{"type":"argument","children":{"message":{"type":"argument","executable":true,"parser":"minecraft:message"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"op":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:game_profile"}}},"pardon":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:game_profile"}}},"pardon-ip":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"word"}}}},"particle":{"type":"literal","children":{"name":{"type":"argument","children":{"pos":{"type":"argument","children":{"delta":{"type":"argument","children":{"speed":{"type":"argument","children":{"count":{"type":"argument","children":{"force":{"type":"literal","children":{"viewers":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"normal":{"type":"literal","children":{"viewers":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true}},"executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"parser":"brigadier:float","properties":{"min":0.0}}},"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:particle"}}},"perf":{"type":"literal","children":{"start":{"type":"literal","executable":true},"stop":{"type":"literal","executable":true}}},"place":{"type":"literal","children":{"feature":{"type":"literal","children":{"feature":{"type":"argument","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:block_pos"}},"executable":true,"parser":"minecraft:resource_key","properties":{"registry":"minecraft:worldgen/configured_feature"}}}},"jigsaw":{"type":"literal","children":{"pool":{"type":"argument","children":{"target":{"type":"argument","children":{"max_depth":{"type":"argument","children":{"position":{"type":"argument","executable":true,"parser":"minecraft:block_pos"}},"executable":true,"parser":"brigadier:integer","properties":{"max":20,"min":1}}},"parser":"minecraft:resource_location"}},"parser":"minecraft:resource_key","properties":{"registry":"minecraft:worldgen/template_pool"}}}},"structure":{"type":"literal","children":{"structure":{"type":"argument","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:block_pos"}},"executable":true,"parser":"minecraft:resource_key","properties":{"registry":"minecraft:worldgen/structure"}}}},"template":{"type":"literal","children":{"template":{"type":"argument","children":{"pos":{"type":"argument","children":{"rotation":{"type":"argument","children":{"mirror":{"type":"argument","children":{"integrity":{"type":"argument","children":{"seed":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"minecraft:template_mirror"}},"executable":true,"parser":"minecraft:template_rotation"}},"executable":true,"parser":"minecraft:block_pos"}},"executable":true,"parser":"minecraft:resource_location"}}}}},"playsound":{"type":"literal","children":{"sound":{"type":"argument","children":{"ambient":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"block":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"hostile":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"master":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"music":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"neutral":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"player":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"record":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"voice":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"weather":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"volume":{"type":"argument","children":{"pitch":{"type":"argument","children":{"minVolume":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":1.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"max":2.0,"min":0.0}}},"executable":true,"parser":"brigadier:float","properties":{"min":0.0}}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true}},"executable":true,"parser":"minecraft:resource_location"}}},"publish":{"type":"literal","children":{"allowCommands":{"type":"argument","children":{"gamemode":{"type":"argument","children":{"port":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"max":65535,"min":0}}},"executable":true,"parser":"minecraft:gamemode"}},"executable":true,"parser":"brigadier:bool"}},"executable":true},"random":{"type":"literal","children":{"reset":{"type":"literal","children":{"*":{"type":"literal","children":{"seed":{"type":"argument","children":{"includeWorldSeed":{"type":"argument","children":{"includeSequenceId":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:integer"}},"executable":true},"sequence":{"type":"argument","children":{"seed":{"type":"argument","children":{"includeWorldSeed":{"type":"argument","children":{"includeSequenceId":{"type":"argument","executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:bool"}},"executable":true,"parser":"brigadier:integer"}},"executable":true,"parser":"minecraft:resource_location"}}},"roll":{"type":"literal","children":{"range":{"type":"argument","children":{"sequence":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true,"parser":"minecraft:int_range"}}},"value":{"type":"literal","children":{"range":{"type":"argument","children":{"sequence":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true,"parser":"minecraft:int_range"}}}}},"recipe":{"type":"literal","children":{"give":{"type":"literal","children":{"targets":{"type":"argument","children":{"*":{"type":"literal","executable":true},"recipe":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"take":{"type":"literal","children":{"targets":{"type":"argument","children":{"*":{"type":"literal","executable":true},"recipe":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}}}},"reload":{"type":"literal","executable":true},"return":{"type":"literal","children":{"fail":{"type":"literal","executable":true},"run":{"type":"literal"},"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}}},"ride":{"type":"literal","children":{"target":{"type":"argument","children":{"dismount":{"type":"literal","executable":true},"mount":{"type":"literal","children":{"vehicle":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"save-all":{"type":"literal","children":{"flush":{"type":"literal","executable":true}},"executable":true},"save-off":{"type":"literal","executable":true},"save-on":{"type":"literal","executable":true},"say":{"type":"literal","children":{"message":{"type":"argument","executable":true,"parser":"minecraft:message"}}},"schedule":{"type":"literal","children":{"clear":{"type":"literal","children":{"function":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"greedy"}}}},"function":{"type":"literal","children":{"function":{"type":"argument","children":{"time":{"type":"argument","children":{"append":{"type":"literal","executable":true},"replace":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:time","properties":{"min":0}}},"parser":"minecraft:function"}}}}},"scoreboard":{"type":"literal","children":{"objectives":{"type":"literal","children":{"add":{"type":"literal","children":{"objective":{"type":"argument","children":{"criteria":{"type":"argument","children":{"displayName":{"type":"argument","executable":true,"parser":"minecraft:component"}},"executable":true,"parser":"minecraft:objective_criteria"}},"parser":"brigadier:string","properties":{"type":"word"}}}},"list":{"type":"literal","executable":true},"modify":{"type":"literal","children":{"objective":{"type":"argument","children":{"displayautoupdate":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:bool"}}},"displayname":{"type":"literal","children":{"displayName":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"numberformat":{"type":"literal","children":{"blank":{"type":"literal","executable":true},"fixed":{"type":"literal","children":{"contents":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"styled":{"type":"literal","children":{"style":{"type":"argument","executable":true,"parser":"minecraft:style"}}}},"executable":true},"rendertype":{"type":"literal","children":{"hearts":{"type":"literal","executable":true},"integer":{"type":"literal","executable":true}}}},"parser":"minecraft:objective"}}},"remove":{"type":"literal","children":{"objective":{"type":"argument","executable":true,"parser":"minecraft:objective"}}},"setdisplay":{"type":"literal","children":{"slot":{"type":"argument","children":{"objective":{"type":"argument","executable":true,"parser":"minecraft:objective"}},"executable":true,"parser":"minecraft:scoreboard_slot"}}}}},"players":{"type":"literal","children":{"add":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","children":{"score":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"display":{"type":"literal","children":{"name":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","children":{"name":{"type":"argument","executable":true,"parser":"minecraft:component"}},"executable":true,"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"numberformat":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","children":{"blank":{"type":"literal","executable":true},"fixed":{"type":"literal","children":{"contents":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"styled":{"type":"literal","children":{"style":{"type":"argument","executable":true,"parser":"minecraft:style"}}}},"executable":true,"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}}}},"enable":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","executable":true,"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"get":{"type":"literal","children":{"target":{"type":"argument","children":{"objective":{"type":"argument","executable":true,"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"single"}}}},"list":{"type":"literal","children":{"target":{"type":"argument","executable":true,"parser":"minecraft:score_holder","properties":{"amount":"single"}}},"executable":true},"operation":{"type":"literal","children":{"targets":{"type":"argument","children":{"targetObjective":{"type":"argument","children":{"operation":{"type":"argument","children":{"source":{"type":"argument","children":{"sourceObjective":{"type":"argument","executable":true,"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}},"parser":"minecraft:operation"}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"remove":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","children":{"score":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"reset":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","executable":true,"parser":"minecraft:objective"}},"executable":true,"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"set":{"type":"literal","children":{"targets":{"type":"argument","children":{"objective":{"type":"argument","children":{"score":{"type":"argument","executable":true,"parser":"brigadier:integer"}},"parser":"minecraft:objective"}},"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}}}}}},"seed":{"type":"literal","executable":true},"setblock":{"type":"literal","children":{"pos":{"type":"argument","children":{"block":{"type":"argument","children":{"destroy":{"type":"literal","executable":true},"keep":{"type":"literal","executable":true},"replace":{"type":"literal","executable":true}},"executable":true,"parser":"minecraft:block_state"}},"parser":"minecraft:block_pos"}}},"setidletimeout":{"type":"literal","children":{"minutes":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}}},"setworldspawn":{"type":"literal","children":{"pos":{"type":"argument","children":{"angle":{"type":"argument","executable":true,"parser":"minecraft:angle"}},"executable":true,"parser":"minecraft:block_pos"}},"executable":true},"spawnpoint":{"type":"literal","children":{"targets":{"type":"argument","children":{"pos":{"type":"argument","children":{"angle":{"type":"argument","executable":true,"parser":"minecraft:angle"}},"executable":true,"parser":"minecraft:block_pos"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true},"spectate":{"type":"literal","children":{"target":{"type":"argument","children":{"player":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"single"}}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}},"executable":true},"spreadplayers":{"type":"literal","children":{"center":{"type":"argument","children":{"spreadDistance":{"type":"argument","children":{"maxRange":{"type":"argument","children":{"respectTeams":{"type":"argument","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}},"parser":"brigadier:bool"},"under":{"type":"literal","children":{"maxHeight":{"type":"argument","children":{"respectTeams":{"type":"argument","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}},"parser":"brigadier:bool"}},"parser":"brigadier:integer"}}}},"parser":"brigadier:float","properties":{"min":1.0}}},"parser":"brigadier:float","properties":{"min":0.0}}},"parser":"minecraft:vec2"}}},"stop":{"type":"literal","executable":true},"stopsound":{"type":"literal","children":{"targets":{"type":"argument","children":{"*":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}}},"ambient":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"block":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"hostile":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"master":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"music":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"neutral":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"player":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"record":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"voice":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true},"weather":{"type":"literal","children":{"sound":{"type":"argument","executable":true,"parser":"minecraft:resource_location"}},"executable":true}},"executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"summon":{"type":"literal","children":{"entity":{"type":"argument","children":{"pos":{"type":"argument","children":{"nbt":{"type":"argument","executable":true,"parser":"minecraft:nbt_compound_tag"}},"executable":true,"parser":"minecraft:vec3"}},"executable":true,"parser":"minecraft:resource","properties":{"registry":"minecraft:entity_type"}}}},"tag":{"type":"literal","children":{"targets":{"type":"argument","children":{"add":{"type":"literal","children":{"name":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"word"}}}},"list":{"type":"literal","executable":true},"remove":{"type":"literal","children":{"name":{"type":"argument","executable":true,"parser":"brigadier:string","properties":{"type":"word"}}}}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}},"team":{"type":"literal","children":{"add":{"type":"literal","children":{"team":{"type":"argument","children":{"displayName":{"type":"argument","executable":true,"parser":"minecraft:component"}},"executable":true,"parser":"brigadier:string","properties":{"type":"word"}}}},"empty":{"type":"literal","children":{"team":{"type":"argument","executable":true,"parser":"minecraft:team"}}},"join":{"type":"literal","children":{"team":{"type":"argument","children":{"members":{"type":"argument","executable":true,"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}},"executable":true,"parser":"minecraft:team"}}},"leave":{"type":"literal","children":{"members":{"type":"argument","executable":true,"parser":"minecraft:score_holder","properties":{"amount":"multiple"}}}},"list":{"type":"literal","children":{"team":{"type":"argument","executable":true,"parser":"minecraft:team"}},"executable":true},"modify":{"type":"literal","children":{"team":{"type":"argument","children":{"collisionRule":{"type":"literal","children":{"always":{"type":"literal","executable":true},"never":{"type":"literal","executable":true},"pushOtherTeams":{"type":"literal","executable":true},"pushOwnTeam":{"type":"literal","executable":true}}},"color":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"minecraft:color"}}},"deathMessageVisibility":{"type":"literal","children":{"always":{"type":"literal","executable":true},"hideForOtherTeams":{"type":"literal","executable":true},"hideForOwnTeam":{"type":"literal","executable":true},"never":{"type":"literal","executable":true}}},"displayName":{"type":"literal","children":{"displayName":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"friendlyFire":{"type":"literal","children":{"allowed":{"type":"argument","executable":true,"parser":"brigadier:bool"}}},"nametagVisibility":{"type":"literal","children":{"always":{"type":"literal","executable":true},"hideForOtherTeams":{"type":"literal","executable":true},"hideForOwnTeam":{"type":"literal","executable":true},"never":{"type":"literal","executable":true}}},"prefix":{"type":"literal","children":{"prefix":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"seeFriendlyInvisibles":{"type":"literal","children":{"allowed":{"type":"argument","executable":true,"parser":"brigadier:bool"}}},"suffix":{"type":"literal","children":{"suffix":{"type":"argument","executable":true,"parser":"minecraft:component"}}}},"parser":"minecraft:team"}}},"remove":{"type":"literal","children":{"team":{"type":"argument","executable":true,"parser":"minecraft:team"}}}}},"teammsg":{"type":"literal","children":{"message":{"type":"argument","executable":true,"parser":"minecraft:message"}}},"teleport":{"type":"literal","children":{"destination":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}},"location":{"type":"argument","executable":true,"parser":"minecraft:vec3"},"targets":{"type":"argument","children":{"destination":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}},"location":{"type":"argument","children":{"facing":{"type":"literal","children":{"entity":{"type":"literal","children":{"facingEntity":{"type":"argument","children":{"facingAnchor":{"type":"argument","executable":true,"parser":"minecraft:entity_anchor"}},"executable":true,"parser":"minecraft:entity","properties":{"type":"entities","amount":"single"}}}},"facingLocation":{"type":"argument","executable":true,"parser":"minecraft:vec3"}}},"rotation":{"type":"argument","executable":true,"parser":"minecraft:rotation"}},"executable":true,"parser":"minecraft:vec3"}},"parser":"minecraft:entity","properties":{"type":"entities","amount":"multiple"}}}},"tell":{"type":"literal","redirect":["msg"]},"tellraw":{"type":"literal","children":{"targets":{"type":"argument","children":{"message":{"type":"argument","executable":true,"parser":"minecraft:component"}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"tick":{"type":"literal","children":{"freeze":{"type":"literal","executable":true},"query":{"type":"literal","executable":true},"rate":{"type":"literal","children":{"rate":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"max":10000.0,"min":1.0}}}},"sprint":{"type":"literal","children":{"stop":{"type":"literal","executable":true},"time":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":1}}}},"step":{"type":"literal","children":{"stop":{"type":"literal","executable":true},"time":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":1}}},"executable":true},"unfreeze":{"type":"literal","executable":true}}},"time":{"type":"literal","children":{"add":{"type":"literal","children":{"time":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":0}}}},"query":{"type":"literal","children":{"day":{"type":"literal","executable":true},"daytime":{"type":"literal","executable":true},"gametime":{"type":"literal","executable":true}}},"set":{"type":"literal","children":{"day":{"type":"literal","executable":true},"midnight":{"type":"literal","executable":true},"night":{"type":"literal","executable":true},"noon":{"type":"literal","executable":true},"time":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":0}}}}}},"title":{"type":"literal","children":{"targets":{"type":"argument","children":{"actionbar":{"type":"literal","children":{"title":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"clear":{"type":"literal","executable":true},"reset":{"type":"literal","executable":true},"subtitle":{"type":"literal","children":{"title":{"type":"argument","executable":true,"parser":"minecraft:component"}}},"times":{"type":"literal","children":{"fadeIn":{"type":"argument","children":{"stay":{"type":"argument","children":{"fadeOut":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":0}}},"parser":"minecraft:time","properties":{"min":0}}},"parser":"minecraft:time","properties":{"min":0}}}},"title":{"type":"literal","children":{"title":{"type":"argument","executable":true,"parser":"minecraft:component"}}}},"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}}},"tm":{"type":"literal","redirect":["teammsg"]},"tp":{"type":"literal","redirect":["teleport"]},"transfer":{"type":"literal","children":{"hostname":{"type":"argument","children":{"port":{"type":"argument","children":{"players":{"type":"argument","executable":true,"parser":"minecraft:entity","properties":{"type":"players","amount":"multiple"}}},"executable":true,"parser":"brigadier:integer","properties":{"max":65535,"min":1}}},"executable":true,"parser":"brigadier:string","properties":{"type":"phrase"}}}},"trigger":{"type":"literal","children":{"objective":{"type":"argument","children":{"add":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}}},"set":{"type":"literal","children":{"value":{"type":"argument","executable":true,"parser":"brigadier:integer"}}}},"executable":true,"parser":"minecraft:objective"}}},"w":{"type":"literal","redirect":["msg"]},"weather":{"type":"literal","children":{"clear":{"type":"literal","children":{"duration":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":1}}},"executable":true},"rain":{"type":"literal","children":{"duration":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":1}}},"executable":true},"thunder":{"type":"literal","children":{"duration":{"type":"argument","executable":true,"parser":"minecraft:time","properties":{"min":1}}},"executable":true}}},"whitelist":{"type":"literal","children":{"add":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:game_profile"}}},"list":{"type":"literal","executable":true},"off":{"type":"literal","executable":true},"on":{"type":"literal","executable":true},"reload":{"type":"literal","executable":true},"remove":{"type":"literal","children":{"targets":{"type":"argument","executable":true,"parser":"minecraft:game_profile"}}}}},"worldborder":{"type":"literal","children":{"add":{"type":"literal","children":{"distance":{"type":"argument","children":{"time":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"executable":true,"parser":"brigadier:double","properties":{"max":59999968.0,"min":-59999968.0}}}},"center":{"type":"literal","children":{"pos":{"type":"argument","executable":true,"parser":"minecraft:vec2"}}},"damage":{"type":"literal","children":{"amount":{"type":"literal","children":{"damagePerBlock":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"min":0.0}}}},"buffer":{"type":"literal","children":{"distance":{"type":"argument","executable":true,"parser":"brigadier:float","properties":{"min":0.0}}}}}},"get":{"type":"literal","executable":true},"set":{"type":"literal","children":{"distance":{"type":"argument","children":{"time":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}},"executable":true,"parser":"brigadier:double","properties":{"max":59999968.0,"min":-59999968.0}}}},"warning":{"type":"literal","children":{"distance":{"type":"literal","children":{"distance":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}}},"time":{"type":"literal","children":{"time":{"type":"argument","executable":true,"parser":"brigadier:integer","properties":{"min":0}}}}}}}},"xp":{"type":"literal","redirect":["experience"]}}}} diff --git a/protocol/data/entity_types_767.json b/protocol/data/entity_types_767.json new file mode 100644 index 0000000..8e5dcbb --- /dev/null +++ b/protocol/data/entity_types_767.json @@ -0,0 +1 @@ +["allay","area_effect_cloud","armadillo","armor_stand","arrow","axolotl","bat","bee","blaze","block_display","boat","bogged","breeze","breeze_wind_charge","camel","cat","cave_spider","chest_boat","chest_minecart","chicken","cod","command_block_minecart","cow","creeper","dolphin","donkey","dragon_fireball","drowned","egg","elder_guardian","end_crystal","ender_dragon","ender_pearl","enderman","endermite","evoker","evoker_fangs","experience_bottle","experience_orb","eye_of_ender","falling_block","firework_rocket","fox","frog","furnace_minecart","ghast","giant","glow_item_frame","glow_squid","goat","guardian","hoglin","hopper_minecart","horse","husk","illusioner","interaction","iron_golem","item","item_display","item_frame","ominous_item_spawner","fireball","leash_knot","lightning_bolt","llama","llama_spit","magma_cube","marker","minecart","mooshroom","mule","ocelot","painting","panda","parrot","phantom","pig","piglin","piglin_brute","pillager","polar_bear","potion","pufferfish","rabbit","ravager","salmon","sheep","shulker","shulker_bullet","silverfish","skeleton","skeleton_horse","slime","small_fireball","sniffer","snow_golem","snowball","spawner_minecart","spectral_arrow","spider","squid","stray","strider","tadpole","text_display","tnt","tnt_minecart","trader_llama","trident","tropical_fish","turtle","vex","villager","vindicator","wandering_trader","warden","wind_charge","witch","wither","wither_skeleton","wither_skull","wolf","zoglin","zombie","zombie_horse","zombie_villager","zombified_piglin","player","fishing_bobber"] diff --git a/protocol/data/items_767.json b/protocol/data/items_767.json new file mode 100644 index 0000000..f1d7c51 --- /dev/null +++ b/protocol/data/items_767.json @@ -0,0 +1 @@ +{"names":["air","stone","granite","polished_granite","diorite","polished_diorite","andesite","polished_andesite","deepslate","cobbled_deepslate","polished_deepslate","calcite","tuff","tuff_slab","tuff_stairs","tuff_wall","chiseled_tuff","polished_tuff","polished_tuff_slab","polished_tuff_stairs","polished_tuff_wall","tuff_bricks","tuff_brick_slab","tuff_brick_stairs","tuff_brick_wall","chiseled_tuff_bricks","dripstone_block","grass_block","dirt","coarse_dirt","podzol","rooted_dirt","mud","crimson_nylium","warped_nylium","cobblestone","oak_planks","spruce_planks","birch_planks","jungle_planks","acacia_planks","cherry_planks","dark_oak_planks","mangrove_planks","bamboo_planks","crimson_planks","warped_planks","bamboo_mosaic","oak_sapling","spruce_sapling","birch_sapling","jungle_sapling","acacia_sapling","cherry_sapling","dark_oak_sapling","mangrove_propagule","bedrock","sand","suspicious_sand","suspicious_gravel","red_sand","gravel","coal_ore","deepslate_coal_ore","iron_ore","deepslate_iron_ore","copper_ore","deepslate_copper_ore","gold_ore","deepslate_gold_ore","redstone_ore","deepslate_redstone_ore","emerald_ore","deepslate_emerald_ore","lapis_ore","deepslate_lapis_ore","diamond_ore","deepslate_diamond_ore","nether_gold_ore","nether_quartz_ore","ancient_debris","coal_block","raw_iron_block","raw_copper_block","raw_gold_block","heavy_core","amethyst_block","budding_amethyst","iron_block","copper_block","gold_block","diamond_block","netherite_block","exposed_copper","weathered_copper","oxidized_copper","chiseled_copper","exposed_chiseled_copper","weathered_chiseled_copper","oxidized_chiseled_copper","cut_copper","exposed_cut_copper","weathered_cut_copper","oxidized_cut_copper","cut_copper_stairs","exposed_cut_copper_stairs","weathered_cut_copper_stairs","oxidized_cut_copper_stairs","cut_copper_slab","exposed_cut_copper_slab","weathered_cut_copper_slab","oxidized_cut_copper_slab","waxed_copper_block","waxed_exposed_copper","waxed_weathered_copper","waxed_oxidized_copper","waxed_chiseled_copper","waxed_exposed_chiseled_copper","waxed_weathered_chiseled_copper","waxed_oxidized_chiseled_copper","waxed_cut_copper","waxed_exposed_cut_copper","waxed_weathered_cut_copper","waxed_oxidized_cut_copper","waxed_cut_copper_stairs","waxed_exposed_cut_copper_stairs","waxed_weathered_cut_copper_stairs","waxed_oxidized_cut_copper_stairs","waxed_cut_copper_slab","waxed_exposed_cut_copper_slab","waxed_weathered_cut_copper_slab","waxed_oxidized_cut_copper_slab","oak_log","spruce_log","birch_log","jungle_log","acacia_log","cherry_log","dark_oak_log","mangrove_log","mangrove_roots","muddy_mangrove_roots","crimson_stem","warped_stem","bamboo_block","stripped_oak_log","stripped_spruce_log","stripped_birch_log","stripped_jungle_log","stripped_acacia_log","stripped_cherry_log","stripped_dark_oak_log","stripped_mangrove_log","stripped_crimson_stem","stripped_warped_stem","stripped_oak_wood","stripped_spruce_wood","stripped_birch_wood","stripped_jungle_wood","stripped_acacia_wood","stripped_cherry_wood","stripped_dark_oak_wood","stripped_mangrove_wood","stripped_crimson_hyphae","stripped_warped_hyphae","stripped_bamboo_block","oak_wood","spruce_wood","birch_wood","jungle_wood","acacia_wood","cherry_wood","dark_oak_wood","mangrove_wood","crimson_hyphae","warped_hyphae","oak_leaves","spruce_leaves","birch_leaves","jungle_leaves","acacia_leaves","cherry_leaves","dark_oak_leaves","mangrove_leaves","azalea_leaves","flowering_azalea_leaves","sponge","wet_sponge","glass","tinted_glass","lapis_block","sandstone","chiseled_sandstone","cut_sandstone","cobweb","short_grass","fern","azalea","flowering_azalea","dead_bush","seagrass","sea_pickle","white_wool","orange_wool","magenta_wool","light_blue_wool","yellow_wool","lime_wool","pink_wool","gray_wool","light_gray_wool","cyan_wool","purple_wool","blue_wool","brown_wool","green_wool","red_wool","black_wool","dandelion","poppy","blue_orchid","allium","azure_bluet","red_tulip","orange_tulip","white_tulip","pink_tulip","oxeye_daisy","cornflower","lily_of_the_valley","wither_rose","torchflower","pitcher_plant","spore_blossom","brown_mushroom","red_mushroom","crimson_fungus","warped_fungus","crimson_roots","warped_roots","nether_sprouts","weeping_vines","twisting_vines","sugar_cane","kelp","moss_carpet","pink_petals","moss_block","hanging_roots","big_dripleaf","small_dripleaf","bamboo","oak_slab","spruce_slab","birch_slab","jungle_slab","acacia_slab","cherry_slab","dark_oak_slab","mangrove_slab","bamboo_slab","bamboo_mosaic_slab","crimson_slab","warped_slab","stone_slab","smooth_stone_slab","sandstone_slab","cut_sandstone_slab","petrified_oak_slab","cobblestone_slab","brick_slab","stone_brick_slab","mud_brick_slab","nether_brick_slab","quartz_slab","red_sandstone_slab","cut_red_sandstone_slab","purpur_slab","prismarine_slab","prismarine_brick_slab","dark_prismarine_slab","smooth_quartz","smooth_red_sandstone","smooth_sandstone","smooth_stone","bricks","bookshelf","chiseled_bookshelf","decorated_pot","mossy_cobblestone","obsidian","torch","end_rod","chorus_plant","chorus_flower","purpur_block","purpur_pillar","purpur_stairs","spawner","chest","crafting_table","farmland","furnace","ladder","cobblestone_stairs","snow","ice","snow_block","cactus","clay","jukebox","oak_fence","spruce_fence","birch_fence","jungle_fence","acacia_fence","cherry_fence","dark_oak_fence","mangrove_fence","bamboo_fence","crimson_fence","warped_fence","pumpkin","carved_pumpkin","jack_o_lantern","netherrack","soul_sand","soul_soil","basalt","polished_basalt","smooth_basalt","soul_torch","glowstone","infested_stone","infested_cobblestone","infested_stone_bricks","infested_mossy_stone_bricks","infested_cracked_stone_bricks","infested_chiseled_stone_bricks","infested_deepslate","stone_bricks","mossy_stone_bricks","cracked_stone_bricks","chiseled_stone_bricks","packed_mud","mud_bricks","deepslate_bricks","cracked_deepslate_bricks","deepslate_tiles","cracked_deepslate_tiles","chiseled_deepslate","reinforced_deepslate","brown_mushroom_block","red_mushroom_block","mushroom_stem","iron_bars","chain","glass_pane","melon","vine","glow_lichen","brick_stairs","stone_brick_stairs","mud_brick_stairs","mycelium","lily_pad","nether_bricks","cracked_nether_bricks","chiseled_nether_bricks","nether_brick_fence","nether_brick_stairs","sculk","sculk_vein","sculk_catalyst","sculk_shrieker","enchanting_table","end_portal_frame","end_stone","end_stone_bricks","dragon_egg","sandstone_stairs","ender_chest","emerald_block","oak_stairs","spruce_stairs","birch_stairs","jungle_stairs","acacia_stairs","cherry_stairs","dark_oak_stairs","mangrove_stairs","bamboo_stairs","bamboo_mosaic_stairs","crimson_stairs","warped_stairs","command_block","beacon","cobblestone_wall","mossy_cobblestone_wall","brick_wall","prismarine_wall","red_sandstone_wall","mossy_stone_brick_wall","granite_wall","stone_brick_wall","mud_brick_wall","nether_brick_wall","andesite_wall","red_nether_brick_wall","sandstone_wall","end_stone_brick_wall","diorite_wall","blackstone_wall","polished_blackstone_wall","polished_blackstone_brick_wall","cobbled_deepslate_wall","polished_deepslate_wall","deepslate_brick_wall","deepslate_tile_wall","anvil","chipped_anvil","damaged_anvil","chiseled_quartz_block","quartz_block","quartz_bricks","quartz_pillar","quartz_stairs","white_terracotta","orange_terracotta","magenta_terracotta","light_blue_terracotta","yellow_terracotta","lime_terracotta","pink_terracotta","gray_terracotta","light_gray_terracotta","cyan_terracotta","purple_terracotta","blue_terracotta","brown_terracotta","green_terracotta","red_terracotta","black_terracotta","barrier","light","hay_block","white_carpet","orange_carpet","magenta_carpet","light_blue_carpet","yellow_carpet","lime_carpet","pink_carpet","gray_carpet","light_gray_carpet","cyan_carpet","purple_carpet","blue_carpet","brown_carpet","green_carpet","red_carpet","black_carpet","terracotta","packed_ice","dirt_path","sunflower","lilac","rose_bush","peony","tall_grass","large_fern","white_stained_glass","orange_stained_glass","magenta_stained_glass","light_blue_stained_glass","yellow_stained_glass","lime_stained_glass","pink_stained_glass","gray_stained_glass","light_gray_stained_glass","cyan_stained_glass","purple_stained_glass","blue_stained_glass","brown_stained_glass","green_stained_glass","red_stained_glass","black_stained_glass","white_stained_glass_pane","orange_stained_glass_pane","magenta_stained_glass_pane","light_blue_stained_glass_pane","yellow_stained_glass_pane","lime_stained_glass_pane","pink_stained_glass_pane","gray_stained_glass_pane","light_gray_stained_glass_pane","cyan_stained_glass_pane","purple_stained_glass_pane","blue_stained_glass_pane","brown_stained_glass_pane","green_stained_glass_pane","red_stained_glass_pane","black_stained_glass_pane","prismarine","prismarine_bricks","dark_prismarine","prismarine_stairs","prismarine_brick_stairs","dark_prismarine_stairs","sea_lantern","red_sandstone","chiseled_red_sandstone","cut_red_sandstone","red_sandstone_stairs","repeating_command_block","chain_command_block","magma_block","nether_wart_block","warped_wart_block","red_nether_bricks","bone_block","structure_void","shulker_box","white_shulker_box","orange_shulker_box","magenta_shulker_box","light_blue_shulker_box","yellow_shulker_box","lime_shulker_box","pink_shulker_box","gray_shulker_box","light_gray_shulker_box","cyan_shulker_box","purple_shulker_box","blue_shulker_box","brown_shulker_box","green_shulker_box","red_shulker_box","black_shulker_box","white_glazed_terracotta","orange_glazed_terracotta","magenta_glazed_terracotta","light_blue_glazed_terracotta","yellow_glazed_terracotta","lime_glazed_terracotta","pink_glazed_terracotta","gray_glazed_terracotta","light_gray_glazed_terracotta","cyan_glazed_terracotta","purple_glazed_terracotta","blue_glazed_terracotta","brown_glazed_terracotta","green_glazed_terracotta","red_glazed_terracotta","black_glazed_terracotta","white_concrete","orange_concrete","magenta_concrete","light_blue_concrete","yellow_concrete","lime_concrete","pink_concrete","gray_concrete","light_gray_concrete","cyan_concrete","purple_concrete","blue_concrete","brown_concrete","green_concrete","red_concrete","black_concrete","white_concrete_powder","orange_concrete_powder","magenta_concrete_powder","light_blue_concrete_powder","yellow_concrete_powder","lime_concrete_powder","pink_concrete_powder","gray_concrete_powder","light_gray_concrete_powder","cyan_concrete_powder","purple_concrete_powder","blue_concrete_powder","brown_concrete_powder","green_concrete_powder","red_concrete_powder","black_concrete_powder","turtle_egg","sniffer_egg","dead_tube_coral_block","dead_brain_coral_block","dead_bubble_coral_block","dead_fire_coral_block","dead_horn_coral_block","tube_coral_block","brain_coral_block","bubble_coral_block","fire_coral_block","horn_coral_block","tube_coral","brain_coral","bubble_coral","fire_coral","horn_coral","dead_brain_coral","dead_bubble_coral","dead_fire_coral","dead_horn_coral","dead_tube_coral","tube_coral_fan","brain_coral_fan","bubble_coral_fan","fire_coral_fan","horn_coral_fan","dead_tube_coral_fan","dead_brain_coral_fan","dead_bubble_coral_fan","dead_fire_coral_fan","dead_horn_coral_fan","blue_ice","conduit","polished_granite_stairs","smooth_red_sandstone_stairs","mossy_stone_brick_stairs","polished_diorite_stairs","mossy_cobblestone_stairs","end_stone_brick_stairs","stone_stairs","smooth_sandstone_stairs","smooth_quartz_stairs","granite_stairs","andesite_stairs","red_nether_brick_stairs","polished_andesite_stairs","diorite_stairs","cobbled_deepslate_stairs","polished_deepslate_stairs","deepslate_brick_stairs","deepslate_tile_stairs","polished_granite_slab","smooth_red_sandstone_slab","mossy_stone_brick_slab","polished_diorite_slab","mossy_cobblestone_slab","end_stone_brick_slab","smooth_sandstone_slab","smooth_quartz_slab","granite_slab","andesite_slab","red_nether_brick_slab","polished_andesite_slab","diorite_slab","cobbled_deepslate_slab","polished_deepslate_slab","deepslate_brick_slab","deepslate_tile_slab","scaffolding","redstone","redstone_torch","redstone_block","repeater","comparator","piston","sticky_piston","slime_block","honey_block","observer","hopper","dispenser","dropper","lectern","target","lever","lightning_rod","daylight_detector","sculk_sensor","calibrated_sculk_sensor","tripwire_hook","trapped_chest","tnt","redstone_lamp","note_block","stone_button","polished_blackstone_button","oak_button","spruce_button","birch_button","jungle_button","acacia_button","cherry_button","dark_oak_button","mangrove_button","bamboo_button","crimson_button","warped_button","stone_pressure_plate","polished_blackstone_pressure_plate","light_weighted_pressure_plate","heavy_weighted_pressure_plate","oak_pressure_plate","spruce_pressure_plate","birch_pressure_plate","jungle_pressure_plate","acacia_pressure_plate","cherry_pressure_plate","dark_oak_pressure_plate","mangrove_pressure_plate","bamboo_pressure_plate","crimson_pressure_plate","warped_pressure_plate","iron_door","oak_door","spruce_door","birch_door","jungle_door","acacia_door","cherry_door","dark_oak_door","mangrove_door","bamboo_door","crimson_door","warped_door","copper_door","exposed_copper_door","weathered_copper_door","oxidized_copper_door","waxed_copper_door","waxed_exposed_copper_door","waxed_weathered_copper_door","waxed_oxidized_copper_door","iron_trapdoor","oak_trapdoor","spruce_trapdoor","birch_trapdoor","jungle_trapdoor","acacia_trapdoor","cherry_trapdoor","dark_oak_trapdoor","mangrove_trapdoor","bamboo_trapdoor","crimson_trapdoor","warped_trapdoor","copper_trapdoor","exposed_copper_trapdoor","weathered_copper_trapdoor","oxidized_copper_trapdoor","waxed_copper_trapdoor","waxed_exposed_copper_trapdoor","waxed_weathered_copper_trapdoor","waxed_oxidized_copper_trapdoor","oak_fence_gate","spruce_fence_gate","birch_fence_gate","jungle_fence_gate","acacia_fence_gate","cherry_fence_gate","dark_oak_fence_gate","mangrove_fence_gate","bamboo_fence_gate","crimson_fence_gate","warped_fence_gate","powered_rail","detector_rail","rail","activator_rail","saddle","minecart","chest_minecart","furnace_minecart","tnt_minecart","hopper_minecart","carrot_on_a_stick","warped_fungus_on_a_stick","elytra","oak_boat","oak_chest_boat","spruce_boat","spruce_chest_boat","birch_boat","birch_chest_boat","jungle_boat","jungle_chest_boat","acacia_boat","acacia_chest_boat","cherry_boat","cherry_chest_boat","dark_oak_boat","dark_oak_chest_boat","mangrove_boat","mangrove_chest_boat","bamboo_raft","bamboo_chest_raft","structure_block","jigsaw","turtle_helmet","turtle_scute","armadillo_scute","wolf_armor","flint_and_steel","bowl","apple","bow","arrow","coal","charcoal","diamond","emerald","lapis_lazuli","quartz","amethyst_shard","raw_iron","iron_ingot","raw_copper","copper_ingot","raw_gold","gold_ingot","netherite_ingot","netherite_scrap","wooden_sword","wooden_shovel","wooden_pickaxe","wooden_axe","wooden_hoe","stone_sword","stone_shovel","stone_pickaxe","stone_axe","stone_hoe","golden_sword","golden_shovel","golden_pickaxe","golden_axe","golden_hoe","iron_sword","iron_shovel","iron_pickaxe","iron_axe","iron_hoe","diamond_sword","diamond_shovel","diamond_pickaxe","diamond_axe","diamond_hoe","netherite_sword","netherite_shovel","netherite_pickaxe","netherite_axe","netherite_hoe","stick","mushroom_stew","string","feather","gunpowder","wheat_seeds","wheat","bread","leather_helmet","leather_chestplate","leather_leggings","leather_boots","chainmail_helmet","chainmail_chestplate","chainmail_leggings","chainmail_boots","iron_helmet","iron_chestplate","iron_leggings","iron_boots","diamond_helmet","diamond_chestplate","diamond_leggings","diamond_boots","golden_helmet","golden_chestplate","golden_leggings","golden_boots","netherite_helmet","netherite_chestplate","netherite_leggings","netherite_boots","flint","porkchop","cooked_porkchop","painting","golden_apple","enchanted_golden_apple","oak_sign","spruce_sign","birch_sign","jungle_sign","acacia_sign","cherry_sign","dark_oak_sign","mangrove_sign","bamboo_sign","crimson_sign","warped_sign","oak_hanging_sign","spruce_hanging_sign","birch_hanging_sign","jungle_hanging_sign","acacia_hanging_sign","cherry_hanging_sign","dark_oak_hanging_sign","mangrove_hanging_sign","bamboo_hanging_sign","crimson_hanging_sign","warped_hanging_sign","bucket","water_bucket","lava_bucket","powder_snow_bucket","snowball","leather","milk_bucket","pufferfish_bucket","salmon_bucket","cod_bucket","tropical_fish_bucket","axolotl_bucket","tadpole_bucket","brick","clay_ball","dried_kelp_block","paper","book","slime_ball","egg","compass","recovery_compass","bundle","fishing_rod","clock","spyglass","glowstone_dust","cod","salmon","tropical_fish","pufferfish","cooked_cod","cooked_salmon","ink_sac","glow_ink_sac","cocoa_beans","white_dye","orange_dye","magenta_dye","light_blue_dye","yellow_dye","lime_dye","pink_dye","gray_dye","light_gray_dye","cyan_dye","purple_dye","blue_dye","brown_dye","green_dye","red_dye","black_dye","bone_meal","bone","sugar","cake","white_bed","orange_bed","magenta_bed","light_blue_bed","yellow_bed","lime_bed","pink_bed","gray_bed","light_gray_bed","cyan_bed","purple_bed","blue_bed","brown_bed","green_bed","red_bed","black_bed","cookie","crafter","filled_map","shears","melon_slice","dried_kelp","pumpkin_seeds","melon_seeds","beef","cooked_beef","chicken","cooked_chicken","rotten_flesh","ender_pearl","blaze_rod","ghast_tear","gold_nugget","nether_wart","potion","glass_bottle","spider_eye","fermented_spider_eye","blaze_powder","magma_cream","brewing_stand","cauldron","ender_eye","glistering_melon_slice","armadillo_spawn_egg","allay_spawn_egg","axolotl_spawn_egg","bat_spawn_egg","bee_spawn_egg","blaze_spawn_egg","bogged_spawn_egg","breeze_spawn_egg","cat_spawn_egg","camel_spawn_egg","cave_spider_spawn_egg","chicken_spawn_egg","cod_spawn_egg","cow_spawn_egg","creeper_spawn_egg","dolphin_spawn_egg","donkey_spawn_egg","drowned_spawn_egg","elder_guardian_spawn_egg","ender_dragon_spawn_egg","enderman_spawn_egg","endermite_spawn_egg","evoker_spawn_egg","fox_spawn_egg","frog_spawn_egg","ghast_spawn_egg","glow_squid_spawn_egg","goat_spawn_egg","guardian_spawn_egg","hoglin_spawn_egg","horse_spawn_egg","husk_spawn_egg","iron_golem_spawn_egg","llama_spawn_egg","magma_cube_spawn_egg","mooshroom_spawn_egg","mule_spawn_egg","ocelot_spawn_egg","panda_spawn_egg","parrot_spawn_egg","phantom_spawn_egg","pig_spawn_egg","piglin_spawn_egg","piglin_brute_spawn_egg","pillager_spawn_egg","polar_bear_spawn_egg","pufferfish_spawn_egg","rabbit_spawn_egg","ravager_spawn_egg","salmon_spawn_egg","sheep_spawn_egg","shulker_spawn_egg","silverfish_spawn_egg","skeleton_spawn_egg","skeleton_horse_spawn_egg","slime_spawn_egg","sniffer_spawn_egg","snow_golem_spawn_egg","spider_spawn_egg","squid_spawn_egg","stray_spawn_egg","strider_spawn_egg","tadpole_spawn_egg","trader_llama_spawn_egg","tropical_fish_spawn_egg","turtle_spawn_egg","vex_spawn_egg","villager_spawn_egg","vindicator_spawn_egg","wandering_trader_spawn_egg","warden_spawn_egg","witch_spawn_egg","wither_spawn_egg","wither_skeleton_spawn_egg","wolf_spawn_egg","zoglin_spawn_egg","zombie_spawn_egg","zombie_horse_spawn_egg","zombie_villager_spawn_egg","zombified_piglin_spawn_egg","experience_bottle","fire_charge","wind_charge","writable_book","written_book","mace","item_frame","glow_item_frame","flower_pot","carrot","potato","baked_potato","poisonous_potato","map","golden_carrot","skeleton_skull","wither_skeleton_skull","player_head","zombie_head","creeper_head","dragon_head","piglin_head","nether_star","pumpkin_pie","firework_rocket","firework_star","enchanted_book","nether_brick","prismarine_shard","prismarine_crystals","rabbit","cooked_rabbit","rabbit_stew","rabbit_foot","rabbit_hide","armor_stand","iron_horse_armor","golden_horse_armor","diamond_horse_armor","leather_horse_armor","lead","name_tag","command_block_minecart","mutton","cooked_mutton","white_banner","orange_banner","magenta_banner","light_blue_banner","yellow_banner","lime_banner","pink_banner","gray_banner","light_gray_banner","cyan_banner","purple_banner","blue_banner","brown_banner","green_banner","red_banner","black_banner","end_crystal","chorus_fruit","popped_chorus_fruit","torchflower_seeds","pitcher_pod","beetroot","beetroot_seeds","beetroot_soup","dragon_breath","splash_potion","spectral_arrow","tipped_arrow","lingering_potion","shield","totem_of_undying","shulker_shell","iron_nugget","knowledge_book","debug_stick","music_disc_13","music_disc_cat","music_disc_blocks","music_disc_chirp","music_disc_creator","music_disc_creator_music_box","music_disc_far","music_disc_mall","music_disc_mellohi","music_disc_stal","music_disc_strad","music_disc_ward","music_disc_11","music_disc_wait","music_disc_otherside","music_disc_relic","music_disc_5","music_disc_pigstep","music_disc_precipice","disc_fragment_5","trident","phantom_membrane","nautilus_shell","heart_of_the_sea","crossbow","suspicious_stew","loom","flower_banner_pattern","creeper_banner_pattern","skull_banner_pattern","mojang_banner_pattern","globe_banner_pattern","piglin_banner_pattern","flow_banner_pattern","guster_banner_pattern","goat_horn","composter","barrel","smoker","blast_furnace","cartography_table","fletching_table","grindstone","smithing_table","stonecutter","bell","lantern","soul_lantern","sweet_berries","glow_berries","campfire","soul_campfire","shroomlight","honeycomb","bee_nest","beehive","honey_bottle","honeycomb_block","lodestone","crying_obsidian","blackstone","blackstone_slab","blackstone_stairs","gilded_blackstone","polished_blackstone","polished_blackstone_slab","polished_blackstone_stairs","chiseled_polished_blackstone","polished_blackstone_bricks","polished_blackstone_brick_slab","polished_blackstone_brick_stairs","cracked_polished_blackstone_bricks","respawn_anchor","candle","white_candle","orange_candle","magenta_candle","light_blue_candle","yellow_candle","lime_candle","pink_candle","gray_candle","light_gray_candle","cyan_candle","purple_candle","blue_candle","brown_candle","green_candle","red_candle","black_candle","small_amethyst_bud","medium_amethyst_bud","large_amethyst_bud","amethyst_cluster","pointed_dripstone","ochre_froglight","verdant_froglight","pearlescent_froglight","frogspawn","echo_shard","brush","netherite_upgrade_smithing_template","sentry_armor_trim_smithing_template","dune_armor_trim_smithing_template","coast_armor_trim_smithing_template","wild_armor_trim_smithing_template","ward_armor_trim_smithing_template","eye_armor_trim_smithing_template","vex_armor_trim_smithing_template","tide_armor_trim_smithing_template","snout_armor_trim_smithing_template","rib_armor_trim_smithing_template","spire_armor_trim_smithing_template","wayfinder_armor_trim_smithing_template","shaper_armor_trim_smithing_template","silence_armor_trim_smithing_template","raiser_armor_trim_smithing_template","host_armor_trim_smithing_template","flow_armor_trim_smithing_template","bolt_armor_trim_smithing_template","angler_pottery_sherd","archer_pottery_sherd","arms_up_pottery_sherd","blade_pottery_sherd","brewer_pottery_sherd","burn_pottery_sherd","danger_pottery_sherd","explorer_pottery_sherd","flow_pottery_sherd","friend_pottery_sherd","guster_pottery_sherd","heart_pottery_sherd","heartbreak_pottery_sherd","howl_pottery_sherd","miner_pottery_sherd","mourner_pottery_sherd","plenty_pottery_sherd","prize_pottery_sherd","scrape_pottery_sherd","sheaf_pottery_sherd","shelter_pottery_sherd","skull_pottery_sherd","snort_pottery_sherd","copper_grate","exposed_copper_grate","weathered_copper_grate","oxidized_copper_grate","waxed_copper_grate","waxed_exposed_copper_grate","waxed_weathered_copper_grate","waxed_oxidized_copper_grate","copper_bulb","exposed_copper_bulb","weathered_copper_bulb","oxidized_copper_bulb","waxed_copper_bulb","waxed_exposed_copper_bulb","waxed_weathered_copper_bulb","waxed_oxidized_copper_bulb","trial_spawner","trial_key","ominous_trial_key","vault","ominous_bottle","breeze_rod"],"stack_sizes":{"shulker_box":1,"white_shulker_box":1,"orange_shulker_box":1,"magenta_shulker_box":1,"light_blue_shulker_box":1,"yellow_shulker_box":1,"lime_shulker_box":1,"pink_shulker_box":1,"gray_shulker_box":1,"light_gray_shulker_box":1,"cyan_shulker_box":1,"purple_shulker_box":1,"blue_shulker_box":1,"brown_shulker_box":1,"green_shulker_box":1,"red_shulker_box":1,"black_shulker_box":1,"saddle":1,"minecart":1,"chest_minecart":1,"furnace_minecart":1,"tnt_minecart":1,"hopper_minecart":1,"carrot_on_a_stick":1,"warped_fungus_on_a_stick":1,"elytra":1,"oak_boat":1,"oak_chest_boat":1,"spruce_boat":1,"spruce_chest_boat":1,"birch_boat":1,"birch_chest_boat":1,"jungle_boat":1,"jungle_chest_boat":1,"acacia_boat":1,"acacia_chest_boat":1,"cherry_boat":1,"cherry_chest_boat":1,"dark_oak_boat":1,"dark_oak_chest_boat":1,"mangrove_boat":1,"mangrove_chest_boat":1,"bamboo_raft":1,"bamboo_chest_raft":1,"turtle_helmet":1,"wolf_armor":1,"flint_and_steel":1,"bow":1,"wooden_sword":1,"wooden_shovel":1,"wooden_pickaxe":1,"wooden_axe":1,"wooden_hoe":1,"stone_sword":1,"stone_shovel":1,"stone_pickaxe":1,"stone_axe":1,"stone_hoe":1,"golden_sword":1,"golden_shovel":1,"golden_pickaxe":1,"golden_axe":1,"golden_hoe":1,"iron_sword":1,"iron_shovel":1,"iron_pickaxe":1,"iron_axe":1,"iron_hoe":1,"diamond_sword":1,"diamond_shovel":1,"diamond_pickaxe":1,"diamond_axe":1,"diamond_hoe":1,"netherite_sword":1,"netherite_shovel":1,"netherite_pickaxe":1,"netherite_axe":1,"netherite_hoe":1,"mushroom_stew":1,"leather_helmet":1,"leather_chestplate":1,"leather_leggings":1,"leather_boots":1,"chainmail_helmet":1,"chainmail_chestplate":1,"chainmail_leggings":1,"chainmail_boots":1,"iron_helmet":1,"iron_chestplate":1,"iron_leggings":1,"iron_boots":1,"diamond_helmet":1,"diamond_chestplate":1,"diamond_leggings":1,"diamond_boots":1,"golden_helmet":1,"golden_chestplate":1,"golden_leggings":1,"golden_boots":1,"netherite_helmet":1,"netherite_chestplate":1,"netherite_leggings":1,"netherite_boots":1,"oak_sign":16,"spruce_sign":16,"birch_sign":16,"jungle_sign":16,"acacia_sign":16,"cherry_sign":16,"dark_oak_sign":16,"mangrove_sign":16,"bamboo_sign":16,"crimson_sign":16,"warped_sign":16,"oak_hanging_sign":16,"spruce_hanging_sign":16,"birch_hanging_sign":16,"jungle_hanging_sign":16,"acacia_hanging_sign":16,"cherry_hanging_sign":16,"dark_oak_hanging_sign":16,"mangrove_hanging_sign":16,"bamboo_hanging_sign":16,"crimson_hanging_sign":16,"warped_hanging_sign":16,"bucket":16,"water_bucket":1,"lava_bucket":1,"powder_snow_bucket":1,"snowball":16,"milk_bucket":1,"pufferfish_bucket":1,"salmon_bucket":1,"cod_bucket":1,"tropical_fish_bucket":1,"axolotl_bucket":1,"tadpole_bucket":1,"egg":16,"bundle":1,"fishing_rod":1,"spyglass":1,"cake":1,"white_bed":1,"orange_bed":1,"magenta_bed":1,"light_blue_bed":1,"yellow_bed":1,"lime_bed":1,"pink_bed":1,"gray_bed":1,"light_gray_bed":1,"cyan_bed":1,"purple_bed":1,"blue_bed":1,"brown_bed":1,"green_bed":1,"red_bed":1,"black_bed":1,"shears":1,"ender_pearl":16,"potion":1,"writable_book":1,"written_book":16,"mace":1,"enchanted_book":1,"rabbit_stew":1,"armor_stand":16,"iron_horse_armor":1,"golden_horse_armor":1,"diamond_horse_armor":1,"leather_horse_armor":1,"command_block_minecart":1,"white_banner":16,"orange_banner":16,"magenta_banner":16,"light_blue_banner":16,"yellow_banner":16,"lime_banner":16,"pink_banner":16,"gray_banner":16,"light_gray_banner":16,"cyan_banner":16,"purple_banner":16,"blue_banner":16,"brown_banner":16,"green_banner":16,"red_banner":16,"black_banner":16,"beetroot_soup":1,"splash_potion":1,"lingering_potion":1,"shield":1,"totem_of_undying":1,"knowledge_book":1,"debug_stick":1,"music_disc_13":1,"music_disc_cat":1,"music_disc_blocks":1,"music_disc_chirp":1,"music_disc_creator":1,"music_disc_creator_music_box":1,"music_disc_far":1,"music_disc_mall":1,"music_disc_mellohi":1,"music_disc_stal":1,"music_disc_strad":1,"music_disc_ward":1,"music_disc_11":1,"music_disc_wait":1,"music_disc_otherside":1,"music_disc_relic":1,"music_disc_5":1,"music_disc_pigstep":1,"music_disc_precipice":1,"trident":1,"crossbow":1,"suspicious_stew":1,"flower_banner_pattern":1,"creeper_banner_pattern":1,"skull_banner_pattern":1,"mojang_banner_pattern":1,"globe_banner_pattern":1,"piglin_banner_pattern":1,"flow_banner_pattern":1,"guster_banner_pattern":1,"goat_horn":1,"honey_bottle":16,"brush":1},"durability":{"carrot_on_a_stick":25,"warped_fungus_on_a_stick":100,"elytra":432,"turtle_helmet":275,"wolf_armor":64,"flint_and_steel":64,"bow":384,"wooden_sword":59,"wooden_shovel":59,"wooden_pickaxe":59,"wooden_axe":59,"wooden_hoe":59,"stone_sword":131,"stone_shovel":131,"stone_pickaxe":131,"stone_axe":131,"stone_hoe":131,"golden_sword":32,"golden_shovel":32,"golden_pickaxe":32,"golden_axe":32,"golden_hoe":32,"iron_sword":250,"iron_shovel":250,"iron_pickaxe":250,"iron_axe":250,"iron_hoe":250,"diamond_sword":1561,"diamond_shovel":1561,"diamond_pickaxe":1561,"diamond_axe":1561,"diamond_hoe":1561,"netherite_sword":2031,"netherite_shovel":2031,"netherite_pickaxe":2031,"netherite_axe":2031,"netherite_hoe":2031,"leather_helmet":55,"leather_chestplate":80,"leather_leggings":75,"leather_boots":65,"chainmail_helmet":165,"chainmail_chestplate":240,"chainmail_leggings":225,"chainmail_boots":195,"iron_helmet":165,"iron_chestplate":240,"iron_leggings":225,"iron_boots":195,"diamond_helmet":363,"diamond_chestplate":528,"diamond_leggings":495,"diamond_boots":429,"golden_helmet":77,"golden_chestplate":112,"golden_leggings":105,"golden_boots":91,"netherite_helmet":407,"netherite_chestplate":592,"netherite_leggings":555,"netherite_boots":481,"fishing_rod":64,"shears":238,"mace":500,"shield":336,"trident":250,"crossbow":465,"brush":64}} diff --git a/protocol/data/lang_en_us.json b/protocol/data/lang_en_us.json new file mode 100644 index 0000000..702b98e --- /dev/null +++ b/protocol/data/lang_en_us.json @@ -0,0 +1 @@ +{"advancements.adventure.adventuring_time.description":"Discover every biome","advancements.adventure.adventuring_time.title":"Adventuring Time","advancements.adventure.arbalistic.description":"Kill five unique mobs with one crossbow shot","advancements.adventure.arbalistic.title":"Arbalistic","advancements.adventure.avoid_vibration.description":"Sneak near a Sculk Sensor or Warden to prevent it from detecting you","advancements.adventure.avoid_vibration.title":"Sneak 100","advancements.adventure.blowback.description":"Kill a Breeze with a deflected Breeze-shot Wind Charge","advancements.adventure.blowback.title":"Blowback","advancements.adventure.brush_armadillo.description":"Get Armadillo Scutes from an Armadillo using a Brush","advancements.adventure.brush_armadillo.title":"Isn't It Scute?","advancements.adventure.bullseye.description":"Hit the bullseye of a Target block from at least 30 meters away","advancements.adventure.bullseye.title":"Bullseye","advancements.adventure.craft_decorated_pot_using_only_sherds.description":"Make a Decorated Pot out of 4 Pottery Sherds","advancements.adventure.craft_decorated_pot_using_only_sherds.title":"Careful Restoration","advancements.adventure.crafters_crafting_crafters.description":"Be near a Crafter when it crafts a Crafter","advancements.adventure.crafters_crafting_crafters.title":"Crafters Crafting Crafters","advancements.adventure.fall_from_world_height.description":"Free fall from the top of the world (build limit) to the bottom of the world and survive","advancements.adventure.fall_from_world_height.title":"Caves & Cliffs","advancements.adventure.hero_of_the_village.description":"Successfully defend a village from a raid","advancements.adventure.hero_of_the_village.title":"Hero of the Village","advancements.adventure.honey_block_slide.description":"Jump into a Honey Block to break your fall","advancements.adventure.honey_block_slide.title":"Sticky Situation","advancements.adventure.kill_a_mob.description":"Kill any hostile monster","advancements.adventure.kill_a_mob.title":"Monster Hunter","advancements.adventure.kill_all_mobs.description":"Kill one of every hostile monster","advancements.adventure.kill_all_mobs.title":"Monsters Hunted","advancements.adventure.kill_mob_near_sculk_catalyst.description":"Kill a mob near a Sculk Catalyst","advancements.adventure.kill_mob_near_sculk_catalyst.title":"It Spreads","advancements.adventure.lighten_up.description":"Scrape a Copper Bulb with an Axe to make it brighter","advancements.adventure.lighten_up.title":"Lighten Up","advancements.adventure.lightning_rod_with_villager_no_fire.description":"Protect a Villager from an undesired shock without starting a fire","advancements.adventure.lightning_rod_with_villager_no_fire.title":"Surge Protector","advancements.adventure.minecraft_trials_edition.description":"Step foot in a Trial Chamber","advancements.adventure.minecraft_trials_edition.title":"Minecraft: Trial(s) Edition","advancements.adventure.ol_betsy.description":"Shoot a Crossbow","advancements.adventure.ol_betsy.title":"Ol' Betsy","advancements.adventure.overoverkill.description":"Deal 50 hearts of damage in a single hit using the Mace","advancements.adventure.overoverkill.title":"Over-Overkill","advancements.adventure.play_jukebox_in_meadows.description":"Make the Meadows come alive with the sound of music from a Jukebox","advancements.adventure.play_jukebox_in_meadows.title":"Sound of Music","advancements.adventure.read_power_from_chiseled_bookshelf.description":"Read the power signal of a Chiseled Bookshelf using a Comparator","advancements.adventure.read_power_from_chiseled_bookshelf.title":"The Power of Books","advancements.adventure.revaulting.description":"Unlock an Ominous Vault with an Ominous Trial Key","advancements.adventure.revaulting.title":"Revaulting","advancements.adventure.root.description":"Adventure, exploration and combat","advancements.adventure.root.title":"Adventure","advancements.adventure.salvage_sherd.description":"Brush a Suspicious block to obtain a Pottery Sherd","advancements.adventure.salvage_sherd.title":"Respecting the Remnants","advancements.adventure.shoot_arrow.description":"Shoot something with an Arrow","advancements.adventure.shoot_arrow.title":"Take Aim","advancements.adventure.sleep_in_bed.description":"Sleep in a Bed to change your respawn point","advancements.adventure.sleep_in_bed.title":"Sweet Dreams","advancements.adventure.sniper_duel.description":"Kill a Skeleton from at least 50 meters away","advancements.adventure.sniper_duel.title":"Sniper Duel","advancements.adventure.spyglass_at_dragon.description":"Look at the Ender Dragon through a Spyglass","advancements.adventure.spyglass_at_dragon.title":"Is It a Plane?","advancements.adventure.spyglass_at_ghast.description":"Look at a Ghast through a Spyglass","advancements.adventure.spyglass_at_ghast.title":"Is It a Balloon?","advancements.adventure.spyglass_at_parrot.description":"Look at a Parrot through a Spyglass","advancements.adventure.spyglass_at_parrot.title":"Is It a Bird?","advancements.adventure.summon_iron_golem.description":"Summon an Iron Golem to help defend a village","advancements.adventure.summon_iron_golem.title":"Hired Help","advancements.adventure.throw_trident.description":"Throw a Trident at something.\nNote: Throwing away your only weapon is not a good idea.","advancements.adventure.throw_trident.title":"A Throwaway Joke","advancements.adventure.totem_of_undying.description":"Use a Totem of Undying to cheat death","advancements.adventure.totem_of_undying.title":"Postmortal","advancements.adventure.trade.description":"Successfully trade with a Villager","advancements.adventure.trade.title":"What a Deal!","advancements.adventure.trade_at_world_height.description":"Trade with a Villager at the build height limit","advancements.adventure.trade_at_world_height.title":"Star Trader","advancements.adventure.trim_with_all_exclusive_armor_patterns.description":"Apply these smithing templates at least once: Spire, Snout, Rib, Ward, Silence, Vex, Tide, Wayfinder","advancements.adventure.trim_with_all_exclusive_armor_patterns.title":"Smithing with Style","advancements.adventure.trim_with_any_armor_pattern.description":"Craft a trimmed armor at a Smithing Table","advancements.adventure.trim_with_any_armor_pattern.title":"Crafting a New Look","advancements.adventure.two_birds_one_arrow.description":"Kill two Phantoms with a piercing Arrow","advancements.adventure.two_birds_one_arrow.title":"Two Birds, One Arrow","advancements.adventure.under_lock_and_key.description":"Unlock a Vault with a Trial Key","advancements.adventure.under_lock_and_key.title":"Under Lock and Key","advancements.adventure.very_very_frightening.description":"Strike a Villager with lightning","advancements.adventure.very_very_frightening.title":"Very Very Frightening","advancements.adventure.voluntary_exile.description":"Kill a raid captain.\nMaybe consider staying away from villages for the time being...","advancements.adventure.voluntary_exile.title":"Voluntary Exile","advancements.adventure.walk_on_powder_snow_with_leather_boots.description":"Walk on Powder Snow... without sinking in it","advancements.adventure.walk_on_powder_snow_with_leather_boots.title":"Light as a Rabbit","advancements.adventure.who_needs_rockets.description":"Use a Wind Charge to launch yourself upward 8 blocks","advancements.adventure.who_needs_rockets.title":"Who Needs Rockets?","advancements.adventure.whos_the_pillager_now.description":"Give a Pillager a taste of their own medicine","advancements.adventure.whos_the_pillager_now.title":"Who's the Pillager Now?","advancements.empty":"There doesn't seem to be anything here...","advancements.end.dragon_breath.description":"Collect Dragon's Breath in a Glass Bottle","advancements.end.dragon_breath.title":"You Need a Mint","advancements.end.dragon_egg.description":"Hold the Dragon Egg","advancements.end.dragon_egg.title":"The Next Generation","advancements.end.elytra.description":"Find Elytra","advancements.end.elytra.title":"Sky's the Limit","advancements.end.enter_end_gateway.description":"Escape the island","advancements.end.enter_end_gateway.title":"Remote Getaway","advancements.end.find_end_city.description":"Go on in, what could happen?","advancements.end.find_end_city.title":"The City at the End of the Game","advancements.end.kill_dragon.description":"Good luck","advancements.end.kill_dragon.title":"Free the End","advancements.end.levitate.description":"Levitate up 50 blocks from the attacks of a Shulker","advancements.end.levitate.title":"Great View From Up Here","advancements.end.respawn_dragon.description":"Respawn the Ender Dragon","advancements.end.respawn_dragon.title":"The End... Again...","advancements.end.root.description":"Or the beginning?","advancements.end.root.title":"The End","advancements.husbandry.allay_deliver_cake_to_note_block.description":"Have an Allay drop a Cake at a Note Block","advancements.husbandry.allay_deliver_cake_to_note_block.title":"Birthday Song","advancements.husbandry.allay_deliver_item_to_player.description":"Have an Allay deliver items to you","advancements.husbandry.allay_deliver_item_to_player.title":"You've Got a Friend in Me","advancements.husbandry.axolotl_in_a_bucket.description":"Catch an Axolotl in a Bucket","advancements.husbandry.axolotl_in_a_bucket.title":"The Cutest Predator","advancements.husbandry.balanced_diet.description":"Eat everything that is edible, even if it's not good for you","advancements.husbandry.balanced_diet.title":"A Balanced Diet","advancements.husbandry.breed_all_animals.description":"Breed all the animals!","advancements.husbandry.breed_all_animals.title":"Two by Two","advancements.husbandry.breed_an_animal.description":"Breed two animals together","advancements.husbandry.breed_an_animal.title":"The Parrots and the Bats","advancements.husbandry.complete_catalogue.description":"Tame all Cat variants!","advancements.husbandry.complete_catalogue.title":"A Complete Catalogue","advancements.husbandry.feed_snifflet.description":"Feed a Snifflet","advancements.husbandry.feed_snifflet.title":"Little Sniffs","advancements.husbandry.fishy_business.description":"Catch a fish","advancements.husbandry.fishy_business.title":"Fishy Business","advancements.husbandry.froglights.description":"Have all Froglights in your inventory","advancements.husbandry.froglights.title":"With Our Powers Combined!","advancements.husbandry.kill_axolotl_target.description":"Team up with an Axolotl and win a fight","advancements.husbandry.kill_axolotl_target.title":"The Healing Power of Friendship!","advancements.husbandry.leash_all_frog_variants.description":"Get each Frog variant on a Lead","advancements.husbandry.leash_all_frog_variants.title":"When the Squad Hops into Town","advancements.husbandry.make_a_sign_glow.description":"Make the text of any kind of sign glow","advancements.husbandry.make_a_sign_glow.title":"Glow and Behold!","advancements.husbandry.netherite_hoe.description":"Use a Netherite Ingot to upgrade a Hoe, and then reevaluate your life choices","advancements.husbandry.netherite_hoe.title":"Serious Dedication","advancements.husbandry.obtain_sniffer_egg.description":"Obtain a Sniffer Egg","advancements.husbandry.obtain_sniffer_egg.title":"Smells Interesting","advancements.husbandry.plant_any_sniffer_seed.description":"Plant any Sniffer seed","advancements.husbandry.plant_any_sniffer_seed.title":"Planting the Past","advancements.husbandry.plant_seed.description":"Plant a seed and watch it grow","advancements.husbandry.plant_seed.title":"A Seedy Place","advancements.husbandry.remove_wolf_armor.description":"Remove Wolf Armor from a Wolf using Shears","advancements.husbandry.remove_wolf_armor.title":"Shear Brilliance","advancements.husbandry.repair_wolf_armor.description":"Repair a damaged Wolf Armor using Armadillo Scutes","advancements.husbandry.repair_wolf_armor.title":"Good as New","advancements.husbandry.ride_a_boat_with_a_goat.description":"Get in a Boat and float with a Goat","advancements.husbandry.ride_a_boat_with_a_goat.title":"Whatever Floats Your Goat!","advancements.husbandry.root.description":"The world is full of friends and food","advancements.husbandry.root.title":"Husbandry","advancements.husbandry.safely_harvest_honey.description":"Use a Campfire to collect Honey from a Beehive using a Glass Bottle without aggravating the Bees","advancements.husbandry.safely_harvest_honey.title":"Bee Our Guest","advancements.husbandry.silk_touch_nest.description":"Move a Bee Nest, with 3 Bees inside, using Silk Touch","advancements.husbandry.silk_touch_nest.title":"Total Beelocation","advancements.husbandry.tactical_fishing.description":"Catch a Fish... without a Fishing Rod!","advancements.husbandry.tactical_fishing.title":"Tactical Fishing","advancements.husbandry.tadpole_in_a_bucket.description":"Catch a Tadpole in a Bucket","advancements.husbandry.tadpole_in_a_bucket.title":"Bukkit Bukkit","advancements.husbandry.tame_an_animal.description":"Tame an animal","advancements.husbandry.tame_an_animal.title":"Best Friends Forever","advancements.husbandry.wax_off.description":"Scrape Wax off of a Copper block!","advancements.husbandry.wax_off.title":"Wax Off","advancements.husbandry.wax_on.description":"Apply Honeycomb to a Copper block!","advancements.husbandry.wax_on.title":"Wax On","advancements.husbandry.whole_pack.description":"Tame one of each Wolf variant","advancements.husbandry.whole_pack.title":"The Whole Pack","advancements.nether.all_effects.description":"Have every effect applied at the same time","advancements.nether.all_effects.title":"How Did We Get Here?","advancements.nether.all_potions.description":"Have every potion effect applied at the same time","advancements.nether.all_potions.title":"A Furious Cocktail","advancements.nether.brew_potion.description":"Brew a Potion","advancements.nether.brew_potion.title":"Local Brewery","advancements.nether.charge_respawn_anchor.description":"Charge a Respawn Anchor to the maximum","advancements.nether.charge_respawn_anchor.title":"Not Quite \"Nine\" Lives","advancements.nether.create_beacon.description":"Construct and place a Beacon","advancements.nether.create_beacon.title":"Bring Home the Beacon","advancements.nether.create_full_beacon.description":"Bring a Beacon to full power","advancements.nether.create_full_beacon.title":"Beaconator","advancements.nether.distract_piglin.description":"Distract Piglins with gold","advancements.nether.distract_piglin.title":"Oh Shiny","advancements.nether.explore_nether.description":"Explore all Nether biomes","advancements.nether.explore_nether.title":"Hot Tourist Destinations","advancements.nether.fast_travel.description":"Use the Nether to travel 7 km in the Overworld","advancements.nether.fast_travel.title":"Subspace Bubble","advancements.nether.find_bastion.description":"Enter a Bastion Remnant","advancements.nether.find_bastion.title":"Those Were the Days","advancements.nether.find_fortress.description":"Break your way into a Nether Fortress","advancements.nether.find_fortress.title":"A Terrible Fortress","advancements.nether.get_wither_skull.description":"Obtain a Wither Skeleton's skull","advancements.nether.get_wither_skull.title":"Spooky Scary Skeleton","advancements.nether.loot_bastion.description":"Loot a Chest in a Bastion Remnant","advancements.nether.loot_bastion.title":"War Pigs","advancements.nether.netherite_armor.description":"Get a full suit of Netherite armor","advancements.nether.netherite_armor.title":"Cover Me in Debris","advancements.nether.obtain_ancient_debris.description":"Obtain Ancient Debris","advancements.nether.obtain_ancient_debris.title":"Hidden in the Depths","advancements.nether.obtain_blaze_rod.description":"Relieve a Blaze of its rod","advancements.nether.obtain_blaze_rod.title":"Into Fire","advancements.nether.obtain_crying_obsidian.description":"Obtain Crying Obsidian","advancements.nether.obtain_crying_obsidian.title":"Who is Cutting Onions?","advancements.nether.return_to_sender.description":"Destroy a Ghast with a fireball","advancements.nether.return_to_sender.title":"Return to Sender","advancements.nether.ride_strider.description":"Ride a Strider with a Warped Fungus on a Stick","advancements.nether.ride_strider.title":"This Boat Has Legs","advancements.nether.ride_strider_in_overworld_lava.description":"Take a Strider for a loooong ride on a lava lake in the Overworld","advancements.nether.ride_strider_in_overworld_lava.title":"Feels Like Home","advancements.nether.root.description":"Bring summer clothes","advancements.nether.root.title":"Nether","advancements.nether.summon_wither.description":"Summon the Wither","advancements.nether.summon_wither.title":"Withering Heights","advancements.nether.uneasy_alliance.description":"Rescue a Ghast from the Nether, bring it safely home to the Overworld... and then kill it","advancements.nether.uneasy_alliance.title":"Uneasy Alliance","advancements.nether.use_lodestone.description":"Use a Compass on a Lodestone","advancements.nether.use_lodestone.title":"Country Lode, Take Me Home","advancements.progress":"%s/%s","advancements.sad_label":":(","advancements.story.cure_zombie_villager.description":"Weaken and then cure a Zombie Villager","advancements.story.cure_zombie_villager.title":"Zombie Doctor","advancements.story.deflect_arrow.description":"Deflect a projectile with a Shield","advancements.story.deflect_arrow.title":"Not Today, Thank You","advancements.story.enchant_item.description":"Enchant an item at an Enchanting Table","advancements.story.enchant_item.title":"Enchanter","advancements.story.enter_the_end.description":"Enter the End Portal","advancements.story.enter_the_end.title":"The End?","advancements.story.enter_the_nether.description":"Build, light and enter a Nether Portal","advancements.story.enter_the_nether.title":"We Need to Go Deeper","advancements.story.follow_ender_eye.description":"Follow an Eye of Ender","advancements.story.follow_ender_eye.title":"Eye Spy","advancements.story.form_obsidian.description":"Obtain a block of Obsidian","advancements.story.form_obsidian.title":"Ice Bucket Challenge","advancements.story.iron_tools.description":"Upgrade your Pickaxe","advancements.story.iron_tools.title":"Isn't It Iron Pick","advancements.story.lava_bucket.description":"Fill a Bucket with lava","advancements.story.lava_bucket.title":"Hot Stuff","advancements.story.mine_diamond.description":"Acquire diamonds","advancements.story.mine_diamond.title":"Diamonds!","advancements.story.mine_stone.description":"Mine Stone with your new Pickaxe","advancements.story.mine_stone.title":"Stone Age","advancements.story.obtain_armor.description":"Protect yourself with a piece of iron armor","advancements.story.obtain_armor.title":"Suit Up","advancements.story.root.description":"The heart and story of the game","advancements.story.root.title":"Minecraft","advancements.story.shiny_gear.description":"Diamond armor saves lives","advancements.story.shiny_gear.title":"Cover Me with Diamonds","advancements.story.smelt_iron.description":"Smelt an Iron Ingot","advancements.story.smelt_iron.title":"Acquire Hardware","advancements.story.upgrade_tools.description":"Construct a better Pickaxe","advancements.story.upgrade_tools.title":"Getting an Upgrade","advancements.toast.challenge":"Challenge Complete!","advancements.toast.goal":"Goal Reached!","advancements.toast.task":"Advancement Made!","argument.anchor.invalid":"Invalid entity anchor position %s","argument.angle.incomplete":"Incomplete (expected 1 angle)","argument.angle.invalid":"Invalid angle","argument.block.id.invalid":"Unknown block type '%s'","argument.block.property.duplicate":"Property '%s' can only be set once for block %s","argument.block.property.invalid":"Block %s does not accept '%s' for %s property","argument.block.property.novalue":"Expected value for property '%s' on block %s","argument.block.property.unclosed":"Expected closing ] for block state properties","argument.block.property.unknown":"Block %s does not have property '%s'","argument.block.tag.disallowed":"Tags aren't allowed here, only actual blocks","argument.color.invalid":"Unknown color '%s'","argument.component.invalid":"Invalid chat component: %s","argument.criteria.invalid":"Unknown criterion '%s'","argument.dimension.invalid":"Unknown dimension '%s'","argument.double.big":"Double must not be more than %s, found %s","argument.double.low":"Double must not be less than %s, found %s","argument.entity.invalid":"Invalid name or UUID","argument.entity.notfound.entity":"No entity was found","argument.entity.notfound.player":"No player was found","argument.entity.options.advancements.description":"Players with advancements","argument.entity.options.distance.description":"Distance to entity","argument.entity.options.distance.negative":"Distance cannot be negative","argument.entity.options.dx.description":"Entities between x and x + dx","argument.entity.options.dy.description":"Entities between y and y + dy","argument.entity.options.dz.description":"Entities between z and z + dz","argument.entity.options.gamemode.description":"Players with game mode","argument.entity.options.inapplicable":"Option '%s' isn't applicable here","argument.entity.options.level.description":"Experience level","argument.entity.options.level.negative":"Level shouldn't be negative","argument.entity.options.limit.description":"Maximum number of entities to return","argument.entity.options.limit.toosmall":"Limit must be at least 1","argument.entity.options.mode.invalid":"Invalid or unknown game mode '%s'","argument.entity.options.name.description":"Entity name","argument.entity.options.nbt.description":"Entities with NBT","argument.entity.options.predicate.description":"Custom predicate","argument.entity.options.scores.description":"Entities with scores","argument.entity.options.sort.description":"Sort the entities","argument.entity.options.sort.irreversible":"Invalid or unknown sort type '%s'","argument.entity.options.tag.description":"Entities with tag","argument.entity.options.team.description":"Entities on team","argument.entity.options.type.description":"Entities of type","argument.entity.options.type.invalid":"Invalid or unknown entity type '%s'","argument.entity.options.unknown":"Unknown option '%s'","argument.entity.options.unterminated":"Expected end of options","argument.entity.options.valueless":"Expected value for option '%s'","argument.entity.options.x.description":"x position","argument.entity.options.x_rotation.description":"Entity's x rotation","argument.entity.options.y.description":"y position","argument.entity.options.y_rotation.description":"Entity's y rotation","argument.entity.options.z.description":"z position","argument.entity.selector.allEntities":"All entities","argument.entity.selector.allPlayers":"All players","argument.entity.selector.missing":"Missing selector type","argument.entity.selector.nearestEntity":"Nearest entity","argument.entity.selector.nearestPlayer":"Nearest player","argument.entity.selector.not_allowed":"Selector not allowed","argument.entity.selector.randomPlayer":"Random player","argument.entity.selector.self":"Current entity","argument.entity.selector.unknown":"Unknown selector type '%s'","argument.entity.toomany":"Only one entity is allowed, but the provided selector allows more than one","argument.enum.invalid":"Invalid value \"%s\"","argument.float.big":"Float must not be more than %s, found %s","argument.float.low":"Float must not be less than %s, found %s","argument.gamemode.invalid":"Unknown game mode: %s","argument.id.invalid":"Invalid ID","argument.id.unknown":"Unknown ID: %s","argument.integer.big":"Integer must not be more than %s, found %s","argument.integer.low":"Integer must not be less than %s, found %s","argument.item.id.invalid":"Unknown item '%s'","argument.item.tag.disallowed":"Tags aren't allowed here, only actual items","argument.literal.incorrect":"Expected literal %s","argument.long.big":"Long must not be more than %s, found %s","argument.long.low":"Long must not be less than %s, found %s","argument.message.too_long":"Chat message was too long (%s > maximum %s characters)","argument.nbt.array.invalid":"Invalid array type '%s'","argument.nbt.array.mixed":"Can't insert %s into %s","argument.nbt.expected.key":"Expected key","argument.nbt.expected.value":"Expected value","argument.nbt.list.mixed":"Can't insert %s into list of %s","argument.nbt.trailing":"Unexpected trailing data","argument.player.entities":"Only players may be affected by this command, but the provided selector includes entities","argument.player.toomany":"Only one player is allowed, but the provided selector allows more than one","argument.player.unknown":"That player does not exist","argument.pos.missing.double":"Expected a coordinate","argument.pos.missing.int":"Expected a block position","argument.pos.mixed":"Cannot mix world & local coordinates (everything must either use ^ or not)","argument.pos.outofbounds":"That position is outside the allowed boundaries.","argument.pos.outofworld":"That position is out of this world!","argument.pos.unloaded":"That position is not loaded","argument.pos2d.incomplete":"Incomplete (expected 2 coordinates)","argument.pos3d.incomplete":"Incomplete (expected 3 coordinates)","argument.range.empty":"Expected value or range of values","argument.range.ints":"Only whole numbers allowed, not decimals","argument.range.swapped":"Min cannot be bigger than max","argument.resource.invalid_type":"Element '%s' has wrong type '%s' (expected '%s')","argument.resource.not_found":"Can't find element '%s' of type '%s'","argument.resource_or_id.failed_to_parse":"Failed to parse structure: %s","argument.resource_or_id.invalid":"Invalid id or tag","argument.resource_tag.invalid_type":"Tag '%s' has wrong type '%s' (expected '%s')","argument.resource_tag.not_found":"Can't find tag '%s' of type '%s'","argument.rotation.incomplete":"Incomplete (expected 2 coordinates)","argument.scoreHolder.empty":"No relevant score holders could be found","argument.scoreboardDisplaySlot.invalid":"Unknown display slot '%s'","argument.style.invalid":"Invalid style: %s","argument.time.invalid_tick_count":"The tick count must be non-negative","argument.time.invalid_unit":"Invalid unit","argument.time.tick_count_too_low":"The tick count must not be less than %s, found %s","argument.uuid.invalid":"Invalid UUID","block.minecraft.bed.no_sleep":"You can sleep only at night or during thunderstorms","block.minecraft.bed.not_safe":"You may not rest now; there are monsters nearby","block.minecraft.bed.obstructed":"This bed is obstructed","block.minecraft.bed.occupied":"This bed is occupied","block.minecraft.bed.too_far_away":"You may not rest now; the bed is too far away","block.minecraft.bedrock":"Bedrock","block.minecraft.set_spawn":"Respawn point set","block.minecraft.spawn.not_valid":"You have no home bed or charged respawn anchor, or it was obstructed","block.minecraft.spawner":"Monster Spawner","block.minecraft.spawner.desc1":"Interact with Spawn Egg:","block.minecraft.spawner.desc2":"Sets Mob Type","chat.cannotSend":"Cannot send chat message","chat.coordinates":"%s, %s, %s","chat.coordinates.tooltip":"Click to teleport","chat.copy":"Copy to Clipboard","chat.copy.click":"Click to Copy to Clipboard","chat.deleted_marker":"This chat message has been deleted by the server.","chat.disabled.chain_broken":"Chat disabled due to broken chain. Please try reconnecting.","chat.disabled.expiredProfileKey":"Chat disabled due to expired profile public key. Please try reconnecting.","chat.disabled.invalid_command_signature":"Command had unexpected or missing command argument signatures.","chat.disabled.invalid_signature":"Chat had an invalid signature. Please try reconnecting.","chat.disabled.launcher":"Chat disabled by launcher option. Cannot send message.","chat.disabled.missingProfileKey":"Chat disabled due to missing profile public key. Please try reconnecting.","chat.disabled.options":"Chat disabled in client options.","chat.disabled.out_of_order_chat":"Chat received out-of-order. Did your system time change?","chat.disabled.profile":"Chat is not allowed by account settings. Press '%s' again for more information.","chat.disabled.profile.moreInfo":"Chat is not allowed by account settings. Cannot send or view messages.","chat.editBox":"chat","chat.filtered":"Filtered by the server.","chat.filtered_full":"The server has hidden your message for some players.","chat.link.confirm":"Are you sure you want to open the following website?","chat.link.confirmTrusted":"Do you want to open this link or copy it to your clipboard?","chat.link.open":"Open in Browser","chat.link.warning":"Never open links from people that you don't trust!","chat.queue":"[+%s pending lines]","chat.square_brackets":"[%s]","chat.tag.error":"Server sent invalid message.","chat.tag.modified":"Message modified by the server. Original:","chat.tag.not_secure":"Unverified message. Cannot be reported.","chat.tag.system":"Server message. Cannot be reported.","chat.tag.system_single_player":"Server message.","chat.type.admin":"[%s: %s]","chat.type.advancement.challenge":"%s has completed the challenge %s","chat.type.advancement.goal":"%s has reached the goal %s","chat.type.advancement.task":"%s has made the advancement %s","chat.type.announcement":"[%s] %s","chat.type.emote":"* %s %s","chat.type.team.hover":"Message Team","chat.type.team.sent":"-> %s <%s> %s","chat.type.team.text":"%s <%s> %s","chat.type.text":"<%s> %s","chat.type.text.narrate":"%s says %s","chat.validation_error":"Chat validation error","chat_screen.message":"Message to send: %s","chat_screen.title":"Chat screen","chat_screen.usage":"Input message and press Enter to send","command.context.here":"<--[HERE]","command.context.parse_error":"%s at position %s: %s","command.exception":"Could not parse command: %s","command.expected.separator":"Expected whitespace to end one argument, but found trailing data","command.failed":"An unexpected error occurred trying to execute that command","command.forkLimit":"Maximum number of contexts (%s) reached","command.unknown.argument":"Incorrect argument for command","command.unknown.command":"Unknown or incomplete command, see below for error","commands.advancement.advancementNotFound":"No advancement was found by the name '%1$s'","commands.advancement.criterionNotFound":"The advancement %1$s does not contain the criterion '%2$s'","commands.advancement.grant.criterion.to.many.failure":"Couldn't grant criterion '%s' of advancement %s to %s players as they already have it","commands.advancement.grant.criterion.to.many.success":"Granted criterion '%s' of advancement %s to %s players","commands.advancement.grant.criterion.to.one.failure":"Couldn't grant criterion '%s' of advancement %s to %s as they already have it","commands.advancement.grant.criterion.to.one.success":"Granted criterion '%s' of advancement %s to %s","commands.advancement.grant.many.to.many.failure":"Couldn't grant %s advancements to %s players as they already have them","commands.advancement.grant.many.to.many.success":"Granted %s advancements to %s players","commands.advancement.grant.many.to.one.failure":"Couldn't grant %s advancements to %s as they already have them","commands.advancement.grant.many.to.one.success":"Granted %s advancements to %s","commands.advancement.grant.one.to.many.failure":"Couldn't grant advancement %s to %s players as they already have it","commands.advancement.grant.one.to.many.success":"Granted the advancement %s to %s players","commands.advancement.grant.one.to.one.failure":"Couldn't grant advancement %s to %s as they already have it","commands.advancement.grant.one.to.one.success":"Granted the advancement %s to %s","commands.advancement.revoke.criterion.to.many.failure":"Couldn't revoke criterion '%s' of advancement %s from %s players as they don't have it","commands.advancement.revoke.criterion.to.many.success":"Revoked criterion '%s' of advancement %s from %s players","commands.advancement.revoke.criterion.to.one.failure":"Couldn't revoke criterion '%s' of advancement %s from %s as they don't have it","commands.advancement.revoke.criterion.to.one.success":"Revoked criterion '%s' of advancement %s from %s","commands.advancement.revoke.many.to.many.failure":"Couldn't revoke %s advancements from %s players as they don't have them","commands.advancement.revoke.many.to.many.success":"Revoked %s advancements from %s players","commands.advancement.revoke.many.to.one.failure":"Couldn't revoke %s advancements from %s as they don't have them","commands.advancement.revoke.many.to.one.success":"Revoked %s advancements from %s","commands.advancement.revoke.one.to.many.failure":"Couldn't revoke advancement %s from %s players as they don't have it","commands.advancement.revoke.one.to.many.success":"Revoked the advancement %s from %s players","commands.advancement.revoke.one.to.one.failure":"Couldn't revoke advancement %s from %s as they don't have it","commands.advancement.revoke.one.to.one.success":"Revoked the advancement %s from %s","commands.attribute.base_value.get.success":"Base value of attribute %s for entity %s is %s","commands.attribute.base_value.set.success":"Base value for attribute %s for entity %s set to %s","commands.attribute.failed.entity":"%s is not a valid entity for this command","commands.attribute.failed.modifier_already_present":"Modifier %s is already present on attribute %s for entity %s","commands.attribute.failed.no_attribute":"Entity %s has no attribute %s","commands.attribute.failed.no_modifier":"Attribute %s for entity %s has no modifier %s","commands.attribute.modifier.add.success":"Added modifier %s to attribute %s for entity %s","commands.attribute.modifier.remove.success":"Removed modifier %s from attribute %s for entity %s","commands.attribute.modifier.value.get.success":"Value of modifier %s on attribute %s for entity %s is %s","commands.attribute.value.get.success":"Value of attribute %s for entity %s is %s","commands.ban.failed":"Nothing changed. The player is already banned","commands.ban.success":"Banned %s: %s","commands.banip.failed":"Nothing changed. That IP is already banned","commands.banip.info":"This ban affects %s player(s): %s","commands.banip.invalid":"Invalid IP address or unknown player","commands.banip.success":"Banned IP %s: %s","commands.banlist.entry":"%s was banned by %s: %s","commands.banlist.entry.unknown":"(Unknown)","commands.banlist.list":"There are %s ban(s):","commands.banlist.none":"There are no bans","commands.bossbar.create.failed":"A bossbar already exists with the ID '%s'","commands.bossbar.create.success":"Created custom bossbar %s","commands.bossbar.get.max":"Custom bossbar %s has a maximum of %s","commands.bossbar.get.players.none":"Custom bossbar %s has no players currently online","commands.bossbar.get.players.some":"Custom bossbar %s has %s player(s) currently online: %s","commands.bossbar.get.value":"Custom bossbar %s has a value of %s","commands.bossbar.get.visible.hidden":"Custom bossbar %s is currently hidden","commands.bossbar.get.visible.visible":"Custom bossbar %s is currently shown","commands.bossbar.list.bars.none":"There are no custom bossbars active","commands.bossbar.list.bars.some":"There are %s custom bossbar(s) active: %s","commands.bossbar.remove.success":"Removed custom bossbar %s","commands.bossbar.set.color.success":"Custom bossbar %s has changed color","commands.bossbar.set.color.unchanged":"Nothing changed. That's already the color of this bossbar","commands.bossbar.set.max.success":"Custom bossbar %s has changed maximum to %s","commands.bossbar.set.max.unchanged":"Nothing changed. That's already the max of this bossbar","commands.bossbar.set.name.success":"Custom bossbar %s has been renamed","commands.bossbar.set.name.unchanged":"Nothing changed. That's already the name of this bossbar","commands.bossbar.set.players.success.none":"Custom bossbar %s no longer has any players","commands.bossbar.set.players.success.some":"Custom bossbar %s now has %s player(s): %s","commands.bossbar.set.players.unchanged":"Nothing changed. Those players are already on the bossbar with nobody to add or remove","commands.bossbar.set.style.success":"Custom bossbar %s has changed style","commands.bossbar.set.style.unchanged":"Nothing changed. That's already the style of this bossbar","commands.bossbar.set.value.success":"Custom bossbar %s has changed value to %s","commands.bossbar.set.value.unchanged":"Nothing changed. That's already the value of this bossbar","commands.bossbar.set.visibility.unchanged.hidden":"Nothing changed. The bossbar is already hidden","commands.bossbar.set.visibility.unchanged.visible":"Nothing changed. The bossbar is already visible","commands.bossbar.set.visible.success.hidden":"Custom bossbar %s is now hidden","commands.bossbar.set.visible.success.visible":"Custom bossbar %s is now visible","commands.bossbar.unknown":"No bossbar exists with the ID '%s'","commands.clear.success.multiple":"Removed %s item(s) from %s players","commands.clear.success.single":"Removed %s item(s) from player %s","commands.clear.test.multiple":"Found %s matching item(s) on %s players","commands.clear.test.single":"Found %s matching item(s) on player %s","commands.clone.failed":"No blocks were cloned","commands.clone.overlap":"The source and destination areas cannot overlap","commands.clone.success":"Successfully cloned %s block(s)","commands.clone.toobig":"Too many blocks in the specified area (maximum %s, specified %s)","commands.damage.invulnerable":"Target is invulnerable to the given damage type","commands.damage.success":"Applied %s damage to %s","commands.data.block.get":"%s on block %s, %s, %s after scale factor of %s is %s","commands.data.block.invalid":"The target block is not a block entity","commands.data.block.modified":"Modified block data of %s, %s, %s","commands.data.block.query":"%s, %s, %s has the following block data: %s","commands.data.entity.get":"%s on %s after scale factor of %s is %s","commands.data.entity.invalid":"Unable to modify player data","commands.data.entity.modified":"Modified entity data of %s","commands.data.entity.query":"%s has the following entity data: %s","commands.data.get.invalid":"Can't get %s; only numeric tags are allowed","commands.data.get.multiple":"This argument accepts a single NBT value","commands.data.get.unknown":"Can't get %s; tag doesn't exist","commands.data.merge.failed":"Nothing changed. The specified properties already have these values","commands.data.modify.expected_list":"Expected list, got: %s","commands.data.modify.expected_object":"Expected object, got: %s","commands.data.modify.expected_value":"Expected value, got: %s","commands.data.modify.invalid_index":"Invalid list index: %s","commands.data.modify.invalid_substring":"Invalid substring indices: %s to %s","commands.data.storage.get":"%s in storage %s after scale factor of %s is %s","commands.data.storage.modified":"Modified storage %s","commands.data.storage.query":"Storage %s has the following contents: %s","commands.datapack.disable.failed":"Pack '%s' is not enabled!","commands.datapack.disable.failed.feature":"Pack '%s' cannot be disabled, since it is part of an enabled flag!","commands.datapack.enable.failed":"Pack '%s' is already enabled!","commands.datapack.enable.failed.no_flags":"Pack '%s' cannot be enabled, since required flags are not enabled in this world: %s!","commands.datapack.list.available.none":"There are no more data packs available","commands.datapack.list.available.success":"There are %s data pack(s) available: %s","commands.datapack.list.enabled.none":"There are no data packs enabled","commands.datapack.list.enabled.success":"There are %s data pack(s) enabled: %s","commands.datapack.modify.disable":"Disabling data pack %s","commands.datapack.modify.enable":"Enabling data pack %s","commands.datapack.unknown":"Unknown data pack '%s'","commands.debug.alreadyRunning":"The tick profiler is already started","commands.debug.function.noRecursion":"Can't trace from inside of function","commands.debug.function.noReturnRun":"Tracing can't be used with return run","commands.debug.function.success.multiple":"Traced %s command(s) from %s functions to output file %s","commands.debug.function.success.single":"Traced %s command(s) from function '%s' to output file %s","commands.debug.function.traceFailed":"Failed to trace function","commands.debug.notRunning":"The tick profiler hasn't started","commands.debug.started":"Started tick profiling","commands.debug.stopped":"Stopped tick profiling after %s seconds and %s ticks (%s ticks per second)","commands.defaultgamemode.success":"The default game mode is now %s","commands.deop.failed":"Nothing changed. The player is not an operator","commands.deop.success":"Made %s no longer a server operator","commands.difficulty.failure":"The difficulty did not change; it is already set to %s","commands.difficulty.query":"The difficulty is %s","commands.difficulty.success":"The difficulty has been set to %s","commands.drop.no_held_items":"Entity can't hold any items","commands.drop.no_loot_table":"Entity %s has no loot table","commands.drop.success.multiple":"Dropped %s items","commands.drop.success.multiple_with_table":"Dropped %s items from loot table %s","commands.drop.success.single":"Dropped %s %s","commands.drop.success.single_with_table":"Dropped %s %s from loot table %s","commands.effect.clear.everything.failed":"Target has no effects to remove","commands.effect.clear.everything.success.multiple":"Removed every effect from %s targets","commands.effect.clear.everything.success.single":"Removed every effect from %s","commands.effect.clear.specific.failed":"Target doesn't have the requested effect","commands.effect.clear.specific.success.multiple":"Removed effect %s from %s targets","commands.effect.clear.specific.success.single":"Removed effect %s from %s","commands.effect.give.failed":"Unable to apply this effect (target is either immune to effects, or has something stronger)","commands.effect.give.success.multiple":"Applied effect %s to %s targets","commands.effect.give.success.single":"Applied effect %s to %s","commands.enchant.failed":"Nothing changed. Targets either have no item in their hands or the enchantment could not be applied","commands.enchant.failed.entity":"%s is not a valid entity for this command","commands.enchant.failed.incompatible":"%s cannot support that enchantment","commands.enchant.failed.itemless":"%s is not holding any item","commands.enchant.failed.level":"%s is higher than the maximum level of %s supported by that enchantment","commands.enchant.success.multiple":"Applied enchantment %s to %s entities","commands.enchant.success.single":"Applied enchantment %s to %s's item","commands.execute.blocks.toobig":"Too many blocks in the specified area (maximum %s, specified %s)","commands.execute.conditional.fail":"Test failed","commands.execute.conditional.fail_count":"Test failed, count: %s","commands.execute.conditional.pass":"Test passed","commands.execute.conditional.pass_count":"Test passed, count: %s","commands.execute.function.instantiationFailure":"Failed to instantiate function %s: %s","commands.experience.add.levels.success.multiple":"Gave %s experience levels to %s players","commands.experience.add.levels.success.single":"Gave %s experience levels to %s","commands.experience.add.points.success.multiple":"Gave %s experience points to %s players","commands.experience.add.points.success.single":"Gave %s experience points to %s","commands.experience.query.levels":"%s has %s experience levels","commands.experience.query.points":"%s has %s experience points","commands.experience.set.levels.success.multiple":"Set %s experience levels on %s players","commands.experience.set.levels.success.single":"Set %s experience levels on %s","commands.experience.set.points.invalid":"Cannot set experience points above the maximum points for the player's current level","commands.experience.set.points.success.multiple":"Set %s experience points on %s players","commands.experience.set.points.success.single":"Set %s experience points on %s","commands.fill.failed":"No blocks were filled","commands.fill.success":"Successfully filled %s block(s)","commands.fill.toobig":"Too many blocks in the specified area (maximum %s, specified %s)","commands.fillbiome.success":"Biomes set between %s, %s, %s and %s, %s, %s","commands.fillbiome.success.count":"%s biome entry/entries set between %s, %s, %s and %s, %s, %s","commands.fillbiome.toobig":"Too many blocks in the specified volume (maximum %s, specified %s)","commands.forceload.added.failure":"No chunks were marked for force loading","commands.forceload.added.multiple":"Marked %s chunks in %s from %s to %s to be force loaded","commands.forceload.added.none":"No force loaded chunks were found in %s","commands.forceload.added.single":"Marked chunk %s in %s to be force loaded","commands.forceload.list.multiple":"%s force loaded chunks were found in %s at: %s","commands.forceload.list.single":"A force loaded chunk was found in %s at: %s","commands.forceload.query.failure":"Chunk at %s in %s is not marked for force loading","commands.forceload.query.success":"Chunk at %s in %s is marked for force loading","commands.forceload.removed.all":"Unmarked all force loaded chunks in %s","commands.forceload.removed.failure":"No chunks were removed from force loading","commands.forceload.removed.multiple":"Unmarked %s chunks in %s from %s to %s for force loading","commands.forceload.removed.single":"Unmarked chunk %s in %s for force loading","commands.forceload.toobig":"Too many chunks in the specified area (maximum %s, specified %s)","commands.function.error.argument_not_compound":"Invalid argument type: %s, expected Compound","commands.function.error.missing_argument":"Missing argument %2$s to function %1$s","commands.function.error.missing_arguments":"Missing arguments to function %s","commands.function.error.parse":"While instantiating macro %s: Command '%s' caused error: %s","commands.function.instantiationFailure":"Failed to instantiate function %s: %s","commands.function.result":"Function %s returned %s","commands.function.scheduled.multiple":"Running functions %s","commands.function.scheduled.no_functions":"Can't find any functions for name %s","commands.function.scheduled.single":"Running function %s","commands.function.success.multiple":"Executed %s command(s) from %s functions","commands.function.success.multiple.result":"Executed %s functions","commands.function.success.single":"Executed %s command(s) from function '%s'","commands.function.success.single.result":"Function '%2$s' returned %1$s","commands.gamemode.success.other":"Set %s's game mode to %s","commands.gamemode.success.self":"Set own game mode to %s","commands.gamerule.query":"Gamerule %s is currently set to: %s","commands.gamerule.set":"Gamerule %s is now set to: %s","commands.give.failed.toomanyitems":"Can't give more than %s of %s","commands.give.success.multiple":"Gave %s %s to %s players","commands.give.success.single":"Gave %s %s to %s","commands.help.failed":"Unknown command or insufficient permissions","commands.item.block.set.success":"Replaced a slot at %s, %s, %s with %s","commands.item.entity.set.success.multiple":"Replaced a slot on %s entities with %s","commands.item.entity.set.success.single":"Replaced a slot on %s with %s","commands.item.source.no_such_slot":"The source does not have slot %s","commands.item.source.not_a_container":"Source position %s, %s, %s is not a container","commands.item.target.no_changed.known_item":"No targets accepted item %s into slot %s","commands.item.target.no_changes":"No targets accepted item into slot %s","commands.item.target.no_such_slot":"The target does not have slot %s","commands.item.target.not_a_container":"Target position %s, %s, %s is not a container","commands.jfr.dump.failed":"Failed to dump JFR recording: %s","commands.jfr.start.failed":"Failed to start JFR profiling","commands.jfr.started":"JFR profiling started","commands.jfr.stopped":"JFR profiling stopped and dumped to %s","commands.kick.owner.failed":"Cannot kick server owner in LAN game","commands.kick.singleplayer.failed":"Cannot kick in an offline singleplayer game","commands.kick.success":"Kicked %s: %s","commands.kill.success.multiple":"Killed %s entities","commands.kill.success.single":"Killed %s","commands.list.nameAndId":"%s (%s)","commands.list.players":"There are %s of a max of %s players online: %s","commands.locate.biome.not_found":"Could not find a biome of type \"%s\" within reasonable distance","commands.locate.biome.success":"The nearest %s is at %s (%s blocks away)","commands.locate.poi.not_found":"Could not find a point of interest of type \"%s\" within reasonable distance","commands.locate.poi.success":"The nearest %s is at %s (%s blocks away)","commands.locate.structure.invalid":"There is no structure with type \"%s\"","commands.locate.structure.not_found":"Could not find a structure of type \"%s\" nearby","commands.locate.structure.success":"The nearest %s is at %s (%s blocks away)","commands.message.display.incoming":"%s whispers to you: %s","commands.message.display.outgoing":"You whisper to %s: %s","commands.op.failed":"Nothing changed. The player already is an operator","commands.op.success":"Made %s a server operator","commands.pardon.failed":"Nothing changed. The player isn't banned","commands.pardon.success":"Unbanned %s","commands.pardonip.failed":"Nothing changed. That IP isn't banned","commands.pardonip.invalid":"Invalid IP address","commands.pardonip.success":"Unbanned IP %s","commands.particle.failed":"The particle was not visible for anybody","commands.particle.success":"Displaying particle %s","commands.perf.alreadyRunning":"The performance profiler is already started","commands.perf.notRunning":"The performance profiler hasn't started","commands.perf.reportFailed":"Failed to create debug report","commands.perf.reportSaved":"Created debug report in %s","commands.perf.started":"Started 10 second performance profiling run (use '/perf stop' to stop early)","commands.perf.stopped":"Stopped performance profiling after %s second(s) and %s tick(s) (%s tick(s) per second)","commands.place.feature.failed":"Failed to place feature","commands.place.feature.invalid":"There is no feature with type \"%s\"","commands.place.feature.success":"Placed \"%s\" at %s, %s, %s","commands.place.jigsaw.failed":"Failed to generate jigsaw","commands.place.jigsaw.invalid":"There is no template pool with type \"%s\"","commands.place.jigsaw.success":"Generated jigsaw at %s, %s, %s","commands.place.structure.failed":"Failed to place structure","commands.place.structure.invalid":"There is no structure with type \"%s\"","commands.place.structure.success":"Generated structure \"%s\" at %s, %s, %s","commands.place.template.failed":"Failed to place template","commands.place.template.invalid":"There is no template with id \"%s\"","commands.place.template.success":"Loaded template \"%s\" at %s, %s, %s","commands.playsound.failed":"The sound is too far away to be heard","commands.playsound.success.multiple":"Played sound %s to %s players","commands.playsound.success.single":"Played sound %s to %s","commands.publish.alreadyPublished":"Multiplayer game is already hosted on port %s","commands.publish.failed":"Unable to host local game","commands.publish.started":"Local game hosted on port %s","commands.publish.success":"Multiplayer game is now hosted on port %s","commands.random.error.range_too_large":"The range of the random value must be at most 2147483646","commands.random.error.range_too_small":"The range of the random value must be at least 2","commands.random.reset.all.success":"Reset %s random sequence(s)","commands.random.reset.success":"Reset random sequence %s","commands.random.roll":"%s rolled %s (from %s to %s)","commands.random.sample.success":"Randomized value: %s","commands.recipe.give.failed":"No new recipes were learned","commands.recipe.give.success.multiple":"Unlocked %s recipes for %s players","commands.recipe.give.success.single":"Unlocked %s recipes for %s","commands.recipe.take.failed":"No recipes could be forgotten","commands.recipe.take.success.multiple":"Took %s recipes from %s players","commands.recipe.take.success.single":"Took %s recipes from %s","commands.reload.failure":"Reload failed; keeping old data","commands.reload.success":"Reloading!","commands.ride.already_riding":"%s is already riding %s","commands.ride.dismount.success":"%s stopped riding %s","commands.ride.mount.failure.cant_ride_players":"Players can't be ridden","commands.ride.mount.failure.generic":"%s couldn't start riding %s","commands.ride.mount.failure.loop":"Can't mount entity on itself or any of its passengers","commands.ride.mount.failure.wrong_dimension":"Can't mount entity in different dimension","commands.ride.mount.success":"%s started riding %s","commands.ride.not_riding":"%s is not riding any vehicle","commands.save.alreadyOff":"Saving is already turned off","commands.save.alreadyOn":"Saving is already turned on","commands.save.disabled":"Automatic saving is now disabled","commands.save.enabled":"Automatic saving is now enabled","commands.save.failed":"Unable to save the game (is there enough disk space?)","commands.save.saving":"Saving the game (this may take a moment!)","commands.save.success":"Saved the game","commands.schedule.cleared.failure":"No schedules with id %s","commands.schedule.cleared.success":"Removed %s schedule(s) with id %s","commands.schedule.created.function":"Scheduled function '%s' in %s tick(s) at gametime %s","commands.schedule.created.tag":"Scheduled tag '%s' in %s ticks at gametime %s","commands.schedule.same_tick":"Can't schedule for current tick","commands.scoreboard.objectives.add.duplicate":"An objective already exists by that name","commands.scoreboard.objectives.add.success":"Created new objective %s","commands.scoreboard.objectives.display.alreadyEmpty":"Nothing changed. That display slot is already empty","commands.scoreboard.objectives.display.alreadySet":"Nothing changed. That display slot is already showing that objective","commands.scoreboard.objectives.display.cleared":"Cleared any objectives in display slot %s","commands.scoreboard.objectives.display.set":"Set display slot %s to show objective %s","commands.scoreboard.objectives.list.empty":"There are no objectives","commands.scoreboard.objectives.list.success":"There are %s objective(s): %s","commands.scoreboard.objectives.modify.displayAutoUpdate.disable":"Disabled display auto-update for objective %s","commands.scoreboard.objectives.modify.displayAutoUpdate.enable":"Enabled display auto-update for objective %s","commands.scoreboard.objectives.modify.displayname":"Changed the display name of %s to %s","commands.scoreboard.objectives.modify.objectiveFormat.clear":"Cleared default number format of objective %s","commands.scoreboard.objectives.modify.objectiveFormat.set":"Changed default number format of objective %s","commands.scoreboard.objectives.modify.rendertype":"Changed the render type of objective %s","commands.scoreboard.objectives.remove.success":"Removed objective %s","commands.scoreboard.players.add.success.multiple":"Added %s to %s for %s entities","commands.scoreboard.players.add.success.single":"Added %s to %s for %s (now %s)","commands.scoreboard.players.display.name.clear.success.multiple":"Cleared display name for %s entities in %s","commands.scoreboard.players.display.name.clear.success.single":"Cleared display name for %s in %s","commands.scoreboard.players.display.name.set.success.multiple":"Changed display name to %s for %s entities in %s","commands.scoreboard.players.display.name.set.success.single":"Changed display name to %s for %s in %s","commands.scoreboard.players.display.numberFormat.clear.success.multiple":"Cleared number format for %s entities in %s","commands.scoreboard.players.display.numberFormat.clear.success.single":"Cleared number format for %s in %s","commands.scoreboard.players.display.numberFormat.set.success.multiple":"Changed number format for %s entities in %s","commands.scoreboard.players.display.numberFormat.set.success.single":"Changed number format for %s in %s","commands.scoreboard.players.enable.failed":"Nothing changed. That trigger is already enabled","commands.scoreboard.players.enable.invalid":"Enable only works on trigger-objectives","commands.scoreboard.players.enable.success.multiple":"Enabled trigger %s for %s entities","commands.scoreboard.players.enable.success.single":"Enabled trigger %s for %s","commands.scoreboard.players.get.null":"Can't get value of %s for %s; none is set","commands.scoreboard.players.get.success":"%s has %s %s","commands.scoreboard.players.list.empty":"There are no tracked entities","commands.scoreboard.players.list.entity.empty":"%s has no scores to show","commands.scoreboard.players.list.entity.entry":"%s: %s","commands.scoreboard.players.list.entity.success":"%s has %s score(s):","commands.scoreboard.players.list.success":"There are %s tracked entity/entities: %s","commands.scoreboard.players.operation.success.multiple":"Updated %s for %s entities","commands.scoreboard.players.operation.success.single":"Set %s for %s to %s","commands.scoreboard.players.remove.success.multiple":"Removed %s from %s for %s entities","commands.scoreboard.players.remove.success.single":"Removed %s from %s for %s (now %s)","commands.scoreboard.players.reset.all.multiple":"Reset all scores for %s entities","commands.scoreboard.players.reset.all.single":"Reset all scores for %s","commands.scoreboard.players.reset.specific.multiple":"Reset %s for %s entities","commands.scoreboard.players.reset.specific.single":"Reset %s for %s","commands.scoreboard.players.set.success.multiple":"Set %s for %s entities to %s","commands.scoreboard.players.set.success.single":"Set %s for %s to %s","commands.seed.success":"Seed: %s","commands.setblock.failed":"Could not set the block","commands.setblock.success":"Changed the block at %s, %s, %s","commands.setidletimeout.success":"The player idle timeout is now %s minute(s)","commands.setworldspawn.failure.not_overworld":"Can only set the world spawn for overworld","commands.setworldspawn.success":"Set the world spawn point to %s, %s, %s [%s]","commands.spawnpoint.success.multiple":"Set spawn point to %s, %s, %s [%s] in %s for %s players","commands.spawnpoint.success.single":"Set spawn point to %s, %s, %s [%s] in %s for %s","commands.spectate.not_spectator":"%s is not in spectator mode","commands.spectate.self":"Cannot spectate yourself","commands.spectate.success.started":"Now spectating %s","commands.spectate.success.stopped":"No longer spectating an entity","commands.spreadplayers.failed.entities":"Could not spread %s entity/entities around %s, %s (too many entities for space - try using spread of at most %s)","commands.spreadplayers.failed.invalid.height":"Invalid maxHeight %s; expected higher than world minimum %s","commands.spreadplayers.failed.teams":"Could not spread %s team(s) around %s, %s (too many entities for space - try using spread of at most %s)","commands.spreadplayers.success.entities":"Spread %s player(s) around %s, %s with an average distance of %s blocks apart","commands.spreadplayers.success.teams":"Spread %s team(s) around %s, %s with an average distance of %s blocks apart","commands.stop.stopping":"Stopping the server","commands.stopsound.success.source.any":"Stopped all '%s' sounds","commands.stopsound.success.source.sound":"Stopped sound '%s' on source '%s'","commands.stopsound.success.sourceless.any":"Stopped all sounds","commands.stopsound.success.sourceless.sound":"Stopped sound '%s'","commands.summon.failed":"Unable to summon entity","commands.summon.failed.uuid":"Unable to summon entity due to duplicate UUIDs","commands.summon.invalidPosition":"Invalid position for summon","commands.summon.success":"Summoned new %s","commands.tag.add.failed":"Target either already has the tag or has too many tags","commands.tag.add.success.multiple":"Added tag '%s' to %s entities","commands.tag.add.success.single":"Added tag '%s' to %s","commands.tag.list.multiple.empty":"There are no tags on the %s entities","commands.tag.list.multiple.success":"The %s entities have %s total tags: %s","commands.tag.list.single.empty":"%s has no tags","commands.tag.list.single.success":"%s has %s tags: %s","commands.tag.remove.failed":"Target does not have this tag","commands.tag.remove.success.multiple":"Removed tag '%s' from %s entities","commands.tag.remove.success.single":"Removed tag '%s' from %s","commands.team.add.duplicate":"A team already exists by that name","commands.team.add.success":"Created team %s","commands.team.empty.success":"Removed %s member(s) from team %s","commands.team.empty.unchanged":"Nothing changed. That team is already empty","commands.team.join.success.multiple":"Added %s members to team %s","commands.team.join.success.single":"Added %s to team %s","commands.team.leave.success.multiple":"Removed %s members from any team","commands.team.leave.success.single":"Removed %s from any team","commands.team.list.members.empty":"There are no members on team %s","commands.team.list.members.success":"Team %s has %s member(s): %s","commands.team.list.teams.empty":"There are no teams","commands.team.list.teams.success":"There are %s team(s): %s","commands.team.option.collisionRule.success":"Collision rule for team %s is now \"%s\"","commands.team.option.collisionRule.unchanged":"Nothing changed. Collision rule is already that value","commands.team.option.color.success":"Updated the color for team %s to %s","commands.team.option.color.unchanged":"Nothing changed. That team already has that color","commands.team.option.deathMessageVisibility.success":"Death message visibility for team %s is now \"%s\"","commands.team.option.deathMessageVisibility.unchanged":"Nothing changed. Death message visibility is already that value","commands.team.option.friendlyfire.alreadyDisabled":"Nothing changed. Friendly fire is already disabled for that team","commands.team.option.friendlyfire.alreadyEnabled":"Nothing changed. Friendly fire is already enabled for that team","commands.team.option.friendlyfire.disabled":"Disabled friendly fire for team %s","commands.team.option.friendlyfire.enabled":"Enabled friendly fire for team %s","commands.team.option.name.success":"Updated the name of team %s","commands.team.option.name.unchanged":"Nothing changed. That team already has that name","commands.team.option.nametagVisibility.success":"Nametag visibility for team %s is now \"%s\"","commands.team.option.nametagVisibility.unchanged":"Nothing changed. Nametag visibility is already that value","commands.team.option.prefix.success":"Team prefix set to %s","commands.team.option.seeFriendlyInvisibles.alreadyDisabled":"Nothing changed. That team already can't see invisible teammates","commands.team.option.seeFriendlyInvisibles.alreadyEnabled":"Nothing changed. That team can already see invisible teammates","commands.team.option.seeFriendlyInvisibles.disabled":"Team %s can no longer see invisible teammates","commands.team.option.seeFriendlyInvisibles.enabled":"Team %s can now see invisible teammates","commands.team.option.suffix.success":"Team suffix set to %s","commands.team.remove.success":"Removed team %s","commands.teammsg.failed.noteam":"You must be on a team to message your team","commands.teleport.invalidPosition":"Invalid position for teleport","commands.teleport.success.entity.multiple":"Teleported %s entities to %s","commands.teleport.success.entity.single":"Teleported %s to %s","commands.teleport.success.location.multiple":"Teleported %s entities to %s, %s, %s","commands.teleport.success.location.single":"Teleported %s to %s, %s, %s","commands.tick.query.percentiles":"Percentiles: P50: %sms P95: %sms P99: %sms, sample: %s","commands.tick.query.rate.running":"Target tick rate: %s per second.\nAverage time per tick: %sms (Target: %sms)","commands.tick.query.rate.sprinting":"Target tick rate: %s per second (ignored, reference only).\nAverage time per tick: %sms","commands.tick.rate.success":"Set the target tick rate to %s per second","commands.tick.sprint.report":"Sprint completed with %s ticks per second, or %s ms per tick","commands.tick.sprint.stop.fail":"No tick sprint in progress","commands.tick.sprint.stop.success":"Interrupted the current tick sprint","commands.tick.status.frozen":"The game is frozen","commands.tick.status.lagging":"The game is running, but can't keep up with the target tick rate","commands.tick.status.running":"The game is running normally","commands.tick.status.sprinting":"The game is sprinting","commands.tick.step.fail":"Unable to step the game - the game must be frozen first","commands.tick.step.stop.fail":"No tick step in progress","commands.tick.step.stop.success":"Interrupted the current tick step","commands.tick.step.success":"Stepping %s tick(s)","commands.time.query":"The time is %s","commands.time.set":"Set the time to %s","commands.title.cleared.multiple":"Cleared titles for %s players","commands.title.cleared.single":"Cleared titles for %s","commands.title.reset.multiple":"Reset title options for %s players","commands.title.reset.single":"Reset title options for %s","commands.title.show.actionbar.multiple":"Showing new actionbar title for %s players","commands.title.show.actionbar.single":"Showing new actionbar title for %s","commands.title.show.subtitle.multiple":"Showing new subtitle for %s players","commands.title.show.subtitle.single":"Showing new subtitle for %s","commands.title.show.title.multiple":"Showing new title for %s players","commands.title.show.title.single":"Showing new title for %s","commands.title.times.multiple":"Changed title display times for %s players","commands.title.times.single":"Changed title display times for %s","commands.transfer.error.no_players":"Must specify at least one player to transfer","commands.transfer.success.multiple":"Transferring %s players to %s:%s","commands.transfer.success.single":"Transferring %s to %s:%s","commands.trigger.add.success":"Triggered %s (added %s to value)","commands.trigger.failed.invalid":"You can only trigger objectives that are 'trigger' type","commands.trigger.failed.unprimed":"You cannot trigger this objective yet","commands.trigger.set.success":"Triggered %s (set value to %s)","commands.trigger.simple.success":"Triggered %s","commands.weather.set.clear":"Set the weather to clear","commands.weather.set.rain":"Set the weather to rain","commands.weather.set.thunder":"Set the weather to rain & thunder","commands.whitelist.add.failed":"Player is already whitelisted","commands.whitelist.add.success":"Added %s to the whitelist","commands.whitelist.alreadyOff":"Whitelist is already turned off","commands.whitelist.alreadyOn":"Whitelist is already turned on","commands.whitelist.disabled":"Whitelist is now turned off","commands.whitelist.enabled":"Whitelist is now turned on","commands.whitelist.list":"There are %s whitelisted player(s): %s","commands.whitelist.none":"There are no whitelisted players","commands.whitelist.reloaded":"Reloaded the whitelist","commands.whitelist.remove.failed":"Player is not whitelisted","commands.whitelist.remove.success":"Removed %s from the whitelist","commands.worldborder.center.failed":"Nothing changed. The world border is already centered there","commands.worldborder.center.success":"Set the center of the world border to %s, %s","commands.worldborder.damage.amount.failed":"Nothing changed. The world border damage is already that amount","commands.worldborder.damage.amount.success":"Set the world border damage to %s per block each second","commands.worldborder.damage.buffer.failed":"Nothing changed. The world border damage buffer is already that distance","commands.worldborder.damage.buffer.success":"Set the world border damage buffer to %s block(s)","commands.worldborder.get":"The world border is currently %s block(s) wide","commands.worldborder.set.failed.big":"World border cannot be bigger than %s blocks wide","commands.worldborder.set.failed.far":"World border cannot be further out than %s blocks","commands.worldborder.set.failed.nochange":"Nothing changed. The world border is already that size","commands.worldborder.set.failed.small":"World border cannot be smaller than 1 block wide","commands.worldborder.set.grow":"Growing the world border to %s blocks wide over %s seconds","commands.worldborder.set.immediate":"Set the world border to %s block(s) wide","commands.worldborder.set.shrink":"Shrinking the world border to %s block(s) wide over %s second(s)","commands.worldborder.warning.distance.failed":"Nothing changed. The world border warning is already that distance","commands.worldborder.warning.distance.success":"Set the world border warning distance to %s block(s)","commands.worldborder.warning.time.failed":"Nothing changed. The world border warning is already that amount of time","commands.worldborder.warning.time.success":"Set the world border warning time to %s second(s)","connect.aborted":"Aborted","connect.authorizing":"Logging in...","connect.connecting":"Connecting to the server...","connect.encrypting":"Encrypting...","connect.failed":"Failed to connect to the server","connect.failed.transfer":"Connection failed while transferring to the server","connect.joining":"Joining world...","connect.negotiating":"Negotiating...","connect.reconfiging":"Reconfiguring...","connect.reconfiguring":"Reconfiguring...","connect.transferring":"Transferring to new server...","container.barrel":"Barrel","container.beacon":"Beacon","container.blast_furnace":"Blast Furnace","container.brewing":"Brewing Stand","container.cartography_table":"Cartography Table","container.chest":"Chest","container.chestDouble":"Large Chest","container.crafter":"Crafter","container.crafting":"Crafting","container.creative":"Item Selection","container.dispenser":"Dispenser","container.dropper":"Dropper","container.enchant":"Enchant","container.enchant.clue":"%s . . . ?","container.enchant.lapis.many":"%s Lapis Lazuli","container.enchant.lapis.one":"1 Lapis Lazuli","container.enchant.level.many":"%s Enchantment Levels","container.enchant.level.one":"1 Enchantment Level","container.enchant.level.requirement":"Level Requirement: %s","container.enderchest":"Ender Chest","container.furnace":"Furnace","container.grindstone_title":"Repair & Disenchant","container.hopper":"Item Hopper","container.inventory":"Inventory","container.isLocked":"%s is locked!","container.lectern":"Lectern","container.loom":"Loom","container.repair":"Repair & Name","container.repair.cost":"Enchantment Cost: %1$s","container.repair.expensive":"Too Expensive!","container.shulkerBox":"Shulker Box","container.shulkerBox.itemCount":"%s x%s","container.shulkerBox.more":"and %s more...","container.shulkerBox.unknownContents":"???????","container.smoker":"Smoker","container.spectatorCantOpen":"Unable to open. Loot not generated yet.","container.stonecutter":"Stonecutter","container.upgrade":"Upgrade Gear","container.upgrade.error_tooltip":"Item can't be upgraded this way","container.upgrade.missing_template_tooltip":"Add Smithing Template","death.attack.anvil":"%1$s was squashed by a falling anvil","death.attack.anvil.player":"%1$s was squashed by a falling anvil while fighting %2$s","death.attack.arrow":"%1$s was shot by %2$s","death.attack.arrow.item":"%1$s was shot by %2$s using %3$s","death.attack.badRespawnPoint.link":"Intentional Game Design","death.attack.badRespawnPoint.message":"%1$s was killed by %2$s","death.attack.cactus":"%1$s was pricked to death","death.attack.cactus.player":"%1$s walked into a cactus while trying to escape %2$s","death.attack.cramming":"%1$s was squished too much","death.attack.cramming.player":"%1$s was squashed by %2$s","death.attack.dragonBreath":"%1$s was roasted in dragon's breath","death.attack.dragonBreath.player":"%1$s was roasted in dragon's breath by %2$s","death.attack.drown":"%1$s drowned","death.attack.drown.player":"%1$s drowned while trying to escape %2$s","death.attack.dryout":"%1$s died from dehydration","death.attack.dryout.player":"%1$s died from dehydration while trying to escape %2$s","death.attack.even_more_magic":"%1$s was killed by even more magic","death.attack.explosion":"%1$s blew up","death.attack.explosion.player":"%1$s was blown up by %2$s","death.attack.explosion.player.item":"%1$s was blown up by %2$s using %3$s","death.attack.fall":"%1$s hit the ground too hard","death.attack.fall.player":"%1$s hit the ground too hard while trying to escape %2$s","death.attack.fallingBlock":"%1$s was squashed by a falling block","death.attack.fallingBlock.player":"%1$s was squashed by a falling block while fighting %2$s","death.attack.fallingStalactite":"%1$s was skewered by a falling stalactite","death.attack.fallingStalactite.player":"%1$s was skewered by a falling stalactite while fighting %2$s","death.attack.fireball":"%1$s was fireballed by %2$s","death.attack.fireball.item":"%1$s was fireballed by %2$s using %3$s","death.attack.fireworks":"%1$s went off with a bang","death.attack.fireworks.item":"%1$s went off with a bang due to a firework fired from %3$s by %2$s","death.attack.fireworks.player":"%1$s went off with a bang while fighting %2$s","death.attack.flyIntoWall":"%1$s experienced kinetic energy","death.attack.flyIntoWall.player":"%1$s experienced kinetic energy while trying to escape %2$s","death.attack.freeze":"%1$s froze to death","death.attack.freeze.player":"%1$s was frozen to death by %2$s","death.attack.generic":"%1$s died","death.attack.generic.player":"%1$s died because of %2$s","death.attack.genericKill":"%1$s was killed","death.attack.genericKill.player":"%1$s was killed while fighting %2$s","death.attack.hotFloor":"%1$s discovered the floor was lava","death.attack.hotFloor.player":"%1$s walked into the danger zone due to %2$s","death.attack.inFire":"%1$s went up in flames","death.attack.inFire.player":"%1$s walked into fire while fighting %2$s","death.attack.inWall":"%1$s suffocated in a wall","death.attack.inWall.player":"%1$s suffocated in a wall while fighting %2$s","death.attack.indirectMagic":"%1$s was killed by %2$s using magic","death.attack.indirectMagic.item":"%1$s was killed by %2$s using %3$s","death.attack.lava":"%1$s tried to swim in lava","death.attack.lava.player":"%1$s tried to swim in lava to escape %2$s","death.attack.lightningBolt":"%1$s was struck by lightning","death.attack.lightningBolt.player":"%1$s was struck by lightning while fighting %2$s","death.attack.magic":"%1$s was killed by magic","death.attack.magic.player":"%1$s was killed by magic while trying to escape %2$s","death.attack.message_too_long":"Actually, the message was too long to deliver fully. Sorry! Here's a stripped version: %s","death.attack.mob":"%1$s was slain by %2$s","death.attack.mob.item":"%1$s was slain by %2$s using %3$s","death.attack.onFire":"%1$s burned to death","death.attack.onFire.item":"%1$s was burned to a crisp while fighting %2$s wielding %3$s","death.attack.onFire.player":"%1$s was burned to a crisp while fighting %2$s","death.attack.outOfWorld":"%1$s fell out of the world","death.attack.outOfWorld.player":"%1$s didn't want to live in the same world as %2$s","death.attack.outsideBorder":"%1$s left the confines of this world","death.attack.outsideBorder.player":"%1$s left the confines of this world while fighting %2$s","death.attack.player":"%1$s was slain by %2$s","death.attack.player.item":"%1$s was slain by %2$s using %3$s","death.attack.sonic_boom":"%1$s was obliterated by a sonically-charged shriek","death.attack.sonic_boom.item":"%1$s was obliterated by a sonically-charged shriek while trying to escape %2$s wielding %3$s","death.attack.sonic_boom.player":"%1$s was obliterated by a sonically-charged shriek while trying to escape %2$s","death.attack.stalagmite":"%1$s was impaled on a stalagmite","death.attack.stalagmite.player":"%1$s was impaled on a stalagmite while fighting %2$s","death.attack.starve":"%1$s starved to death","death.attack.starve.player":"%1$s starved to death while fighting %2$s","death.attack.sting":"%1$s was stung to death","death.attack.sting.item":"%1$s was stung to death by %2$s using %3$s","death.attack.sting.player":"%1$s was stung to death by %2$s","death.attack.sweetBerryBush":"%1$s was poked to death by a sweet berry bush","death.attack.sweetBerryBush.player":"%1$s was poked to death by a sweet berry bush while trying to escape %2$s","death.attack.thorns":"%1$s was killed while trying to hurt %2$s","death.attack.thorns.item":"%1$s was killed by %3$s while trying to hurt %2$s","death.attack.thrown":"%1$s was pummeled by %2$s","death.attack.thrown.item":"%1$s was pummeled by %2$s using %3$s","death.attack.trident":"%1$s was impaled by %2$s","death.attack.trident.item":"%1$s was impaled by %2$s with %3$s","death.attack.wither":"%1$s withered away","death.attack.wither.player":"%1$s withered away while fighting %2$s","death.attack.witherSkull":"%1$s was shot by a skull from %2$s","death.attack.witherSkull.item":"%1$s was shot by a skull from %2$s using %3$s","death.fell.accident.generic":"%1$s fell from a high place","death.fell.accident.ladder":"%1$s fell off a ladder","death.fell.accident.other_climbable":"%1$s fell while climbing","death.fell.accident.scaffolding":"%1$s fell off scaffolding","death.fell.accident.twisting_vines":"%1$s fell off some twisting vines","death.fell.accident.vines":"%1$s fell off some vines","death.fell.accident.weeping_vines":"%1$s fell off some weeping vines","death.fell.assist":"%1$s was doomed to fall by %2$s","death.fell.assist.item":"%1$s was doomed to fall by %2$s using %3$s","death.fell.finish":"%1$s fell too far and was finished by %2$s","death.fell.finish.item":"%1$s fell too far and was finished by %2$s using %3$s","death.fell.killer":"%1$s was doomed to fall","disconnect.closed":"Connection closed","disconnect.disconnected":"Disconnected by Server","disconnect.endOfStream":"End of stream","disconnect.exceeded_packet_rate":"Kicked for exceeding packet rate limit","disconnect.genericReason":"%s","disconnect.ignoring_status_request":"Ignoring status request","disconnect.kicked":"Was kicked from the game","disconnect.loginFailed":"Failed to log in","disconnect.loginFailedInfo":"Failed to log in: %s","disconnect.loginFailedInfo.insufficientPrivileges":"Multiplayer is disabled. Please check your Microsoft account settings.","disconnect.loginFailedInfo.invalidSession":"Invalid session (Try restarting your game and the launcher)","disconnect.loginFailedInfo.serversUnavailable":"The authentication servers are currently not reachable. Please try again.","disconnect.loginFailedInfo.userBanned":"You are banned from playing online","disconnect.lost":"Connection Lost","disconnect.overflow":"Buffer overflow","disconnect.packetError":"Network Protocol Error","disconnect.quitting":"Quitting","disconnect.spam":"Kicked for spamming","disconnect.timeout":"Timed out","disconnect.transfer":"Transferred to another server","disconnect.unknownHost":"Unknown host","effect.minecraft.absorption":"Absorption","effect.minecraft.bad_omen":"Bad Omen","effect.minecraft.blindness":"Blindness","effect.minecraft.conduit_power":"Conduit Power","effect.minecraft.darkness":"Darkness","effect.minecraft.dolphins_grace":"Dolphin's Grace","effect.minecraft.fire_resistance":"Fire Resistance","effect.minecraft.glowing":"Glowing","effect.minecraft.haste":"Haste","effect.minecraft.health_boost":"Health Boost","effect.minecraft.hero_of_the_village":"Hero of the Village","effect.minecraft.hunger":"Hunger","effect.minecraft.infested":"Infested","effect.minecraft.instant_damage":"Instant Damage","effect.minecraft.instant_health":"Instant Health","effect.minecraft.invisibility":"Invisibility","effect.minecraft.jump_boost":"Jump Boost","effect.minecraft.levitation":"Levitation","effect.minecraft.luck":"Luck","effect.minecraft.mining_fatigue":"Mining Fatigue","effect.minecraft.nausea":"Nausea","effect.minecraft.night_vision":"Night Vision","effect.minecraft.oozing":"Oozing","effect.minecraft.poison":"Poison","effect.minecraft.raid_omen":"Raid Omen","effect.minecraft.regeneration":"Regeneration","effect.minecraft.resistance":"Resistance","effect.minecraft.saturation":"Saturation","effect.minecraft.slow_falling":"Slow Falling","effect.minecraft.slowness":"Slowness","effect.minecraft.speed":"Speed","effect.minecraft.strength":"Strength","effect.minecraft.trial_omen":"Trial Omen","effect.minecraft.unluck":"Bad Luck","effect.minecraft.water_breathing":"Water Breathing","effect.minecraft.weakness":"Weakness","effect.minecraft.weaving":"Weaving","effect.minecraft.wind_charged":"Wind Charged","effect.minecraft.wither":"Wither","enchantment.minecraft.aqua_affinity":"Aqua Affinity","enchantment.minecraft.bane_of_arthropods":"Bane of Arthropods","enchantment.minecraft.binding_curse":"Curse of Binding","enchantment.minecraft.blast_protection":"Blast Protection","enchantment.minecraft.breach":"Breach","enchantment.minecraft.channeling":"Channeling","enchantment.minecraft.density":"Density","enchantment.minecraft.depth_strider":"Depth Strider","enchantment.minecraft.efficiency":"Efficiency","enchantment.minecraft.feather_falling":"Feather Falling","enchantment.minecraft.fire_aspect":"Fire Aspect","enchantment.minecraft.fire_protection":"Fire Protection","enchantment.minecraft.flame":"Flame","enchantment.minecraft.fortune":"Fortune","enchantment.minecraft.frost_walker":"Frost Walker","enchantment.minecraft.impaling":"Impaling","enchantment.minecraft.infinity":"Infinity","enchantment.minecraft.knockback":"Knockback","enchantment.minecraft.looting":"Looting","enchantment.minecraft.loyalty":"Loyalty","enchantment.minecraft.luck_of_the_sea":"Luck of the Sea","enchantment.minecraft.lure":"Lure","enchantment.minecraft.mending":"Mending","enchantment.minecraft.multishot":"Multishot","enchantment.minecraft.piercing":"Piercing","enchantment.minecraft.power":"Power","enchantment.minecraft.projectile_protection":"Projectile Protection","enchantment.minecraft.protection":"Protection","enchantment.minecraft.punch":"Punch","enchantment.minecraft.quick_charge":"Quick Charge","enchantment.minecraft.respiration":"Respiration","enchantment.minecraft.riptide":"Riptide","enchantment.minecraft.sharpness":"Sharpness","enchantment.minecraft.silk_touch":"Silk Touch","enchantment.minecraft.smite":"Smite","enchantment.minecraft.soul_speed":"Soul Speed","enchantment.minecraft.sweeping":"Sweeping Edge","enchantment.minecraft.sweeping_edge":"Sweeping Edge","enchantment.minecraft.swift_sneak":"Swift Sneak","enchantment.minecraft.thorns":"Thorns","enchantment.minecraft.unbreaking":"Unbreaking","enchantment.minecraft.vanishing_curse":"Curse of Vanishing","enchantment.minecraft.wind_burst":"Wind Burst","entity.minecraft.allay":"Allay","entity.minecraft.area_effect_cloud":"Area Effect Cloud","entity.minecraft.armadillo":"Armadillo","entity.minecraft.armor_stand":"Armor Stand","entity.minecraft.arrow":"Arrow","entity.minecraft.axolotl":"Axolotl","entity.minecraft.bat":"Bat","entity.minecraft.bee":"Bee","entity.minecraft.blaze":"Blaze","entity.minecraft.block_display":"Block Display","entity.minecraft.boat":"Boat","entity.minecraft.bogged":"Bogged","entity.minecraft.breeze":"Breeze","entity.minecraft.breeze_wind_charge":"Wind Charge","entity.minecraft.camel":"Camel","entity.minecraft.cat":"Cat","entity.minecraft.cave_spider":"Cave Spider","entity.minecraft.chest_boat":"Boat with Chest","entity.minecraft.chest_minecart":"Minecart with Chest","entity.minecraft.chicken":"Chicken","entity.minecraft.cod":"Cod","entity.minecraft.command_block_minecart":"Minecart with Command Block","entity.minecraft.cow":"Cow","entity.minecraft.creeper":"Creeper","entity.minecraft.dolphin":"Dolphin","entity.minecraft.donkey":"Donkey","entity.minecraft.dragon_fireball":"Dragon Fireball","entity.minecraft.drowned":"Drowned","entity.minecraft.egg":"Thrown Egg","entity.minecraft.elder_guardian":"Elder Guardian","entity.minecraft.end_crystal":"End Crystal","entity.minecraft.ender_dragon":"Ender Dragon","entity.minecraft.ender_pearl":"Thrown Ender Pearl","entity.minecraft.enderman":"Enderman","entity.minecraft.endermite":"Endermite","entity.minecraft.evoker":"Evoker","entity.minecraft.evoker_fangs":"Evoker Fangs","entity.minecraft.experience_bottle":"Thrown Bottle o' Enchanting","entity.minecraft.experience_orb":"Experience Orb","entity.minecraft.eye_of_ender":"Eye of Ender","entity.minecraft.falling_block":"Falling Block","entity.minecraft.falling_block_type":"Falling %s","entity.minecraft.fireball":"Fireball","entity.minecraft.firework_rocket":"Firework Rocket","entity.minecraft.fishing_bobber":"Fishing Bobber","entity.minecraft.fox":"Fox","entity.minecraft.frog":"Frog","entity.minecraft.furnace_minecart":"Minecart with Furnace","entity.minecraft.ghast":"Ghast","entity.minecraft.giant":"Giant","entity.minecraft.glow_item_frame":"Glow Item Frame","entity.minecraft.glow_squid":"Glow Squid","entity.minecraft.goat":"Goat","entity.minecraft.guardian":"Guardian","entity.minecraft.hoglin":"Hoglin","entity.minecraft.hopper_minecart":"Minecart with Hopper","entity.minecraft.horse":"Horse","entity.minecraft.husk":"Husk","entity.minecraft.illusioner":"Illusioner","entity.minecraft.interaction":"Interaction","entity.minecraft.iron_golem":"Iron Golem","entity.minecraft.item":"Item","entity.minecraft.item_display":"Item Display","entity.minecraft.item_frame":"Item Frame","entity.minecraft.killer_bunny":"The Killer Bunny","entity.minecraft.leash_knot":"Leash Knot","entity.minecraft.lightning_bolt":"Lightning Bolt","entity.minecraft.llama":"Llama","entity.minecraft.llama_spit":"Llama Spit","entity.minecraft.magma_cube":"Magma Cube","entity.minecraft.marker":"Marker","entity.minecraft.minecart":"Minecart","entity.minecraft.mooshroom":"Mooshroom","entity.minecraft.mule":"Mule","entity.minecraft.ocelot":"Ocelot","entity.minecraft.ominous_item_spawner":"Ominous Item Spawner","entity.minecraft.painting":"Painting","entity.minecraft.panda":"Panda","entity.minecraft.parrot":"Parrot","entity.minecraft.phantom":"Phantom","entity.minecraft.pig":"Pig","entity.minecraft.piglin":"Piglin","entity.minecraft.piglin_brute":"Piglin Brute","entity.minecraft.pillager":"Pillager","entity.minecraft.player":"Player","entity.minecraft.polar_bear":"Polar Bear","entity.minecraft.potion":"Potion","entity.minecraft.pufferfish":"Pufferfish","entity.minecraft.rabbit":"Rabbit","entity.minecraft.ravager":"Ravager","entity.minecraft.salmon":"Salmon","entity.minecraft.sheep":"Sheep","entity.minecraft.shulker":"Shulker","entity.minecraft.shulker_bullet":"Shulker Bullet","entity.minecraft.silverfish":"Silverfish","entity.minecraft.skeleton":"Skeleton","entity.minecraft.skeleton_horse":"Skeleton Horse","entity.minecraft.slime":"Slime","entity.minecraft.small_fireball":"Small Fireball","entity.minecraft.sniffer":"Sniffer","entity.minecraft.snow_golem":"Snow Golem","entity.minecraft.snowball":"Snowball","entity.minecraft.spawner_minecart":"Minecart with Monster Spawner","entity.minecraft.spectral_arrow":"Spectral Arrow","entity.minecraft.spider":"Spider","entity.minecraft.squid":"Squid","entity.minecraft.stray":"Stray","entity.minecraft.strider":"Strider","entity.minecraft.tadpole":"Tadpole","entity.minecraft.text_display":"Text Display","entity.minecraft.tnt":"Primed TNT","entity.minecraft.tnt_minecart":"Minecart with TNT","entity.minecraft.trader_llama":"Trader Llama","entity.minecraft.trident":"Trident","entity.minecraft.tropical_fish":"Tropical Fish","entity.minecraft.tropical_fish.predefined.0":"Anemone","entity.minecraft.tropical_fish.predefined.1":"Black Tang","entity.minecraft.tropical_fish.predefined.10":"Moorish Idol","entity.minecraft.tropical_fish.predefined.11":"Ornate Butterflyfish","entity.minecraft.tropical_fish.predefined.12":"Parrotfish","entity.minecraft.tropical_fish.predefined.13":"Queen Angelfish","entity.minecraft.tropical_fish.predefined.14":"Red Cichlid","entity.minecraft.tropical_fish.predefined.15":"Red Lipped Blenny","entity.minecraft.tropical_fish.predefined.16":"Red Snapper","entity.minecraft.tropical_fish.predefined.17":"Threadfin","entity.minecraft.tropical_fish.predefined.18":"Tomato Clownfish","entity.minecraft.tropical_fish.predefined.19":"Triggerfish","entity.minecraft.tropical_fish.predefined.2":"Blue Tang","entity.minecraft.tropical_fish.predefined.20":"Yellowtail Parrotfish","entity.minecraft.tropical_fish.predefined.21":"Yellow Tang","entity.minecraft.tropical_fish.predefined.3":"Butterflyfish","entity.minecraft.tropical_fish.predefined.4":"Cichlid","entity.minecraft.tropical_fish.predefined.5":"Clownfish","entity.minecraft.tropical_fish.predefined.6":"Cotton Candy Betta","entity.minecraft.tropical_fish.predefined.7":"Dottyback","entity.minecraft.tropical_fish.predefined.8":"Emperor Red Snapper","entity.minecraft.tropical_fish.predefined.9":"Goatfish","entity.minecraft.tropical_fish.type.betty":"Betty","entity.minecraft.tropical_fish.type.blockfish":"Blockfish","entity.minecraft.tropical_fish.type.brinely":"Brinely","entity.minecraft.tropical_fish.type.clayfish":"Clayfish","entity.minecraft.tropical_fish.type.dasher":"Dasher","entity.minecraft.tropical_fish.type.flopper":"Flopper","entity.minecraft.tropical_fish.type.glitter":"Glitter","entity.minecraft.tropical_fish.type.kob":"Kob","entity.minecraft.tropical_fish.type.snooper":"Snooper","entity.minecraft.tropical_fish.type.spotty":"Spotty","entity.minecraft.tropical_fish.type.stripey":"Stripey","entity.minecraft.tropical_fish.type.sunstreak":"Sunstreak","entity.minecraft.turtle":"Turtle","entity.minecraft.vex":"Vex","entity.minecraft.villager":"Villager","entity.minecraft.villager.armorer":"Armorer","entity.minecraft.villager.butcher":"Butcher","entity.minecraft.villager.cartographer":"Cartographer","entity.minecraft.villager.cleric":"Cleric","entity.minecraft.villager.farmer":"Farmer","entity.minecraft.villager.fisherman":"Fisherman","entity.minecraft.villager.fletcher":"Fletcher","entity.minecraft.villager.leatherworker":"Leatherworker","entity.minecraft.villager.librarian":"Librarian","entity.minecraft.villager.mason":"Mason","entity.minecraft.villager.nitwit":"Nitwit","entity.minecraft.villager.none":"Villager","entity.minecraft.villager.shepherd":"Shepherd","entity.minecraft.villager.toolsmith":"Toolsmith","entity.minecraft.villager.weaponsmith":"Weaponsmith","entity.minecraft.vindicator":"Vindicator","entity.minecraft.wandering_trader":"Wandering Trader","entity.minecraft.warden":"Warden","entity.minecraft.wind_charge":"Wind Charge","entity.minecraft.witch":"Witch","entity.minecraft.wither":"Wither","entity.minecraft.wither_skeleton":"Wither Skeleton","entity.minecraft.wither_skull":"Wither Skull","entity.minecraft.wolf":"Wolf","entity.minecraft.zoglin":"Zoglin","entity.minecraft.zombie":"Zombie","entity.minecraft.zombie_horse":"Zombie Horse","entity.minecraft.zombie_villager":"Zombie Villager","entity.minecraft.zombified_piglin":"Zombified Piglin","gameMode.adventure":"Adventure Mode","gameMode.changed":"Your game mode has been updated to %s","gameMode.creative":"Creative Mode","gameMode.hardcore":"Hardcore Mode!","gameMode.spectator":"Spectator Mode","gameMode.survival":"Survival Mode","gamerule.announceAdvancements":"Announce advancements","gamerule.blockExplosionDropDecay":"In block interaction explosions, some blocks won't drop their loot","gamerule.blockExplosionDropDecay.description":"Some of the drops from blocks destroyed by explosions caused by block interactions are lost in the explosion.","gamerule.category.chat":"Chat","gamerule.category.drops":"Drops","gamerule.category.misc":"Miscellaneous","gamerule.category.mobs":"Mobs","gamerule.category.player":"Player","gamerule.category.spawning":"Spawning","gamerule.category.updates":"World Updates","gamerule.commandBlockOutput":"Broadcast command block output","gamerule.commandModificationBlockLimit":"Command modification block limit","gamerule.commandModificationBlockLimit.description":"Number of blocks that can be changed at once by one command, such as fill or clone.","gamerule.disableElytraMovementCheck":"Disable elytra movement check","gamerule.disableRaids":"Disable raids","gamerule.doDaylightCycle":"Advance time of day","gamerule.doEntityDrops":"Drop entity equipment","gamerule.doEntityDrops.description":"Controls drops from minecarts (including inventories), item frames, boats, etc.","gamerule.doFireTick":"Update fire","gamerule.doImmediateRespawn":"Respawn immediately","gamerule.doInsomnia":"Spawn phantoms","gamerule.doLimitedCrafting":"Require recipe for crafting","gamerule.doLimitedCrafting.description":"If enabled, players will be able to craft only unlocked recipes.","gamerule.doMobLoot":"Drop mob loot","gamerule.doMobLoot.description":"Controls resource drops from mobs, including experience orbs.","gamerule.doMobSpawning":"Spawn mobs","gamerule.doMobSpawning.description":"Some entities might have separate rules.","gamerule.doPatrolSpawning":"Spawn pillager patrols","gamerule.doTileDrops":"Drop blocks","gamerule.doTileDrops.description":"Controls resource drops from blocks, including experience orbs.","gamerule.doTraderSpawning":"Spawn Wandering Traders","gamerule.doVinesSpread":"Vines spread","gamerule.doVinesSpread.description":"Controls whether or not the Vines block spreads randomly to adjacent blocks. Does not affect other types of vine blocks such as Weeping Vines, Twisting Vines, etc.","gamerule.doWardenSpawning":"Spawn Wardens","gamerule.doWeatherCycle":"Update weather","gamerule.drowningDamage":"Deal drowning damage","gamerule.enderPearlsVanishOnDeath":"Thrown Ender Pearls vanish on death","gamerule.enderPearlsVanishOnDeath.description":"Whether Ender Pearls thrown by a player vanish when that player dies.","gamerule.entitiesWithPassengersCanUsePortals":"Entities with passengers can use portals","gamerule.entitiesWithPassengersCanUsePortals.description":"Allow entities with passengers to teleport through Nether Portals, End Portals, and End Gateways.","gamerule.fallDamage":"Deal fall damage","gamerule.fireDamage":"Deal fire damage","gamerule.forgiveDeadPlayers":"Forgive dead players","gamerule.forgiveDeadPlayers.description":"Angered neutral mobs stop being angry when the targeted player dies nearby.","gamerule.freezeDamage":"Deal freeze damage","gamerule.globalSoundEvents":"Global sound events","gamerule.globalSoundEvents.description":"When certain game events happen, like a boss spawning, the sound is heard everywhere.","gamerule.keepInventory":"Keep inventory after death","gamerule.lavaSourceConversion":"Lava converts to source","gamerule.lavaSourceConversion.description":"When flowing lava is surrounded on two sides by lava sources it converts into a source.","gamerule.logAdminCommands":"Broadcast admin commands","gamerule.maxCommandChainLength":"Command chain size limit","gamerule.maxCommandChainLength.description":"Applies to command block chains and functions.","gamerule.maxCommandForkCount":"Command context limit","gamerule.maxCommandForkCount.description":"Maximum number of contexts that can be used by commands like 'execute as'.","gamerule.maxEntityCramming":"Entity cramming threshold","gamerule.mobExplosionDropDecay":"In mob explosions, some blocks won't drop their loot","gamerule.mobExplosionDropDecay.description":"Some of the drops from blocks destroyed by explosions caused by mobs are lost in the explosion.","gamerule.mobGriefing":"Allow destructive mob actions","gamerule.naturalRegeneration":"Regenerate health","gamerule.playersNetherPortalCreativeDelay":"Player's Nether portal delay in creative mode","gamerule.playersNetherPortalCreativeDelay.description":"Time (in ticks) that a creative mode player needs to stand in a Nether portal before changing dimensions.","gamerule.playersNetherPortalDefaultDelay":"Player's Nether portal delay in non-creative mode","gamerule.playersNetherPortalDefaultDelay.description":"Time (in ticks) that a non-creative mode player needs to stand in a Nether portal before changing dimensions.","gamerule.playersSleepingPercentage":"Sleep percentage","gamerule.playersSleepingPercentage.description":"The percentage of players who must be sleeping to skip the night.","gamerule.projectilesCanBreakBlocks":"Projectiles can break blocks","gamerule.projectilesCanBreakBlocks.description":"Controls whether impact projectiles will destroy blocks that are destructible by them.","gamerule.randomTickSpeed":"Random tick speed rate","gamerule.reducedDebugInfo":"Reduce debug info","gamerule.reducedDebugInfo.description":"Limits contents of debug screen.","gamerule.sendCommandFeedback":"Send command feedback","gamerule.showDeathMessages":"Show death messages","gamerule.snowAccumulationHeight":"Snow accumulation height","gamerule.snowAccumulationHeight.description":"When it snows, layers of snow form on the ground up to at most this number of layers.","gamerule.spawnChunkRadius":"Spawn chunk radius","gamerule.spawnChunkRadius.description":"Amount of chunks that stay loaded around the overworld spawn position.","gamerule.spawnRadius":"Respawn location radius","gamerule.spawnRadius.description":"Controls the size of the area around the spawn point that players can spawn in.","gamerule.spectatorsGenerateChunks":"Allow spectators to generate terrain","gamerule.tntExplosionDropDecay":"In TNT explosions, some blocks won't drop their loot","gamerule.tntExplosionDropDecay.description":"Some of the drops from blocks destroyed by explosions caused by TNT are lost in the explosion.","gamerule.universalAnger":"Universal anger","gamerule.universalAnger.description":"Angered neutral mobs attack any nearby player, not just the player that angered them. Works best if forgiveDeadPlayers is disabled.","gamerule.waterSourceConversion":"Water converts to source","gamerule.waterSourceConversion.description":"When flowing water is surrounded on two sides by water sources it converts into a source.","multiplayer.applyingPack":"Applying resource pack","multiplayer.disconnect.authservers_down":"Authentication servers are down. Please try again later, sorry!","multiplayer.disconnect.banned":"You are banned from this server","multiplayer.disconnect.banned.expiration":"\nYour ban will be removed on %s","multiplayer.disconnect.banned.reason":"You are banned from this server.\nReason: %s","multiplayer.disconnect.banned_ip.expiration":"\nYour ban will be removed on %s","multiplayer.disconnect.banned_ip.reason":"Your IP address is banned from this server.\nReason: %s","multiplayer.disconnect.chat_validation_failed":"Chat message validation failure","multiplayer.disconnect.duplicate_login":"You logged in from another location","multiplayer.disconnect.expired_public_key":"Expired profile public key. Check that your system time is synchronized, and try restarting your game.","multiplayer.disconnect.flying":"Flying is not enabled on this server","multiplayer.disconnect.generic":"Disconnected","multiplayer.disconnect.idling":"You have been idle for too long!","multiplayer.disconnect.illegal_characters":"Illegal characters in chat","multiplayer.disconnect.incompatible":"Incompatible client! Please use %s","multiplayer.disconnect.invalid_entity_attacked":"Attempting to attack an invalid entity","multiplayer.disconnect.invalid_packet":"Server sent an invalid packet","multiplayer.disconnect.invalid_player_data":"Invalid player data","multiplayer.disconnect.invalid_player_movement":"Invalid move player packet received","multiplayer.disconnect.invalid_public_key_signature":"Invalid signature for profile public key.\nTry restarting your game.","multiplayer.disconnect.invalid_public_key_signature.new":"Invalid signature for profile public key.\nTry restarting your game.","multiplayer.disconnect.invalid_vehicle_movement":"Invalid move vehicle packet received","multiplayer.disconnect.ip_banned":"You have been IP banned from this server","multiplayer.disconnect.kicked":"Kicked by an operator","multiplayer.disconnect.missing_tags":"Incomplete set of tags received from server.\nPlease contact server operator.","multiplayer.disconnect.name_taken":"That name is already taken","multiplayer.disconnect.not_whitelisted":"You are not white-listed on this server!","multiplayer.disconnect.out_of_order_chat":"Out-of-order chat packet received. Did your system time change?","multiplayer.disconnect.outdated_client":"Incompatible client! Please use %s","multiplayer.disconnect.outdated_server":"Incompatible client! Please use %s","multiplayer.disconnect.server_full":"The server is full!","multiplayer.disconnect.server_shutdown":"Server closed","multiplayer.disconnect.slow_login":"Took too long to log in","multiplayer.disconnect.too_many_pending_chats":"Too many unacknowledged chat messages","multiplayer.disconnect.transfers_disabled":"Server does not accept transfers","multiplayer.disconnect.unexpected_query_response":"Unexpected custom data from client","multiplayer.disconnect.unsigned_chat":"Received chat packet with missing or invalid signature.","multiplayer.disconnect.unverified_username":"Failed to verify username!","multiplayer.downloadingStats":"Retrieving statistics...","multiplayer.downloadingTerrain":"Loading terrain...","multiplayer.lan.server_found":"New server found: %s","multiplayer.message_not_delivered":"Can't deliver chat message, check server logs: %s","multiplayer.player.joined":"%s joined the game","multiplayer.player.joined.renamed":"%s (formerly known as %s) joined the game","multiplayer.player.left":"%s left the game","multiplayer.player.list.hp":"%shp","multiplayer.player.list.narration":"Online players: %s","multiplayer.requiredTexturePrompt.disconnect":"Server requires a custom resource pack","multiplayer.requiredTexturePrompt.line1":"This server requires the use of a custom resource pack.","multiplayer.requiredTexturePrompt.line2":"Rejecting this custom resource pack will disconnect you from this server.","multiplayer.socialInteractions.not_available":"Social Interactions are only available in Multiplayer worlds","multiplayer.status.and_more":"... and %s more ...","multiplayer.status.cancelled":"Cancelled","multiplayer.status.cannot_connect":"Can't connect to server","multiplayer.status.cannot_resolve":"Can't resolve hostname","multiplayer.status.finished":"Finished","multiplayer.status.incompatible":"Incompatible version!","multiplayer.status.motd.narration":"Message of the day: %s","multiplayer.status.no_connection":"(no connection)","multiplayer.status.old":"Old","multiplayer.status.online":"Online","multiplayer.status.ping":"%s ms","multiplayer.status.ping.narration":"Ping %s milliseconds","multiplayer.status.pinging":"Pinging...","multiplayer.status.player_count":"%s/%s","multiplayer.status.player_count.narration":"%s out of %s players online","multiplayer.status.quitting":"Quitting","multiplayer.status.request_handled":"Status request has been handled","multiplayer.status.unknown":"???","multiplayer.status.unrequested":"Received unrequested status","multiplayer.status.version.narration":"Server version: %s","multiplayer.stopSleeping":"Leave Bed","multiplayer.texturePrompt.failure.line1":"Server resource pack couldn't be applied","multiplayer.texturePrompt.failure.line2":"Any functionality that requires custom resources might not work as expected","multiplayer.texturePrompt.line1":"This server recommends the use of a custom resource pack.","multiplayer.texturePrompt.line2":"Would you like to download and install it automagically?","multiplayer.texturePrompt.serverPrompt":"%s\n\nMessage from server:\n%s","multiplayer.title":"Play Multiplayer","multiplayer.unsecureserver.toast":"Messages sent on this server may be modified and might not reflect the original message","multiplayer.unsecureserver.toast.title":"Chat messages can't be verified","options.difficulty.easy":"Easy","options.difficulty.easy.info":"Hostile mobs spawn but deal less damage. Hunger bar depletes and drains health down to 5 hearts.","options.difficulty.hard":"Hard","options.difficulty.hard.info":"Hostile mobs spawn and deal more damage. Hunger bar depletes and drains all health.","options.difficulty.hardcore":"Hardcore","options.difficulty.normal":"Normal","options.difficulty.normal.info":"Hostile mobs spawn and deal standard damage. Hunger bar depletes and drains health down to half a heart.","options.difficulty.online":"Server Difficulty","options.difficulty.peaceful":"Peaceful","options.difficulty.peaceful.info":"No hostile mobs and only some neutral mobs spawn. Hunger bar doesn't deplete and health replenishes over time.","parsing.bool.expected":"Expected boolean","parsing.bool.invalid":"Invalid boolean, expected 'true' or 'false' but found '%s'","parsing.double.expected":"Expected double","parsing.double.invalid":"Invalid double '%s'","parsing.expected":"Expected '%s'","parsing.float.expected":"Expected float","parsing.float.invalid":"Invalid float '%s'","parsing.int.expected":"Expected integer","parsing.int.invalid":"Invalid integer '%s'","parsing.long.expected":"Expected long","parsing.long.invalid":"Invalid long '%s'","parsing.quote.escape":"Invalid escape sequence '\\%s' in quoted string","parsing.quote.expected.end":"Unclosed quoted string","parsing.quote.expected.start":"Expected quote to start a string","permissions.requires.entity":"An entity is required to run this command here","permissions.requires.player":"A player is required to run this command here","sleep.not_possible":"No amount of rest can pass this night","sleep.players_sleeping":"%s/%s players sleeping","sleep.skipping_night":"Sleeping through this night"} diff --git a/protocol/data/registries_767.json b/protocol/data/registries_767.json new file mode 100644 index 0000000..e30f859 --- /dev/null +++ b/protocol/data/registries_767.json @@ -0,0 +1 @@ +{"minecraft:worldgen/biome":{"minecraft:badlands":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.badlands"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"grass_color":{"type":"int","value":9470285},"foliage_color":{"type":"int","value":10387789},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:bamboo_jungle":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.bamboo_jungle"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7842047},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.949999988079071},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:basalt_deltas":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.nether.basalt_deltas"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"ambient_sound":{"type":"string","value":"minecraft:ambient.basalt_deltas.loop"},"additions_sound":{"type":"compound","value":{"sound":{"type":"string","value":"minecraft:ambient.basalt_deltas.additions"},"tick_chance":{"type":"double","value":0.0111}}},"particle":{"type":"compound","value":{"probability":{"type":"float","value":0.1180933341383934},"options":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:white_ash"}}}}},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":6840176},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.basalt_deltas.mood"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:beach":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7907327},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:birch_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8037887},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.6000000238418579},"downfall":{"type":"float","value":0.6000000238418579}}},"minecraft:cherry_grove":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.cherry_grove"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8103167},"grass_color":{"type":"int","value":11983713},"foliage_color":{"type":"int","value":11983713},"water_fog_color":{"type":"int","value":6141935},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":6141935},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:cold_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4020182},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:crimson_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.nether.crimson_forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"ambient_sound":{"type":"string","value":"minecraft:ambient.crimson_forest.loop"},"additions_sound":{"type":"compound","value":{"sound":{"type":"string","value":"minecraft:ambient.crimson_forest.additions"},"tick_chance":{"type":"double","value":0.0111}}},"particle":{"type":"compound","value":{"probability":{"type":"float","value":0.02500000037252903},"options":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:crimson_spore"}}}}},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":3343107},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.crimson_forest.mood"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:dark_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"grass_color_modifier":{"type":"string","value":"dark_forest"},"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7972607},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.699999988079071},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:deep_cold_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4020182},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:deep_dark":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.deep_dark"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7907327},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:deep_frozen_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":3750089},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5},"temperature_modifier":{"type":"string","value":"frozen"}}},"minecraft:deep_lukewarm_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":267827},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4566514},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:deep_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:desert":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.desert"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:dripstone_caves":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.dripstone_caves"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7907327},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:end_barrens":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":0},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":10518688},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:end_highlands":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":0},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":10518688},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:end_midlands":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":0},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":10518688},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:eroded_badlands":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.badlands"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"grass_color":{"type":"int","value":9470285},"foliage_color":{"type":"int","value":10387789},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:flower_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.flower_forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7972607},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.699999988079071},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7972607},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.699999988079071},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:frozen_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8364543},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":3750089},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0},"downfall":{"type":"float","value":0.5},"temperature_modifier":{"type":"string","value":"frozen"}}},"minecraft:frozen_peaks":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.frozen_peaks"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8756735},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":-0.699999988079071},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:frozen_river":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8364543},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":3750089},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0},"downfall":{"type":"float","value":0.5}}},"minecraft:grove":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.grove"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8495359},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":-0.20000000298023224},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:ice_spikes":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8364543},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0},"downfall":{"type":"float","value":0.5}}},"minecraft:jagged_peaks":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.jagged_peaks"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8756735},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":-0.699999988079071},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:jungle":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.jungle"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7842047},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.949999988079071},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:lukewarm_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":267827},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4566514},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:lush_caves":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.lush_caves"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:mangrove_swamp":{"type":"compound","value":{"effects":{"type":"compound","value":{"grass_color_modifier":{"type":"string","value":"swamp"},"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.swamp"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7907327},"foliage_color":{"type":"int","value":9285927},"water_fog_color":{"type":"int","value":5077600},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":3832426},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:meadow":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.meadow"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":937679},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:mushroom_fields":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7842047},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.8999999761581421},"downfall":{"type":"float","value":1}}},"minecraft:nether_wastes":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.nether.nether_wastes"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"ambient_sound":{"type":"string","value":"minecraft:ambient.nether_wastes.loop"},"additions_sound":{"type":"compound","value":{"sound":{"type":"string","value":"minecraft:ambient.nether_wastes.additions"},"tick_chance":{"type":"double","value":0.0111}}},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":3344392},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.nether_wastes.mood"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:old_growth_birch_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8037887},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.6000000238418579},"downfall":{"type":"float","value":0.6000000238418579}}},"minecraft:old_growth_pine_taiga":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.old_growth_taiga"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8168447},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.30000001192092896},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:old_growth_spruce_taiga":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.old_growth_taiga"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8233983},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.25},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:plains":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7907327},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:river":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:savanna":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7254527},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:savanna_plateau":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7254527},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:small_end_islands":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":0},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":10518688},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:snowy_beach":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8364543},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4020182},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.05000000074505806},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:snowy_plains":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8364543},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0},"downfall":{"type":"float","value":0.5}}},"minecraft:snowy_slopes":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.snowy_slopes"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":8560639},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":-0.30000001192092896},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:snowy_taiga":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8625919},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4020182},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":-0.5},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:soul_sand_valley":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.nether.soul_sand_valley"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"ambient_sound":{"type":"string","value":"minecraft:ambient.soul_sand_valley.loop"},"additions_sound":{"type":"compound","value":{"sound":{"type":"string","value":"minecraft:ambient.soul_sand_valley.additions"},"tick_chance":{"type":"double","value":0.0111}}},"particle":{"type":"compound","value":{"probability":{"type":"float","value":0.0062500000931322575},"options":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:ash"}}}}},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":1787717},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.soul_sand_valley.mood"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:sparse_jungle":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.sparse_jungle"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7842047},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.949999988079071},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:stony_peaks":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.stony_peaks"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7776511},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":1},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:stony_shore":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8233727},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.20000000298023224},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:sunflower_plains":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7907327},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.4000000059604645}}},"minecraft:swamp":{"type":"compound","value":{"effects":{"type":"compound","value":{"grass_color_modifier":{"type":"string","value":"swamp"},"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.swamp"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7907327},"foliage_color":{"type":"int","value":6975545},"water_fog_color":{"type":"int","value":2302743},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":6388580},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.800000011920929},"downfall":{"type":"float","value":0.8999999761581421}}},"minecraft:taiga":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8233983},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.25},"downfall":{"type":"float","value":0.800000011920929}}},"minecraft:the_end":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":0},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":10518688},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:the_void":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:warm_ocean":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8103167},"water_fog_color":{"type":"int","value":270131},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4445678},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.5},"downfall":{"type":"float","value":0.5}}},"minecraft:warped_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.nether.warped_forest"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"ambient_sound":{"type":"string","value":"minecraft:ambient.warped_forest.loop"},"additions_sound":{"type":"compound","value":{"sound":{"type":"string","value":"minecraft:ambient.warped_forest.additions"},"tick_chance":{"type":"double","value":0.0111}}},"particle":{"type":"compound","value":{"probability":{"type":"float","value":0.014279999770224094},"options":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:warped_spore"}}}}},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":1705242},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.warped_forest.mood"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:windswept_forest":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8233727},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.20000000298023224},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:windswept_gravelly_hills":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8233727},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.20000000298023224},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:windswept_hills":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":8233727},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":1},"temperature":{"type":"float","value":0.20000000298023224},"downfall":{"type":"float","value":0.30000001192092896}}},"minecraft:windswept_savanna":{"type":"compound","value":{"effects":{"type":"compound","value":{"sky_color":{"type":"int","value":7254527},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}},"minecraft:wooded_badlands":{"type":"compound","value":{"effects":{"type":"compound","value":{"music":{"type":"compound","value":{"replace_current_music":{"type":"byte","value":0},"max_delay":{"type":"int","value":24000},"sound":{"type":"string","value":"minecraft:music.overworld.badlands"},"min_delay":{"type":"int","value":12000}}},"sky_color":{"type":"int","value":7254527},"grass_color":{"type":"int","value":9470285},"foliage_color":{"type":"int","value":10387789},"water_fog_color":{"type":"int","value":329011},"fog_color":{"type":"int","value":12638463},"water_color":{"type":"int","value":4159204},"mood_sound":{"type":"compound","value":{"tick_delay":{"type":"int","value":6000},"offset":{"type":"double","value":2},"sound":{"type":"string","value":"minecraft:ambient.cave"},"block_search_extent":{"type":"int","value":8}}}}},"has_precipitation":{"type":"byte","value":0},"temperature":{"type":"float","value":2},"downfall":{"type":"float","value":0}}}},"minecraft:chat_type":{"minecraft:chat":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:emote_command":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.emote"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.emote"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:msg_command_incoming":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"commands.message.display.incoming"},"style":{"type":"compound","value":{"color":{"type":"string","value":"gray"},"italic":{"type":"byte","value":1}}},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:msg_command_outgoing":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"commands.message.display.outgoing"},"style":{"type":"compound","value":{"color":{"type":"string","value":"gray"},"italic":{"type":"byte","value":1}}},"parameters":{"type":"list","value":{"type":"string","value":["target","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:say_command":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.announcement"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:team_msg_command_incoming":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.team.text"},"parameters":{"type":"list","value":{"type":"string","value":["target","sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}},"minecraft:team_msg_command_outgoing":{"type":"compound","value":{"chat":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.team.sent"},"parameters":{"type":"list","value":{"type":"string","value":["target","sender","content"]}}}},"narration":{"type":"compound","value":{"translation_key":{"type":"string","value":"chat.type.text.narrate"},"parameters":{"type":"list","value":{"type":"string","value":["sender","content"]}}}}}}},"minecraft:trim_pattern":{"minecraft:bolt":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:bolt_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.bolt"}}},"asset_id":{"type":"string","value":"minecraft:bolt"},"decal":{"type":"byte","value":0}}},"minecraft:coast":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:coast_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.coast"}}},"asset_id":{"type":"string","value":"minecraft:coast"},"decal":{"type":"byte","value":0}}},"minecraft:dune":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:dune_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.dune"}}},"asset_id":{"type":"string","value":"minecraft:dune"},"decal":{"type":"byte","value":0}}},"minecraft:eye":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:eye_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.eye"}}},"asset_id":{"type":"string","value":"minecraft:eye"},"decal":{"type":"byte","value":0}}},"minecraft:flow":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:flow_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.flow"}}},"asset_id":{"type":"string","value":"minecraft:flow"},"decal":{"type":"byte","value":0}}},"minecraft:host":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:host_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.host"}}},"asset_id":{"type":"string","value":"minecraft:host"},"decal":{"type":"byte","value":0}}},"minecraft:raiser":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:raiser_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.raiser"}}},"asset_id":{"type":"string","value":"minecraft:raiser"},"decal":{"type":"byte","value":0}}},"minecraft:rib":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:rib_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.rib"}}},"asset_id":{"type":"string","value":"minecraft:rib"},"decal":{"type":"byte","value":0}}},"minecraft:sentry":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:sentry_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.sentry"}}},"asset_id":{"type":"string","value":"minecraft:sentry"},"decal":{"type":"byte","value":0}}},"minecraft:shaper":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:shaper_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.shaper"}}},"asset_id":{"type":"string","value":"minecraft:shaper"},"decal":{"type":"byte","value":0}}},"minecraft:silence":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:silence_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.silence"}}},"asset_id":{"type":"string","value":"minecraft:silence"},"decal":{"type":"byte","value":0}}},"minecraft:snout":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:snout_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.snout"}}},"asset_id":{"type":"string","value":"minecraft:snout"},"decal":{"type":"byte","value":0}}},"minecraft:spire":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:spire_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.spire"}}},"asset_id":{"type":"string","value":"minecraft:spire"},"decal":{"type":"byte","value":0}}},"minecraft:tide":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:tide_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.tide"}}},"asset_id":{"type":"string","value":"minecraft:tide"},"decal":{"type":"byte","value":0}}},"minecraft:vex":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:vex_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.vex"}}},"asset_id":{"type":"string","value":"minecraft:vex"},"decal":{"type":"byte","value":0}}},"minecraft:ward":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:ward_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.ward"}}},"asset_id":{"type":"string","value":"minecraft:ward"},"decal":{"type":"byte","value":0}}},"minecraft:wayfinder":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:wayfinder_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.wayfinder"}}},"asset_id":{"type":"string","value":"minecraft:wayfinder"},"decal":{"type":"byte","value":0}}},"minecraft:wild":{"type":"compound","value":{"template_item":{"type":"string","value":"minecraft:wild_armor_trim_smithing_template"},"description":{"type":"compound","value":{"translate":{"type":"string","value":"trim_pattern.minecraft.wild"}}},"asset_id":{"type":"string","value":"minecraft:wild"},"decal":{"type":"byte","value":0}}}},"minecraft:trim_material":{"minecraft:amethyst":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:amethyst_shard"},"asset_name":{"type":"string","value":"amethyst"},"item_model_index":{"type":"float","value":1},"description":{"type":"compound","value":{"color":{"type":"string","value":"#9A5CC6"},"translate":{"type":"string","value":"trim_material.minecraft.amethyst"}}}}},"minecraft:copper":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:copper_ingot"},"asset_name":{"type":"string","value":"copper"},"item_model_index":{"type":"float","value":0.5},"description":{"type":"compound","value":{"color":{"type":"string","value":"#B4684D"},"translate":{"type":"string","value":"trim_material.minecraft.copper"}}}}},"minecraft:diamond":{"type":"compound","value":{"override_armor_materials":{"type":"compound","value":{"minecraft:diamond":{"type":"string","value":"diamond_darker"}}},"ingredient":{"type":"string","value":"minecraft:diamond"},"asset_name":{"type":"string","value":"diamond"},"item_model_index":{"type":"float","value":0.800000011920929},"description":{"type":"compound","value":{"color":{"type":"string","value":"#6EECD2"},"translate":{"type":"string","value":"trim_material.minecraft.diamond"}}}}},"minecraft:emerald":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:emerald"},"asset_name":{"type":"string","value":"emerald"},"item_model_index":{"type":"float","value":0.699999988079071},"description":{"type":"compound","value":{"color":{"type":"string","value":"#11A036"},"translate":{"type":"string","value":"trim_material.minecraft.emerald"}}}}},"minecraft:gold":{"type":"compound","value":{"override_armor_materials":{"type":"compound","value":{"minecraft:gold":{"type":"string","value":"gold_darker"}}},"ingredient":{"type":"string","value":"minecraft:gold_ingot"},"asset_name":{"type":"string","value":"gold"},"item_model_index":{"type":"float","value":0.6000000238418579},"description":{"type":"compound","value":{"color":{"type":"string","value":"#DEB12D"},"translate":{"type":"string","value":"trim_material.minecraft.gold"}}}}},"minecraft:iron":{"type":"compound","value":{"override_armor_materials":{"type":"compound","value":{"minecraft:iron":{"type":"string","value":"iron_darker"}}},"ingredient":{"type":"string","value":"minecraft:iron_ingot"},"asset_name":{"type":"string","value":"iron"},"item_model_index":{"type":"float","value":0.20000000298023224},"description":{"type":"compound","value":{"color":{"type":"string","value":"#ECECEC"},"translate":{"type":"string","value":"trim_material.minecraft.iron"}}}}},"minecraft:lapis":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:lapis_lazuli"},"asset_name":{"type":"string","value":"lapis"},"item_model_index":{"type":"float","value":0.8999999761581421},"description":{"type":"compound","value":{"color":{"type":"string","value":"#416E97"},"translate":{"type":"string","value":"trim_material.minecraft.lapis"}}}}},"minecraft:netherite":{"type":"compound","value":{"override_armor_materials":{"type":"compound","value":{"minecraft:netherite":{"type":"string","value":"netherite_darker"}}},"ingredient":{"type":"string","value":"minecraft:netherite_ingot"},"asset_name":{"type":"string","value":"netherite"},"item_model_index":{"type":"float","value":0.30000001192092896},"description":{"type":"compound","value":{"color":{"type":"string","value":"#625859"},"translate":{"type":"string","value":"trim_material.minecraft.netherite"}}}}},"minecraft:quartz":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:quartz"},"asset_name":{"type":"string","value":"quartz"},"item_model_index":{"type":"float","value":0.10000000149011612},"description":{"type":"compound","value":{"color":{"type":"string","value":"#E3D4C4"},"translate":{"type":"string","value":"trim_material.minecraft.quartz"}}}}},"minecraft:redstone":{"type":"compound","value":{"ingredient":{"type":"string","value":"minecraft:redstone"},"asset_name":{"type":"string","value":"redstone"},"item_model_index":{"type":"float","value":0.4000000059604645},"description":{"type":"compound","value":{"color":{"type":"string","value":"#971607"},"translate":{"type":"string","value":"trim_material.minecraft.redstone"}}}}}},"minecraft:wolf_variant":{"minecraft:ashen":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_ashen"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_ashen_angry"},"biomes":{"type":"string","value":"minecraft:snowy_taiga"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_ashen_tame"}}},"minecraft:black":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_black"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_black_angry"},"biomes":{"type":"string","value":"minecraft:old_growth_pine_taiga"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_black_tame"}}},"minecraft:chestnut":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_chestnut"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_chestnut_angry"},"biomes":{"type":"string","value":"minecraft:old_growth_spruce_taiga"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_chestnut_tame"}}},"minecraft:pale":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_angry"},"biomes":{"type":"string","value":"minecraft:taiga"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_tame"}}},"minecraft:rusty":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_rusty"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_rusty_angry"},"biomes":{"type":"string","value":"#minecraft:is_jungle"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_rusty_tame"}}},"minecraft:snowy":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_snowy"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_snowy_angry"},"biomes":{"type":"string","value":"minecraft:grove"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_snowy_tame"}}},"minecraft:spotted":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_spotted"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_spotted_angry"},"biomes":{"type":"string","value":"#minecraft:is_savanna"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_spotted_tame"}}},"minecraft:striped":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_striped"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_striped_angry"},"biomes":{"type":"string","value":"#minecraft:is_badlands"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_striped_tame"}}},"minecraft:woods":{"type":"compound","value":{"wild_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_woods"},"angry_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_woods_angry"},"biomes":{"type":"string","value":"minecraft:forest"},"tame_texture":{"type":"string","value":"minecraft:entity/wolf/wolf_woods_tame"}}}},"minecraft:painting_variant":{"minecraft:alban":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:alban"},"height":{"type":"int","value":1}}},"minecraft:aztec":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:aztec"},"height":{"type":"int","value":1}}},"minecraft:aztec2":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:aztec2"},"height":{"type":"int","value":1}}},"minecraft:backyard":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:backyard"},"height":{"type":"int","value":4}}},"minecraft:baroque":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:baroque"},"height":{"type":"int","value":2}}},"minecraft:bomb":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:bomb"},"height":{"type":"int","value":1}}},"minecraft:bouquet":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:bouquet"},"height":{"type":"int","value":3}}},"minecraft:burning_skull":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:burning_skull"},"height":{"type":"int","value":4}}},"minecraft:bust":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:bust"},"height":{"type":"int","value":2}}},"minecraft:cavebird":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:cavebird"},"height":{"type":"int","value":3}}},"minecraft:changing":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:changing"},"height":{"type":"int","value":2}}},"minecraft:cotan":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:cotan"},"height":{"type":"int","value":3}}},"minecraft:courbet":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:courbet"},"height":{"type":"int","value":1}}},"minecraft:creebet":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:creebet"},"height":{"type":"int","value":1}}},"minecraft:donkey_kong":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:donkey_kong"},"height":{"type":"int","value":3}}},"minecraft:earth":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:earth"},"height":{"type":"int","value":2}}},"minecraft:endboss":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:endboss"},"height":{"type":"int","value":3}}},"minecraft:fern":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:fern"},"height":{"type":"int","value":3}}},"minecraft:fighters":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:fighters"},"height":{"type":"int","value":2}}},"minecraft:finding":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:finding"},"height":{"type":"int","value":2}}},"minecraft:fire":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:fire"},"height":{"type":"int","value":2}}},"minecraft:graham":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:graham"},"height":{"type":"int","value":2}}},"minecraft:humble":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:humble"},"height":{"type":"int","value":2}}},"minecraft:kebab":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:kebab"},"height":{"type":"int","value":1}}},"minecraft:lowmist":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:lowmist"},"height":{"type":"int","value":2}}},"minecraft:match":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:match"},"height":{"type":"int","value":2}}},"minecraft:meditative":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:meditative"},"height":{"type":"int","value":1}}},"minecraft:orb":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:orb"},"height":{"type":"int","value":4}}},"minecraft:owlemons":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:owlemons"},"height":{"type":"int","value":3}}},"minecraft:passage":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:passage"},"height":{"type":"int","value":2}}},"minecraft:pigscene":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:pigscene"},"height":{"type":"int","value":4}}},"minecraft:plant":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:plant"},"height":{"type":"int","value":1}}},"minecraft:pointer":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:pointer"},"height":{"type":"int","value":4}}},"minecraft:pond":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:pond"},"height":{"type":"int","value":4}}},"minecraft:pool":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:pool"},"height":{"type":"int","value":1}}},"minecraft:prairie_ride":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:prairie_ride"},"height":{"type":"int","value":2}}},"minecraft:sea":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:sea"},"height":{"type":"int","value":1}}},"minecraft:skeleton":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:skeleton"},"height":{"type":"int","value":3}}},"minecraft:skull_and_roses":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:skull_and_roses"},"height":{"type":"int","value":2}}},"minecraft:stage":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:stage"},"height":{"type":"int","value":2}}},"minecraft:sunflowers":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:sunflowers"},"height":{"type":"int","value":3}}},"minecraft:sunset":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:sunset"},"height":{"type":"int","value":1}}},"minecraft:tides":{"type":"compound","value":{"width":{"type":"int","value":3},"asset_id":{"type":"string","value":"minecraft:tides"},"height":{"type":"int","value":3}}},"minecraft:unpacked":{"type":"compound","value":{"width":{"type":"int","value":4},"asset_id":{"type":"string","value":"minecraft:unpacked"},"height":{"type":"int","value":4}}},"minecraft:void":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:void"},"height":{"type":"int","value":2}}},"minecraft:wanderer":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:wanderer"},"height":{"type":"int","value":2}}},"minecraft:wasteland":{"type":"compound","value":{"width":{"type":"int","value":1},"asset_id":{"type":"string","value":"minecraft:wasteland"},"height":{"type":"int","value":1}}},"minecraft:water":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:water"},"height":{"type":"int","value":2}}},"minecraft:wind":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:wind"},"height":{"type":"int","value":2}}},"minecraft:wither":{"type":"compound","value":{"width":{"type":"int","value":2},"asset_id":{"type":"string","value":"minecraft:wither"},"height":{"type":"int","value":2}}}},"minecraft:dimension_type":{"minecraft:overworld":{"type":"compound","value":{"piglin_safe":{"type":"byte","value":0},"natural":{"type":"byte","value":1},"ambient_light":{"type":"float","value":0},"monster_spawn_block_light_limit":{"type":"int","value":0},"infiniburn":{"type":"string","value":"#minecraft:infiniburn_overworld"},"respawn_anchor_works":{"type":"byte","value":0},"has_skylight":{"type":"byte","value":1},"bed_works":{"type":"byte","value":1},"effects":{"type":"string","value":"minecraft:overworld"},"has_raids":{"type":"byte","value":1},"logical_height":{"type":"int","value":384},"coordinate_scale":{"type":"double","value":1},"monster_spawn_light_level":{"type":"compound","value":{"min_inclusive":{"type":"int","value":0},"max_inclusive":{"type":"int","value":7},"type":{"type":"string","value":"minecraft:uniform"}}},"min_y":{"type":"int","value":-64},"ultrawarm":{"type":"byte","value":0},"has_ceiling":{"type":"byte","value":0},"height":{"type":"int","value":384}}},"minecraft:overworld_caves":{"type":"compound","value":{"piglin_safe":{"type":"byte","value":0},"natural":{"type":"byte","value":1},"ambient_light":{"type":"float","value":0},"monster_spawn_block_light_limit":{"type":"int","value":0},"infiniburn":{"type":"string","value":"#minecraft:infiniburn_overworld"},"respawn_anchor_works":{"type":"byte","value":0},"has_skylight":{"type":"byte","value":1},"bed_works":{"type":"byte","value":1},"effects":{"type":"string","value":"minecraft:overworld"},"has_raids":{"type":"byte","value":1},"logical_height":{"type":"int","value":384},"coordinate_scale":{"type":"double","value":1},"monster_spawn_light_level":{"type":"compound","value":{"min_inclusive":{"type":"int","value":0},"max_inclusive":{"type":"int","value":7},"type":{"type":"string","value":"minecraft:uniform"}}},"min_y":{"type":"int","value":-64},"ultrawarm":{"type":"byte","value":0},"has_ceiling":{"type":"byte","value":1},"height":{"type":"int","value":384}}},"minecraft:the_end":{"type":"compound","value":{"piglin_safe":{"type":"byte","value":0},"natural":{"type":"byte","value":0},"ambient_light":{"type":"float","value":0},"monster_spawn_block_light_limit":{"type":"int","value":0},"infiniburn":{"type":"string","value":"#minecraft:infiniburn_end"},"respawn_anchor_works":{"type":"byte","value":0},"has_skylight":{"type":"byte","value":0},"bed_works":{"type":"byte","value":0},"effects":{"type":"string","value":"minecraft:the_end"},"fixed_time":{"type":"long","value":[0,6000]},"has_raids":{"type":"byte","value":1},"logical_height":{"type":"int","value":256},"coordinate_scale":{"type":"double","value":1},"monster_spawn_light_level":{"type":"compound","value":{"min_inclusive":{"type":"int","value":0},"max_inclusive":{"type":"int","value":7},"type":{"type":"string","value":"minecraft:uniform"}}},"min_y":{"type":"int","value":0},"ultrawarm":{"type":"byte","value":0},"has_ceiling":{"type":"byte","value":0},"height":{"type":"int","value":256}}},"minecraft:the_nether":{"type":"compound","value":{"piglin_safe":{"type":"byte","value":1},"natural":{"type":"byte","value":0},"ambient_light":{"type":"float","value":0.10000000149011612},"monster_spawn_block_light_limit":{"type":"int","value":15},"infiniburn":{"type":"string","value":"#minecraft:infiniburn_nether"},"respawn_anchor_works":{"type":"byte","value":1},"has_skylight":{"type":"byte","value":0},"bed_works":{"type":"byte","value":0},"effects":{"type":"string","value":"minecraft:the_nether"},"fixed_time":{"type":"long","value":[0,18000]},"has_raids":{"type":"byte","value":0},"logical_height":{"type":"int","value":128},"coordinate_scale":{"type":"double","value":8},"monster_spawn_light_level":{"type":"int","value":7},"min_y":{"type":"int","value":0},"ultrawarm":{"type":"byte","value":1},"has_ceiling":{"type":"byte","value":1},"height":{"type":"int","value":256}}}},"minecraft:damage_type":{"minecraft:arrow":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"arrow"}}},"minecraft:bad_respawn_point":{"type":"compound","value":{"scaling":{"type":"string","value":"always"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"badRespawnPoint"},"death_message_type":{"type":"string","value":"intentional_game_design"}}},"minecraft:cactus":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"cactus"}}},"minecraft:campfire":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"inFire"}}},"minecraft:cramming":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"cramming"}}},"minecraft:dragon_breath":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"dragonBreath"}}},"minecraft:drown":{"type":"compound","value":{"effects":{"type":"string","value":"drowning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"drown"}}},"minecraft:dry_out":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"dryout"}}},"minecraft:explosion":{"type":"compound","value":{"scaling":{"type":"string","value":"always"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"explosion"}}},"minecraft:fall":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"fall"},"death_message_type":{"type":"string","value":"fall_variants"}}},"minecraft:falling_anvil":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"anvil"}}},"minecraft:falling_block":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"fallingBlock"}}},"minecraft:falling_stalactite":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"fallingStalactite"}}},"minecraft:fireball":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"fireball"}}},"minecraft:fireworks":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"fireworks"}}},"minecraft:fly_into_wall":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"flyIntoWall"}}},"minecraft:freeze":{"type":"compound","value":{"effects":{"type":"string","value":"freezing"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"freeze"}}},"minecraft:generic":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"generic"}}},"minecraft:generic_kill":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"genericKill"}}},"minecraft:hot_floor":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"hotFloor"}}},"minecraft:in_fire":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"inFire"}}},"minecraft:in_wall":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"inWall"}}},"minecraft:indirect_magic":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"indirectMagic"}}},"minecraft:lava":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"lava"}}},"minecraft:lightning_bolt":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"lightningBolt"}}},"minecraft:magic":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"magic"}}},"minecraft:mob_attack":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"mob"}}},"minecraft:mob_attack_no_aggro":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"mob"}}},"minecraft:mob_projectile":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"mob"}}},"minecraft:on_fire":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"onFire"}}},"minecraft:out_of_world":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"outOfWorld"}}},"minecraft:outside_border":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"outsideBorder"}}},"minecraft:player_attack":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"player"}}},"minecraft:player_explosion":{"type":"compound","value":{"scaling":{"type":"string","value":"always"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"explosion.player"}}},"minecraft:sonic_boom":{"type":"compound","value":{"scaling":{"type":"string","value":"always"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"sonic_boom"}}},"minecraft:spit":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"mob"}}},"minecraft:stalagmite":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"stalagmite"}}},"minecraft:starve":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"starve"}}},"minecraft:sting":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"sting"}}},"minecraft:sweet_berry_bush":{"type":"compound","value":{"effects":{"type":"string","value":"poking"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"sweetBerryBush"}}},"minecraft:thorns":{"type":"compound","value":{"effects":{"type":"string","value":"thorns"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"thorns"}}},"minecraft:thrown":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"thrown"}}},"minecraft:trident":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"trident"}}},"minecraft:unattributed_fireball":{"type":"compound","value":{"effects":{"type":"string","value":"burning"},"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"onFire"}}},"minecraft:wind_charge":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"mob"}}},"minecraft:wither":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0},"message_id":{"type":"string","value":"wither"}}},"minecraft:wither_skull":{"type":"compound","value":{"scaling":{"type":"string","value":"when_caused_by_living_non_player"},"exhaustion":{"type":"float","value":0.10000000149011612},"message_id":{"type":"string","value":"witherSkull"}}}},"minecraft:banner_pattern":{"minecraft:base":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.base"},"asset_id":{"type":"string","value":"minecraft:base"}}},"minecraft:border":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.border"},"asset_id":{"type":"string","value":"minecraft:border"}}},"minecraft:bricks":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.bricks"},"asset_id":{"type":"string","value":"minecraft:bricks"}}},"minecraft:circle":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.circle"},"asset_id":{"type":"string","value":"minecraft:circle"}}},"minecraft:creeper":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.creeper"},"asset_id":{"type":"string","value":"minecraft:creeper"}}},"minecraft:cross":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.cross"},"asset_id":{"type":"string","value":"minecraft:cross"}}},"minecraft:curly_border":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.curly_border"},"asset_id":{"type":"string","value":"minecraft:curly_border"}}},"minecraft:diagonal_left":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.diagonal_left"},"asset_id":{"type":"string","value":"minecraft:diagonal_left"}}},"minecraft:diagonal_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.diagonal_right"},"asset_id":{"type":"string","value":"minecraft:diagonal_right"}}},"minecraft:diagonal_up_left":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.diagonal_up_left"},"asset_id":{"type":"string","value":"minecraft:diagonal_up_left"}}},"minecraft:diagonal_up_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.diagonal_up_right"},"asset_id":{"type":"string","value":"minecraft:diagonal_up_right"}}},"minecraft:flow":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.flow"},"asset_id":{"type":"string","value":"minecraft:flow"}}},"minecraft:flower":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.flower"},"asset_id":{"type":"string","value":"minecraft:flower"}}},"minecraft:globe":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.globe"},"asset_id":{"type":"string","value":"minecraft:globe"}}},"minecraft:gradient":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.gradient"},"asset_id":{"type":"string","value":"minecraft:gradient"}}},"minecraft:gradient_up":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.gradient_up"},"asset_id":{"type":"string","value":"minecraft:gradient_up"}}},"minecraft:guster":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.guster"},"asset_id":{"type":"string","value":"minecraft:guster"}}},"minecraft:half_horizontal":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.half_horizontal"},"asset_id":{"type":"string","value":"minecraft:half_horizontal"}}},"minecraft:half_horizontal_bottom":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.half_horizontal_bottom"},"asset_id":{"type":"string","value":"minecraft:half_horizontal_bottom"}}},"minecraft:half_vertical":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.half_vertical"},"asset_id":{"type":"string","value":"minecraft:half_vertical"}}},"minecraft:half_vertical_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.half_vertical_right"},"asset_id":{"type":"string","value":"minecraft:half_vertical_right"}}},"minecraft:mojang":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.mojang"},"asset_id":{"type":"string","value":"minecraft:mojang"}}},"minecraft:piglin":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.piglin"},"asset_id":{"type":"string","value":"minecraft:piglin"}}},"minecraft:rhombus":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.rhombus"},"asset_id":{"type":"string","value":"minecraft:rhombus"}}},"minecraft:skull":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.skull"},"asset_id":{"type":"string","value":"minecraft:skull"}}},"minecraft:small_stripes":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.small_stripes"},"asset_id":{"type":"string","value":"minecraft:small_stripes"}}},"minecraft:square_bottom_left":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.square_bottom_left"},"asset_id":{"type":"string","value":"minecraft:square_bottom_left"}}},"minecraft:square_bottom_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.square_bottom_right"},"asset_id":{"type":"string","value":"minecraft:square_bottom_right"}}},"minecraft:square_top_left":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.square_top_left"},"asset_id":{"type":"string","value":"minecraft:square_top_left"}}},"minecraft:square_top_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.square_top_right"},"asset_id":{"type":"string","value":"minecraft:square_top_right"}}},"minecraft:straight_cross":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.straight_cross"},"asset_id":{"type":"string","value":"minecraft:straight_cross"}}},"minecraft:stripe_bottom":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_bottom"},"asset_id":{"type":"string","value":"minecraft:stripe_bottom"}}},"minecraft:stripe_center":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_center"},"asset_id":{"type":"string","value":"minecraft:stripe_center"}}},"minecraft:stripe_downleft":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_downleft"},"asset_id":{"type":"string","value":"minecraft:stripe_downleft"}}},"minecraft:stripe_downright":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_downright"},"asset_id":{"type":"string","value":"minecraft:stripe_downright"}}},"minecraft:stripe_left":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_left"},"asset_id":{"type":"string","value":"minecraft:stripe_left"}}},"minecraft:stripe_middle":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_middle"},"asset_id":{"type":"string","value":"minecraft:stripe_middle"}}},"minecraft:stripe_right":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_right"},"asset_id":{"type":"string","value":"minecraft:stripe_right"}}},"minecraft:stripe_top":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.stripe_top"},"asset_id":{"type":"string","value":"minecraft:stripe_top"}}},"minecraft:triangle_bottom":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.triangle_bottom"},"asset_id":{"type":"string","value":"minecraft:triangle_bottom"}}},"minecraft:triangle_top":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.triangle_top"},"asset_id":{"type":"string","value":"minecraft:triangle_top"}}},"minecraft:triangles_bottom":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.triangles_bottom"},"asset_id":{"type":"string","value":"minecraft:triangles_bottom"}}},"minecraft:triangles_top":{"type":"compound","value":{"translation_key":{"type":"string","value":"block.minecraft.banner.triangles_top"},"asset_id":{"type":"string","value":"minecraft:triangles_top"}}}},"minecraft:enchantment":{"minecraft:aqua_affinity":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["head"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":4},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":4}}},"id":{"type":"string","value":"minecraft:enchantment.aqua_affinity"},"attribute":{"type":"string","value":"minecraft:player.submerged_mining_speed"},"operation":{"type":"string","value":"add_multiplied_total"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":41}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/head_armor"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.aqua_affinity"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:bane_of_arthropods":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"primary_items":{"type":"string","value":"#minecraft:enchantable/sword"},"effects":{"type":"compound","value":{"minecraft:damage":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:sensitive_to_bane_of_arthropods"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2.5}}}}}}]}},"minecraft:post_attack":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:sensitive_to_bane_of_arthropods"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}},{"predicate":{"type":"compound","value":{"is_direct":{"type":"byte","value":1}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}]}}}},"enchanted":{"type":"string","value":"attacker"},"effect":{"type":"compound","value":{"min_amplifier":{"type":"float","value":3},"to_apply":{"type":"string","value":"minecraft:slowness"},"min_duration":{"type":"float","value":1.5},"type":{"type":"string","value":"minecraft:apply_mob_effect"},"max_duration":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1.5}}},"max_amplifier":{"type":"float","value":3}}},"affected":{"type":"string","value":"victim"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/weapon"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.bane_of_arthropods"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:binding_curse":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:prevent_armor_change":{"type":"compound","value":{}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":25}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/equippable"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.binding_curse"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:blast_protection":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.15000000596046448},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.15000000596046448}}},"id":{"type":"string","value":"minecraft:enchantment.blast_protection"},"attribute":{"type":"string","value":"minecraft:generic.explosion_knockback_resistance"},"operation":{"type":"string","value":"add_value"}}]}},"minecraft:damage_protection":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":1},"id":{"type":"string","value":"minecraft:is_explosion"}},{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":13}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/armor"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.blast_protection"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/armor"}}},"minecraft:breach":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:armor_effectiveness":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":-0.15000000596046448},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":-0.15000000596046448}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mace"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.breach"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:channeling":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:post_attack":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:weather_check"},"thundering":{"type":"byte","value":1}},{"predicate":{"type":"compound","value":{"location":{"type":"compound","value":{"can_see_sky":{"type":"byte","value":1}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}},{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:trident"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"direct_attacker"}}]}}}},"enchanted":{"type":"string","value":"attacker"},"effect":{"type":"compound","value":{"effects":{"type":"list","value":{"type":"compound","value":[{"type":{"type":"string","value":"minecraft:summon_entity"},"entity":{"type":"string","value":"minecraft:lightning_bolt"}},{"volume":{"type":"float","value":5},"sound":{"type":"string","value":"minecraft:item.trident.thunder"},"pitch":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:play_sound"}}]}},"type":{"type":"string","value":"minecraft:all_of"}}},"affected":{"type":"string","value":"victim"}}]}},"minecraft:hit_block":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:weather_check"},"thundering":{"type":"byte","value":1}},{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:trident"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}},{"predicate":{"type":"compound","value":{"can_see_sky":{"type":"byte","value":1}}},"condition":{"type":"string","value":"minecraft:location_check"}},{"condition":{"type":"string","value":"minecraft:block_state_property"},"block":{"type":"string","value":"minecraft:lightning_rod"}}]}}}},"effect":{"type":"compound","value":{"effects":{"type":"list","value":{"type":"compound","value":[{"type":{"type":"string","value":"minecraft:summon_entity"},"entity":{"type":"string","value":"minecraft:lightning_bolt"}},{"volume":{"type":"float","value":5},"sound":{"type":"string","value":"minecraft:item.trident.thunder"},"pitch":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:play_sound"}}]}},"type":{"type":"string","value":"minecraft:all_of"}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":25}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/trident"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.channeling"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:density":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:smash_damage_per_fallen_block":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.5}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mace"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.density"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:depth_strider":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["feet"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.3333333432674408},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.3333333432674408}}},"id":{"type":"string","value":"minecraft:enchantment.depth_strider"},"attribute":{"type":"string","value":"minecraft:generic.water_movement_efficiency"},"operation":{"type":"string","value":"add_value"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/foot_armor"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.depth_strider"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/boots"}}},"minecraft:efficiency":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"added":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:levels_squared"}}},"id":{"type":"string","value":"minecraft:enchantment.efficiency"},"attribute":{"type":"string","value":"minecraft:player.mining_efficiency"},"operation":{"type":"string","value":"add_value"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":51}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mining"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.efficiency"}}},"anvil_cost":{"type":"int","value":1},"weight":{"type":"int","value":10}}},"minecraft:feather_falling":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:damage_protection":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":1},"id":{"type":"string","value":"minecraft:is_fall"}},{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":3},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":3}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":6},"base":{"type":"int","value":11}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":6},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/foot_armor"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.feather_falling"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5}}},"minecraft:fire_aspect":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"primary_items":{"type":"string","value":"#minecraft:enchantable/sword"},"effects":{"type":"compound","value":{"minecraft:post_attack":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"is_direct":{"type":"byte","value":1}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"enchanted":{"type":"string","value":"attacker"},"effect":{"type":"compound","value":{"duration":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":4},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":4}}},"type":{"type":"string","value":"minecraft:ignite"}}},"affected":{"type":"string","value":"victim"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":60}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/fire_aspect"},"max_level":{"type":"int","value":2},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.fire_aspect"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:fire_protection":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":-0.15000000596046448},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":-0.15000000596046448}}},"id":{"type":"string","value":"minecraft:enchantment.fire_protection"},"attribute":{"type":"string","value":"minecraft:generic.burning_time"},"operation":{"type":"string","value":"add_multiplied_base"}}]}},"minecraft:damage_protection":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":1},"id":{"type":"string","value":"minecraft:is_fire"}},{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}]}}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":18}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/armor"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.fire_protection"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/armor"}}},"minecraft:flame":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:projectile_spawned":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"duration":{"type":"float","value":100},"type":{"type":"string","value":"minecraft:ignite"}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":20}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/bow"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.flame"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:fortune":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mining_loot"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.fortune"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/mining"}}},"minecraft:frost_walker":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["feet"]}},"effects":{"type":"compound","value":{"minecraft:location_changed":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_on_ground":{"type":"byte","value":1}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"predicate":{"type":"compound","value":{"predicates":{"type":"list","value":{"type":"compound","value":[{"offset":{"type":"intArray","value":[0,1,0]},"tag":{"type":"string","value":"minecraft:air"},"type":{"type":"string","value":"minecraft:matching_block_tag"}},{"blocks":{"type":"string","value":"minecraft:water"},"type":{"type":"string","value":"minecraft:matching_blocks"}},{"type":{"type":"string","value":"minecraft:matching_fluids"},"fluids":{"type":"string","value":"minecraft:water"}},{"type":{"type":"string","value":"minecraft:unobstructed"}}]}},"type":{"type":"string","value":"minecraft:all_of"}}},"trigger_game_event":{"type":"string","value":"minecraft:block_place"},"offset":{"type":"intArray","value":[0,-1,0]},"block_state":{"type":"compound","value":{"state":{"type":"compound","value":{"Properties":{"type":"compound","value":{"age":{"type":"string","value":"0"}}},"Name":{"type":"string","value":"minecraft:frosted_ice"}}},"type":{"type":"string","value":"minecraft:simple_state_provider"}}},"radius":{"type":"compound","value":{"min":{"type":"float","value":0},"max":{"type":"float","value":16},"type":{"type":"string","value":"minecraft:clamped"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":3}}}}},"type":{"type":"string","value":"minecraft:replace_disk"},"height":{"type":"float","value":1}}}}]}},"minecraft:damage_immunity":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":1},"id":{"type":"string","value":"minecraft:burn_from_stepping"}},{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"effect":{"type":"compound","value":{}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/foot_armor"},"max_level":{"type":"int","value":2},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.frost_walker"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/boots"}}},"minecraft:impaling":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:damage":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:sensitive_to_impaling"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2.5}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":21}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/trident"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.impaling"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:infinity":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:ammo_use":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"items":{"type":"string","value":"minecraft:arrow"}}},"condition":{"type":"string","value":"minecraft:match_tool"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:set"},"value":{"type":"float","value":0}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":20}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/bow"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.infinity"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/bow"}}},"minecraft:knockback":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:knockback":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":55}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/sword"},"max_level":{"type":"int","value":2},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.knockback"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5}}},"minecraft:looting":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:equipment_drops":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:player"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"attacker"}}},"enchanted":{"type":"string","value":"attacker"},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.009999999776482582},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.009999999776482582}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/sword"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.looting"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:loyalty":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:trident_return_acceleration":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":7},"base":{"type":"int","value":12}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/trident"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.loyalty"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5}}},"minecraft:luck_of_the_sea":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:fishing_luck_bonus":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/fishing"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.luck_of_the_sea"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:lure":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:fishing_time_reduction":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":5}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/fishing"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.lure"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:mending":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["any"]}},"effects":{"type":"compound","value":{"minecraft:repair_with_xp":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"factor":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:multiply"}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":25},"base":{"type":"int","value":75}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":25},"base":{"type":"int","value":25}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/durability"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.mending"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:multishot":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:projectile_spread":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":10},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":10}}}}}}]}},"minecraft:projectile_count":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":20}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/crossbow"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.multishot"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/crossbow"}}},"minecraft:piercing":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:projectile_piercing":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/crossbow"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.piercing"}}},"anvil_cost":{"type":"int","value":1},"weight":{"type":"int","value":10},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/crossbow"}}},"minecraft:power":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:damage":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:arrows"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"direct_attacker"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.5}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":16}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/bow"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.power"}}},"anvil_cost":{"type":"int","value":1},"weight":{"type":"int","value":10}}},"minecraft:projectile_protection":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:damage_protection":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":1},"id":{"type":"string","value":"minecraft:is_projectile"}},{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":6},"base":{"type":"int","value":9}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":6},"base":{"type":"int","value":3}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/armor"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.projectile_protection"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/armor"}}},"minecraft:protection":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["armor"]}},"effects":{"type":"compound","value":{"minecraft:damage_protection":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"tags":{"type":"list","value":{"type":"compound","value":[{"expected":{"type":"byte","value":0},"id":{"type":"string","value":"minecraft:bypasses_invulnerability"}}]}}}},"condition":{"type":"string","value":"minecraft:damage_source_properties"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":11},"base":{"type":"int","value":12}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":11},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/armor"},"max_level":{"type":"int","value":4},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.protection"}}},"anvil_cost":{"type":"int","value":1},"weight":{"type":"int","value":10},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/armor"}}},"minecraft:punch":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:knockback":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:arrows"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"direct_attacker"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":37}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":12}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/bow"},"max_level":{"type":"int","value":2},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.punch"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:quick_charge":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand","offhand"]}},"effects":{"type":"compound","value":{"minecraft:crossbow_charging_sounds":{"type":"list","value":{"type":"compound","value":[{"start":{"type":"string","value":"minecraft:item.crossbow.quick_charge_1"},"end":{"type":"string","value":"minecraft:item.crossbow.loading_end"}},{"start":{"type":"string","value":"minecraft:item.crossbow.quick_charge_2"},"end":{"type":"string","value":"minecraft:item.crossbow.loading_end"}},{"start":{"type":"string","value":"minecraft:item.crossbow.quick_charge_3"},"end":{"type":"string","value":"minecraft:item.crossbow.loading_end"}}]}},"minecraft:crossbow_charge_time":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":-0.25},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":-0.25}}}}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":12}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/crossbow"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.quick_charge"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5}}},"minecraft:respiration":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["head"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}},"id":{"type":"string","value":"minecraft:enchantment.respiration"},"attribute":{"type":"string","value":"minecraft:generic.oxygen_bonus"},"operation":{"type":"string","value":"add_value"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":40}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/head_armor"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.respiration"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:riptide":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["hand"]}},"effects":{"type":"compound","value":{"minecraft:trident_spin_attack_strength":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.75},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1.5}}}}},"minecraft:trident_sound":{"type":"list","value":{"type":"string","value":["minecraft:item.trident.riptide_1","minecraft:item.trident.riptide_2","minecraft:item.trident.riptide_3"]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":7},"base":{"type":"int","value":17}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/trident"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.riptide"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/riptide"}}},"minecraft:sharpness":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"primary_items":{"type":"string","value":"#minecraft:enchantable/sword"},"effects":{"type":"compound","value":{"minecraft:damage":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":11},"base":{"type":"int","value":21}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":11},"base":{"type":"int","value":1}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/sharp_weapon"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.sharpness"}}},"anvil_cost":{"type":"int","value":1},"weight":{"type":"int","value":10},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:silk_touch":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:block_experience":{"type":"list","value":{"type":"compound","value":[{"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:set"},"value":{"type":"float","value":0}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mining_loot"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.silk_touch"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/mining"}}},"minecraft:smite":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"primary_items":{"type":"string","value":"#minecraft:enchantable/sword"},"effects":{"type":"compound","value":{"minecraft:damage":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"type":{"type":"string","value":"#minecraft:sensitive_to_smite"}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:add"},"value":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2.5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2.5}}}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/weapon"},"max_level":{"type":"int","value":5},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.smite"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5},"exclusive_set":{"type":"string","value":"#minecraft:exclusive_set/damage"}}},"minecraft:soul_speed":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["feet"]}},"effects":{"type":"compound","value":{"minecraft:location_changed":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:inverted"},"term":{"type":"compound","value":{"predicate":{"type":"compound","value":{"vehicle":{"type":"compound","value":{}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}}},{"condition":{"type":"string","value":"minecraft:any_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:enchantment_active_check"},"active":{"type":"byte","value":1}},{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_flying":{"type":"byte","value":0}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}},{"condition":{"type":"string","value":"minecraft:any_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"predicate":{"type":"compound","value":{"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}},{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_on_ground":{"type":"byte","value":0}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}]}}}]}}},{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:enchantment_active_check"},"active":{"type":"byte","value":0}},{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_flying":{"type":"byte","value":0}}},"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}]}}}]}}}]}}}},"effect":{"type":"compound","value":{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.010499999858438969},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.04050000011920929}}},"id":{"type":"string","value":"minecraft:enchantment.soul_speed"},"attribute":{"type":"string","value":"minecraft:generic.movement_speed"},"type":{"type":"string","value":"minecraft:attribute"},"operation":{"type":"string","value":"add_value"}}}},{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"amount":{"type":"float","value":1},"id":{"type":"string","value":"minecraft:enchantment.soul_speed"},"attribute":{"type":"string","value":"minecraft:generic.movement_efficiency"},"type":{"type":"string","value":"minecraft:attribute"},"operation":{"type":"string","value":"add_value"}}}},{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:random_chance"},"chance":{"type":"compound","value":{"amount":{"type":"float","value":0.03999999910593033},"type":{"type":"string","value":"minecraft:enchantment_level"}}}},{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_on_ground":{"type":"byte","value":1}}},"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}]}}}},"effect":{"type":"compound","value":{"amount":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:damage_item"}}}}]}},"minecraft:tick":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"periodic_tick":{"type":"int","value":5},"flags":{"type":"compound","value":{"is_flying":{"type":"byte","value":0},"is_on_ground":{"type":"byte","value":1}}},"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}},"movement":{"type":"compound","value":{"horizontal_speed":{"type":"compound","value":{"min":{"type":"double","value":9.999999747378752e-06}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}},"effect":{"type":"compound","value":{"horizontal_position":{"type":"compound","value":{"type":{"type":"string","value":"in_bounding_box"}}},"particle":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:soul"}}},"vertical_velocity":{"type":"compound","value":{"base":{"type":"float","value":0.10000000149011612}}},"vertical_position":{"type":"compound","value":{"offset":{"type":"float","value":0.10000000149011612},"type":{"type":"string","value":"entity_position"}}},"type":{"type":"string","value":"minecraft:spawn_particles"},"speed":{"type":"float","value":1},"horizontal_velocity":{"type":"compound","value":{"movement_scale":{"type":"float","value":-0.20000000298023224}}}}}},{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:all_of"},"terms":{"type":"list","value":{"type":"compound","value":[{"condition":{"type":"string","value":"minecraft:random_chance"},"chance":{"type":"float","value":0.3499999940395355}},{"predicate":{"type":"compound","value":{"periodic_tick":{"type":"int","value":5},"flags":{"type":"compound","value":{"is_flying":{"type":"byte","value":0},"is_on_ground":{"type":"byte","value":1}}},"movement_affected_by":{"type":"compound","value":{"block":{"type":"compound","value":{"blocks":{"type":"string","value":"#minecraft:soul_speed_blocks"}}}}},"movement":{"type":"compound","value":{"horizontal_speed":{"type":"compound","value":{"min":{"type":"double","value":9.999999747378752e-06}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"this"}}]}}}},"effect":{"type":"compound","value":{"volume":{"type":"float","value":0.6000000238418579},"sound":{"type":"string","value":"minecraft:particle.soul_escape"},"pitch":{"type":"compound","value":{"min_inclusive":{"type":"float","value":0.6000000238418579},"max_exclusive":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:uniform"}}},"type":{"type":"string","value":"minecraft:play_sound"}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":25}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":10},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/foot_armor"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.soul_speed"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:sweeping_edge":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:fraction"},"numerator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}},"denominator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}},"id":{"type":"string","value":"minecraft:enchantment.sweeping_edge"},"attribute":{"type":"string","value":"minecraft:player.sweeping_damage_ratio"},"operation":{"type":"string","value":"add_value"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":20}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/sword"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.sweeping_edge"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}},"minecraft:swift_sneak":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["legs"]}},"effects":{"type":"compound","value":{"minecraft:attributes":{"type":"list","value":{"type":"compound","value":[{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.15000000596046448},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.15000000596046448}}},"id":{"type":"string","value":"minecraft:enchantment.swift_sneak"},"attribute":{"type":"string","value":"minecraft:player.sneaking_speed"},"operation":{"type":"string","value":"add_value"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":25},"base":{"type":"int","value":75}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":25},"base":{"type":"int","value":25}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/leg_armor"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.swift_sneak"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:thorns":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["any"]}},"primary_items":{"type":"string","value":"#minecraft:enchantable/chest_armor"},"effects":{"type":"compound","value":{"minecraft:post_attack":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:random_chance"},"chance":{"type":"compound","value":{"amount":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.15000000596046448},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":0.15000000596046448}}},"type":{"type":"string","value":"minecraft:enchantment_level"}}}}},"enchanted":{"type":"string","value":"victim"},"effect":{"type":"compound","value":{"effects":{"type":"list","value":{"type":"compound","value":[{"damage_type":{"type":"string","value":"minecraft:thorns"},"max_damage":{"type":"float","value":5},"min_damage":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:damage_entity"}},{"amount":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:damage_item"}}]}},"type":{"type":"string","value":"minecraft:all_of"}}},"affected":{"type":"string","value":"attacker"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":60}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":20},"base":{"type":"int","value":10}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/armor"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.thorns"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:unbreaking":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["any"]}},"effects":{"type":"compound","value":{"minecraft:item_damage":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"items":{"type":"string","value":"#minecraft:enchantable/armor"}}},"condition":{"type":"string","value":"minecraft:match_tool"}}},"effect":{"type":"compound","value":{"chance":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:fraction"},"numerator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":2},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}},"denominator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":5},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":10}}}}},"type":{"type":"string","value":"minecraft:remove_binomial"}}}},{"requirements":{"type":"compound","value":{"condition":{"type":"string","value":"minecraft:inverted"},"term":{"type":"compound","value":{"predicate":{"type":"compound","value":{"items":{"type":"string","value":"#minecraft:enchantable/armor"}}},"condition":{"type":"string","value":"minecraft:match_tool"}}}}},"effect":{"type":"compound","value":{"chance":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:fraction"},"numerator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1}}},"denominator":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":1},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":2}}}}},"type":{"type":"string","value":"minecraft:remove_binomial"}}}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":55}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":8},"base":{"type":"int","value":5}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/durability"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.unbreaking"}}},"anvil_cost":{"type":"int","value":2},"weight":{"type":"int","value":5}}},"minecraft:vanishing_curse":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["any"]}},"effects":{"type":"compound","value":{"minecraft:prevent_equipment_drop":{"type":"compound","value":{}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":50}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":0},"base":{"type":"int","value":25}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/vanishing"},"max_level":{"type":"int","value":1},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.vanishing_curse"}}},"anvil_cost":{"type":"int","value":8},"weight":{"type":"int","value":1}}},"minecraft:wind_burst":{"type":"compound","value":{"slots":{"type":"list","value":{"type":"string","value":["mainhand"]}},"effects":{"type":"compound","value":{"minecraft:post_attack":{"type":"list","value":{"type":"compound","value":[{"requirements":{"type":"compound","value":{"predicate":{"type":"compound","value":{"flags":{"type":"compound","value":{"is_flying":{"type":"byte","value":0}}},"movement":{"type":"compound","value":{"fall_distance":{"type":"compound","value":{"min":{"type":"double","value":1.5}}}}}}},"condition":{"type":"string","value":"minecraft:entity_properties"},"entity":{"type":"string","value":"direct_attacker"}}},"enchanted":{"type":"string","value":"attacker"},"effect":{"type":"compound","value":{"block_interaction":{"type":"string","value":"trigger"},"immune_blocks":{"type":"string","value":"#minecraft:blocks_wind_charge_explosions"},"sound":{"type":"string","value":"minecraft:entity.wind_charge.wind_burst"},"knockback_multiplier":{"type":"compound","value":{"values":{"type":"list","value":{"type":"float","value":[1.2000000476837158,1.75,2.200000047683716]}},"type":{"type":"string","value":"minecraft:lookup"},"fallback":{"type":"compound","value":{"per_level_above_first":{"type":"float","value":0.3499999940395355},"type":{"type":"string","value":"minecraft:linear"},"base":{"type":"float","value":1.5}}}}},"large_particle":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:gust_emitter_large"}}},"radius":{"type":"float","value":3.5},"type":{"type":"string","value":"minecraft:explode"},"small_particle":{"type":"compound","value":{"type":{"type":"string","value":"minecraft:gust_emitter_small"}}}}},"affected":{"type":"string","value":"attacker"}}]}}}},"max_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":65}}},"min_cost":{"type":"compound","value":{"per_level_above_first":{"type":"int","value":9},"base":{"type":"int","value":15}}},"supported_items":{"type":"string","value":"#minecraft:enchantable/mace"},"max_level":{"type":"int","value":3},"description":{"type":"compound","value":{"translate":{"type":"string","value":"enchantment.minecraft.wind_burst"}}},"anvil_cost":{"type":"int","value":4},"weight":{"type":"int","value":2}}}},"minecraft:jukebox_song":{"minecraft:11":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.11"},"length_in_seconds":{"type":"float","value":71},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.11"}}},"comparator_output":{"type":"int","value":11}}},"minecraft:13":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.13"},"length_in_seconds":{"type":"float","value":178},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.13"}}},"comparator_output":{"type":"int","value":1}}},"minecraft:5":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.5"},"length_in_seconds":{"type":"float","value":178},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.5"}}},"comparator_output":{"type":"int","value":15}}},"minecraft:blocks":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.blocks"},"length_in_seconds":{"type":"float","value":345},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.blocks"}}},"comparator_output":{"type":"int","value":3}}},"minecraft:cat":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.cat"},"length_in_seconds":{"type":"float","value":185},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.cat"}}},"comparator_output":{"type":"int","value":2}}},"minecraft:chirp":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.chirp"},"length_in_seconds":{"type":"float","value":185},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.chirp"}}},"comparator_output":{"type":"int","value":4}}},"minecraft:creator":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.creator"},"length_in_seconds":{"type":"float","value":176},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.creator"}}},"comparator_output":{"type":"int","value":12}}},"minecraft:creator_music_box":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.creator_music_box"},"length_in_seconds":{"type":"float","value":73},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.creator_music_box"}}},"comparator_output":{"type":"int","value":11}}},"minecraft:far":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.far"},"length_in_seconds":{"type":"float","value":174},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.far"}}},"comparator_output":{"type":"int","value":5}}},"minecraft:mall":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.mall"},"length_in_seconds":{"type":"float","value":197},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.mall"}}},"comparator_output":{"type":"int","value":6}}},"minecraft:mellohi":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.mellohi"},"length_in_seconds":{"type":"float","value":96},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.mellohi"}}},"comparator_output":{"type":"int","value":7}}},"minecraft:otherside":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.otherside"},"length_in_seconds":{"type":"float","value":195},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.otherside"}}},"comparator_output":{"type":"int","value":14}}},"minecraft:pigstep":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.pigstep"},"length_in_seconds":{"type":"float","value":149},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.pigstep"}}},"comparator_output":{"type":"int","value":13}}},"minecraft:precipice":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.precipice"},"length_in_seconds":{"type":"float","value":299},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.precipice"}}},"comparator_output":{"type":"int","value":13}}},"minecraft:relic":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.relic"},"length_in_seconds":{"type":"float","value":218},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.relic"}}},"comparator_output":{"type":"int","value":14}}},"minecraft:stal":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.stal"},"length_in_seconds":{"type":"float","value":150},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.stal"}}},"comparator_output":{"type":"int","value":8}}},"minecraft:strad":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.strad"},"length_in_seconds":{"type":"float","value":188},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.strad"}}},"comparator_output":{"type":"int","value":9}}},"minecraft:wait":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.wait"},"length_in_seconds":{"type":"float","value":238},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.wait"}}},"comparator_output":{"type":"int","value":12}}},"minecraft:ward":{"type":"compound","value":{"sound_event":{"type":"string","value":"minecraft:music_disc.ward"},"length_in_seconds":{"type":"float","value":251},"description":{"type":"compound","value":{"translate":{"type":"string","value":"jukebox_song.minecraft.ward"}}},"comparator_output":{"type":"int","value":10}}}}} diff --git a/protocol/data/tags_767.json b/protocol/data/tags_767.json new file mode 100644 index 0000000..4e5d407 --- /dev/null +++ b/protocol/data/tags_767.json @@ -0,0 +1 @@ +{"minecraft:block":{"minecraft:acacia_logs":[50,70,60,78],"minecraft:air":[0,729,730],"minecraft:all_hanging_signs":[208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,227,228,226,229],"minecraft:all_signs":[186,187,188,189,191,192,828,829,193,194,190,199,200,201,202,204,205,830,831,206,207,203,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,227,228,226,229],"minecraft:ancient_city_replaceable":[1023,1036,1032,1038,1034,1037,1035,1039,1024,1041,1042,137],"minecraft:animals_spawnable_on":[8],"minecraft:anvil":[408,409,410],"minecraft:armadillo_spawnable_on":[8,494,425,429,426,439,437,433,36,10],"minecraft:axolotls_spawnable_on":[251],"minecraft:azalea_grows_on":[9,8,11,10,323,1021,1016,1022,55,34,36,35,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,249,925],"minecraft:azalea_root_replaceable":[1,2,4,6,909,1023,9,8,11,10,323,1021,1016,1022,55,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,36,251,37,34,249,925],"minecraft:badlands_terracotta":[494,425,429,426,439,437,433],"minecraft:bamboo_blocks":[56,65],"minecraft:bamboo_plantable_on":[34,36,35,9,8,11,10,323,1021,1016,1022,55,727,726,37,38],"minecraft:banners":[503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534],"minecraft:base_stone_nether":[255,258,849],"minecraft:base_stone_overworld":[1,2,4,6,909,1023],"minecraft:beacon_base_blocks":[840,347,181,163,164],"minecraft:beds":[117,118,114,115,112,110,116,106,111,108,105,104,109,113,103,107],"minecraft:bee_growables":[601,383,384,183,316,315,598,599,788,1009,1010],"minecraft:beehives":[836,837],"minecraft:big_dripleaf_placeable":[251,1016,9,8,11,10,323,1021,1022,55,184],"minecraft:birch_logs":[48,68,58,76],"minecraft:blocks_wind_charge_explosions":[464,31],"minecraft:buttons":[385,386,387,388,389,391,824,825,392,393,390,246,864],"minecraft:camel_sand_step_sound_blocks":[34,36,35,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677],"minecraft:campfires":[786,787],"minecraft:candle_cakes":[886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902],"minecraft:candles":[869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885],"minecraft:cauldrons":[331,332,333,334],"minecraft:cave_vines":[1010,1009],"minecraft:ceiling_hanging_signs":[208,209,210,211,212,213,214,215,216,217,218],"minecraft:cherry_logs":[51,71,61,79],"minecraft:climbable":[196,317,772,805,806,807,808,1009,1010],"minecraft:coal_ores":[43,44],"minecraft:combination_step_sound_blocks":[478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,1014,247,797,796,809],"minecraft:completes_find_tree_tutorial":[52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79,798,799,800,801,789,790,791,792,85,82,83,88,86,84,90,91,89,87,608,795],"minecraft:concrete_powder":[662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677],"minecraft:convertable_to_mud":[9,10,1021],"minecraft:copper_ores":[936,937],"minecraft:coral_blocks":[688,689,690,691,692],"minecraft:coral_plants":[698,699,700,701,702],"minecraft:corals":[698,699,700,701,702,708,709,710,711,712],"minecraft:crimson_stems":[798,799,800,801],"minecraft:crops":[601,383,384,183,316,315,598,599],"minecraft:crystal_sound_blocks":[903,904],"minecraft:dampens_vibrations":[130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493],"minecraft:dark_oak_logs":[52,72,62,80],"minecraft:dead_bush_may_place_on":[34,36,35,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,9,8,11,10,323,1021,1016,1022,55],"minecraft:deepslate_ore_replaceables":[1023,909],"minecraft:diamond_ores":[179,180],"minecraft:dirt":[9,8,11,10,323,1021,1016,1022,55],"minecraft:does_not_block_hoppers":[836,837],"minecraft:doors":[195,583,584,585,586,588,826,827,589,590,587,974,975,977,976,978,979,981,980,232],"minecraft:dragon_immune":[464,31,335,336,603,351,604,605,832,833,146,170,842,337,308,843,1054],"minecraft:dragon_transparent":[465,173,174],"minecraft:dripstone_replaceable_blocks":[1,2,4,6,909,1023],"minecraft:emerald_ores":[342,343],"minecraft:enchantment_power_provider":[167],"minecraft:enchantment_power_transmitter":[0,32,33,123,124,125,126,127,173,174,247,317,318,465,501,502,611,729,730,731,796,797,809,1020],"minecraft:enderman_holdable":[147,149,150,151,152,153,154,155,156,157,158,160,159,148,9,8,11,10,323,1021,1016,1022,55,34,36,37,161,162,166,250,251,311,264,312,803,802,809,794,793,796],"minecraft:fall_damage_resetting":[196,317,772,805,806,807,808,1009,1010,788,122],"minecraft:features_cannot_replace":[31,175,177,336,1054,1057,1058],"minecraft:fence_gates":[570,568,572,569,319,567,820,821,573,574,571],"minecraft:fences":[254,578,580,575,576,577,816,817,581,582,579,326],"minecraft:fire":[173,174],"minecraft:flower_pots":[355,367,368,369,370,371,372,373,374,375,366,357,358,359,360,361,363,379,380,381,365,382,376,377,378,728,844,845,846,847,1048,1049,364,362,356],"minecraft:flowers":[147,149,150,151,152,153,154,155,156,157,158,160,159,148,497,498,500,499,600,91,1013,30,87,1015,593,1011],"minecraft:foxes_spawnable_on":[8,247,249,11,10],"minecraft:frog_prefer_jump_to":[324,1017],"minecraft:frogs_spawnable_on":[8,1022,54,55],"minecraft:geode_invalid_blocks":[31,32,33,248,496,724],"minecraft:goats_spawnable_on":[8,1,247,249,496,37],"minecraft:gold_ores":[39,45,40],"minecraft:guarded_by_piglins":[163,774,177,344,860,411,1047,613,629,625,626,623,621,627,617,622,619,616,615,620,624,628,614,618,39,45,40],"minecraft:hoglin_repellents":[794,845,263,843],"minecraft:ice":[248,496,724,606],"minecraft:impermeable":[94,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,924],"minecraft:incorrect_for_diamond_tool":[],"minecraft:incorrect_for_gold_tool":[170,842,840,843,841,181,179,180,342,343,347,163,1047,39,40,242,243,164,1045,41,42,97,95,96,932,1046,936,937,957,953,941,934,955,951,939,935,954,950,938,933,956,952,940,958,973,969,965,959,971,967,963,960,972,968,964,961,970,966,962,1006,1056,945,944,943,942,949,948,947,946,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,982,983,985,984,986,987,989,988,974,975,977,976,978,979,981,980],"minecraft:incorrect_for_iron_tool":[170,842,840,843,841],"minecraft:incorrect_for_netherite_tool":[],"minecraft:incorrect_for_stone_tool":[170,842,840,843,841,181,179,180,342,343,347,163,1047,39,40,242,243],"minecraft:incorrect_for_wooden_tool":[170,842,840,843,841,181,179,180,342,343,347,163,1047,39,40,242,243,164,1045,41,42,97,95,96,932,1046,936,937,957,953,941,934,955,951,939,935,954,950,938,933,956,952,940,958,973,969,965,959,971,967,963,960,972,968,964,961,970,966,962,1006,1056,945,944,943,942,949,948,947,946,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,982,983,985,984,986,987,989,988,974,975,977,976,978,979,981,980],"minecraft:infiniburn_end":[255,607,31],"minecraft:infiniburn_nether":[255,607],"minecraft:infiniburn_overworld":[255,607],"minecraft:inside_step_sound_blocks":[925,929,318,324,908,1015],"minecraft:invalid_spawn_inside":[335,603],"minecraft:iron_ores":[41,42],"minecraft:jungle_logs":[49,69,59,77],"minecraft:lapis_ores":[95,96],"minecraft:lava_pool_stone_cannot_replace":[31,175,177,336,1054,1057,1058,85,82,83,88,86,84,90,91,89,87,52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79,798,799,800,801,789,790,791,792],"minecraft:leaves":[85,82,83,88,86,84,90,91,89,87],"minecraft:logs":[52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79,798,799,800,801,789,790,791,792],"minecraft:logs_that_burn":[52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79],"minecraft:lush_ground_replaceable":[1,2,4,6,909,1023,1010,1009,9,8,11,10,323,1021,1016,1022,55,251,37,34],"minecraft:maintains_farmland":[315,313,316,314,601,383,384,598,148,599,183],"minecraft:mangrove_logs":[53,73,64,81],"minecraft:mangrove_logs_can_grow_through":[1022,55,54,89,53,30,1014,317],"minecraft:mangrove_roots_can_grow_through":[1022,55,54,1014,317,30,247],"minecraft:mineable/axe":[102,314,313,1012,727,774,836,837,601,1018,1017,167,305,161,786,383,777,264,1010,1009,177,593,592,340,834,182,803,415,125,124,778,318,123,1020,265,253,196,502,780,324,773,316,312,307,328,384,315,311,306,162,772,1019,781,787,1011,252,788,501,411,808,807,317,794,806,805,183,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,570,568,572,569,319,567,820,821,573,574,571,52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79,798,799,800,801,789,790,791,792,13,14,15,16,17,19,810,811,20,21,18,23,24,25,26,27,29,1013,30,28,186,187,188,189,191,192,828,829,193,194,190,199,200,201,202,204,205,830,831,206,207,203,385,386,387,388,389,391,824,825,392,393,390,195,583,584,585,586,588,826,827,589,590,587,254,578,580,575,576,577,816,817,581,582,579,233,234,235,236,237,239,814,815,240,241,238,539,540,541,542,543,545,812,813,546,547,544,176,348,349,350,457,459,822,823,460,461,458,288,286,290,287,284,285,818,819,291,292,289,54,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,227,228,226,229,22,548,462,56,65,168],"minecraft:mineable/hoe":[608,795,477,680,835,804,92,93,85,82,83,88,86,84,90,91,89,926,927,1016,1014,928,930,929,931,1015,87],"minecraft:mineable/pickaxe":[1,2,3,4,5,6,7,12,39,40,41,42,43,44,45,95,96,97,98,99,100,101,163,164,165,169,170,175,179,180,181,185,198,231,232,242,243,255,258,259,293,294,295,296,308,309,320,321,325,326,327,329,330,337,341,342,343,344,347,412,413,416,417,418,419,420,421,422,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,466,467,468,469,470,471,472,473,474,475,494,495,535,536,537,538,549,550,551,552,553,554,555,556,558,559,560,561,562,563,564,565,566,594,595,596,597,607,609,610,612,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,703,704,705,706,707,713,714,715,716,717,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,775,776,779,782,783,784,785,793,802,840,841,842,843,848,849,850,852,853,854,855,856,857,858,860,861,862,863,866,867,868,909,923,935,934,933,932,936,937,938,939,940,941,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,1006,1007,1008,1023,1024,1025,1026,1028,1029,1030,1032,1033,1034,1036,1037,1038,1040,1041,1042,1044,1045,1046,1047,248,496,724,128,121,129,905,908,907,906,903,904,300,304,303,1043,299,302,301,246,864,353,354,759,760,761,762,763,764,766,767,768,769,770,771,851,859,865,1027,1031,1035,1039,765,912,916,921,613,629,625,626,623,621,627,617,622,619,616,615,620,624,628,614,618,408,409,410,331,332,333,334,197,119,120,423,725,298,322,557,297,1056,910,911,917,913,914,915,918,919,920,922,945,944,943,942,949,948,947,946,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,974,975,977,976,978,979,981,980,982,983,985,984,986,987,989,988,1059],"minecraft:mineable/shovel":[251,9,10,11,184,8,37,323,34,36,249,247,256,602,257,1021,55,1022,35,38,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677],"minecraft:mob_interactable_doors":[195,583,584,585,586,588,826,827,589,590,587,974,975,977,976,978,979,981,980],"minecraft:mooshrooms_spawnable_on":[323],"minecraft:moss_replaceable":[1,2,4,6,909,1023,1010,1009,9,8,11,10,323,1021,1016,1022,55],"minecraft:mushroom_grow_block":[323,11,802,793],"minecraft:needs_diamond_tool":[170,842,840,843,841],"minecraft:needs_iron_tool":[181,179,180,342,343,347,163,1047,39,40,242,243],"minecraft:needs_stone_tool":[164,1045,41,42,97,95,96,932,1046,936,937,957,953,941,934,955,951,939,935,954,950,938,933,956,952,940,958,973,969,965,959,971,967,963,960,972,968,964,961,970,966,962,1006,1056,945,944,943,942,949,948,947,946,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,982,983,985,984,986,987,989,988,974,975,977,976,978,979,981,980],"minecraft:nether_carver_replaceables":[1,2,4,6,909,1023,255,258,849,9,8,11,10,323,1021,1016,1022,55,802,793,608,795,256,257],"minecraft:nylium":[802,793],"minecraft:oak_logs":[46,66,63,74],"minecraft:occludes_vibration_signals":[130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"minecraft:overworld_carver_replaceables":[1,2,4,6,909,1023,9,8,11,10,323,1021,1016,1022,55,34,36,35,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,41,42,936,937,32,37,38,99,535,923,247,496,1045,1046],"minecraft:overworld_natural_logs":[50,48,46,49,47,52,53,51],"minecraft:parrots_spawnable_on":[8,0,85,82,83,88,86,84,90,91,89,87,52,72,62,80,46,66,63,74,50,70,60,78,48,68,58,76,49,69,59,77,47,67,57,75,53,73,64,81,51,71,61,79,798,799,800,801,789,790,791,792],"minecraft:piglin_repellents":[174,260,785,261,787],"minecraft:planks":[13,14,15,16,17,19,810,811,20,21,18],"minecraft:polar_bears_spawnable_on_alternate":[248],"minecraft:portals":[263,335,603],"minecraft:pressure_plates":[412,413,233,234,235,236,237,239,814,815,240,241,238,231,863],"minecraft:prevent_mob_spawning_inside":[197,119,120,423],"minecraft:rabbits_spawnable_on":[8,247,249,34],"minecraft:rails":[197,119,120,423],"minecraft:redstone_ores":[242,243],"minecraft:replaceable":[0,32,33,123,124,125,126,127,173,174,247,317,318,465,501,502,611,729,730,731,796,797,809,1020],"minecraft:replaceable_by_trees":[85,82,83,88,86,84,90,91,89,87,123,124,125,317,318,497,498,499,500,501,502,1020,600,32,126,127,796,797,809],"minecraft:sand":[34,36,35],"minecraft:saplings":[23,24,25,26,27,29,1012,1013,30,28],"minecraft:sculk_replaceable":[1,2,4,6,909,1023,9,8,11,10,323,1021,1016,1022,55,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,802,793,255,258,849,34,36,37,256,257,923,1044,251,1008,337,535,99],"minecraft:sculk_replaceable_world_gen":[1,2,4,6,909,1023,9,8,11,10,323,1021,1016,1022,55,494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,802,793,255,258,849,34,36,37,256,257,923,1044,251,1008,337,535,99,1036,1032,1024,1041,1042,1028],"minecraft:shulker_boxes":[613,629,625,626,623,621,627,617,622,619,616,615,620,624,628,614,618],"minecraft:signs":[186,187,188,189,191,192,828,829,193,194,190,199,200,201,202,204,205,830,831,206,207,203],"minecraft:slabs":[539,540,541,542,543,545,812,813,546,547,544,548,549,550,556,551,562,559,560,555,554,558,553,473,474,475,746,747,748,749,750,751,752,753,754,755,756,757,758,552,561,852,857,862,1026,1030,1034,1038,971,972,973,954,955,956,957,970,557,910,914,919],"minecraft:small_dripleaf_placeable":[251,1016],"minecraft:small_flowers":[147,149,150,151,152,153,154,155,156,157,158,160,159,148],"minecraft:smelts_to_glass":[34,36],"minecraft:snaps_goat_horn":[50,48,46,49,47,52,53,51,1,496,41,43,936,342],"minecraft:sniffer_diggable_block":[9,8,11,10,1021,1016,1022,55],"minecraft:sniffer_egg_hatch_boost":[1016],"minecraft:snow":[247,249,925],"minecraft:snow_layer_can_survive_on":[838,256,1022],"minecraft:snow_layer_cannot_survive_on":[248,496,464],"minecraft:soul_fire_base_blocks":[256,257],"minecraft:soul_speed_blocks":[256,257],"minecraft:spruce_logs":[47,67,57,75],"minecraft:stairs":[176,348,349,350,457,459,822,823,460,461,458,462,198,341,327,321,320,596,422,538,471,470,472,732,733,734,735,736,737,738,739,740,741,742,743,744,745,850,858,861,1025,1029,1033,1037,950,951,952,953,967,968,969,966,322,911,915,920],"minecraft:standing_signs":[186,187,188,189,191,192,828,829,193,194,190],"minecraft:stone_bricks":[293,294,295,296],"minecraft:stone_buttons":[246,864],"minecraft:stone_ore_replaceables":[1,2,4,6],"minecraft:stone_pressure_plates":[231,863],"minecraft:strider_warm_blocks":[33],"minecraft:sword_efficient":[85,82,83,88,86,84,90,91,89,87,23,24,25,26,27,29,1012,1013,30,28,147,149,150,151,152,153,154,155,156,157,158,160,159,148,601,383,384,183,316,315,598,599,123,124,125,317,318,497,498,499,500,501,502,1020,600,161,162,252,311,264,265,312,313,314,324,340,788,1009,1010,1011,1014,1015,1017,1018,1019,328,794,796,797,803,805,806,807,808,809,592,593],"minecraft:tall_flowers":[497,498,500,499,600],"minecraft:terracotta":[494,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440],"minecraft:trail_ruins_replaceable":[37],"minecraft:trapdoors":[288,286,290,287,284,285,818,819,291,292,289,466,982,983,985,984,986,987,989,988],"minecraft:underwater_bonemeals":[126,698,699,700,701,702,708,709,710,711,712,718,719,720,721,722],"minecraft:unstable_bottom_center":[570,568,572,569,319,567,820,821,573,574,571],"minecraft:valid_spawn":[8,11],"minecraft:vibration_resonators":[903],"minecraft:wall_corals":[718,719,720,721,722],"minecraft:wall_hanging_signs":[219,220,221,222,223,224,225,227,228,226,229],"minecraft:wall_post_override":[171,260,244,346,186,187,188,189,191,192,828,829,193,194,190,199,200,201,202,204,205,830,831,206,207,203,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,412,413,233,234,235,236,237,239,814,815,240,241,238,231,863],"minecraft:wall_signs":[199,200,201,202,204,205,830,831,206,207,203],"minecraft:walls":[353,354,759,760,761,762,763,764,766,767,768,769,770,771,851,859,865,1027,1031,1035,1039,765,912,916,921],"minecraft:warped_stems":[789,790,791,792],"minecraft:wart_blocks":[608,795],"minecraft:wither_immune":[464,31,335,336,603,351,604,605,832,833,146,465,1054],"minecraft:wither_summon_base_blocks":[256,257],"minecraft:wolves_spawnable_on":[8,247,249,10,11],"minecraft:wooden_buttons":[385,386,387,388,389,391,824,825,392,393,390],"minecraft:wooden_doors":[195,583,584,585,586,588,826,827,589,590,587],"minecraft:wooden_fences":[254,578,580,575,576,577,816,817,581,582,579],"minecraft:wooden_pressure_plates":[233,234,235,236,237,239,814,815,240,241,238],"minecraft:wooden_slabs":[539,540,541,542,543,545,812,813,546,547,544],"minecraft:wooden_stairs":[176,348,349,350,457,459,822,823,460,461,458],"minecraft:wooden_trapdoors":[288,286,290,287,284,285,818,819,291,292,289],"minecraft:wool":[130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"minecraft:wool_carpets":[478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493]},"minecraft:item":{"minecraft:acacia_logs":[136,170,149,159],"minecraft:anvil":[419,420,421],"minecraft:armadillo_food":[1000],"minecraft:arrows":[802,1160,1159],"minecraft:axes":[841,826,831,846,821,836],"minecraft:axolotl_food":[918],"minecraft:bamboo_blocks":[144,165],"minecraft:banners":[1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148],"minecraft:beacon_payment_items":[816,806,805,815,811],"minecraft:beds":[978,979,975,976,973,971,977,967,972,969,966,965,970,974,964,968],"minecraft:bee_food":[218,219,220,221,222,223,224,225,226,227,228,229,230,231,465,466,468,467,232,185,198,55,181,246,294,233],"minecraft:birch_logs":[134,168,147,157],"minecraft:boats":[774,776,778,780,782,786,788,790,784,775,777,779,781,783,787,789,791,785],"minecraft:bookshelf_books":[925,1092,1114,1091,1166],"minecraft:breaks_decorated_pots":[838,823,828,843,818,833,841,826,831,846,821,836,840,825,830,845,820,835,839,824,829,844,819,834,842,827,832,847,822,837,1188,1093],"minecraft:buttons":[684,685,686,687,688,690,693,694,691,692,689,682,683],"minecraft:camel_food":[308],"minecraft:candles":[1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257],"minecraft:cat_food":[935,936],"minecraft:cherry_logs":[137,171,150,160],"minecraft:chest_armor":[857,861,873,865,869,877],"minecraft:chest_boats":[775,777,779,781,783,787,789,791,785],"minecraft:chicken_food":[853,987,986,1155,1152,1153],"minecraft:cluster_max_harvestables":[840,830,835,845,825,820],"minecraft:coal_ores":[62,63],"minecraft:coals":[803,804],"minecraft:compasses":[928,929],"minecraft:completes_find_tree_tutorial":[138,172,151,161,132,166,145,155,136,170,149,159,134,168,147,157,135,169,148,158,133,167,146,156,139,173,152,162,137,171,150,160,142,153,174,163,143,154,175,164,179,176,177,182,180,178,184,185,183,181,517,518],"minecraft:copper_ores":[66,67],"minecraft:cow_food":[854],"minecraft:creeper_drop_music_discs":[1168,1169,1170,1171,1174,1175,1176,1177,1178,1179,1180,1181],"minecraft:creeper_igniters":[798,1089],"minecraft:crimson_stems":[142,153,174,163],"minecraft:dampens_vibrations":[202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461],"minecraft:dark_oak_logs":[138,172,151,161],"minecraft:decorated_pot_ingredients":[921,1288,1289,1290,1291,1292,1293,1294,1295,1297,1299,1300,1301,1302,1303,1304,1305,1307,1308,1309,1310,1296,1298,1306],"minecraft:decorated_pot_sherds":[1288,1289,1290,1291,1292,1293,1294,1295,1297,1299,1300,1301,1302,1303,1304,1305,1307,1308,1309,1310,1296,1298,1306],"minecraft:diamond_ores":[76,77],"minecraft:dirt":[28,27,30,29,364,31,247,32,141],"minecraft:doors":[711,712,713,714,715,717,720,721,718,719,716,722,723,724,725,726,727,728,729,710],"minecraft:dyeable":[856,857,858,859,1127,797],"minecraft:emerald_ores":[72,73],"minecraft:enchantable/armor":[859,863,875,867,871,879,858,862,874,866,870,878,857,861,873,865,869,877,856,860,872,864,868,876,794],"minecraft:enchantable/bow":[801],"minecraft:enchantable/chest_armor":[857,861,873,865,869,877],"minecraft:enchantable/crossbow":[1192],"minecraft:enchantable/durability":[859,863,875,867,871,879,858,862,874,866,870,878,857,861,873,865,869,877,856,860,872,864,868,876,794,773,1162,838,823,828,843,818,833,841,826,831,846,821,836,840,825,830,845,820,835,839,824,829,844,819,834,842,827,832,847,822,837,801,1192,1188,798,983,1268,931,771,772,1093],"minecraft:enchantable/equippable":[859,863,875,867,871,879,858,862,874,866,870,878,857,861,873,865,869,877,856,860,872,864,868,876,794,773,1105,1107,1106,1103,1104,1108,1109,323],"minecraft:enchantable/fire_aspect":[838,823,828,843,818,833,1093],"minecraft:enchantable/fishing":[931],"minecraft:enchantable/foot_armor":[859,863,875,867,871,879],"minecraft:enchantable/head_armor":[856,860,872,864,868,876,794],"minecraft:enchantable/leg_armor":[858,862,874,866,870,878],"minecraft:enchantable/mace":[1093],"minecraft:enchantable/mining":[841,826,831,846,821,836,840,825,830,845,820,835,839,824,829,844,819,834,842,827,832,847,822,837,983],"minecraft:enchantable/mining_loot":[841,826,831,846,821,836,840,825,830,845,820,835,839,824,829,844,819,834,842,827,832,847,822,837],"minecraft:enchantable/sharp_weapon":[838,823,828,843,818,833,841,826,831,846,821,836],"minecraft:enchantable/sword":[838,823,828,843,818,833],"minecraft:enchantable/trident":[1188],"minecraft:enchantable/vanishing":[859,863,875,867,871,879,858,862,874,866,870,878,857,861,873,865,869,877,856,860,872,864,868,876,794,773,1162,838,823,828,843,818,833,841,826,831,846,821,836,840,825,830,845,820,835,839,824,829,844,819,834,842,827,832,847,822,837,801,1192,1188,798,983,1268,931,771,772,1093,928,323,1105,1107,1106,1103,1104,1108,1109],"minecraft:enchantable/weapon":[838,823,828,843,818,833,841,826,831,846,821,836,1093],"minecraft:fence_gates":[754,752,756,753,750,751,759,760,757,758,755],"minecraft:fences":[311,315,317,312,313,314,320,321,318,319,316,369],"minecraft:fishes":[935,939,936,940,938,937],"minecraft:flowers":[218,219,220,221,222,223,224,225,226,227,228,229,230,231,465,466,468,467,232,185,198,55,181,246,294,233],"minecraft:foot_armor":[859,863,875,867,871,879],"minecraft:fox_food":[1216,1217],"minecraft:freeze_immune_wearables":[859,858,857,856,1127],"minecraft:frog_food":[926],"minecraft:goat_food":[854],"minecraft:gold_ores":[68,78,69],"minecraft:hanging_signs":[897,898,899,901,902,900,903,906,907,904,905],"minecraft:head_armor":[856,860,872,864,868,876,794],"minecraft:hoes":[842,827,832,847,822,837],"minecraft:hoglin_food":[236],"minecraft:horse_food":[854,962,445,800,1102,884,885],"minecraft:horse_tempt_items":[1102,884,885],"minecraft:ignored_by_piglin_babies":[913],"minecraft:iron_ores":[64,65],"minecraft:jungle_logs":[135,169,148,158],"minecraft:lapis_ores":[74,75],"minecraft:leaves":[179,176,177,182,180,178,184,185,183,181],"minecraft:lectern_books":[1092,1091],"minecraft:leg_armor":[858,862,874,866,870,878],"minecraft:llama_food":[854,445],"minecraft:llama_tempt_items":[445],"minecraft:logs":[138,172,151,161,132,166,145,155,136,170,149,159,134,168,147,157,135,169,148,158,133,167,146,156,139,173,152,162,137,171,150,160,142,153,174,163,143,154,175,164],"minecraft:logs_that_burn":[138,172,151,161,132,166,145,155,136,170,149,159,134,168,147,157,135,169,148,158,133,167,146,156,139,173,152,162,137,171,150,160],"minecraft:mangrove_logs":[139,173,152,162],"minecraft:meat":[988,990,989,991,1132,882,1119,1131,881,1118,992],"minecraft:non_flammable_wood":[143,154,175,164,142,153,174,163,45,46,262,263,708,709,320,321,740,741,759,760,393,394,693,694,720,721,895,896,907,906],"minecraft:noteblock_top_instruments":[1106,1103,1107,1108,1104,1109,1105],"minecraft:oak_logs":[132,166,145,155],"minecraft:ocelot_food":[935,936],"minecraft:panda_food":[251],"minecraft:parrot_food":[853,987,986,1155,1152,1153],"minecraft:parrot_poisonous_food":[980],"minecraft:pickaxes":[840,825,830,845,820,835],"minecraft:pig_food":[1097,1098,1154],"minecraft:piglin_food":[881,882],"minecraft:piglin_loved":[68,78,69,90,1231,697,815,1213,932,1102,1007,884,885,872,873,874,875,1125,828,830,829,831,832,814,84],"minecraft:piglin_repellents":[331,1215,1219],"minecraft:planks":[36,37,38,39,40,42,45,46,43,44,41],"minecraft:rabbit_food":[1097,1102,218],"minecraft:rails":[763,761,762,764],"minecraft:redstone_ores":[70,71],"minecraft:sand":[57,60,58],"minecraft:saplings":[48,49,50,51,52,54,197,198,55,53],"minecraft:sheep_food":[854],"minecraft:shovels":[839,824,829,844,819,834],"minecraft:signs":[886,887,888,890,889,892,895,896,893,894,891],"minecraft:skulls":[1105,1107,1106,1103,1104,1108,1109],"minecraft:slabs":[252,253,254,255,256,258,262,263,259,260,257,261,264,265,271,266,277,274,275,270,269,273,268,278,279,280,639,640,641,642,643,644,645,646,647,648,649,650,651,267,276,1229,1237,1233,652,653,655,654,130,129,128,111,110,109,108,131,272,13,18,22],"minecraft:small_flowers":[218,219,220,221,222,223,224,225,226,227,228,229,230,231],"minecraft:smelts_to_glass":[57,60],"minecraft:sniffer_food":[1152],"minecraft:soul_fire_base_blocks":[326,327],"minecraft:spruce_logs":[133,167,146,156],"minecraft:stairs":[383,384,385,386,387,389,393,394,390,391,388,392,304,380,370,362,361,297,426,513,507,506,508,621,622,623,624,625,626,627,628,629,630,631,632,633,634,1230,1238,1234,635,636,638,637,107,106,105,104,126,125,124,127,363,14,19,23],"minecraft:stone_bricks":[340,341,342,343],"minecraft:stone_buttons":[682,683],"minecraft:stone_crafting_materials":[35,1228,9],"minecraft:stone_tool_materials":[35,1228,9],"minecraft:strider_food":[237],"minecraft:strider_tempt_items":[237,772],"minecraft:swords":[838,823,828,843,818,833],"minecraft:tall_flowers":[465,466,468,467,232],"minecraft:terracotta":[462,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442],"minecraft:trapdoors":[735,733,737,734,731,732,740,741,738,739,736,730,742,743,744,745,746,747,748,749],"minecraft:trim_materials":[811,813,815,807,806,805,816,657,808,809],"minecraft:trim_templates":[1274,1280,1272,1275,1271,1273,1279,1277,1270,1276,1278,1281,1282,1283,1284,1285,1286,1287],"minecraft:trimmable_armor":[859,863,875,867,871,879,858,862,874,866,870,878,857,861,873,865,869,877,856,860,872,864,868,876,794],"minecraft:turtle_food":[200],"minecraft:villager_plantable_seeds":[853,1098,1097,1155,1152,1153],"minecraft:walls":[397,398,399,400,401,402,403,404,406,407,408,409,410,411,412,414,413,415,416,418,417,405,15,20,24],"minecraft:warped_stems":[143,154,175,164],"minecraft:wart_blocks":[517,518],"minecraft:wolf_food":[988,990,989,991,1132,882,1119,1131,881,1118,992],"minecraft:wooden_buttons":[684,685,686,687,688,690,693,694,691,692,689],"minecraft:wooden_doors":[711,712,713,714,715,717,720,721,718,719,716],"minecraft:wooden_fences":[311,315,317,312,313,314,320,321,318,319,316],"minecraft:wooden_pressure_plates":[699,700,701,702,703,705,708,709,706,707,704],"minecraft:wooden_slabs":[252,253,254,255,256,258,262,263,259,260,257],"minecraft:wooden_stairs":[383,384,385,386,387,389,393,394,390,391,388],"minecraft:wooden_trapdoors":[735,733,737,734,731,732,740,741,738,739,736],"minecraft:wool":[202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217],"minecraft:wool_carpets":[446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461]},"minecraft:fluid":{"minecraft:lava":[4,3],"minecraft:water":[2,1]},"minecraft:entity_type":{"minecraft:aquatic":[111,5,50,29,20,83,86,110,24,101,48,104],"minecraft:arrows":[4,99],"minecraft:arthropod":[7,34,90,100,16],"minecraft:axolotl_always_hostiles":[27,50,29],"minecraft:axolotl_hunt_targets":[110,83,86,20,101,48,104],"minecraft:beehive_inhabitors":[7],"minecraft:can_breathe_under_water":[91,102,120,92,11,125,124,126,127,123,27,54,119,76,5,43,50,29,111,48,20,83,86,101,110,104,3],"minecraft:can_turn_in_boats":[12],"minecraft:deflects_projectiles":[12],"minecraft:dismounts_underwater":[14,19,25,53,65,71,77,85,100,103,108,125],"minecraft:fall_damage_immune":[57,96,88,0,6,7,8,15,19,45,76,67,72,75,119,12],"minecraft:freeze_hurts_extra_types":[103,8,67],"minecraft:freeze_immune_entity_types":[102,81,96,119],"minecraft:frog_food":[93,67],"minecraft:ignores_poison_and_regen":[91,102,120,92,11,125,124,126,127,123,27,54,119,76],"minecraft:illager":[35,55,80,114],"minecraft:illager_friends":[35,55,80,114],"minecraft:immune_to_infested":[90],"minecraft:immune_to_oozing":[93],"minecraft:impact_projectiles":[4,99,41,97,62,94,28,109,26,121,117,13],"minecraft:inverted_healing_and_harm":[91,102,120,92,11,125,124,126,127,123,27,54,119,76],"minecraft:no_anger_from_wind_charge":[12,91,11,102,124,54,100,16,93],"minecraft:non_controlling_rider":[93,67],"minecraft:not_scary_for_pufferfish":[111,50,29,20,83,86,110,24,101,48,104],"minecraft:powder_snow_walkable_mobs":[84,34,90,42],"minecraft:raiders":[35,80,85,114,55,118],"minecraft:redirectable_projectile":[62,117,13],"minecraft:sensitive_to_bane_of_arthropods":[7,34,90,100,16],"minecraft:sensitive_to_impaling":[111,5,50,29,20,83,86,110,24,101,48,104],"minecraft:sensitive_to_smite":[91,102,120,92,11,125,124,126,127,123,27,54,119,76],"minecraft:skeletons":[91,102,120,92,11],"minecraft:undead":[91,102,120,92,11,125,124,126,127,123,27,54,119,76],"minecraft:wither_friends":[91,102,120,92,11,125,124,126,127,123,27,54,119,76],"minecraft:zombies":[125,124,126,127,123,27,54]},"minecraft:worldgen/biome":{"minecraft:allows_surface_slime_spawns":["minecraft:swamp","minecraft:mangrove_swamp"],"minecraft:allows_tropical_fish_spawns_at_any_height":["minecraft:lush_caves"],"minecraft:has_closer_water_fog":["minecraft:swamp","minecraft:mangrove_swamp"],"minecraft:has_structure/ancient_city":["minecraft:deep_dark"],"minecraft:has_structure/bastion_remnant":["minecraft:crimson_forest","minecraft:nether_wastes","minecraft:soul_sand_valley","minecraft:warped_forest"],"minecraft:has_structure/buried_treasure":["minecraft:beach","minecraft:snowy_beach"],"minecraft:has_structure/desert_pyramid":["minecraft:desert"],"minecraft:has_structure/end_city":["minecraft:end_highlands","minecraft:end_midlands"],"minecraft:has_structure/igloo":["minecraft:snowy_taiga","minecraft:snowy_plains","minecraft:snowy_slopes"],"minecraft:has_structure/jungle_temple":["minecraft:bamboo_jungle","minecraft:jungle"],"minecraft:has_structure/mineshaft":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:river","minecraft:frozen_river","minecraft:beach","minecraft:snowy_beach","minecraft:meadow","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:snowy_slopes","minecraft:cherry_grove","minecraft:windswept_hills","minecraft:windswept_forest","minecraft:windswept_gravelly_hills","minecraft:taiga","minecraft:snowy_taiga","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga","minecraft:bamboo_jungle","minecraft:jungle","minecraft:sparse_jungle","minecraft:forest","minecraft:flower_forest","minecraft:birch_forest","minecraft:old_growth_birch_forest","minecraft:dark_forest","minecraft:grove","minecraft:stony_shore","minecraft:mushroom_fields","minecraft:ice_spikes","minecraft:windswept_savanna","minecraft:desert","minecraft:savanna","minecraft:snowy_plains","minecraft:plains","minecraft:sunflower_plains","minecraft:swamp","minecraft:mangrove_swamp","minecraft:savanna_plateau","minecraft:dripstone_caves","minecraft:lush_caves"],"minecraft:has_structure/mineshaft_mesa":["minecraft:badlands","minecraft:eroded_badlands","minecraft:wooded_badlands"],"minecraft:has_structure/nether_fortress":["minecraft:nether_wastes","minecraft:soul_sand_valley","minecraft:crimson_forest","minecraft:warped_forest","minecraft:basalt_deltas"],"minecraft:has_structure/nether_fossil":["minecraft:soul_sand_valley"],"minecraft:has_structure/ocean_monument":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean"],"minecraft:has_structure/ocean_ruin_cold":["minecraft:frozen_ocean","minecraft:cold_ocean","minecraft:ocean","minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean"],"minecraft:has_structure/ocean_ruin_warm":["minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:deep_lukewarm_ocean"],"minecraft:has_structure/pillager_outpost":["minecraft:desert","minecraft:plains","minecraft:savanna","minecraft:snowy_plains","minecraft:taiga","minecraft:meadow","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:snowy_slopes","minecraft:cherry_grove","minecraft:grove"],"minecraft:has_structure/ruined_portal_desert":["minecraft:desert"],"minecraft:has_structure/ruined_portal_jungle":["minecraft:bamboo_jungle","minecraft:jungle","minecraft:sparse_jungle"],"minecraft:has_structure/ruined_portal_mountain":["minecraft:badlands","minecraft:eroded_badlands","minecraft:wooded_badlands","minecraft:windswept_hills","minecraft:windswept_forest","minecraft:windswept_gravelly_hills","minecraft:savanna_plateau","minecraft:windswept_savanna","minecraft:stony_shore","minecraft:meadow","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:snowy_slopes","minecraft:cherry_grove"],"minecraft:has_structure/ruined_portal_nether":["minecraft:nether_wastes","minecraft:soul_sand_valley","minecraft:crimson_forest","minecraft:warped_forest","minecraft:basalt_deltas"],"minecraft:has_structure/ruined_portal_ocean":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean"],"minecraft:has_structure/ruined_portal_standard":["minecraft:beach","minecraft:snowy_beach","minecraft:river","minecraft:frozen_river","minecraft:taiga","minecraft:snowy_taiga","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga","minecraft:forest","minecraft:flower_forest","minecraft:birch_forest","minecraft:old_growth_birch_forest","minecraft:dark_forest","minecraft:grove","minecraft:mushroom_fields","minecraft:ice_spikes","minecraft:dripstone_caves","minecraft:lush_caves","minecraft:savanna","minecraft:snowy_plains","minecraft:plains","minecraft:sunflower_plains"],"minecraft:has_structure/ruined_portal_swamp":["minecraft:swamp","minecraft:mangrove_swamp"],"minecraft:has_structure/shipwreck":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean"],"minecraft:has_structure/shipwreck_beached":["minecraft:beach","minecraft:snowy_beach"],"minecraft:has_structure/stronghold":["minecraft:mushroom_fields","minecraft:deep_frozen_ocean","minecraft:frozen_ocean","minecraft:deep_cold_ocean","minecraft:cold_ocean","minecraft:deep_ocean","minecraft:ocean","minecraft:deep_lukewarm_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:stony_shore","minecraft:swamp","minecraft:mangrove_swamp","minecraft:snowy_slopes","minecraft:snowy_plains","minecraft:snowy_beach","minecraft:windswept_gravelly_hills","minecraft:grove","minecraft:windswept_hills","minecraft:snowy_taiga","minecraft:windswept_forest","minecraft:taiga","minecraft:plains","minecraft:meadow","minecraft:beach","minecraft:forest","minecraft:old_growth_spruce_taiga","minecraft:flower_forest","minecraft:birch_forest","minecraft:dark_forest","minecraft:savanna_plateau","minecraft:savanna","minecraft:jungle","minecraft:badlands","minecraft:desert","minecraft:wooded_badlands","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:frozen_river","minecraft:river","minecraft:ice_spikes","minecraft:old_growth_pine_taiga","minecraft:sunflower_plains","minecraft:old_growth_birch_forest","minecraft:sparse_jungle","minecraft:bamboo_jungle","minecraft:eroded_badlands","minecraft:windswept_savanna","minecraft:cherry_grove","minecraft:frozen_peaks","minecraft:dripstone_caves","minecraft:lush_caves","minecraft:deep_dark"],"minecraft:has_structure/swamp_hut":["minecraft:swamp"],"minecraft:has_structure/trail_ruins":["minecraft:taiga","minecraft:snowy_taiga","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga","minecraft:old_growth_birch_forest","minecraft:jungle"],"minecraft:has_structure/trial_chambers":["minecraft:mushroom_fields","minecraft:deep_frozen_ocean","minecraft:frozen_ocean","minecraft:deep_cold_ocean","minecraft:cold_ocean","minecraft:deep_ocean","minecraft:ocean","minecraft:deep_lukewarm_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:stony_shore","minecraft:swamp","minecraft:mangrove_swamp","minecraft:snowy_slopes","minecraft:snowy_plains","minecraft:snowy_beach","minecraft:windswept_gravelly_hills","minecraft:grove","minecraft:windswept_hills","minecraft:snowy_taiga","minecraft:windswept_forest","minecraft:taiga","minecraft:plains","minecraft:meadow","minecraft:beach","minecraft:forest","minecraft:old_growth_spruce_taiga","minecraft:flower_forest","minecraft:birch_forest","minecraft:dark_forest","minecraft:savanna_plateau","minecraft:savanna","minecraft:jungle","minecraft:badlands","minecraft:desert","minecraft:wooded_badlands","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:frozen_river","minecraft:river","minecraft:ice_spikes","minecraft:old_growth_pine_taiga","minecraft:sunflower_plains","minecraft:old_growth_birch_forest","minecraft:sparse_jungle","minecraft:bamboo_jungle","minecraft:eroded_badlands","minecraft:windswept_savanna","minecraft:cherry_grove","minecraft:frozen_peaks","minecraft:dripstone_caves","minecraft:lush_caves"],"minecraft:has_structure/village_desert":["minecraft:desert"],"minecraft:has_structure/village_plains":["minecraft:plains","minecraft:meadow"],"minecraft:has_structure/village_savanna":["minecraft:savanna"],"minecraft:has_structure/village_snowy":["minecraft:snowy_plains"],"minecraft:has_structure/village_taiga":["minecraft:taiga"],"minecraft:has_structure/woodland_mansion":["minecraft:dark_forest"],"minecraft:increased_fire_burnout":["minecraft:bamboo_jungle","minecraft:mushroom_fields","minecraft:mangrove_swamp","minecraft:snowy_slopes","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:swamp","minecraft:jungle"],"minecraft:is_badlands":["minecraft:badlands","minecraft:eroded_badlands","minecraft:wooded_badlands"],"minecraft:is_beach":["minecraft:beach","minecraft:snowy_beach"],"minecraft:is_deep_ocean":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean"],"minecraft:is_end":["minecraft:the_end","minecraft:end_highlands","minecraft:end_midlands","minecraft:small_end_islands","minecraft:end_barrens"],"minecraft:is_forest":["minecraft:forest","minecraft:flower_forest","minecraft:birch_forest","minecraft:old_growth_birch_forest","minecraft:dark_forest","minecraft:grove"],"minecraft:is_hill":["minecraft:windswept_hills","minecraft:windswept_forest","minecraft:windswept_gravelly_hills"],"minecraft:is_jungle":["minecraft:bamboo_jungle","minecraft:jungle","minecraft:sparse_jungle"],"minecraft:is_mountain":["minecraft:meadow","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:snowy_slopes","minecraft:cherry_grove"],"minecraft:is_nether":["minecraft:nether_wastes","minecraft:soul_sand_valley","minecraft:crimson_forest","minecraft:warped_forest","minecraft:basalt_deltas"],"minecraft:is_ocean":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean"],"minecraft:is_overworld":["minecraft:mushroom_fields","minecraft:deep_frozen_ocean","minecraft:frozen_ocean","minecraft:deep_cold_ocean","minecraft:cold_ocean","minecraft:deep_ocean","minecraft:ocean","minecraft:deep_lukewarm_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:stony_shore","minecraft:swamp","minecraft:mangrove_swamp","minecraft:snowy_slopes","minecraft:snowy_plains","minecraft:snowy_beach","minecraft:windswept_gravelly_hills","minecraft:grove","minecraft:windswept_hills","minecraft:snowy_taiga","minecraft:windswept_forest","minecraft:taiga","minecraft:plains","minecraft:meadow","minecraft:beach","minecraft:forest","minecraft:old_growth_spruce_taiga","minecraft:flower_forest","minecraft:birch_forest","minecraft:dark_forest","minecraft:savanna_plateau","minecraft:savanna","minecraft:jungle","minecraft:badlands","minecraft:desert","minecraft:wooded_badlands","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:frozen_river","minecraft:river","minecraft:ice_spikes","minecraft:old_growth_pine_taiga","minecraft:sunflower_plains","minecraft:old_growth_birch_forest","minecraft:sparse_jungle","minecraft:bamboo_jungle","minecraft:eroded_badlands","minecraft:windswept_savanna","minecraft:cherry_grove","minecraft:frozen_peaks","minecraft:dripstone_caves","minecraft:lush_caves","minecraft:deep_dark"],"minecraft:is_river":["minecraft:river","minecraft:frozen_river"],"minecraft:is_savanna":["minecraft:savanna","minecraft:savanna_plateau","minecraft:windswept_savanna"],"minecraft:is_taiga":["minecraft:taiga","minecraft:snowy_taiga","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga"],"minecraft:mineshaft_blocking":["minecraft:deep_dark"],"minecraft:more_frequent_drowned_spawns":["minecraft:river","minecraft:frozen_river"],"minecraft:plays_underwater_music":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:river","minecraft:frozen_river"],"minecraft:polar_bears_spawn_on_alternate_blocks":["minecraft:frozen_ocean","minecraft:deep_frozen_ocean"],"minecraft:produces_corals_from_bonemeal":["minecraft:warm_ocean"],"minecraft:reduce_water_ambient_spawns":["minecraft:river","minecraft:frozen_river"],"minecraft:required_ocean_monument_surrounding":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:river","minecraft:frozen_river"],"minecraft:snow_golem_melts":["minecraft:badlands","minecraft:basalt_deltas","minecraft:crimson_forest","minecraft:desert","minecraft:eroded_badlands","minecraft:nether_wastes","minecraft:savanna","minecraft:savanna_plateau","minecraft:soul_sand_valley","minecraft:warped_forest","minecraft:windswept_savanna","minecraft:wooded_badlands"],"minecraft:spawns_cold_variant_frogs":["minecraft:snowy_plains","minecraft:ice_spikes","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:snowy_slopes","minecraft:frozen_ocean","minecraft:deep_frozen_ocean","minecraft:grove","minecraft:deep_dark","minecraft:frozen_river","minecraft:snowy_taiga","minecraft:snowy_beach","minecraft:the_end","minecraft:end_highlands","minecraft:end_midlands","minecraft:small_end_islands","minecraft:end_barrens"],"minecraft:spawns_gold_rabbits":["minecraft:desert"],"minecraft:spawns_snow_foxes":["minecraft:snowy_plains","minecraft:ice_spikes","minecraft:frozen_ocean","minecraft:snowy_taiga","minecraft:frozen_river","minecraft:snowy_beach","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:snowy_slopes","minecraft:grove"],"minecraft:spawns_warm_variant_frogs":["minecraft:desert","minecraft:warm_ocean","minecraft:bamboo_jungle","minecraft:jungle","minecraft:sparse_jungle","minecraft:savanna","minecraft:savanna_plateau","minecraft:windswept_savanna","minecraft:nether_wastes","minecraft:soul_sand_valley","minecraft:crimson_forest","minecraft:warped_forest","minecraft:basalt_deltas","minecraft:badlands","minecraft:eroded_badlands","minecraft:wooded_badlands","minecraft:mangrove_swamp"],"minecraft:spawns_white_rabbits":["minecraft:snowy_plains","minecraft:ice_spikes","minecraft:frozen_ocean","minecraft:snowy_taiga","minecraft:frozen_river","minecraft:snowy_beach","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:snowy_slopes","minecraft:grove"],"minecraft:stronghold_biased_to":["minecraft:plains","minecraft:sunflower_plains","minecraft:snowy_plains","minecraft:ice_spikes","minecraft:desert","minecraft:forest","minecraft:flower_forest","minecraft:birch_forest","minecraft:dark_forest","minecraft:old_growth_birch_forest","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga","minecraft:taiga","minecraft:snowy_taiga","minecraft:savanna","minecraft:savanna_plateau","minecraft:windswept_hills","minecraft:windswept_gravelly_hills","minecraft:windswept_forest","minecraft:windswept_savanna","minecraft:jungle","minecraft:sparse_jungle","minecraft:bamboo_jungle","minecraft:badlands","minecraft:eroded_badlands","minecraft:wooded_badlands","minecraft:meadow","minecraft:grove","minecraft:snowy_slopes","minecraft:frozen_peaks","minecraft:jagged_peaks","minecraft:stony_peaks","minecraft:mushroom_fields","minecraft:dripstone_caves","minecraft:lush_caves"],"minecraft:water_on_map_outlines":["minecraft:deep_frozen_ocean","minecraft:deep_cold_ocean","minecraft:deep_ocean","minecraft:deep_lukewarm_ocean","minecraft:frozen_ocean","minecraft:ocean","minecraft:cold_ocean","minecraft:lukewarm_ocean","minecraft:warm_ocean","minecraft:river","minecraft:frozen_river","minecraft:swamp","minecraft:mangrove_swamp"],"minecraft:without_patrol_spawns":["minecraft:mushroom_fields"],"minecraft:without_wandering_trader_spawns":["minecraft:the_void"],"minecraft:without_zombie_sieges":["minecraft:mushroom_fields"]},"minecraft:enchantment":{"minecraft:curse":["minecraft:binding_curse","minecraft:vanishing_curse"],"minecraft:double_trade_price":["minecraft:binding_curse","minecraft:vanishing_curse","minecraft:swift_sneak","minecraft:soul_speed","minecraft:frost_walker","minecraft:mending","minecraft:wind_burst"],"minecraft:exclusive_set/armor":["minecraft:protection","minecraft:blast_protection","minecraft:fire_protection","minecraft:projectile_protection"],"minecraft:exclusive_set/boots":["minecraft:frost_walker","minecraft:depth_strider"],"minecraft:exclusive_set/bow":["minecraft:infinity","minecraft:mending"],"minecraft:exclusive_set/crossbow":["minecraft:multishot","minecraft:piercing"],"minecraft:exclusive_set/damage":["minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:impaling","minecraft:density","minecraft:breach"],"minecraft:exclusive_set/mining":["minecraft:fortune","minecraft:silk_touch"],"minecraft:exclusive_set/riptide":["minecraft:loyalty","minecraft:channeling"],"minecraft:in_enchanting_table":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach"],"minecraft:non_treasure":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach"],"minecraft:on_mob_spawn_equipment":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach"],"minecraft:on_random_loot":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach","minecraft:binding_curse","minecraft:vanishing_curse","minecraft:frost_walker","minecraft:mending"],"minecraft:on_traded_equipment":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach"],"minecraft:prevents_bee_spawns_when_mining":["minecraft:silk_touch"],"minecraft:prevents_decorated_pot_shattering":["minecraft:silk_touch"],"minecraft:prevents_ice_melting":["minecraft:silk_touch"],"minecraft:prevents_infested_spawns":["minecraft:silk_touch"],"minecraft:smelts_loot":["minecraft:fire_aspect"],"minecraft:tooltip_order":["minecraft:binding_curse","minecraft:vanishing_curse","minecraft:riptide","minecraft:channeling","minecraft:wind_burst","minecraft:frost_walker","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:impaling","minecraft:power","minecraft:density","minecraft:breach","minecraft:piercing","minecraft:sweeping_edge","minecraft:multishot","minecraft:fire_aspect","minecraft:flame","minecraft:knockback","minecraft:punch","minecraft:protection","minecraft:blast_protection","minecraft:fire_protection","minecraft:projectile_protection","minecraft:feather_falling","minecraft:fortune","minecraft:looting","minecraft:silk_touch","minecraft:luck_of_the_sea","minecraft:efficiency","minecraft:quick_charge","minecraft:lure","minecraft:respiration","minecraft:aqua_affinity","minecraft:soul_speed","minecraft:swift_sneak","minecraft:depth_strider","minecraft:thorns","minecraft:loyalty","minecraft:unbreaking","minecraft:infinity","minecraft:mending"],"minecraft:tradeable":["minecraft:protection","minecraft:fire_protection","minecraft:feather_falling","minecraft:blast_protection","minecraft:projectile_protection","minecraft:respiration","minecraft:aqua_affinity","minecraft:thorns","minecraft:depth_strider","minecraft:sharpness","minecraft:smite","minecraft:bane_of_arthropods","minecraft:knockback","minecraft:fire_aspect","minecraft:looting","minecraft:sweeping_edge","minecraft:efficiency","minecraft:silk_touch","minecraft:unbreaking","minecraft:fortune","minecraft:power","minecraft:punch","minecraft:flame","minecraft:infinity","minecraft:luck_of_the_sea","minecraft:lure","minecraft:loyalty","minecraft:impaling","minecraft:riptide","minecraft:channeling","minecraft:multishot","minecraft:quick_charge","minecraft:piercing","minecraft:density","minecraft:breach","minecraft:binding_curse","minecraft:vanishing_curse","minecraft:frost_walker","minecraft:mending"],"minecraft:treasure":["minecraft:binding_curse","minecraft:vanishing_curse","minecraft:swift_sneak","minecraft:soul_speed","minecraft:frost_walker","minecraft:mending","minecraft:wind_burst"]},"minecraft:damage_type":{"minecraft:always_hurts_ender_dragons":["minecraft:fireworks","minecraft:explosion","minecraft:player_explosion","minecraft:bad_respawn_point"],"minecraft:always_kills_armor_stands":["minecraft:arrow","minecraft:trident","minecraft:fireball","minecraft:wither_skull","minecraft:wind_charge"],"minecraft:always_most_significant_fall":["minecraft:out_of_world"],"minecraft:always_triggers_silverfish":["minecraft:magic"],"minecraft:avoids_guardian_thorns":["minecraft:magic","minecraft:thorns","minecraft:fireworks","minecraft:explosion","minecraft:player_explosion","minecraft:bad_respawn_point"],"minecraft:burn_from_stepping":["minecraft:campfire","minecraft:hot_floor"],"minecraft:burns_armor_stands":["minecraft:on_fire"],"minecraft:bypasses_armor":["minecraft:on_fire","minecraft:in_wall","minecraft:cramming","minecraft:drown","minecraft:fly_into_wall","minecraft:generic","minecraft:wither","minecraft:dragon_breath","minecraft:starve","minecraft:fall","minecraft:freeze","minecraft:stalagmite","minecraft:magic","minecraft:indirect_magic","minecraft:out_of_world","minecraft:generic_kill","minecraft:sonic_boom","minecraft:outside_border"],"minecraft:bypasses_effects":["minecraft:starve"],"minecraft:bypasses_enchantments":["minecraft:sonic_boom"],"minecraft:bypasses_invulnerability":["minecraft:out_of_world","minecraft:generic_kill"],"minecraft:bypasses_resistance":["minecraft:out_of_world","minecraft:generic_kill"],"minecraft:bypasses_shield":["minecraft:on_fire","minecraft:in_wall","minecraft:cramming","minecraft:drown","minecraft:fly_into_wall","minecraft:generic","minecraft:wither","minecraft:dragon_breath","minecraft:starve","minecraft:fall","minecraft:freeze","minecraft:stalagmite","minecraft:magic","minecraft:indirect_magic","minecraft:out_of_world","minecraft:generic_kill","minecraft:sonic_boom","minecraft:outside_border","minecraft:falling_anvil","minecraft:falling_stalactite"],"minecraft:bypasses_wolf_armor":["minecraft:out_of_world","minecraft:generic_kill","minecraft:cramming","minecraft:drown","minecraft:dry_out","minecraft:freeze","minecraft:in_wall","minecraft:indirect_magic","minecraft:magic","minecraft:outside_border","minecraft:starve","minecraft:thorns","minecraft:wither"],"minecraft:can_break_armor_stand":["minecraft:player_attack","minecraft:player_explosion"],"minecraft:damages_helmet":["minecraft:falling_anvil","minecraft:falling_block","minecraft:falling_stalactite"],"minecraft:ignites_armor_stands":["minecraft:in_fire","minecraft:campfire"],"minecraft:is_drowning":["minecraft:drown"],"minecraft:is_explosion":["minecraft:fireworks","minecraft:explosion","minecraft:player_explosion","minecraft:bad_respawn_point"],"minecraft:is_fall":["minecraft:fall","minecraft:stalagmite"],"minecraft:is_fire":["minecraft:in_fire","minecraft:campfire","minecraft:on_fire","minecraft:lava","minecraft:hot_floor","minecraft:unattributed_fireball","minecraft:fireball"],"minecraft:is_freezing":["minecraft:freeze"],"minecraft:is_lightning":["minecraft:lightning_bolt"],"minecraft:is_player_attack":["minecraft:player_attack"],"minecraft:is_projectile":["minecraft:arrow","minecraft:trident","minecraft:mob_projectile","minecraft:unattributed_fireball","minecraft:fireball","minecraft:wither_skull","minecraft:thrown","minecraft:wind_charge"],"minecraft:no_anger":["minecraft:mob_attack_no_aggro"],"minecraft:no_impact":["minecraft:drown"],"minecraft:no_knockback":["minecraft:explosion","minecraft:player_explosion","minecraft:bad_respawn_point","minecraft:in_fire","minecraft:lightning_bolt","minecraft:on_fire","minecraft:lava","minecraft:hot_floor","minecraft:in_wall","minecraft:cramming","minecraft:drown","minecraft:starve","minecraft:cactus","minecraft:fall","minecraft:fly_into_wall","minecraft:out_of_world","minecraft:generic","minecraft:magic","minecraft:wither","minecraft:dragon_breath","minecraft:dry_out","minecraft:sweet_berry_bush","minecraft:freeze","minecraft:stalagmite","minecraft:outside_border","minecraft:generic_kill","minecraft:campfire"],"minecraft:panic_causes":["minecraft:cactus","minecraft:freeze","minecraft:hot_floor","minecraft:in_fire","minecraft:lava","minecraft:lightning_bolt","minecraft:on_fire","minecraft:arrow","minecraft:dragon_breath","minecraft:explosion","minecraft:fireball","minecraft:fireworks","minecraft:indirect_magic","minecraft:magic","minecraft:mob_attack","minecraft:mob_projectile","minecraft:player_attack","minecraft:player_explosion","minecraft:sonic_boom","minecraft:sting","minecraft:thrown","minecraft:trident","minecraft:unattributed_fireball","minecraft:wind_charge","minecraft:wither","minecraft:wither_skull"],"minecraft:panic_environmental_causes":["minecraft:cactus","minecraft:freeze","minecraft:hot_floor","minecraft:in_fire","minecraft:lava","minecraft:lightning_bolt","minecraft:on_fire"],"minecraft:witch_resistant_to":["minecraft:magic","minecraft:indirect_magic","minecraft:sonic_boom","minecraft:thorns"],"minecraft:wither_immune_to":["minecraft:drown"]},"minecraft:banner_pattern":{"minecraft:no_item_required":["minecraft:square_bottom_left","minecraft:square_bottom_right","minecraft:square_top_left","minecraft:square_top_right","minecraft:stripe_bottom","minecraft:stripe_top","minecraft:stripe_left","minecraft:stripe_right","minecraft:stripe_center","minecraft:stripe_middle","minecraft:stripe_downright","minecraft:stripe_downleft","minecraft:small_stripes","minecraft:cross","minecraft:straight_cross","minecraft:triangle_bottom","minecraft:triangle_top","minecraft:triangles_bottom","minecraft:triangles_top","minecraft:diagonal_left","minecraft:diagonal_up_right","minecraft:diagonal_up_left","minecraft:diagonal_right","minecraft:circle","minecraft:rhombus","minecraft:half_vertical","minecraft:half_horizontal","minecraft:half_vertical_right","minecraft:half_horizontal_bottom","minecraft:border","minecraft:curly_border","minecraft:gradient","minecraft:gradient_up","minecraft:bricks"],"minecraft:pattern_item/creeper":["minecraft:creeper"],"minecraft:pattern_item/flow":["minecraft:flow"],"minecraft:pattern_item/flower":["minecraft:flower"],"minecraft:pattern_item/globe":["minecraft:globe"],"minecraft:pattern_item/guster":["minecraft:guster"],"minecraft:pattern_item/mojang":["minecraft:mojang"],"minecraft:pattern_item/piglin":["minecraft:piglin"],"minecraft:pattern_item/skull":["minecraft:skull"]},"minecraft:painting_variant":{"minecraft:placeable":["minecraft:kebab","minecraft:aztec","minecraft:alban","minecraft:aztec2","minecraft:bomb","minecraft:plant","minecraft:wasteland","minecraft:pool","minecraft:courbet","minecraft:sea","minecraft:sunset","minecraft:creebet","minecraft:wanderer","minecraft:graham","minecraft:match","minecraft:bust","minecraft:stage","minecraft:void","minecraft:skull_and_roses","minecraft:wither","minecraft:fighters","minecraft:pointer","minecraft:pigscene","minecraft:burning_skull","minecraft:skeleton","minecraft:donkey_kong","minecraft:baroque","minecraft:humble","minecraft:meditative","minecraft:prairie_ride","minecraft:unpacked","minecraft:backyard","minecraft:bouquet","minecraft:cavebird","minecraft:changing","minecraft:cotan","minecraft:endboss","minecraft:fern","minecraft:finding","minecraft:lowmist","minecraft:orb","minecraft:owlemons","minecraft:passage","minecraft:pond","minecraft:sunflowers","minecraft:tides"]}} diff --git a/protocol/gamedata.py b/protocol/gamedata.py new file mode 100644 index 0000000..3ea859c --- /dev/null +++ b/protocol/gamedata.py @@ -0,0 +1,219 @@ +# ============================================================ +# PyMC - 原版数据表加载器 (1.21.1 / 协议 767) +# ============================================================ + +""" +Lazy loaders for the vanilla data tables bundled in ``protocol/data``. + +The JSON files are generated by ``tools/gen_protocol_data.py`` from +PrismarineJS minecraft-data and misode/mcmeta. They provide the pieces a real +1.21.1 client expects from a real server and which cannot be hand-written +reliably: synchronised registries, tags, the item ID table, the brigadier +command tree and an en_us language subset used to render translatable +messages on the console. +""" + +from __future__ import annotations + +import json +import struct +import sys +from functools import lru_cache +from pathlib import Path +from typing import Any + +DATA_VERSION = 767 + + +def _data_dir_candidates() -> list[Path]: + here = Path(__file__).resolve().parent + return [ + here / "data", + Path(sys.argv[0]).resolve().parent / "protocol" / "data", + Path("protocol") / "data", + ] + + +@lru_cache(maxsize=None) +def load_data(name: str) -> Any: + """Load ``protocol/data/`` (source tree, Nuitka bundle or CWD).""" + for directory in _data_dir_candidates(): + path = directory / name + if path.exists(): + with path.open("r", encoding="utf-8") as f: + return json.load(f) + raise FileNotFoundError( + f"Cannot find protocol data file {name!r}; " + f"searched {[str(d) for d in _data_dir_candidates()]}" + ) + + +# ------------------------------------------------------------------ +# Typed NBT JSON ({"type": ..., "value": ...}) -> binary NBT +# ------------------------------------------------------------------ + +_TAG_IDS = { + "end": 0, "byte": 1, "short": 2, "int": 3, "long": 4, "float": 5, + "double": 6, "byteArray": 7, "string": 8, "list": 9, "compound": 10, + "intArray": 11, "longArray": 12, +} + + +def _long_value(value) -> int: + # prismarine-nbt stores longs as [high, low] int pairs. + if isinstance(value, (list, tuple)): + high, low = value + value = ((high & 0xFFFFFFFF) << 32) | (low & 0xFFFFFFFF) + value &= 0xFFFFFFFFFFFFFFFF + return value - (1 << 64) if value >= (1 << 63) else value + + +def _nbt_string(text: str) -> bytes: + raw = text.encode("utf-8") + return struct.pack(">H", len(raw)) + raw + + +def _typed_payload(tag_type: str, value) -> bytes: + if tag_type == "byte": + return struct.pack(">b", ((int(value) + 128) & 0xFF) - 128) + if tag_type == "short": + return struct.pack(">h", int(value)) + if tag_type == "int": + return struct.pack(">i", int(value)) + if tag_type == "long": + return struct.pack(">q", _long_value(value)) + if tag_type == "float": + return struct.pack(">f", float(value)) + if tag_type == "double": + return struct.pack(">d", float(value)) + if tag_type == "string": + return _nbt_string(value) + if tag_type == "byteArray": + return struct.pack(">i", len(value)) + bytes((int(v) & 0xFF) for v in value) + if tag_type == "intArray": + return struct.pack(">i", len(value)) + b"".join(struct.pack(">i", int(v)) for v in value) + if tag_type == "longArray": + return struct.pack(">i", len(value)) + b"".join( + struct.pack(">q", _long_value(v)) for v in value) + if tag_type == "list": + inner_type = value["type"] + items = value["value"] + out = bytearray([_TAG_IDS[inner_type]]) + out += struct.pack(">i", len(items)) + for item in items: + out += _typed_payload(inner_type, item) + return bytes(out) + if tag_type == "compound": + out = bytearray() + for key, child in value.items(): + out.append(_TAG_IDS[child["type"]]) + out += _nbt_string(key) + out += _typed_payload(child["type"], child["value"]) + out.append(0) + return bytes(out) + raise ValueError(f"unsupported NBT tag type: {tag_type}") + + +def encode_typed_nbt(node: dict) -> bytes: + """Encode a typed-JSON NBT node as nameless network NBT.""" + return bytes([_TAG_IDS[node["type"]]]) + _typed_payload(node["type"], node["value"]) + + +# ------------------------------------------------------------------ +# Registries +# ------------------------------------------------------------------ + +def _biome_order(vanilla_names: list[str]) -> list[str]: + """Keep PyMC's saved biome indices stable; append the rest of vanilla.""" + try: + from world.biomes import BIOME_NAME_TO_ID + except Exception: # pragma: no cover - defensive + return vanilla_names + known = [n for n, _ in sorted(BIOME_NAME_TO_ID.items(), key=lambda kv: kv[1])] + ordered = [n for n in known if n in set(vanilla_names)] + if ordered != known: + # A PyMC biome is missing from vanilla data: indices would shift. + raise RuntimeError("world.biomes contains biomes unknown to 1.21.1") + extra = [n for n in vanilla_names if n not in set(known)] + return ordered + extra + + +@lru_cache(maxsize=None) +def synced_registries() -> dict[str, list[tuple[str, bytes]]]: + """ + Registries sent during configuration. + + Returns ``{registry_id: [(entry_id, nbt_bytes), ...]}``; list position is + the numeric ID the client assigns to the entry. + """ + raw = load_data("registries_767.json") + result: dict[str, list[tuple[str, bytes]]] = {} + for registry_id, entries in raw.items(): + names = list(entries.keys()) + if registry_id == "minecraft:worldgen/biome": + names = _biome_order(names) + result[registry_id] = [(name, encode_typed_nbt(entries[name])) for name in names] + return result + + +@lru_cache(maxsize=None) +def registry_index(registry_id: str) -> dict[str, int]: + """``{entry_id: numeric_id}`` for a synchronised registry.""" + return {name: i for i, (name, _) in enumerate(synced_registries()[registry_id])} + + +@lru_cache(maxsize=None) +def tags() -> dict[str, dict[str, list[int]]]: + """``{registry: {tag: [numeric ids]}}`` for the Update Tags packet.""" + raw = load_data("tags_767.json") + result: dict[str, dict[str, list[int]]] = {} + for registry_id, registry_tags in raw.items(): + sample = next((v for v in registry_tags.values() if v), []) + if sample and isinstance(sample[0], str): + index = registry_index(registry_id) + result[registry_id] = { + tag: [index[v] for v in values if v in index] + for tag, values in registry_tags.items() + } + else: + result[registry_id] = registry_tags + return result + + +# ------------------------------------------------------------------ +# Items / entity types +# ------------------------------------------------------------------ + +@lru_cache(maxsize=None) +def item_names() -> list[str]: + """Item identifiers (namespaced) indexed by protocol ID.""" + return ["minecraft:" + n for n in load_data("items_767.json")["names"]] + + +@lru_cache(maxsize=None) +def item_ids() -> dict[str, int]: + return {name: i for i, name in enumerate(item_names())} + + +@lru_cache(maxsize=None) +def item_stack_sizes() -> dict[str, int]: + return {"minecraft:" + k: v for k, v in load_data("items_767.json")["stack_sizes"].items()} + + +@lru_cache(maxsize=None) +def item_durability() -> dict[str, int]: + return {"minecraft:" + k: v for k, v in load_data("items_767.json")["durability"].items()} + + +@lru_cache(maxsize=None) +def entity_type_ids() -> dict[str, int]: + return {"minecraft:" + n: i for i, n in enumerate(load_data("entity_types_767.json"))} + + +@lru_cache(maxsize=None) +def language() -> dict[str, str]: + """en_us subset used to print translatable components on the console.""" + try: + return load_data("lang_en_us.json") + except FileNotFoundError: + return {} diff --git a/protocol/packet_map.py b/protocol/packet_map.py index b4d51a8..1b593e4 100755 --- a/protocol/packet_map.py +++ b/protocol/packet_map.py @@ -463,7 +463,7 @@ "block_action": 0x08, # block_event "chunk_batch_start": 0x0D, "chunk_batch_finished": 0x0C, - "set_chunk_cache_radius": 0x62, # simulation_distance (NOT 0x55!) + "set_chunk_cache_radius": 0x55, # Set Render Distance (update_view_distance) "sound_effect": 0x68, "system_chat": 0x6C, "player_abilities": 0x38, # abilities (NOT 0x3A!) @@ -563,6 +563,12 @@ "set_projectile_power": 0x79, "reset_score": 0x44, "chunk_biomes": 0x0E, + "collect": 0x6F, + "entity_update_attributes": 0x75, + "update_view_distance": 0x55, + "simulation_distance": 0x62, + "ping_response": 0x36, + "initialize_world_border": 0x25, }, # --- 1.21.4 (Protocol 770) --- @@ -785,25 +791,41 @@ "block_place": 0x35, "chunk_batch_received": None, }, + # --- 1.21.1 (Protocol 767) - NATIVE --- + # Verified against PrismarineJS minecraft-data 1.21.1/protocol.json + # (play.toServer). Keep in sync with tests/test_packet_ids.py. 767: { "confirm_teleportation": 0x00, - "chat_command": 0x05, - "signed_chat_command": 0x06, - "chat_message": 0x07, - "keep_alive": 0x1A, - "player_position": 0x1C, - "player_position_rotation": 0x1D, - "player_rotation": 0x1E, - "player_on_ground": 0x1F, - "block_dig": 0x26, - "held_item_slot": 0x31, - "block_place": 0x3A, - "chunk_batch_received": 0x09, - "click_container": 0x0C, - "close_container": 0x0D, - "interact": 0x14, - "set_creative_mode_slot": 0x22, - "use_item": 0x29, + "chat_command": 0x04, + "signed_chat_command": 0x05, + "chat_message": 0x06, + "chat_session_update": 0x07, + "chunk_batch_received": 0x08, + "client_command": 0x09, + "client_settings": 0x0A, + "tab_complete": 0x0B, + "configuration_acknowledged": 0x0C, + "click_container": 0x0E, + "close_container": 0x0F, + "custom_payload": 0x12, + "interact": 0x16, + "keep_alive": 0x18, + "player_position": 0x1A, + "player_position_rotation": 0x1B, + "player_rotation": 0x1C, + "player_on_ground": 0x1D, + "pick_item": 0x20, + "ping_request": 0x21, + "player_abilities": 0x23, + "block_dig": 0x24, + "entity_action": 0x25, + "pong": 0x27, + "held_item_slot": 0x2F, + "set_creative_mode_slot": 0x32, + "update_sign": 0x35, + "arm_animation": 0x36, + "block_place": 0x38, + "use_item": 0x39, }, 770: { "confirm_teleportation": 0x00, diff --git a/protocol/text.py b/protocol/text.py new file mode 100644 index 0000000..b1424cc --- /dev/null +++ b/protocol/text.py @@ -0,0 +1,186 @@ +# ============================================================ +# PyMC - 文本组件 (Text Component) +# ============================================================ + +""" +Text component helpers. + +Every chat-like payload in the protocol carries a *text component*: + + * 1.20.3+ (protocol >= 765): nameless network NBT + * older versions: a JSON string + +Callers may pass a plain string, a component dict, a list of components or a +JSON string describing a component; ``encode_component`` picks the right wire +format for the connection. ``plain_text`` renders a component for the server +console using the bundled en_us table, the way the vanilla server logs +``Steve joined the game`` for ``multiplayer.player.joined``. +""" + +from __future__ import annotations + +import json +import re +from typing import Any + +from protocol.data_types import write_string +from protocol.nbt import NbtByte, encode_nbt + +NBT_TEXT_PROTOCOL = 765 # 1.20.3: text components became NBT on the wire + +_COMPONENT_KEYS = ("text", "translate", "selector", "score", "keybind", "nbt") +_LEGACY_PREFIX = "[PyMC] " +_FORMAT_CODE_RE = re.compile("§[0-9a-fk-orA-FK-OR]") +_BOOL_STYLE_KEYS = ("bold", "italic", "underlined", "strikethrough", "obfuscated", "interpret") + + +def to_component(message: Any) -> dict: + """Normalise anything message-like into a text component dict.""" + if isinstance(message, dict): + return message + if isinstance(message, (list, tuple)): + parts = [to_component(part) for part in message] + if not parts: + return {"text": ""} + if len(parts) == 1: + return parts[0] + return {"text": "", "extra": parts} + text = "" if message is None else str(message) + stripped = text.lstrip() + if stripped.startswith("{") and stripped.endswith("}"): + try: + parsed = json.loads(stripped) + except ValueError: + parsed = None + if isinstance(parsed, dict) and any(key in parsed for key in _COMPONENT_KEYS): + return parsed + if text.startswith(_LEGACY_PREFIX): + text = text[len(_LEGACY_PREFIX):] + return {"text": text} + + +def translate(key: str, *args: Any, **style: Any) -> dict: + """Build a translatable component: ``translate("chat.type.text", name, msg)``.""" + component: dict = {"translate": key} + if args: + component["with"] = [ + arg if isinstance(arg, dict) else {"text": str(arg)} for arg in args + ] + component.update(style) + return component + + +def text(value: str, **style: Any) -> dict: + component = {"text": str(value)} + component.update(style) + return component + + +def player_name(conn) -> dict: + """Vanilla-style clickable/hoverable player name.""" + name = getattr(conn, "username", "") or "?" + component: dict = { + "text": name, + "insertion": name, + "clickEvent": {"action": "suggest_command", "value": f"/tell {name} "}, + } + uuid = getattr(conn, "uuid", None) + if uuid is not None: + component["hoverEvent"] = { + "action": "show_entity", + "contents": { + "type": "minecraft:player", + "id": str(uuid), + "name": {"text": name}, + }, + } + return component + + +# ------------------------------------------------------------------ +# Wire encoding +# ------------------------------------------------------------------ + +def _nbt_ready(value: Any, in_list: bool = False) -> Any: + """Make a component tree encodable as NBT (homogeneous lists, byte bools).""" + if isinstance(value, bool): + return {"text": "true" if value else "false"} if in_list else NbtByte(1 if value else 0) + if isinstance(value, dict): + return {str(k): _nbt_ready(v) for k, v in value.items() if v is not None} + if isinstance(value, (list, tuple)): + return [_nbt_ready(v, in_list=True) for v in value] + if in_list and not isinstance(value, dict): + return {"text": str(value)} + if isinstance(value, float): + return value + return value + + +def component_to_nbt(message: Any) -> bytes: + component = to_component(message) + if set(component.keys()) == {"text"} and isinstance(component["text"], str): + # A bare string tag is a valid (and the smallest) text component. + return encode_nbt(component["text"], with_type=True) + return encode_nbt(_nbt_ready(component), with_type=True) + + +def component_to_json(message: Any) -> str: + return json.dumps(to_component(message), ensure_ascii=False, separators=(",", ":")) + + +def encode_component(message: Any, protocol_version: int) -> bytes: + """Encode a text component for the given protocol version.""" + if protocol_version >= NBT_TEXT_PROTOCOL: + return component_to_nbt(message) + return write_string(component_to_json(message)) + + +# ------------------------------------------------------------------ +# Console rendering +# ------------------------------------------------------------------ + +_ARG_RE = re.compile(r"%(?:(\d+)\$)?([s%d])") + + +def _format_translation(template: str, args: list[str]) -> str: + counter = 0 + + def repl(match: re.Match) -> str: + nonlocal counter + if match.group(2) == "%": + return "%" + if match.group(1): + index = int(match.group(1)) - 1 + else: + index = counter + counter += 1 + return args[index] if 0 <= index < len(args) else "" + + return _ARG_RE.sub(repl, template) + + +def plain_text(message: Any, strip_formatting: bool = True) -> str: + """Render a component as plain text (en_us) for logs and RCON.""" + component = to_component(message) + out = [] + + if "text" in component: + out.append(str(component.get("text", ""))) + elif "translate" in component: + from protocol.gamedata import language + key = str(component["translate"]) + template = language().get(key, component.get("fallback", key)) + args = [plain_text(arg, strip_formatting) for arg in component.get("with", [])] + out.append(_format_translation(template, args)) + elif "selector" in component: + out.append(str(component["selector"])) + elif "keybind" in component: + out.append(str(component["keybind"])) + + for extra in component.get("extra", []) or []: + out.append(plain_text(extra, strip_formatting)) + + rendered = "".join(out) + if strip_formatting: + rendered = _FORMAT_CODE_RE.sub("", rendered) + return rendered diff --git a/requirements.txt b/requirements.txt index 20d3368..c6ef916 100755 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,6 @@ pytest>=7.0 # 打包/构建时可选: # nuitka # ordered-set + +# online-mode=true (协议加密) 需要: +# cryptography>=42 diff --git a/server.properties b/server.properties index 1d42964..c2da55a 100755 --- a/server.properties +++ b/server.properties @@ -1,57 +1,59 @@ -# ============================================================ -# PyMC 服务器配置文件 -# Minecraft 1.21.1 服务端 -# ============================================================ - -server-ip=0.0.0.0 -server-port=25565 -motd=PyMC - Python Minecraft 1.21.1 服务器 -max-players=20 -online-mode=false -view-distance=4 -network-compression-threshold=256 -gamemode=survival +#Minecraft server properties +allow-flight=false +broadcast-console-to-ops=true +broadcast-rcon-to-ops=true +chunk-generation-multithreading=false +chunk-generation-workers=0 +debug=false difficulty=normal +enable-command-block=true +enable-rcon=false +enable-status=true +enforce-whitelist=false +fluid-flow-enabled=true +force-gamemode=false +gamemode=survival +hardcore=false +hide-online-players=false +join-immediate-radius=2 level-name=world -level-type=default level-seed=12345 -level-spawn-x=0 -level-spawn-y=100 -level-spawn-z=0 -spawn-protection=0 -enable-command-block=true -web-admin-enabled=true -web-admin-host=127.0.0.1 -web-admin-port=25568 -web-admin-allow-remote=false +level-type=default +log-ips=true +max-players=20 +max-protocol-version=770 +min-protocol-version=47 +mods-directory=mods +motd=PyMC - Python Minecraft 1.21.1 服务器 +network-compression-threshold=256 +network-movement-rate-hz=20 +network-packet-batching=true +online-mode=false +op-permission-level=4 permissions-file=permissions.json -chunk-generation-multithreading=false -chunk-generation-workers=0 -join-immediate-radius=2 -# Multi-version protocol support +player-idle-timeout=0 +plugins-directory=plugins +pvp=true +rcon.password= +rcon.port=25575 +redstone-enabled=true +server-ip=0.0.0.0 +server-port=25565 +simulation-distance=10 +spawn-animals=true +spawn-monsters=true +spawn-protection=0 support-protocol-versions=all -min-protocol-version=47 -max-protocol-version=770 - -# Watchdog dual-process mutual protection +tab-list-footer= +tab-list-header= +vanilla-terrain=true +view-distance=4 watchdog-enabled=false watchdog-health-port=25569 -watchdog-partner-pid=0 watchdog-max-missed-heartbeats=5 - -# Network optimization -network-packet-batching=true -network-movement-rate-hz=20 - -# Vanilla terrain generation -vanilla-terrain=true - -# Redstone -redstone-enabled=true - -# Fluids -fluid-flow-enabled=true - -# PYMC native Python mod and plugin directories -mods-directory=mods -plugins-directory=plugins +watchdog-partner-pid=0 +web-admin-allow-remote=false +web-admin-enabled=true +web-admin-host=127.0.0.1 +web-admin-port=25568 +white-list=false diff --git a/serverlog.py b/serverlog.py new file mode 100644 index 0000000..3491289 --- /dev/null +++ b/serverlog.py @@ -0,0 +1,91 @@ +# ============================================================ +# PyMC - 日志系统 (原版服务端格式) +# ============================================================ + +""" +Console and file logging in the vanilla dedicated-server layout: + + [12:34:56] [Server thread/INFO]: Done (3.142s)! For help, type "help" + + * console: stdout, INFO and above (DEBUG when ``debug=true``) + * file: ``logs/latest.log``; on startup the previous ``latest.log`` is + archived as ``logs/YYYY-MM-DD-N.log.gz`` exactly like vanilla. +""" + +from __future__ import annotations + +import gzip +import logging +import os +import shutil +import sys +import threading +import time +from pathlib import Path + +LOG_DIR = "logs" +LATEST_LOG = "latest.log" + +_LEVEL_NAMES = {"WARNING": "WARN", "CRITICAL": "FATAL"} + + +class VanillaFormatter(logging.Formatter): + """``[HH:MM:SS] [thread/LEVEL]: message``""" + + def format(self, record: logging.LogRecord) -> str: + level = _LEVEL_NAMES.get(record.levelname, record.levelname) + stamp = time.strftime("%H:%M:%S", time.localtime(record.created)) + message = record.getMessage() + if record.exc_info: + message = f"{message}\n{self.formatException(record.exc_info)}" + return f"[{stamp}] [{record.threadName}/{level}]: {message}" + + +def archive_latest_log(log_dir: str | os.PathLike = LOG_DIR) -> Path | None: + """Compress an existing latest.log to ``-.log.gz``; returns the archive.""" + log_dir = Path(log_dir) + latest = log_dir / LATEST_LOG + if not latest.exists() or latest.stat().st_size == 0: + return None + date = time.strftime("%Y-%m-%d", time.localtime(latest.stat().st_mtime)) + index = 1 + while (log_dir / f"{date}-{index}.log.gz").exists(): + index += 1 + archive = log_dir / f"{date}-{index}.log.gz" + try: + with latest.open("rb") as src, gzip.open(archive, "wb") as dst: + shutil.copyfileobj(src, dst) + latest.unlink() + except OSError: + return None + return archive + + +def setup_logging(debug: bool = False, log_dir: str | os.PathLike = LOG_DIR) -> None: + """Install vanilla-style console + ``logs/latest.log`` handlers.""" + threading.main_thread().name = "Server thread" + + root = logging.getLogger() + for handler in list(root.handlers): + root.removeHandler(handler) + root.setLevel(logging.DEBUG if debug else logging.INFO) + + formatter = VanillaFormatter() + + console = logging.StreamHandler(sys.stdout) + console.setLevel(logging.DEBUG if debug else logging.INFO) + console.setFormatter(formatter) + root.addHandler(console) + + try: + Path(log_dir).mkdir(parents=True, exist_ok=True) + archive_latest_log(log_dir) + file_handler = logging.FileHandler(Path(log_dir) / LATEST_LOG, encoding="utf-8") + file_handler.setLevel(logging.DEBUG if debug else logging.INFO) + file_handler.setFormatter(formatter) + root.addHandler(file_handler) + except OSError as e: + root.warning(f"Could not open {log_dir}/{LATEST_LOG} for writing: {e}") + + # asyncio 的调试噪声不属于服务端日志 + logging.getLogger("asyncio").setLevel(logging.WARNING) diff --git a/tests/test_e2e_login.py b/tests/test_e2e_login.py new file mode 100644 index 0000000..6a05b75 --- /dev/null +++ b/tests/test_e2e_login.py @@ -0,0 +1,283 @@ +"""End-to-end test: a raw 1.21.1 client pings, logs in and chats over TCP.""" + +import asyncio +import json +import os +import tempfile +import unittest +import uuid +from pathlib import Path + +from protocol.data_types import ( + read_string, read_varint, write_string, write_uuid, write_varint, +) +from protocol.packet import pack_packet, read_packet_async + +REPO_ROOT = Path(__file__).resolve().parent.parent + + +def _native_terrain_available() -> bool: + from world._native_binary import is_runnable_native_binary + for name in ("terrain_gen", "terrain_gen.exe"): + path = REPO_ROOT / "native" / name + try: + if path.exists() and is_runnable_native_binary(path): + return True + except Exception: + pass + return False + + +class RawClient: + def __init__(self, reader, writer): + self.reader, self.writer = reader, writer + self.threshold = -1 + + @classmethod + async def connect(cls, port: int, next_state: int) -> "RawClient": + reader, writer = await asyncio.open_connection("127.0.0.1", port) + client = cls(reader, writer) + handshake = (write_varint(767) + write_string("127.0.0.1") + + (port).to_bytes(2, "big") + write_varint(next_state)) + await client.send(0x00, handshake) + return client + + async def send(self, packet_id: int, payload: bytes = b""): + self.writer.write(pack_packet(packet_id, payload, self.threshold)) + await self.writer.drain() + + async def read(self): + return await asyncio.wait_for(read_packet_async(self.reader, self.threshold), 20) + + def close(self): + self.writer.close() + + +@unittest.skipUnless(_native_terrain_available(), + "native terrain generator not built (run build.sh / cmake)") +class EndToEndLoginTests(unittest.IsolatedAsyncioTestCase): + async def asyncSetUp(self): + from commands import CommandManager, register_all_vanilla_commands + from config import DEFAULT_CONFIG + from network.server import MinecraftServer + + self.tmp = tempfile.TemporaryDirectory() + self.cwd = os.getcwd() + os.chdir(self.tmp.name) + config = dict(DEFAULT_CONFIG) + config.update({ + "server-ip": "127.0.0.1", "server-port": 0, "web-admin-enabled": False, + "level-seed": "12345", "view-distance": 2, "join-immediate-radius": 1, + "motd": "E2E", "plugins-directory": "no-plugins", "mods-directory": "no-mods", + "permissions-file": os.path.join(self.tmp.name, "permissions.json"), + }) + self.server = MinecraftServer(config, config_path=os.path.join(self.tmp.name, "server.properties")) + self.server.command_manager = CommandManager(self.server) + register_all_vanilla_commands(self.server.command_manager) + self.task = asyncio.create_task(self.server.start()) + await asyncio.wait_for(self.server.wait_until_ready(), 60) + self.port = self.server._server.sockets[0].getsockname()[1] + + async def asyncTearDown(self): + self.server.request_stop() + await asyncio.wait_for(self.task, 30) + await self.server.stop() + os.chdir(self.cwd) + self.tmp.cleanup() + + async def test_status_ping(self): + client = await RawClient.connect(self.port, 1) + await client.send(0x00) + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x00) + status = json.loads(read_string(payload, 0)[0]) + self.assertEqual(status["version"], {"name": "1.21.1", "protocol": 767}) + self.assertEqual(status["description"], {"text": "E2E"}) + self.assertEqual(status["players"]["online"], 0) + await client.send(0x01, (42).to_bytes(8, "big")) + packet_id, payload = await client.read() + self.assertEqual((packet_id, payload), (0x01, (42).to_bytes(8, "big"))) + client.close() + + async def test_login_join_chat_and_quit(self): + client = await RawClient.connect(self.port, 2) + await client.send(0x00, write_string("Tester") + write_uuid(uuid.uuid4())) + + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x03) # Set Compression + client.threshold = read_varint(payload, 0)[0] + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x02) # Login Success + self.assertEqual(read_string(payload, 16)[0], "Tester") + await client.send(0x03) # Login Acknowledged + + # --- configuration --- + seen = [] + while True: + packet_id, payload = await client.read() + seen.append(packet_id) + if packet_id == 0x03: # Finish Configuration + break + self.assertEqual(seen.count(0x07), 11) # all synchronised registries + self.assertIn(0x0D, seen) # Update Tags + self.assertIn(0x0C, seen) # Feature Flags + self.assertLess(seen.index(0x07), seen.index(0x0D)) + await client.send(0x03) # Acknowledge Finish Configuration + + # --- play --- + play_ids = [] + joined = False + for _ in range(400): + packet_id, payload = await client.read() + play_ids.append(packet_id) + if packet_id == 0x6C and b"multiplayer.player.joined" in payload: + joined = True + break + self.assertTrue(joined, f"no join message; got {sorted(set(play_ids))}") + self.assertEqual(play_ids[0], 0x2B) # Login (play) + for required in (0x11, 0x38, 0x0B, 0x27, 0x40, 0x56, 0x13, 0x3E): + self.assertIn(required, play_ids, hex(required)) + self.assertEqual(len(self.server.get_online_players()), 1) + + # chat is broadcast as message + chat = (write_string("hello") + bytes(16) + b"\x00" + write_varint(0) + bytes(3)) + await client.send(0x06, chat) + for _ in range(200): + packet_id, payload = await client.read() + if packet_id == 0x6C and b"chat.type.text" in payload: + self.assertIn(b"hello", payload) + break + else: + self.fail("chat message was not broadcast") + + # the world metadata files exist in vanilla layout + world = Path(self.tmp.name, "world") + self.assertTrue((world / "level.dat").exists()) + self.assertTrue((world / "session.lock").exists()) + self.assertTrue(Path(self.tmp.name, "usercache.json").exists()) + + client.close() + for _ in range(100): + if not self.server.get_online_players(): + break + await asyncio.sleep(0.05) + self.assertEqual(self.server.get_online_players(), []) + self.assertTrue(any(world.joinpath("playerdata").iterdir())) + + +def _cryptography_available() -> bool: + from network import encryption + return encryption.available() + + +@unittest.skipUnless(_native_terrain_available() and _cryptography_available(), + "needs the native terrain generator and the cryptography package") +class OnlineModeLoginTests(unittest.IsolatedAsyncioTestCase): + """online-mode=true against a local stand-in for the Mojang session server.""" + + PROFILE_ID = "069a79f444e94726a5befca90e38aaf5" + + async def asyncSetUp(self): + from commands import CommandManager, register_all_vanilla_commands + from config import DEFAULT_CONFIG + from network.server import MinecraftServer + + self.requests = [] + + async def session_server(reader, writer): + request_line = (await reader.readline()).decode() + while (await reader.readline()).strip(): + pass + self.requests.append(request_line) + body = json.dumps({ + "id": self.PROFILE_ID, "name": "Notch", + "properties": [{"name": "textures", "value": "dGV4", "signature": "c2ln"}], + }).encode() + writer.write(b"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n" + + f"Content-Length: {len(body)}\r\nConnection: close\r\n\r\n".encode() + body) + await writer.drain() + writer.close() + + self.session = await asyncio.start_server(session_server, "127.0.0.1", 0) + session_port = self.session.sockets[0].getsockname()[1] + self.old_env = os.environ.get("PYMC_SESSION_SERVER") + os.environ["PYMC_SESSION_SERVER"] = f"http://127.0.0.1:{session_port}/hasJoined" + + self.tmp = tempfile.TemporaryDirectory() + self.cwd = os.getcwd() + os.chdir(self.tmp.name) + config = dict(DEFAULT_CONFIG) + config.update({ + "server-ip": "127.0.0.1", "server-port": 0, "web-admin-enabled": False, + "online-mode": True, "level-seed": "1", "view-distance": 2, + "join-immediate-radius": 1, "plugins-directory": "no-plugins", + "mods-directory": "no-mods", + "permissions-file": os.path.join(self.tmp.name, "permissions.json"), + }) + self.server = MinecraftServer(config, config_path=os.path.join(self.tmp.name, "server.properties")) + self.server.command_manager = CommandManager(self.server) + register_all_vanilla_commands(self.server.command_manager) + self.task = asyncio.create_task(self.server.start()) + await asyncio.wait_for(self.server.wait_until_ready(), 60) + self.port = self.server._server.sockets[0].getsockname()[1] + + async def asyncTearDown(self): + self.server.request_stop() + await asyncio.wait_for(self.task, 30) + await self.server.stop() + self.session.close() + if self.old_env is None: + os.environ.pop("PYMC_SESSION_SERVER", None) + else: + os.environ["PYMC_SESSION_SERVER"] = self.old_env + os.chdir(self.cwd) + self.tmp.cleanup() + + async def test_encrypted_login_uses_session_profile(self): + from cryptography.hazmat.primitives import serialization + from cryptography.hazmat.primitives.asymmetric import padding + from network.encryption import DecryptingReader, StreamCipher, server_id_hash + + client = await RawClient.connect(self.port, 2) + await client.send(0x00, write_string("notch") + write_uuid(uuid.uuid4())) + + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x01) # Encryption Request + server_id, offset = read_string(payload, 0) + key_length, offset = read_varint(payload, offset) + public_der = payload[offset:offset + key_length] + offset += key_length + token_length, offset = read_varint(payload, offset) + token = payload[offset:offset + token_length] + self.assertEqual(server_id, "") + + public_key = serialization.load_der_public_key(public_der) + secret = os.urandom(16) + encrypted_secret = public_key.encrypt(secret, padding.PKCS1v15()) + encrypted_token = public_key.encrypt(token, padding.PKCS1v15()) + await client.send(0x01, write_varint(len(encrypted_secret)) + encrypted_secret + + write_varint(len(encrypted_token)) + encrypted_token) + + # everything from here on is AES/CFB8 encrypted in both directions + cipher = StreamCipher(secret) + client.reader = DecryptingReader(client.reader, cipher) + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x03) # Set Compression + client.threshold = read_varint(payload, 0)[0] + packet_id, payload = await client.read() + self.assertEqual(packet_id, 0x02) # Login Success + self.assertEqual(payload[:16], uuid.UUID(self.PROFILE_ID).bytes) + name, offset = read_string(payload, 16) + self.assertEqual(name, "Notch") # canonical name from the profile + property_count, offset = read_varint(payload, offset) + self.assertEqual(property_count, 1) + self.assertEqual(read_string(payload, offset)[0], "textures") + + expected_hash = server_id_hash("", secret, public_der) + self.assertIn(f"serverId={expected_hash}", self.requests[0]) + self.assertIn("username=notch", self.requests[0]) + client.close() + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_inventory_clicks.py b/tests/test_inventory_clicks.py index e5e79ae..a8fdcae 100755 --- a/tests/test_inventory_clicks.py +++ b/tests/test_inventory_clicks.py @@ -100,15 +100,17 @@ async def test_right_click_picks_up_rounded_half(self): self.assertEqual(conn.inventory_obj.get_slot(0).count, 2) self.assertEqual(conn.inventory_obj.carried_item.count, 3) - async def test_stale_click_does_not_mutate_inventory(self): + async def test_stale_click_is_applied_then_fully_resynced(self): + # Vanilla processes a click even when its state id is stale and then + # sends the full container state to correct the client. conn = self.make_connection() conn.inventory_obj.set_slot(0, ItemStack("minecraft:stone", 5)) await _handle_click_container(conn, click_payload(36, state_id=9), None) - self.assertEqual(conn.inventory_obj.get_slot(0).count, 5) - self.assertIsNone(conn.inventory_obj.carried_item) - self.assertEqual(len(conn.sent_packets), 1) + self.assertIsNone(conn.inventory_obj.get_slot(0)) + self.assertEqual(conn.inventory_obj.carried_item.count, 5) + self.assertEqual(conn.sent_packets[-1][0], 0x13) class ItemPickupTests(unittest.IsolatedAsyncioTestCase): diff --git a/tests/test_login_identity.py b/tests/test_login_identity.py index 94e347c..f52d913 100644 --- a/tests/test_login_identity.py +++ b/tests/test_login_identity.py @@ -19,13 +19,17 @@ def test_offline_uuid_matches_java_name_uuid_vectors(self): self.assertEqual(actual, uuid.UUID(expected)) -class OnlineModeTests(unittest.IsolatedAsyncioTestCase): - async def test_online_mode_fails_before_server_startup(self): - server = SimpleNamespace(online_mode=True, running=False) - with self.assertRaisesRegex(RuntimeError, "session authentication"): - await MinecraftServer.start(server) - self.assertFalse(server.running) +class OnlineModeTests(unittest.TestCase): + def test_server_hash_matches_known_vectors(self): + # Reference digests from the protocol documentation (signed hex SHA-1). + from network.encryption import server_id_hash + self.assertEqual(server_id_hash("Notch", b"", b""), + "4ed1f46bbe04bc756bcb17c0c7ce3e4632f06a48") + self.assertEqual(server_id_hash("jeb_", b"", b""), + "-7c9d5b0044c130109a5d7b5fb5c317c02b4e28c1") + self.assertEqual(server_id_hash("simon", b"", b""), + "88e16a1019277b15d58faf0541e11910eb756f6") if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() diff --git a/tests/test_native_worldgen.py b/tests/test_native_worldgen.py index 468f273..634db11 100755 --- a/tests/test_native_worldgen.py +++ b/tests/test_native_worldgen.py @@ -54,6 +54,42 @@ def test_batch_metadata_and_chunk_nbt_biome_roundtrip(self): _, decoded_biomes = decoded self.assertEqual(decoded_biomes, biomes) + def test_vanilla_terrain_layers_and_biomes(self): + from world.chunk_io import BLOCK_NAME_TO_DEFAULT_STATE, STATE_ID_TO_BLOCK + from world.terrain_native import native_binary_version + self.assertTrue(native_binary_version(_find_native_binary()).startswith("pymc-worldgen 2")) + gen = NativeTerrainGenerator(seed=12345, worker_count=2) + try: + coords = [(x * 8, z * 8) for x in range(-3, 4) for z in range(-3, 4)] + results = gen.generate_chunks_with_metadata(coords) + spawn = gen.find_spawn() + again = gen.find_spawn() + finally: + gen.shutdown() + + bedrock = BLOCK_NAME_TO_DEFAULT_STATE["minecraft:bedrock"] + names = set() + biomes = set() + for blocks, heightmap, chunk_biomes in results: + # Vanilla bedrock floor: y=-64 is always bedrock, y=-59 never is. + self.assertTrue(all(blocks[0][z][x] == bedrock for z in range(16) for x in range(16))) + self.assertFalse(any(blocks[5][z][x] == bedrock for z in range(16) for x in range(16))) + for y in (0, 40, 60, 62, 64, 80, 100): + for z in range(0, 16, 5): + for x in range(0, 16, 5): + names.add(STATE_ID_TO_BLOCK.get(blocks[y][z][x], ("?", {}))[0]) + for section in chunk_biomes: + biomes.update(section) + # deepslate below y=0, stone above, oceans at sea level, a varied biome map + self.assertIn("minecraft:deepslate", names) + self.assertIn("minecraft:stone", names) + self.assertIn("minecraft:water", names) + self.assertGreaterEqual(len(biomes), 6) + + self.assertIsNotNone(spawn) + self.assertEqual(spawn, again) + self.assertLessEqual(max(abs(spawn[0]), abs(spawn[1])), 2560) + if __name__ == "__main__": unittest.main() diff --git a/tests/test_play_dispatch.py b/tests/test_play_dispatch.py index c474b8c..9ea42b6 100644 --- a/tests/test_play_dispatch.py +++ b/tests/test_play_dispatch.py @@ -9,8 +9,10 @@ class PlayDispatchTests(unittest.TestCase): def test_native_packet_ids_are_used_for_native_protocol(self): conn = SimpleNamespace(protocol_version=767) - self.assertTrue(_is_serverbound_packet(conn, 0x1A, "keep_alive", 0x1A)) - self.assertTrue(_is_serverbound_packet(conn, 0x0C, "click_container", 0x0C)) + self.assertTrue(_is_serverbound_packet(conn, 0x18, "keep_alive", 0x18)) + self.assertTrue(_is_serverbound_packet(conn, 0x0E, "click_container", 0x0E)) + # 0x1A is Set Player Position in 1.21.1, never Keep Alive. + self.assertFalse(_is_serverbound_packet(conn, 0x1A, "keep_alive", 0x18)) def test_native_packet_ids_do_not_leak_into_old_protocols(self): conn = SimpleNamespace(protocol_version=47) diff --git a/tests/test_player_visibility.py b/tests/test_player_visibility.py index 03f4596..21b2c4a 100644 --- a/tests/test_player_visibility.py +++ b/tests/test_player_visibility.py @@ -75,19 +75,19 @@ def test_metadata_payload_shows_all_skin_parts(self): payload = build_player_metadata_payload(player) eid, offset = read_varint(payload, 0) self.assertEqual(eid, 42) - self.assertEqual(payload[offset], 17) # skin parts index - type_id, offset2 = read_varint(payload, offset + 1) - self.assertEqual(type_id, 0) # Byte - self.assertEqual(payload[offset2], 0x7F) # all layers - self.assertEqual(payload[offset2 + 1], 0xFF) + # index 0: entity flags (Byte), index 6: pose (type 21), index 17: skin parts + self.assertEqual(payload[offset:offset + 3], bytes([0, 0, 0])) + self.assertEqual(payload[offset + 3:offset + 6], bytes([6, 21, 0])) + self.assertEqual(payload[offset + 6:offset + 9], bytes([17, 0, 0x7F])) + self.assertEqual(payload[offset + 9], 0xFF) - def test_rotate_head_payload(self): + def test_sneaking_sets_flag_and_pose(self): player = FakeConn("Alex", 42) - player.yaw = 180.0 - payload = build_rotate_head_payload(player) - eid, offset = read_varint(payload, 0) - self.assertEqual(eid, 42) - self.assertEqual(payload[offset], 128) # 180° -> 180/360*256 = 128 + player.sneaking = True + payload = build_player_metadata_payload(player) + _, offset = read_varint(payload, 0) + self.assertEqual(payload[offset + 2], 0x02) # sneaking flag + self.assertEqual(payload[offset + 5], 5) # Pose.SNEAKING class SpawnSyncTests(unittest.IsolatedAsyncioTestCase): @@ -106,12 +106,20 @@ async def test_spawn_is_idempotent(self): await send_player_spawn(observer, player) self.assertEqual(len(observer.sent), 2) - async def test_spawn_skipped_for_versioned_clients(self): - observer = FakeConn("Steve", 1, version_handler=object()) + async def test_spawn_skipped_for_other_protocol_versions(self): + observer = FakeConn("Steve", 1) + observer.protocol_version = 47 player = FakeConn("Alex", 2) await send_player_spawn(observer, player) self.assertEqual(observer.sent, []) + async def test_spawn_sent_to_clients_with_version_handler(self): + # Real connections always carry a version handler after the handshake. + observer = FakeConn("Steve", 1, version_handler=object()) + player = FakeConn("Alex", 2) + await send_player_spawn(observer, player) + self.assertEqual(observer.sent[0][0], 0x01) + async def test_visibility_sync_is_bidirectional(self): a = FakeConn("Steve", 1) b = FakeConn("Alex", 2) diff --git a/tests/test_spawn_safety.py b/tests/test_spawn_safety.py index bc42556..c3e9ad7 100755 --- a/tests/test_spawn_safety.py +++ b/tests/test_spawn_safety.py @@ -1,7 +1,7 @@ import unittest from handlers.play import _is_safe_player_location, _resolve_spawn_location -from world.blocks import AIR, GRASS_BLOCK, STONE, WATER +from world.blocks import AIR, GRASS_BLOCK, LAVA, STONE, WATER def _empty_chunk(): @@ -67,14 +67,45 @@ def test_resolve_spawn_generates_missing_chunk(self): self.assertEqual(_resolve_spawn_location(server, 0, 0), (0, 65, 0)) self.assertIn((0, 0), server.world_storage.saved) - def test_resolve_spawn_moves_away_from_blocked_column(self): + def test_resolve_spawn_stands_on_top_of_the_column(self): + # Like vanilla, the player stands on the topmost full block. chunk = _empty_chunk() _set_block(chunk, 0, 64, 0, GRASS_BLOCK) _set_block(chunk, 0, 65, 0, STONE) _set_block(chunk, 1, 64, 0, GRASS_BLOCK) server = FakeServer(FakeStorage({(0, 0): chunk})) - self.assertEqual(_resolve_spawn_location(server, 0, 0), (1, 65, 0)) + self.assertEqual(_resolve_spawn_location(server, 0, 0), (0, 66, 0)) + + def test_resolve_spawn_skips_water_and_lava(self): + chunk = _empty_chunk() + for z in range(16): + for x in range(16): + _set_block(chunk, x, 50, z, STONE) + _set_block(chunk, x, 51, z, WATER) + _set_block(chunk, 5, 51, 0, STONE) # an island far enough from lava + _set_block(chunk, 1, 51, 0, LAVA) # lava pool top + _set_block(chunk, 2, 51, 0, STONE) # stone right next to the lava + server = FakeServer(FakeStorage({(0, 0): chunk})) + + self.assertEqual(_resolve_spawn_location(server, 0, 0), (5, 52, 0)) + + def test_new_players_spawn_within_spawn_radius_on_safe_ground(self): + from handlers.play.spawn import fudge_spawn_location + chunks = {} + for cx in (-1, 0): + for cz in (-1, 0): + chunk = _make_ground_chunk(64, GRASS_BLOCK) + chunks[(cx, cz)] = chunk + _set_block(chunks[(0, 0)], 0, 65, 0, LAVA) + server = FakeServer(FakeStorage(chunks)) + server.gamerules = {"spawnRadius": 3} + for _ in range(50): + x, y, z = fudge_spawn_location(server, (0, 65, 0)) + self.assertLessEqual(abs(x), 3) + self.assertLessEqual(abs(z), 3) + self.assertEqual(y, 65) + self.assertGreater(abs(x) + abs(z), 1) # never on or next to the lava def test_safe_location_requires_air_space_and_solid_ground(self): chunk = _make_ground_chunk(70, GRASS_BLOCK) diff --git a/tests/test_vanilla_server.py b/tests/test_vanilla_server.py new file mode 100644 index 0000000..ea3992a --- /dev/null +++ b/tests/test_vanilla_server.py @@ -0,0 +1,576 @@ +"""Tests for the vanilla-compatible server shell and 1.21.1 protocol data.""" + +import asyncio +import gzip +import json +import os +import struct +import tempfile +import unittest +import uuid +from pathlib import Path +from types import SimpleNamespace + +from protocol.data_types import read_string, read_varint, write_string, write_varint + + +class PacketIdTests(unittest.TestCase): + """IDs cross-checked with minecraft-data 1.21.1 protocol.json.""" + + def test_serverbound_play_ids(self): + from protocol.packet_map import get_serverbound_packet as sb + expected = { + "confirm_teleportation": 0x00, "chat_command": 0x04, "signed_chat_command": 0x05, + "chat_message": 0x06, "chunk_batch_received": 0x08, "client_command": 0x09, + "client_settings": 0x0A, "tab_complete": 0x0B, "click_container": 0x0E, + "close_container": 0x0F, "custom_payload": 0x12, "interact": 0x16, + "keep_alive": 0x18, "player_position": 0x1A, "player_position_rotation": 0x1B, + "player_rotation": 0x1C, "player_on_ground": 0x1D, "player_abilities": 0x23, + "block_dig": 0x24, "entity_action": 0x25, "held_item_slot": 0x2F, + "set_creative_mode_slot": 0x32, "arm_animation": 0x36, "block_place": 0x38, + "use_item": 0x39, + } + for name, packet_id in expected.items(): + self.assertEqual(sb(767, name), packet_id, name) + + def test_serverbound_ids_are_unique(self): + from protocol.packet_map import SERVERBOUND_PACKETS + ids = [v for v in SERVERBOUND_PACKETS[767].values() if v is not None] + self.assertEqual(len(ids), len(set(ids))) + + def test_clientbound_spot_checks(self): + from protocol.packet_map import get_clientbound_packet as cb + self.assertEqual(cb(767, "system_chat"), 0x6C) + self.assertEqual(cb(767, "declare_commands"), 0x11) + self.assertEqual(cb(767, "acknowledge_player_digging"), 0x05) + self.assertEqual(cb(767, "set_chunk_cache_radius"), 0x55) + self.assertEqual(cb(767, "damage_event"), 0x1A) + + +class TextComponentTests(unittest.TestCase): + def test_modern_clients_get_nbt(self): + from protocol.text import encode_component + data = encode_component({"translate": "chat.type.text", "with": ["Steve", "hi"]}, 767) + self.assertEqual(data[0], 10) # TAG_Compound, no root name + self.assertIn(b"chat.type.text", data) + self.assertNotIn(b"{", data[:2]) + + def test_plain_string_is_a_string_tag(self): + from protocol.text import encode_component + data = encode_component("hello", 767) + self.assertEqual(data, b"\x08\x00\x05hello") + + def test_legacy_clients_get_json(self): + from protocol.text import encode_component + text, offset = read_string(encode_component("hello", 47), 0) + self.assertEqual(json.loads(text), {"text": "hello"}) + + def test_json_strings_and_legacy_prefix(self): + from protocol.text import to_component + self.assertEqual(to_component('{"text":"x","color":"red"}'), {"text": "x", "color": "red"}) + self.assertEqual(to_component("[PyMC] saved"), {"text": "saved"}) + + def test_plain_text_renders_translations(self): + from protocol.text import plain_text, translate + self.assertEqual( + plain_text(translate("multiplayer.player.joined", "Steve", color="yellow")), + "Steve joined the game") + self.assertEqual( + plain_text(translate("chat.type.text", "Steve", "hi \u00a7cthere")), " hi there") + self.assertEqual( + plain_text(translate("commands.list.players", 1, 20, "Steve")), + "There are 1 of a max of 20 players online: Steve") + + +class ConfigTests(unittest.TestCase): + def test_vanilla_layout_and_roundtrip(self): + import config + with tempfile.TemporaryDirectory() as tmp: + path = os.path.join(tmp, "server.properties") + loaded = config.load_config(path) + lines = Path(path).read_text(encoding="utf-8").splitlines() + self.assertEqual(lines[0], "#Minecraft server properties") + keys = [line.split("=", 1)[0] for line in lines[2:]] + self.assertEqual(keys, sorted(keys)) + for key in ("motd", "white-list", "enable-rcon", "rcon.port", "pvp", + "spawn-protection", "max-players", "level-seed", "online-mode"): + self.assertIn(key, keys) + + loaded["motd"] = "A: b=c #1\nsecond \u4e2d\u6587" + loaded["custom-key"] = "kept" + config.save_config(loaded, path) + again = config.load_config(path) + self.assertEqual(again["motd"], "A: b=c #1\nsecond \u4e2d\u6587") + self.assertEqual(again["custom-key"], "kept") + self.assertIs(again["white-list"], False) + self.assertEqual(again["rcon.port"], 25575) + + def test_legacy_spawn_keys_are_read_but_not_written(self): + import config + with tempfile.TemporaryDirectory() as tmp: + path = os.path.join(tmp, "server.properties") + Path(path).write_text("level-spawn-x=12\nview-distance=6\n", encoding="utf-8") + loaded = config.load_config(path) + self.assertEqual(loaded["level-spawn-x"], 12) + self.assertEqual(loaded["view-distance"], 6) + self.assertNotIn("level-spawn-x", Path(path).read_text(encoding="utf-8")) + + +class PermissionFileTests(unittest.TestCase): + def test_vanilla_json_files(self): + from admin.permissions import PermissionManager, offline_uuid + with tempfile.TemporaryDirectory() as tmp: + manager = PermissionManager(os.path.join(tmp, "permissions.json")) + self.assertTrue(manager.op("Steve")) + self.assertFalse(manager.op("steve")) + manager.ban_player("Griefer", "being rude", source="Steve") + manager.ban_ip("10.0.0.9") + manager.add_whitelist("Alex") + + ops = json.loads(Path(tmp, "ops.json").read_text()) + self.assertEqual(ops, [{"uuid": str(offline_uuid("Steve")), "name": "Steve", + "level": 4, "bypassesPlayerLimit": False}]) + banned = json.loads(Path(tmp, "banned-players.json").read_text())[0] + self.assertEqual((banned["name"], banned["reason"], banned["source"], banned["expires"]), + ("Griefer", "being rude", "Steve", "forever")) + self.assertRegex(banned["created"], r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d \+0000$") + self.assertEqual(json.loads(Path(tmp, "banned-ips.json").read_text())[0]["ip"], "10.0.0.9") + self.assertEqual(json.loads(Path(tmp, "whitelist.json").read_text())[0]["name"], "Alex") + self.assertNotIn("ops", json.loads(Path(tmp, "permissions.json").read_text())) + + reloaded = PermissionManager(os.path.join(tmp, "permissions.json")) + self.assertEqual(reloaded.get_op_level("STEVE"), 4) + self.assertTrue(reloaded.is_banned("griefer")) + self.assertTrue(reloaded.is_whitelisted("alex")) + + def test_login_checks_use_vanilla_messages(self): + from admin.permissions import PermissionManager + from protocol.text import plain_text + with tempfile.TemporaryDirectory() as tmp: + manager = PermissionManager(os.path.join(tmp, "permissions.json")) + manager.ban_player("Griefer", "being rude") + self.assertEqual(plain_text(manager.check_login("griefer", "1.1.1.1")), + "You are banned from this server.\nReason: being rude") + manager.data["whitelist"]["enabled"] = True + self.assertEqual(plain_text(manager.check_login("Stranger", "1.1.1.1")), + "You are not white-listed on this server!") + manager.op("Admin") + self.assertIsNone(manager.check_login("Admin", "1.1.1.1")) + + def test_legacy_permissions_json_is_migrated(self): + from admin.permissions import PermissionManager + with tempfile.TemporaryDirectory() as tmp: + Path(tmp, "permissions.json").write_text(json.dumps({ + "ops": ["Old"], + "bans": {"players": {"bad": {"name": "Bad", "reason": "r"}}, "ips": {}}, + "whitelist": {"enabled": True, "players": ["W"]}, + })) + manager = PermissionManager(os.path.join(tmp, "permissions.json")) + self.assertTrue(manager.is_op("old")) + self.assertTrue(manager.is_banned("Bad")) + self.assertTrue(manager.data["whitelist"]["enabled"]) + self.assertTrue(Path(tmp, "ops.json").exists()) + + def test_usercache(self): + from admin.permissions import UserCache + with tempfile.TemporaryDirectory() as tmp: + cache = UserCache(os.path.join(tmp, "usercache.json")) + player_uuid = uuid.uuid4() + cache.record("Steve", player_uuid) + again = UserCache(os.path.join(tmp, "usercache.json")) + self.assertEqual(again.lookup("steve"), str(player_uuid)) + self.assertEqual(again.name_for("STEVE"), "Steve") + entry = json.loads(Path(tmp, "usercache.json").read_text())[0] + self.assertEqual(set(entry), {"name", "uuid", "expiresOn"}) + + +class LevelDataTests(unittest.TestCase): + def test_roundtrip_and_backup(self): + from world.level_data import LevelData + with tempfile.TemporaryDirectory() as tmp: + level = LevelData() + level.spawn = (1, 70, -3) + level.game_time = 123456789012 + level.day_time = 18000 + level.raining = True + level.rain_time = 500 + level.gamerules = {"keepInventory": "true"} + level.seed = -5 + level.difficulty = "hard" + level.save(tmp) + level.save(tmp) + self.assertTrue(Path(tmp, "level.dat_old").exists()) + with gzip.open(Path(tmp, "level.dat"), "rb") as f: + raw = f.read() + self.assertEqual(raw[:3], b"\x0a\x00\x00") # named (empty) root compound + + loaded = LevelData.load(tmp) + self.assertTrue(loaded.existed) + self.assertEqual(loaded.spawn, (1, 70, -3)) + self.assertEqual(loaded.game_time, 123456789012) + self.assertEqual(loaded.day_time, 18000) + self.assertTrue(loaded.raining) + self.assertEqual(loaded.gamerules, {"keepInventory": "true"}) + self.assertEqual(loaded.seed, -5) + self.assertEqual(loaded.difficulty, "hard") + + def test_session_lock_is_exclusive(self): + from world.level_data import SessionLock, SessionLockError + with tempfile.TemporaryDirectory() as tmp: + first = SessionLock(tmp) + first.acquire() + with self.assertRaises(SessionLockError): + SessionLock(tmp).acquire() + first.release() + second = SessionLock(tmp) + second.acquire() + second.release() + + def test_time_manager_tracks_days_and_weather(self): + from network.managers.time import TimeManager + from world.level_data import LevelData + manager = TimeManager(initial_time=0) + manager.day_time_total = 24000 * 3 + 500 + manager.age = 99 + manager.set_weather("thunder", 1000) + self.assertEqual(manager.time, 500) + self.assertEqual(manager.get_day_count(), 3) + level = LevelData() + manager.write_level_data(level) + self.assertTrue(level.raining and level.thundering) + restored = TimeManager(initial_time=0) + restored.apply_level_data(level) + self.assertEqual((restored.day_time_total, restored.age, restored.weather), + (24000 * 3 + 500, 99, "thunder")) + + +class RegistryDataTests(unittest.TestCase): + def test_all_synced_registries_present(self): + from protocol.gamedata import synced_registries + registries = synced_registries() + for name in ("minecraft:dimension_type", "minecraft:worldgen/biome", "minecraft:chat_type", + "minecraft:damage_type", "minecraft:painting_variant", "minecraft:wolf_variant", + "minecraft:trim_pattern", "minecraft:trim_material", + "minecraft:banner_pattern", "minecraft:enchantment", "minecraft:jukebox_song"): + self.assertIn(name, registries) + self.assertGreater(len(registries[name]), 0) + + def test_overworld_spans_minus_64_to_320(self): + from protocol.gamedata import synced_registries + from protocol.nbt import decode_nbt + entries = synced_registries()["minecraft:dimension_type"] + self.assertEqual(entries[0][0], "minecraft:overworld") # index 0 is used in Login + value, _ = decode_nbt(entries[0][1], 0, with_type=True, with_name=False) + self.assertEqual(value["min_y"], -64) + self.assertEqual(value["height"], 384) + + def test_biome_ids_match_world_storage(self): + from protocol.gamedata import registry_index + from world.biomes import BIOME_NAME_TO_ID + index = registry_index("minecraft:worldgen/biome") + for name, biome_id in BIOME_NAME_TO_ID.items(): + self.assertEqual(index[name], biome_id, name) + + def test_tags_payload(self): + from handlers.configuration import build_tags_payload + from protocol.gamedata import tags + all_tags = tags() + self.assertEqual(sorted(all_tags["minecraft:fluid"]["minecraft:water"]), [1, 2]) + self.assertIn("minecraft:mineable/pickaxe", all_tags["minecraft:block"]) + self.assertIn("minecraft:climbable", all_tags["minecraft:block"]) + + payload = build_tags_payload() + count, offset = read_varint(payload, 0) + self.assertEqual(count, len(all_tags)) + for _ in range(count): + _registry, offset = read_string(payload, offset) + tag_count, offset = read_varint(payload, offset) + for _ in range(tag_count): + _name, offset = read_string(payload, offset) + entries, offset = read_varint(payload, offset) + for _ in range(entries): + _, offset = read_varint(payload, offset) + self.assertEqual(offset, len(payload)) + + def test_item_table(self): + from world.inventory import item_name_to_protocol_id, protocol_id_to_item_name, ItemStack + self.assertEqual(item_name_to_protocol_id("minecraft:stone"), 1) + self.assertEqual(item_name_to_protocol_id("minecraft:grass_block"), 27) + self.assertEqual(protocol_id_to_item_name(item_name_to_protocol_id("minecraft:diamond_sword")), + "minecraft:diamond_sword") + self.assertEqual(ItemStack("minecraft:ender_pearl", 1).max_stack_size, 16) + self.assertEqual(ItemStack("minecraft:iron_pickaxe", 1).max_stack_size, 1) + self.assertEqual(ItemStack("minecraft:iron_ingot", 1).max_stack_size, 64) + self.assertEqual(ItemStack("minecraft:iron_pickaxe", 1).max_durability, 250) + + +def _decode_command_tree(payload: bytes): + """Minimal Commands packet decoder (enough to validate structure).""" + from protocol.gamedata import load_data + parsers = {v: k for k, v in load_data("commands_767.json")["parsers"].items()} + count, offset = read_varint(payload, 0) + nodes = [] + for _ in range(count): + flags = payload[offset] + offset += 1 + child_count, offset = read_varint(payload, offset) + children = [] + for _ in range(child_count): + child, offset = read_varint(payload, offset) + children.append(child) + node = {"flags": flags, "children": children} + if flags & 0x08: + node["redirect"], offset = read_varint(payload, offset) + kind = flags & 0x03 + if kind in (1, 2): + node["name"], offset = read_string(payload, offset) + if kind == 2: + parser_id, offset = read_varint(payload, offset) + parser = parsers[parser_id] + node["parser"] = parser + if parser in ("brigadier:float", "brigadier:double", "brigadier:integer", "brigadier:long"): + size = {"brigadier:float": 4, "brigadier:double": 8, + "brigadier:integer": 4, "brigadier:long": 8}[parser] + limits = payload[offset] + offset += 1 + size * bin(limits & 3).count("1") + elif parser == "brigadier:string": + _, offset = read_varint(payload, offset) + elif parser in ("minecraft:entity", "minecraft:score_holder"): + offset += 1 + elif parser == "minecraft:time": + offset += 4 + elif parser.startswith("minecraft:resource"): + if parser != "minecraft:resource_location": + _, offset = read_string(payload, offset) + if flags & 0x10: + node["suggestions"], offset = read_string(payload, offset) + nodes.append(node) + root, offset = read_varint(payload, offset) + return nodes, root, offset + + +class CommandTreeTests(unittest.TestCase): + def test_tree_is_well_formed(self): + from commands.brigadier import build_commands_payload + payload = build_commands_payload( + ["gamemode", "tp", "teleport", "execute", "give", "time", "msg", "tell", "w", "pymcext"]) + nodes, root, offset = _decode_command_tree(payload) + self.assertEqual(offset, len(payload)) + self.assertEqual(nodes[root]["flags"] & 0x03, 0) + top = {nodes[i]["name"]: nodes[i] for i in nodes[root]["children"]} + self.assertEqual(set(top), {"gamemode", "tp", "teleport", "execute", "give", "time", + "msg", "tell", "w", "pymcext"}) + # tp is an alias: it redirects to the teleport node + self.assertEqual(nodes[top["tp"]["redirect"]]["name"], "teleport") + # /gamemode [] + mode = nodes[top["gamemode"]["children"][0]] + self.assertEqual(mode["parser"], "minecraft:gamemode") + self.assertTrue(mode["flags"] & 0x04) + # non-vanilla commands get a greedy argument with server-side suggestions + extra = nodes[top["pymcext"]["children"][0]] + self.assertEqual((extra["parser"], extra["suggestions"]), + ("brigadier:string", "minecraft:ask_server")) + for node in nodes: + for child in node["children"]: + self.assertLess(child, len(nodes)) + + +class InventoryLayoutTests(unittest.TestCase): + def test_window_order_and_hotbar_first(self): + from world.inventory import ItemStack, PlayerInventory, player_window_slots + inventory = PlayerInventory() + self.assertEqual(inventory.add_item(ItemStack("minecraft:stone", 70)), 0) + self.assertEqual(inventory.get_slot(0).count, 64) # hotbar first, like vanilla + self.assertEqual(inventory.get_slot(1).count, 6) + inventory.set_slot(39, ItemStack("minecraft:iron_helmet", 1)) + inventory.set_slot(40, ItemStack("minecraft:shield", 1)) + window = player_window_slots(inventory) + self.assertEqual(len(window), 46) + self.assertEqual(window[36].count, 64) # hotbar slot 0 + self.assertEqual(window[5].item_id, "minecraft:iron_helmet") + self.assertEqual(window[45].item_id, "minecraft:shield") + self.assertIsNone(window[0]) + + def test_slot_encoding(self): + from world.inventory import ItemStack, decode_slot_entry, encode_slot_entry + self.assertEqual(encode_slot_entry(None), b"\x00") + pickaxe = ItemStack("minecraft:iron_pickaxe", 1, damage=12) + decoded, offset = decode_slot_entry(encode_slot_entry(pickaxe)) + self.assertEqual((decoded.item_id, decoded.count, decoded.damage), + ("minecraft:iron_pickaxe", 1, 12)) + self.assertEqual(offset, len(encode_slot_entry(pickaxe))) + + +class LightingTests(unittest.TestCase): + def setUp(self): + from world.chunk_io import BLOCK_NAME_TO_DEFAULT_STATE as states + self.states = states + self.blocks = [[[0] * 16 for _ in range(16)] for _ in range(64)] + stone = states["minecraft:stone"] + for y in range(11): + for z in range(16): + for x in range(16): + self.blocks[y][z][x] = stone + + def light(self): + from world.lighting import compute_light + sky, block = compute_light(self.blocks) + return (lambda x, y, z: sky[y * 256 + z * 16 + x], + lambda x, y, z: block[y * 256 + z * 16 + x]) + + def test_sky_light_passes_plants_and_filters_through_leaves(self): + self.blocks[11][0][0] = self.states["minecraft:short_grass"] + leaves = self.states["minecraft:oak_leaves"] + for z in range(4, 9): + for x in range(4, 9): + self.blocks[14][z][x] = leaves + sky, _ = self.light() + self.assertEqual(sky(2, 12, 2), 15) + self.assertEqual(sky(0, 11, 0), 15) # inside the grass tuft + self.assertEqual(sky(6, 14, 6), 14) # leaves filter one level + self.assertGreaterEqual(sky(6, 11, 6), 12) # shade under the canopy, not darkness + self.assertEqual(sky(3, 5, 3), 0) # solid stone + + def test_sky_light_spreads_under_overhangs(self): + stone = self.states["minecraft:stone"] + for z in range(16): + for x in range(10, 16): + self.blocks[13][z][x] = stone + sky, _ = self.light() + self.assertEqual(sky(10, 12, 5), 14) + self.assertEqual(sky(15, 12, 5), 9) + + def test_block_light_from_torch(self): + self.blocks[5][8][8] = self.states["minecraft:torch"] + self.blocks[5][8][9] = 0 + self.blocks[5][8][10] = 0 + _, block = self.light() + self.assertEqual([block(8, 5, 8), block(9, 5, 8), block(10, 5, 8)], [14, 13, 12]) + self.assertEqual(block(8, 6, 8), 0) + + def test_packet_layout(self): + from world.lighting import build_light_sections + sky_mask, block_mask, empty_sky, empty_block, sky_arrays, block_arrays = \ + build_light_sections(self.blocks) + sections = len(self.blocks) // 16 + 2 + self.assertEqual(sky_mask | empty_sky, (1 << sections) - 1) + self.assertEqual(sky_mask & empty_sky, 0) + self.assertEqual(len(sky_arrays), bin(sky_mask).count("1")) + self.assertEqual(len(block_arrays), bin(block_mask).count("1")) + self.assertTrue(all(len(a) == 2048 for a in sky_arrays)) + self.assertTrue(sky_mask & (1 << (sections - 1))) # section above the world + + +class StatusResponseTests(unittest.TestCase): + def make_server(self, **config): + players = [SimpleNamespace(username="Steve", uuid=uuid.uuid4(), allow_server_listing=True)] + return SimpleNamespace(config=config, motd="Hello", max_players=20, + get_online_players=lambda: players) + + def test_vanilla_fields(self): + from handlers.status import build_status_response + response = build_status_response(self.make_server(), 767) + self.assertEqual(response["version"], {"name": "1.21.1", "protocol": 767}) + self.assertEqual(response["description"], {"text": "Hello"}) + self.assertEqual(response["players"]["online"], 1) + self.assertEqual(response["players"]["sample"][0]["name"], "Steve") + self.assertIs(response["enforcesSecureChat"], False) + + def test_unsupported_client_sees_native_protocol(self): + from handlers.status import build_status_response + self.assertEqual(build_status_response(self.make_server(), 9999)["version"]["protocol"], 767) + + def test_hide_online_players(self): + from handlers.status import build_status_response + response = build_status_response(self.make_server(**{"hide-online-players": True}), 767) + self.assertNotIn("sample", response["players"]) + + +class EncryptionTests(unittest.TestCase): + def setUp(self): + from network import encryption + if not encryption.available(): + self.skipTest("cryptography is not installed") + + def test_rsa_and_stream_cipher(self): + from cryptography.hazmat.primitives import serialization + from cryptography.hazmat.primitives.asymmetric import padding + from network.encryption import ServerKeyPair, StreamCipher + pair = ServerKeyPair() + public = serialization.load_der_public_key(pair.public_der) + secret = os.urandom(16) + self.assertEqual(pair.decrypt(public.encrypt(secret, padding.PKCS1v15())), secret) + + server, client = StreamCipher(secret), StreamCipher(secret) + message = b"x" * 1000 + b"minecraft" + ciphertext = server.encrypt(message[:500]) + server.encrypt(message[500:]) + self.assertNotEqual(ciphertext, message) + self.assertEqual(client.decrypt(ciphertext[:7]) + client.decrypt(ciphertext[7:]), message) + + +class RconTests(unittest.IsolatedAsyncioTestCase): + async def test_login_and_command(self): + from commands import CommandManager + from commands.framework import Command, SUCCESS + from network.rcon import RconServer + + server = SimpleNamespace( + permissions=SimpleNamespace(has_permission=lambda *a: True, is_op=lambda n: False), + gamerules={}, config={}, get_online_players=lambda: [], java_plugin_bridge=None) + server.command_manager = CommandManager(server) + + async def _echo(ctx): + await ctx.reply({"translate": "commands.list.players", "with": ["0", "20", ""]}) + await ctx.reply("second line") + return SUCCESS + + command = Command(name="list") + command._execute_func = _echo + server.command_manager.register(command) + + rcon = RconServer(server, "127.0.0.1", 0, "s3cret") + await rcon.start() + port = rcon._listener.sockets[0].getsockname()[1] + reader, writer = await asyncio.open_connection("127.0.0.1", port) + + async def exchange(request_id, kind, body): + data = struct.pack(" Anvil migration, vanilla playerdata, block state order.""" + +import gzip +import shutil +import struct +import tempfile +import unittest +from pathlib import Path + +from world.chunk_io import ( + BLOCK_KEY_TO_STATE_ID, BLOCK_NAME_TO_DEFAULT_STATE, PYMC_STATE_ORDER_TAG, STATE_ID_TO_BLOCK, + _palette_entry_to_state_id, _state_id_to_palette_entry, _uses_legacy_state_order, + deserialize_chunk, serialize_chunk, +) +from world.level_data import _plain +from world.storage import HAS_ZSTD, WorldStorage, player_nbt_to_state, player_state_to_nbt + +STONE = BLOCK_NAME_TO_DEFAULT_STATE["minecraft:stone"] + + +def _empty_chunk(): + return [[[0] * 16 for _ in range(16)] for _ in range(384)] + + +def _state(name, **props): + for state_id, (block, values) in STATE_ID_TO_BLOCK.items(): + if block == name and all(values.get(k) == v for k, v in props.items()): + return state_id + raise KeyError(name) + + +class BlockStateOrderTests(unittest.TestCase): + def test_vanilla_state_ids_last_property_fastest(self): + # Vanilla: oak_stairs facing=north, half=top, shape=straight, waterlogged=true is the + # first state; waterlogged (the last property) varies fastest. + base = BLOCK_NAME_TO_DEFAULT_STATE["minecraft:oak_stairs"] + first = _state("minecraft:oak_stairs", facing="north", half="top", + shape="straight", waterlogged="true") + second = _state("minecraft:oak_stairs", facing="north", half="top", + shape="straight", waterlogged="false") + self.assertEqual(second, first + 1) + self.assertEqual(base, first + 11) # vanilla default: bottom, straight, not waterlogged + + def test_palette_entry_roundtrip_with_properties(self): + for name in ("minecraft:oak_stairs", "minecraft:redstone_wire", "minecraft:chest"): + state_id = BLOCK_NAME_TO_DEFAULT_STATE[name] + 3 + entry = _state_id_to_palette_entry(state_id) + self.assertEqual(_palette_entry_to_state_id(entry), state_id) + + def test_new_chunks_are_tagged_and_old_ones_detected(self): + blocks = _empty_chunk() + blocks[70][1][2] = _state("minecraft:oak_stairs", facing="east", half="bottom", + shape="straight", waterlogged="false") + raw = serialize_chunk(blocks, chunk_x=3, chunk_z=-2) + from protocol.nbt import decode_nbt + root, _ = decode_nbt(raw, 0, with_type=True, with_name=True) + self.assertIn(PYMC_STATE_ORDER_TAG, root) + self.assertFalse(_uses_legacy_state_order(root)) + self.assertTrue(_uses_legacy_state_order({"DataVersion": 3955, "LastUpdate": 0})) + self.assertEqual(deserialize_chunk(raw), blocks) + + +class AnvilStorageTests(unittest.TestCase): + def setUp(self): + self.dir = Path(tempfile.mkdtemp(prefix="pymc-world-")) + + def tearDown(self): + shutil.rmtree(self.dir, ignore_errors=True) + + def test_chunks_survive_reopen_as_mca(self): + storage = WorldStorage(str(self.dir), region_format="anvil") + storage.initialize() + blocks = _empty_chunk() + blocks[0][0][0] = STONE + blocks[200][15][15] = BLOCK_NAME_TO_DEFAULT_STATE["minecraft:gold_block"] + storage.save_generated_chunk(-33, 40, blocks) + storage.flush() + storage.close() + + self.assertTrue((self.dir / "region" / "r.-2.1.mca").exists()) + with open(self.dir / "region" / "r.-2.1.mca", "rb") as f: + header = f.read(8192) + self.assertEqual(len(header), 8192) + index = (-33 & 31) + (40 & 31) * 32 + offset = struct.unpack(">I", header[index * 4:index * 4 + 4])[0] >> 8 + self.assertGreaterEqual(offset, 2) + + reopened = WorldStorage(str(self.dir), region_format="anvil") + reopened.initialize() + self.assertEqual(reopened.load_generated_chunk(-33, 40), blocks) + self.assertIsNone(reopened.load_generated_chunk(0, 0)) + + def test_built_chunk_cache_invalidated_by_saves(self): + storage = WorldStorage(str(self.dir), region_format="anvil") + storage.initialize() + blocks = _empty_chunk() + storage.save_generated_chunk(1, 1, blocks) + storage.put_built_chunk(1, 1, [0], [0], b"data") + self.assertEqual(storage.get_built_chunk(1, 1), ([0], [0], b"data")) + blocks[100][0][0] = STONE + storage.save_generated_chunk(1, 1, blocks) + self.assertIsNone(storage.get_built_chunk(1, 1)) + lazy = storage.lazy_chunk_blocks(1, 1) + self.assertEqual(lazy[100][0][0], STONE) + self.assertEqual(len(lazy), 384) + + @unittest.skipUnless(HAS_ZSTD, "zstandard is not installed") + def test_linear_world_is_migrated_to_anvil(self): + linear = WorldStorage(str(self.dir), region_format="linear") + linear.initialize() + blocks = _empty_chunk() + blocks[64][4][4] = STONE + linear.save_generated_chunk(5, 6, blocks) + linear.flush() + linear.close() + self.assertTrue((self.dir / "region" / "r.0.0.linear").exists()) + + anvil = WorldStorage(str(self.dir), region_format="anvil") + anvil.initialize() + self.assertTrue((self.dir / "region" / "r.0.0.mca").exists()) + self.assertFalse((self.dir / "region" / "r.0.0.linear").exists()) + self.assertEqual(anvil.load_generated_chunk(5, 6), blocks) + + +class PlayerDataTests(unittest.TestCase): + STATE = { + "username": "Alice", "x": 12.5, "y": 70.0, "z": -3.25, "yaw": 90.0, "pitch": -10.0, + "health": 13.0, "food": 17, "saturation": 2.5, "experience_total": 55, + "experience_level": 5, "experience_progress": 0.25, "gamemode": "creative", + "on_ground": True, "air_supply": 300, "fire_ticks": 0, "freeze_ticks": 0, + "flying": False, "selected_slot": 2, + "inventory": { + "slots": { + "0": {"item": "minecraft:diamond_sword", "count": 1, "damage": 12, "nbt": {}}, + "8": {"item": "minecraft:stone", "count": 64, "damage": 0, "nbt": {}}, + "39": {"item": "minecraft:iron_helmet", "count": 1, "damage": 0, "nbt": {}}, + "40": {"item": "minecraft:shield", "count": 1, "damage": 0, "nbt": {"x": 1}}, + }, + "ender_chest": {"3": {"item": "minecraft:emerald", "count": 9, "damage": 0, "nbt": {}}}, + "selected_slot": 2, "held_slot": 0, + }, + "personal_spawn": [10, 64, 20], + } + + def test_nbt_uses_vanilla_slots(self): + root = _plain(player_state_to_nbt(self.STATE)) + slots = sorted(int(item["Slot"]) for item in root["Inventory"]) + self.assertEqual(slots, [-106, 0, 8, 103]) + self.assertEqual(root["playerGameType"], 1) + self.assertEqual((root["SpawnX"], root["SpawnY"], root["SpawnZ"]), (10, 64, 20)) + + def test_dat_file_roundtrip(self): + tmp = Path(tempfile.mkdtemp(prefix="pymc-player-")) + try: + storage = WorldStorage(str(tmp), region_format="anvil") + storage.initialize() + uuid = "11111111-2222-3333-4444-555555555555" + storage.save_player_data(uuid, self.STATE) + storage.save_player_data(uuid, self.STATE) + path = tmp / "playerdata" / f"{uuid}.dat" + self.assertTrue(path.exists()) + self.assertTrue((tmp / "playerdata" / f"{uuid}.dat_old").exists()) + with gzip.open(path, "rb") as f: + self.assertEqual(f.read(1), b"\x0a") # TAG_Compound root + loaded = storage.load_player_data(uuid) + self.assertEqual(loaded, player_nbt_to_state(_plain(player_state_to_nbt(self.STATE)))) + for key in ("x", "y", "z", "health", "food", "gamemode", "personal_spawn", "inventory"): + self.assertEqual(loaded[key], self.STATE[key], key) + finally: + shutil.rmtree(tmp, ignore_errors=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/gen_protocol_data.py b/tools/gen_protocol_data.py new file mode 100644 index 0000000..66db595 --- /dev/null +++ b/tools/gen_protocol_data.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python3 +"""Regenerate protocol/data/*.json for Minecraft Java 1.21.1 (protocol 767). + +Inputs (not vendored, fetch them first): + + * PrismarineJS minecraft-data (npm i minecraft-data) + data/pc/1.21.1/{loginPacket,items,language,protocol}.json + data/pc/1.20.5/entities.json + * misode/mcmeta, branch ``1.21.1-summary`` + commands/data.min.json + data/tag//data.min.json + +Usage: + python tools/gen_protocol_data.py + +```` holds the mcmeta files with ``/`` replaced by ``_`` +(e.g. ``data_tag_block_data.min.json``) or in their original layout. +""" + +import json +import sys +from pathlib import Path + +OUT = Path(__file__).resolve().parent.parent / "protocol" / "data" + +# Registries the vanilla server synchronises during configuration. +SYNCED_REGISTRIES = [ + "minecraft:worldgen/biome", "minecraft:chat_type", "minecraft:trim_pattern", + "minecraft:trim_material", "minecraft:wolf_variant", "minecraft:painting_variant", + "minecraft:dimension_type", "minecraft:damage_type", "minecraft:banner_pattern", + "minecraft:enchantment", "minecraft:jukebox_song", +] + +# Tag registries sent in Update Tags. Static registries are resolved to numeric +# protocol IDs here; data-driven ones keep names (IDs depend on send order). +STATIC_TAGS = ["block", "item", "fluid", "entity_type"] +DYNAMIC_TAGS = ["worldgen/biome", "enchantment", "damage_type", + "banner_pattern", "painting_variant"] + +FLUID_IDS = {"minecraft:empty": 0, "minecraft:flowing_water": 1, "minecraft:water": 2, + "minecraft:flowing_lava": 3, "minecraft:lava": 4} + +LANG_PREFIXES = ( + "multiplayer.", "death.", "commands.", "command.", "chat.", "gameMode.", + "argument.", "disconnect.", "entity.minecraft.", "gamerule.", + "options.difficulty.", "parsing.", "permissions.", "sleep.", "block.minecraft.bed", + "block.minecraft.spawn", "block.minecraft.set_spawn", "container.", "effect.minecraft.", + "enchantment.minecraft.", "advancements.", "chat_screen.", "connect.", +) + + +def dump(name: str, obj) -> None: + path = OUT / name + path.write_text(json.dumps(obj, ensure_ascii=False, separators=(",", ":"), sort_keys=False) + "\n", + encoding="utf-8") + print(f"wrote {path.name}: {path.stat().st_size // 1024} KiB") + + +def load_mcmeta(root: Path, rel: str): + for cand in (root / rel, root / rel.replace("/", "_")): + if cand.exists(): + return json.loads(cand.read_text(encoding="utf-8")) + raise FileNotFoundError(rel) + + +def flatten_tags(raw: dict) -> dict: + """Resolve '#tag' references; returns {tag: [entry, ...]} with namespaced ids.""" + def ns(v: str) -> str: + return v if ":" in v else "minecraft:" + v + + resolved: dict = {} + + def resolve(tag: str, stack=()): + if tag in resolved: + return resolved[tag] + out = [] + for value in raw[tag]["values"]: + if isinstance(value, dict): + value = value["id"] + if value.startswith("#"): + ref = value[1:].split(":", 1)[-1] + if ref in stack or ref not in raw: + continue + out.extend(resolve(ref, stack + (tag,))) + else: + out.append(ns(value)) + seen = set() + resolved[tag] = [v for v in out if not (v in seen or seen.add(v))] + return resolved[tag] + + for tag in raw: + resolve(tag) + return {"minecraft:" + k: v for k, v in sorted(resolved.items())} + + +def main(): + md = Path(sys.argv[1]) + mcmeta = Path(sys.argv[2]) + OUT.mkdir(parents=True, exist_ok=True) + + # --- registries --- + codec = json.loads((md / "1.21.1/loginPacket.json").read_text())["dimensionCodec"] + registries = {} + for reg in SYNCED_REGISTRIES: + registries[reg] = {e["key"]: e["value"] for e in codec[reg]["entries"]} + dump("registries_767.json", registries) + + # --- items / entity types --- + items = json.loads((md / "1.21.1/items.json").read_text()) + assert [i["id"] for i in items] == list(range(len(items))) + dump("items_767.json", { + "names": [i["name"] for i in items], + "stack_sizes": {i["name"]: i["stackSize"] for i in items if i["stackSize"] != 64}, + "durability": {i["name"]: i["maxDurability"] for i in items if i.get("maxDurability")}, + }) + item_ids = {"minecraft:" + i["name"]: i["id"] for i in items} + + entities = json.loads((md / "1.20.5/entities.json").read_text()) + assert [e["id"] for e in entities] == list(range(len(entities))) + dump("entity_types_767.json", [e["name"] for e in entities]) + entity_ids = {"minecraft:" + e["name"]: e["id"] for e in entities} + + blocks = json.loads((md / "1.21.1/blocks.json").read_text()) + block_ids = {"minecraft:" + b["name"]: b["id"] for b in blocks} + + # --- tags --- + id_maps = {"block": block_ids, "item": item_ids, "fluid": FLUID_IDS, "entity_type": entity_ids} + tags = {} + for reg in STATIC_TAGS: + flat = flatten_tags(load_mcmeta(mcmeta, f"data/tag/{reg}/data.min.json")) + tags["minecraft:" + reg] = {t: [id_maps[reg][v] for v in vals] for t, vals in flat.items()} + for reg in DYNAMIC_TAGS: + tags["minecraft:" + reg] = flatten_tags(load_mcmeta(mcmeta, f"data/tag/{reg}/data.min.json")) + dump("tags_767.json", tags) + + # --- commands --- + tree = load_mcmeta(mcmeta, "commands/data.min.json") + proto = json.loads((md / "1.21.1/protocol.json").read_text()) + parsers = None + + def find_parsers(node): + nonlocal parsers + if parsers is not None: + return + if isinstance(node, list): + if (len(node) == 2 and node[0] == "mapper" and isinstance(node[1], dict) + and "brigadier:bool" in node[1].get("mappings", {}).values()): + parsers = {v: int(k) for k, v in node[1]["mappings"].items()} + return + for child in node: + find_parsers(child) + elif isinstance(node, dict): + for child in node.values(): + find_parsers(child) + + find_parsers(proto) + assert parsers, "parser id table not found" + dump("commands_767.json", {"parsers": parsers, "tree": tree}) + + # --- language subset (console rendering of translatable components) --- + lang = json.loads((md / "1.21.1/language.json").read_text()) + dump("lang_en_us.json", {k: v for k, v in sorted(lang.items()) if k.startswith(LANG_PREFIXES)}) + + +if __name__ == "__main__": + main() diff --git a/tools/gen_worldgen_data.py b/tools/gen_worldgen_data.py new file mode 100644 index 0000000..f5eb1a6 --- /dev/null +++ b/tools/gen_worldgen_data.py @@ -0,0 +1,343 @@ +#!/usr/bin/env python3 +"""Build world/data/worldgen_overworld.json for the native terrain generator. + +Inputs (downloaded on demand into a cache directory, not vendored): + + * misode/mcmeta, branch ``1.21.1-data-json``: the vanilla 1.21.1 worldgen + data (noise settings, density functions, noise parameters, biomes). + * cubiomes ``tables/btree20.h`` (MIT, Copyright (c) 2020 Cubitect): the + overworld multi-noise biome parameter tree. Vanilla builds this table in + code (OverworldBiomeBuilder) and does not ship it as data; cubiomes' + encoding reproduces vanilla's R-tree including its tie-breaking order. + +The output resolves everything the C++ side would otherwise need to know: +block states become numeric state ids, biomes become PyMC registry ids and +density-function/noise references are kept by name (shared sub-graphs). + +Usage: + python tools/gen_worldgen_data.py [cache_dir] +""" + +import json +import re +import sys +import urllib.request +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(ROOT)) + +MCMETA = "https://raw.githubusercontent.com/misode/mcmeta/1.21.1-data-json/data/minecraft/worldgen/" +CUBIOMES = "https://raw.githubusercontent.com/Cubitect/cubiomes/master/" +OUT = ROOT / "world" / "data" / "worldgen_overworld.json" + + +class Fetcher: + def __init__(self, cache: Path): + self.cache = cache + cache.mkdir(parents=True, exist_ok=True) + + def get(self, url: str) -> bytes: + name = re.sub(r"[^A-Za-z0-9_.-]", "_", url.split("://", 1)[1]) + path = self.cache / name + if not path.exists(): + with urllib.request.urlopen(url, timeout=60) as response: + path.write_bytes(response.read()) + return path.read_bytes() + + def worldgen(self, kind: str, key: str): + key = key.split(":", 1)[-1] + return json.loads(self.get(f"{MCMETA}{kind}/{key}.json")) + + +def ns(name: str) -> str: + return name if ":" in name else "minecraft:" + name + + +# ---------------------------------------------------------------------- +# Density functions and noises +# ---------------------------------------------------------------------- + +class GraphCollector: + def __init__(self, fetch: Fetcher): + self.fetch = fetch + self.functions: dict[str, object] = {} + self.noises: dict[str, dict] = {} + + def noise(self, key: str) -> str: + key = ns(key) + if key not in self.noises: + data = self.fetch.worldgen("noise", key) + self.noises[key] = {"firstOctave": data["firstOctave"], + "amplitudes": data["amplitudes"]} + return key + + def walk(self, node): + """Normalise a density function node; references are collected by name.""" + if isinstance(node, (int, float)): + return {"type": "constant", "argument": float(node)} + if isinstance(node, str): + key = ns(node) + if key not in self.functions: + self.functions[key] = None # break cycles + self.functions[key] = self.walk(self.fetch.worldgen("density_function", key)) + return {"type": "ref", "name": key} + node = dict(node) + kind = node["type"].split(":", 1)[-1] + node["type"] = kind + if kind in ("shift_a", "shift_b", "shift"): + node["argument"] = self.noise(node["argument"]) + return node + for field in ("argument", "argument1", "argument2", "input", "when_in_range", + "when_out_of_range", "shift_x", "shift_y", "shift_z"): + if field in node and not (kind == "constant" and field == "argument"): + node[field] = self.walk(node[field]) + if "noise" in node and isinstance(node["noise"], str): + node["noise"] = self.noise(node["noise"]) + if kind == "spline": + node["spline"] = self.spline(node["spline"]) + return node + + def spline(self, spline): + if isinstance(spline, (int, float)): + return float(spline) + return { + "coordinate": self.walk(spline["coordinate"]), + "points": [ + {"location": p["location"], "derivative": p["derivative"], + "value": self.spline(p["value"])} + for p in spline["points"] + ], + } + + +# ---------------------------------------------------------------------- +# Surface rule: resolve block states and biome names +# ---------------------------------------------------------------------- + +def block_state_id(state: dict) -> int: + from world.chunk_io import BLOCK_KEY_TO_STATE_ID, BLOCK_NAME_TO_DEFAULT_STATE + name = ns(state["Name"]) + props = state.get("Properties") or {} + if not props: + return BLOCK_NAME_TO_DEFAULT_STATE[name] + key = (name, tuple(sorted(props.items()))) + if key in BLOCK_KEY_TO_STATE_ID: + return BLOCK_KEY_TO_STATE_ID[key] + # Fall back to the default state when the property combination is unknown. + return BLOCK_NAME_TO_DEFAULT_STATE[name] + + +def biome_id(name: str) -> int: + from world.biomes import BIOME_NAME_TO_ID + return BIOME_NAME_TO_ID[ns(name)] + + +def convert_surface(node, collector: GraphCollector): + if isinstance(node, list): + return [convert_surface(n, collector) for n in node] + if not isinstance(node, dict): + return node + out = {} + for key, value in node.items(): + if key == "type": + out[key] = value.split(":", 1)[-1] + elif key in ("result_state", "default_block", "default_fluid"): + out[key] = block_state_id(value) + elif key == "biome_is": + out[key] = [biome_id(b) for b in value] + elif key == "noise" and isinstance(value, str): + out[key] = collector.noise(value) + else: + out[key] = convert_surface(value, collector) + return out + + +# ---------------------------------------------------------------------- +# Biome parameter tree (cubiomes btree20) +# ---------------------------------------------------------------------- + +def parse_cubiomes_tree(fetch: Fetcher): + header = fetch.get(CUBIOMES + "tables/btree20.h").decode() + biomes_h = fetch.get(CUBIOMES + "biomes.h").decode() + + order = int(re.search(r"btree20_order\s*=\s*(\d+)", header).group(1)) + steps = [int(v) for v in re.search(r"btree20_steps\[\]\s*=\s*\{([^}]*)\}", header).group(1).split(",") if v.strip()] + params_src = re.search(r"btree20_param\[\]\[2\]\s*=\s*\{(.*?)\};", header, re.S).group(1) + params = [[int(a), int(b)] for a, b in re.findall(r"\{\s*(-?\d+)\s*,\s*(-?\d+)\s*\}", params_src)] + nodes_src = re.search(r"btree20_nodes\[\]\s*=\s*\{(.*?)\};", header, re.S).group(1) + nodes_src = re.sub(r"//[^\n]*", "", nodes_src) + nodes = [int(v, 16) for v in re.findall(r"0x([0-9A-Fa-f]+)", nodes_src)] + + # cubiomes biome enum -> vanilla name + enum_src = re.search(r"enum BiomeID\s*\{(.*?)\};", biomes_h, re.S).group(1) + enum_src = re.sub(r"//[^\n]*", "", enum_src) + values: dict[str, int] = {} + current = -1 + for entry in enum_src.split(","): + entry = entry.strip() + if not entry: + continue + if "=" in entry: + name, expr = (p.strip() for p in entry.split("=", 1)) + expr = expr.replace(" ", "") + if re.fullmatch(r"-?\d+", expr): + current = int(expr) + elif "+" in expr: + base, add = expr.split("+") + current = values[base] + int(add) + else: + current = values[expr] + else: + name = entry + current += 1 + values[name] = current + + from world.biomes import BIOME_NAME_TO_ID + id_to_name: dict[int, str] = {} + for name, value in values.items(): + key = "minecraft:" + name + if key in BIOME_NAME_TO_ID and value not in id_to_name: + id_to_name[value] = key + # cubiomes aliases whose first enum name is a pre-1.18 name + for name, value in values.items(): + key = "minecraft:" + name + if key in BIOME_NAME_TO_ID: + id_to_name[value] = key if value not in id_to_name else id_to_name[value] + + remapped = [] + used = set() + for node in nodes: + if (node >> 56) & 0xFF == 0xFF: + cub_id = (node >> 48) & 0xFF + name = id_to_name.get(cub_id) + if name is None: + raise SystemExit(f"unknown cubiomes biome id {cub_id}") + used.add(name) + node = (node & ~(0xFF << 48)) | (BIOME_NAME_TO_ID[name] << 48) + remapped.append(node) + return {"order": order, "steps": steps, "params": params, + "nodes": [str(n) for n in remapped], "biomes": sorted(used)} + + +# Block states used by the feature stage (trees, plants, ores, snow). +WOODS = ["oak", "spruce", "birch", "jungle", "acacia", "dark_oak", "cherry", "mangrove"] +FLOWERS = ["dandelion", "poppy", "blue_orchid", "allium", "azure_bluet", "red_tulip", "orange_tulip", + "white_tulip", "pink_tulip", "oxeye_daisy", "cornflower", "lily_of_the_valley"] +ORES = ["coal", "iron", "copper", "gold", "redstone", "lapis", "diamond", "emerald"] + + +def feature_states() -> dict: + states = {} + + def add(name, **props): + key = "minecraft:" + name + if props: + key += "[" + ",".join(f"{k}={v}" for k, v in sorted(props.items())) + "]" + states[key] = block_state_id({"Name": "minecraft:" + name, + "Properties": {k: str(v) for k, v in props.items()}}) + + for wood in WOODS: + for axis in "xyz": + add(f"{wood}_log", axis=axis) + for distance in range(1, 8): + add(f"{wood}_leaves", distance=distance, persistent="false", waterlogged="false") + for name in ["short_grass", "fern", "dead_bush", "brown_mushroom", "red_mushroom", "pumpkin", "melon", + "lily_pad", "seagrass", "kelp_plant", "mossy_cobblestone", "packed_ice", "ice", "blue_ice", + "stone", "deepslate", "granite", "diorite", "andesite", "tuff", "dirt", "gravel", "clay", + "sand", "grass_block", "podzol", "mycelium", "coarse_dirt", "rooted_dirt", "moss_block", "mud", + "mangrove_roots", "muddy_mangrove_roots", "red_sand", "snow_block", "water", "air", + "moss_carpet", "cobblestone", "terracotta", "bedrock", "sandstone", "calcite", "powder_snow", + "smooth_basalt", "dripstone_block", "glow_lichen"] + FLOWERS: + add(name) + for half in ("lower", "upper"): + for plant in ("tall_grass", "large_fern", "sunflower", "lilac", "rose_bush", "peony", "tall_seagrass"): + add(plant, half=half) + add("cactus", age=0) + add("sugar_cane", age=0) + add("kelp", age=20) + add("sweet_berry_bush", age=3) + add("snow", layers=1) + for block in ("grass_block", "podzol", "mycelium"): + add(block, snowy="true") + for amount in range(1, 5): + for facing in ("north", "east", "south", "west"): + add("pink_petals", facing=facing, flower_amount=amount) + for leaves in ("none", "small", "large"): + add("bamboo", age=0, leaves=leaves, stage=0) + add("bamboo_sapling") + for block in ("brown_mushroom_block", "red_mushroom_block", "mushroom_stem"): + add(block, down="true", east="true", north="true", south="true", up="true", west="true") + add(block, down="false", east="true", north="true", south="true", up="true", west="true") + for face in ("north", "east", "south", "west"): + props = {f: "false" for f in ("north", "east", "south", "west", "up")} + props[face] = "true" + add("vine", **props) + for ore in ORES: + add(f"{ore}_ore") if ore != "redstone" else add("redstone_ore", lit="false") + add(f"deepslate_{ore}_ore") if ore != "redstone" else add("deepslate_redstone_ore", lit="false") + add("sea_pickle", pickles=1, waterlogged="true") + add("sea_pickle", pickles=3, waterlogged="true") + return states + + +def main(): + cache = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "build" / "worldgen-cache" + fetch = Fetcher(cache) + collector = GraphCollector(fetch) + + settings = fetch.worldgen("noise_settings", "overworld") + router = {name: collector.walk(fn) for name, fn in settings["noise_router"].items()} + surface_rule = convert_surface(settings["surface_rule"], collector) + # Noises used directly by the surface system / aquifer / ore veins + for key in ("surface", "surface_secondary", "clay_bands_offset", "badlands_pillar", + "badlands_pillar_roof", "badlands_surface", "iceberg_pillar", + "iceberg_pillar_roof", "iceberg_surface", "surface_swamp", "calcite", + "gravel", "powder_snow", "packed_ice", "ice"): + collector.noise(key) + + biome_temperatures = {} + from world.biomes import BIOME_NAME_TO_ID + for name, biome in BIOME_NAME_TO_ID.items(): + data = fetch.worldgen("biome", name) + biome_temperatures[biome] = { + "temperature": data["temperature"], + "frozen": data.get("temperature_modifier", "none") == "frozen", + "precipitation": bool(data.get("has_precipitation", True)), + } + + out = { + "version": "1.21.1", + "sea_level": settings["sea_level"], + "noise": settings["noise"], + "default_block": block_state_id(settings["default_block"]), + "default_fluid": block_state_id(settings["default_fluid"]), + "aquifers_enabled": settings["aquifers_enabled"], + "ore_veins_enabled": settings["ore_veins_enabled"], + "spawn_target": settings["spawn_target"], + "router": router, + "density_functions": collector.functions, + "noises": collector.noises, + "surface_rule": surface_rule, + "biome_tree": parse_cubiomes_tree(fetch), + "biomes": {str(k): v for k, v in biome_temperatures.items()}, + "biome_ids": dict(BIOME_NAME_TO_ID), + "states": feature_states(), + "blocks": {name: block_state_id({"Name": name}) for name in ( + "minecraft:air", "minecraft:water", "minecraft:lava", "minecraft:stone", + "minecraft:bedrock", "minecraft:deepslate", "minecraft:granite", "minecraft:tuff", + "minecraft:copper_ore", "minecraft:deepslate_iron_ore", "minecraft:raw_copper_block", + "minecraft:raw_iron_block", "minecraft:terracotta", "minecraft:orange_terracotta", + "minecraft:yellow_terracotta", "minecraft:brown_terracotta", "minecraft:red_terracotta", + "minecraft:white_terracotta", "minecraft:light_gray_terracotta", "minecraft:ice", + "minecraft:packed_ice", "minecraft:snow_block", "minecraft:snow", + )}, + } + OUT.write_text(json.dumps(out, separators=(",", ":")) + "\n", encoding="utf-8") + print(f"wrote {OUT} ({OUT.stat().st_size // 1024} KiB): " + f"{len(collector.functions)} density functions, {len(collector.noises)} noises, " + f"{len(out['biome_tree']['nodes'])} biome tree nodes") + + +if __name__ == "__main__": + main() diff --git a/watchdog/network_optimizer.py b/watchdog/network_optimizer.py index df5b42e..9fdd953 100755 --- a/watchdog/network_optimizer.py +++ b/watchdog/network_optimizer.py @@ -52,12 +52,12 @@ def __init__(self, server): async def start(self): """Start the network optimizer.""" if not self.server.config.get('network-packet-batching', True): - logger.info("Network packet batching disabled (network-packet-batching=false)") + logger.debug("Network packet batching disabled (network-packet-batching=false)") return self._running = True self._flush_task = asyncio.create_task(self._flush_loop()) - logger.info(f"Network optimizer started (batch interval={self.movement_batch_interval*1000:.0f}ms, " + logger.debug(f"Network optimizer started (batch interval={self.movement_batch_interval*1000:.0f}ms, " f"movement updates={self._movement_rate_hz:.0f}Hz)") async def stop(self): @@ -73,7 +73,7 @@ async def stop(self): # Flush any remaining packets await self.flush_all() - logger.info(f"Network optimizer stopped (batched={self._packets_batched}, " + logger.debug(f"Network optimizer stopped (batched={self._packets_batched}, " f"direct={self._packets_sent_directly}, " f"movements_dropped={self._movements_dropped})") diff --git a/world/_native_build.py b/world/_native_build.py new file mode 100644 index 0000000..bd48ff4 --- /dev/null +++ b/world/_native_build.py @@ -0,0 +1,88 @@ +# ============================================================ +# PyMC - Build the native terrain generator from source +# ============================================================ + +""" +Compile ``native/terrain_gen.cpp`` with the local C++ compiler. + +Used when no up-to-date terrain_gen binary is present (fresh checkout, +outdated release binary). The result is cached in ``build/native``; it is +rebuilt automatically whenever a generator source file is newer. +""" + +from __future__ import annotations + +import logging +import os +import shutil +import subprocess +import sys +from pathlib import Path + +logger = logging.getLogger("pymc.native_build") + +ROOT = Path(__file__).resolve().parent.parent +SOURCE = ROOT / "native" / "terrain_gen.cpp" + + +def build_cache_dir() -> Path: + return ROOT / "build" / "native" + + +def _sources() -> list[Path]: + files = [SOURCE] + worldgen = ROOT / "native" / "worldgen" + if worldgen.is_dir(): + files.extend(sorted(worldgen.glob("*.h"))) + return files + + +def _compilers() -> list[list[str]]: + if os.name == "nt": + found = [] + if shutil.which("cl"): + found.append(["cl"]) + for cxx in ("g++", "clang++"): + if shutil.which(cxx): + found.append([cxx]) + return found + names = [os.environ.get("CXX", ""), "c++", "g++", "clang++"] + return [[n] for n in names if n and shutil.which(n)] + + +def build_native_generator(force: bool = False) -> str | None: + """Compile terrain_gen; returns the binary path or None.""" + if not SOURCE.exists(): + return None + out_dir = build_cache_dir() + binary = out_dir / ("terrain_gen.exe" if os.name == "nt" else "terrain_gen") + newest_source = max(p.stat().st_mtime for p in _sources()) + if binary.exists() and not force and binary.stat().st_mtime >= newest_source: + return str(binary) + + compilers = _compilers() + if not compilers: + logger.info("No C++ compiler found; cannot build the native terrain generator") + return None + out_dir.mkdir(parents=True, exist_ok=True) + for compiler in compilers: + if compiler[0] == "cl": + cmd = ["cl", "/nologo", "/O2", "/EHsc", "/std:c++17", "/fp:precise", "/DNOMINMAX", + f"/Fe:{binary}", str(SOURCE)] + else: + cmd = compiler + ["-O2", "-std=c++17", "-ffp-contract=off", "-pthread", "-o", str(binary), str(SOURCE)] + if sys.platform == "win32": + cmd.insert(-2, "-static") + logger.info("Building the native terrain generator (one-time, ~10-30 s)...") + try: + result = subprocess.run(cmd, cwd=str(out_dir), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + timeout=600) + except (OSError, subprocess.SubprocessError) as e: + logger.debug(f"{compiler[0]} failed: {e}") + continue + if result.returncode == 0 and binary.exists(): + logger.info(f"Native terrain generator built: {binary}") + return str(binary) + logger.warning(f"Building terrain_gen with {compiler[0]} failed:\n" + + result.stdout.decode("utf-8", errors="replace")[-2000:]) + return None diff --git a/world/ai_native.py b/world/ai_native.py index b9f37dc..4cc47b2 100755 --- a/world/ai_native.py +++ b/world/ai_native.py @@ -131,7 +131,7 @@ def __init__(self, binary_path: str | None = None): if not self.available and not self._redownload_attempted: self._try_redownload_after_crash() else: - logger.info("未找到 mob_ai 原生 AI,将使用 Python AI 回退") + logger.debug("未找到 mob_ai 原生 AI,将使用 Python AI 回退") def _try_redownload_after_crash(self) -> None: """子进程启动崩溃后,自动从 GitHub Release 重新下载二进制。""" @@ -211,7 +211,7 @@ def _start_process(self): self._process = None self._disabled = True return - logger.info("原生 AI 子进程已启动 (PID: %s)", self._process.pid) + logger.debug("原生 AI 子进程已启动 (PID: %s)", self._process.pid) except Exception as e: logger.warning("启动原生 AI 失败: %s", e) self._process = None diff --git a/world/block_behavior.py b/world/block_behavior.py index 3032653..f072b7c 100755 --- a/world/block_behavior.py +++ b/world/block_behavior.py @@ -754,7 +754,7 @@ def save(self, world_dir): f.flush() os.fsync(f.fileno()) os.replace(tmp_path, path) - logger.info(f"已保存 {len(self.containers)} 个方块容器到 {path}") + logger.debug(f"已保存 {len(self.containers)} 个方块容器到 {path}") except Exception as e: logger.error(f"Failed to save container data: {e}") try: @@ -772,7 +772,7 @@ def load(self, world_dir) -> bool: with open(path, "r", encoding="utf-8") as f: data = json.load(f) if self.deserialize(data): - logger.info(f"已加载 {len(self.containers)} 个方块容器 (来自 {path})") + logger.debug(f"已加载 {len(self.containers)} 个方块容器 (来自 {path})") return True except Exception as e: logger.error(f"Failed to load container data: {e}") @@ -877,7 +877,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_container_pos = (x, y, z) conn._open_container_type = 'block' - await send_open_container(conn, window_id, "minecraft:generic_9x3", "Chest") + await send_open_container(conn, window_id, "minecraft:generic_9x3", {"translate": "container.chest"}) # Send container contents: 27 chest slots + 36 player inventory slots all_slots = list(container.items) + [None] * (27 - len(container.items)) @@ -909,7 +909,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_window_id = window_id conn._open_container_pos = (x, y, z) - await send_open_container(conn, window_id, "minecraft:crafting", "Crafting Table") + await send_open_container(conn, window_id, "minecraft:crafting", {"translate": "container.crafting"}) return True @staticmethod @@ -931,7 +931,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_container_pos = (x, y, z) conn._open_container_type = 'block' - await send_open_container(conn, window_id, "minecraft:furnace", "Furnace") + await send_open_container(conn, window_id, "minecraft:furnace", {"translate": "container.furnace"}) # Send furnace contents: 3 furnace slots + 36 player inventory slots all_slots = list(container.items) + [None] * (3 - len(container.items)) @@ -966,7 +966,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_container_pos = (x, y, z) conn._open_container_type = 'block' - await send_open_container(conn, window_id, "minecraft:blast_furnace", "Blast Furnace") + await send_open_container(conn, window_id, "minecraft:blast_furnace", {"translate": "container.blast_furnace"}) all_slots = list(container.items) + [None] * (3 - len(container.items)) inv = getattr(conn, 'inventory_obj', None) @@ -996,7 +996,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_window_id = window_id conn._open_container_pos = (x, y, z) - await send_open_container(conn, window_id, "minecraft:anvil", "Anvil") + await send_open_container(conn, window_id, "minecraft:anvil", {"translate": "container.repair"}) return True @staticmethod @@ -1015,7 +1015,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_window_id = window_id conn._open_container_pos = (x, y, z) - await send_open_container(conn, window_id, "minecraft:enchanting_table", "Enchanting Table") + await send_open_container(conn, window_id, "minecraft:enchantment", {"translate": "container.enchant"}) return True @staticmethod @@ -1040,7 +1040,7 @@ async def on_use(conn, server, x: int, y: int, z: int, conn._open_container_pos = (x, y, z) conn._open_container_type = 'ender_chest' - await send_open_container(conn, window_id, "minecraft:generic_9x3", "Ender Chest") + await send_open_container(conn, window_id, "minecraft:generic_9x3", {"translate": "container.enderchest"}) # Send ender chest contents all_slots = list(inv.ender_chest) + [None] * (27 - len(inv.ender_chest)) diff --git a/world/chunk_io.py b/world/chunk_io.py index bb9ef3f..35cb1a1 100755 --- a/world/chunk_io.py +++ b/world/chunk_io.py @@ -74,20 +74,32 @@ def _property_values(state_def: dict) -> list[str]: return list(state_def.get("values", [])) -def _state_id_to_properties(block_def: dict, state_id: int) -> dict[str, str]: +def _state_id_to_properties(block_def: dict, state_id: int, legacy: bool = False) -> dict[str, str]: + """ + Decode a global state id into block properties. + + Vanilla enumerates block states with the *last* property varying fastest + (oak_leaves 237 = distance=1,persistent=true,waterlogged=true, + 238 = ...waterlogged=false). Releases of PyMC before the fix decoded the + first property fastest; ``legacy=True`` reproduces that order so chunks + written by those versions can still be read correctly. + """ state_defs = block_def.get("states", []) if not state_defs: return {} offset = state_id - block_def["minStateId"] props: dict[str, str] = {} - for state_def in state_defs: + ordered = state_defs if legacy else list(reversed(state_defs)) + for state_def in ordered: values = _property_values(state_def) if not values: continue idx = offset % len(values) props[state_def["name"]] = values[idx] offset //= len(values) + if not legacy: + props = {d["name"]: props[d["name"]] for d in state_defs if d["name"] in props} return props @@ -120,6 +132,7 @@ def _build_block_registry(): state_id_to_block: dict[int, tuple[str, dict[str, str]]] = {} block_key_to_state_id: dict[tuple[str, tuple[tuple[str, str], ...]], int] = {} block_name_to_default_state: dict[str, int] = {} + legacy_key_to_state_id: dict[tuple[str, tuple[tuple[str, str], ...]], int] = {} for block in blocks: name = f"minecraft:{block['name']}" @@ -132,17 +145,42 @@ def _build_block_registry(): props = _state_id_to_properties(block, state_id) state_id_to_block[state_id] = (name, props) block_key_to_state_id[(name, tuple(sorted(props.items())))] = state_id + legacy_props = _state_id_to_properties(block, state_id, legacy=True) + legacy_key_to_state_id[(name, tuple(sorted(legacy_props.items())))] = state_id # 允许省略 Properties 时直接落到 defaultState default_props = _state_id_to_properties(block, default_state) block_key_to_state_id[(name, tuple())] = default_state block_key_to_state_id[(name, tuple(sorted(default_props.items())))] = default_state + global LEGACY_KEY_TO_STATE_ID + LEGACY_KEY_TO_STATE_ID = legacy_key_to_state_id return state_id_to_block, block_key_to_state_id, block_name_to_default_state +LEGACY_KEY_TO_STATE_ID: dict = {} STATE_ID_TO_BLOCK, BLOCK_KEY_TO_STATE_ID, BLOCK_NAME_TO_DEFAULT_STATE = _build_block_registry() +# Chunks written by this version carry this tag; see _uses_legacy_state_order(). +PYMC_STATE_ORDER_TAG = "PyMCStateOrder" +PYMC_STATE_ORDER = 2 + + +def _uses_legacy_state_order(root: dict) -> bool: + """ + True for chunks written by PyMC before the property-order fix. + + Those chunks have no PyMCStateOrder tag, LastUpdate == 0 and no + block_ticks/fluid_ticks lists, which every vanilla 1.21.1 chunk has. + """ + if PYMC_STATE_ORDER_TAG in root: + return False + if "block_ticks" in root or "fluid_ticks" in root: + return False + last_update = root.get("LastUpdate", 0) + last_update = getattr(last_update, "value", last_update) + return int(last_update or 0) == 0 + def is_pymc_chunk_data(data: bytes) -> bool: """判断是否为旧版 PyMC 私有区块缓存。""" @@ -237,7 +275,7 @@ def _state_id_to_palette_entry(state_id: int) -> dict: return entry -def _palette_entry_to_state_id(entry: dict) -> int: +def _palette_entry_to_state_id(entry: dict, legacy: bool = False) -> int: if not isinstance(entry, dict): return 0 @@ -254,7 +292,8 @@ def _palette_entry_to_state_id(entry: dict) -> int: for k, v in props.items() )) - state_id = BLOCK_KEY_TO_STATE_ID.get((name, normalized)) + table = LEGACY_KEY_TO_STATE_ID if legacy else BLOCK_KEY_TO_STATE_ID + state_id = table.get((name, normalized)) if state_id is not None: return state_id return BLOCK_NAME_TO_DEFAULT_STATE.get(name, 0) @@ -359,6 +398,10 @@ def serialize_chunk(chunk_blocks: list[list[list[int]]], chunk_x: int = 0, "WORLD_SURFACE": NbtLongArray(build_heightmap_from_terrain(chunk_blocks, include_water=True)), }, "sections": sections, + PYMC_STATE_ORDER_TAG: PYMC_STATE_ORDER, + "block_ticks": [], + "fluid_ticks": [], + "PostProcessing": [[] for _ in range(NUM_SECTIONS)], "block_entities": [], "structures": { "starts": {}, @@ -379,7 +422,7 @@ def _root_chunk_compound(raw_root: dict) -> dict: return raw_root -def _decode_section_blocks(section: dict, target: list[list[list[int]]]): +def _decode_section_blocks(section: dict, target: list[list[list[int]]], legacy: bool = False): if not isinstance(section, dict): return @@ -397,7 +440,7 @@ def _decode_section_blocks(section: dict, target: list[list[list[int]]]): if not isinstance(palette, list) or not palette: return - palette_ids = [_palette_entry_to_state_id(entry) for entry in palette] + palette_ids = [_palette_entry_to_state_id(entry, legacy) for entry in palette] if len(palette_ids) == 1: entries = [0] * 4096 else: @@ -513,8 +556,9 @@ def deserialize_chunk(data: bytes) -> list[list[list[int]]] | None: blocks = [[[0 for _ in range(16)] for _ in range(16)] for _ in range(WORLD_HEIGHT)] + legacy = _uses_legacy_state_order(chunk) for section in sections: - _decode_section_blocks(section, blocks) + _decode_section_blocks(section, blocks, legacy) return blocks diff --git a/world/data/worldgen_overworld.json b/world/data/worldgen_overworld.json new file mode 100644 index 0000000..8d4cad4 --- /dev/null +++ b/world/data/worldgen_overworld.json @@ -0,0 +1 @@ +{"version":"1.21.1","sea_level":63,"noise":{"height":384,"min_y":-64,"size_horizontal":1,"size_vertical":2},"default_block":1,"default_fluid":80,"aquifers_enabled":true,"ore_veins_enabled":true,"spawn_target":[{"continentalness":[-0.11,1.0],"depth":0.0,"erosion":[-1.0,1.0],"humidity":[-1.0,1.0],"offset":0.0,"temperature":[-1.0,1.0],"weirdness":[-1.0,-0.16]},{"continentalness":[-0.11,1.0],"depth":0.0,"erosion":[-1.0,1.0],"humidity":[-1.0,1.0],"offset":0.0,"temperature":[-1.0,1.0],"weirdness":[0.16,1.0]}],"router":{"barrier":{"type":"noise","noise":"minecraft:aquifer_barrier","xz_scale":1.0,"y_scale":0.5},"continents":{"type":"ref","name":"minecraft:overworld/continents"},"depth":{"type":"ref","name":"minecraft:overworld/depth"},"erosion":{"type":"ref","name":"minecraft:overworld/erosion"},"final_density":{"type":"min","argument1":{"type":"squeeze","argument":{"type":"mul","argument1":{"type":"constant","argument":0.64},"argument2":{"type":"interpolated","argument":{"type":"blend_density","argument":{"type":"add","argument1":{"type":"constant","argument":0.1171875},"argument2":{"type":"mul","argument1":{"type":"y_clamped_gradient","from_value":0.0,"from_y":-64,"to_value":1.0,"to_y":-40},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.1171875},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.078125},"argument2":{"type":"mul","argument1":{"type":"y_clamped_gradient","from_value":1.0,"from_y":240,"to_value":0.0,"to_y":256},"argument2":{"type":"add","argument1":{"type":"constant","argument":0.078125},"argument2":{"type":"range_choice","input":{"type":"ref","name":"minecraft:overworld/sloped_cheese"},"max_exclusive":1.5625,"min_inclusive":-1000000.0,"when_in_range":{"type":"min","argument1":{"type":"ref","name":"minecraft:overworld/sloped_cheese"},"argument2":{"type":"mul","argument1":{"type":"constant","argument":5.0},"argument2":{"type":"ref","name":"minecraft:overworld/caves/entrances"}}},"when_out_of_range":{"type":"max","argument1":{"type":"min","argument1":{"type":"min","argument1":{"type":"add","argument1":{"type":"mul","argument1":{"type":"constant","argument":4.0},"argument2":{"type":"square","argument":{"type":"noise","noise":"minecraft:cave_layer","xz_scale":1.0,"y_scale":8.0}}},"argument2":{"type":"add","argument1":{"type":"clamp","input":{"type":"add","argument1":{"type":"constant","argument":0.27},"argument2":{"type":"noise","noise":"minecraft:cave_cheese","xz_scale":1.0,"y_scale":0.6666666666666666}},"max":1.0,"min":-1.0},"argument2":{"type":"clamp","input":{"type":"add","argument1":{"type":"constant","argument":1.5},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-0.64},"argument2":{"type":"ref","name":"minecraft:overworld/sloped_cheese"}}},"max":0.5,"min":0.0}}},"argument2":{"type":"ref","name":"minecraft:overworld/caves/entrances"}},"argument2":{"type":"add","argument1":{"type":"ref","name":"minecraft:overworld/caves/spaghetti_2d"},"argument2":{"type":"ref","name":"minecraft:overworld/caves/spaghetti_roughness_function"}}},"argument2":{"type":"range_choice","input":{"type":"ref","name":"minecraft:overworld/caves/pillars"},"max_exclusive":0.03,"min_inclusive":-1000000.0,"when_in_range":{"type":"constant","argument":-1000000.0},"when_out_of_range":{"type":"ref","name":"minecraft:overworld/caves/pillars"}}}}}}}}}}}}}},"argument2":{"type":"ref","name":"minecraft:overworld/caves/noodle"}},"fluid_level_floodedness":{"type":"noise","noise":"minecraft:aquifer_fluid_level_floodedness","xz_scale":1.0,"y_scale":0.67},"fluid_level_spread":{"type":"noise","noise":"minecraft:aquifer_fluid_level_spread","xz_scale":1.0,"y_scale":0.7142857142857143},"initial_density_without_jaggedness":{"type":"add","argument1":{"type":"constant","argument":0.1171875},"argument2":{"type":"mul","argument1":{"type":"y_clamped_gradient","from_value":0.0,"from_y":-64,"to_value":1.0,"to_y":-40},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.1171875},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.078125},"argument2":{"type":"mul","argument1":{"type":"y_clamped_gradient","from_value":1.0,"from_y":240,"to_value":0.0,"to_y":256},"argument2":{"type":"add","argument1":{"type":"constant","argument":0.078125},"argument2":{"type":"clamp","input":{"type":"add","argument1":{"type":"constant","argument":-0.703125},"argument2":{"type":"mul","argument1":{"type":"constant","argument":4.0},"argument2":{"type":"quarter_negative","argument":{"type":"mul","argument1":{"type":"ref","name":"minecraft:overworld/depth"},"argument2":{"type":"cache_2d","argument":{"type":"ref","name":"minecraft:overworld/factor"}}}}}},"max":64.0,"min":-64.0}}}}}}},"lava":{"type":"noise","noise":"minecraft:aquifer_lava","xz_scale":1.0,"y_scale":1.0},"ridges":{"type":"ref","name":"minecraft:overworld/ridges"},"temperature":{"type":"shifted_noise","noise":"minecraft:temperature","shift_x":{"type":"ref","name":"minecraft:shift_x"},"shift_y":{"type":"constant","argument":0.0},"shift_z":{"type":"ref","name":"minecraft:shift_z"},"xz_scale":0.25,"y_scale":0.0},"vegetation":{"type":"shifted_noise","noise":"minecraft:vegetation","shift_x":{"type":"ref","name":"minecraft:shift_x"},"shift_y":{"type":"constant","argument":0.0},"shift_z":{"type":"ref","name":"minecraft:shift_z"},"xz_scale":0.25,"y_scale":0.0},"vein_gap":{"type":"noise","noise":"minecraft:ore_gap","xz_scale":1.0,"y_scale":1.0},"vein_ridged":{"type":"add","argument1":{"type":"constant","argument":-0.07999999821186066},"argument2":{"type":"max","argument1":{"type":"abs","argument":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":51.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:ore_vein_a","xz_scale":4.0,"y_scale":4.0},"when_out_of_range":{"type":"constant","argument":0.0}}}},"argument2":{"type":"abs","argument":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":51.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:ore_vein_b","xz_scale":4.0,"y_scale":4.0},"when_out_of_range":{"type":"constant","argument":0.0}}}}}},"vein_toggle":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":51.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:ore_veininess","xz_scale":1.5,"y_scale":1.5},"when_out_of_range":{"type":"constant","argument":0.0}}}},"density_functions":{"minecraft:overworld/continents":{"type":"flat_cache","argument":{"type":"shifted_noise","noise":"minecraft:continentalness","shift_x":{"type":"ref","name":"minecraft:shift_x"},"shift_y":{"type":"constant","argument":0.0},"shift_z":{"type":"ref","name":"minecraft:shift_z"},"xz_scale":0.25,"y_scale":0.0}},"minecraft:shift_x":{"type":"flat_cache","argument":{"type":"cache_2d","argument":{"type":"shift_a","argument":"minecraft:offset"}}},"minecraft:shift_z":{"type":"flat_cache","argument":{"type":"cache_2d","argument":{"type":"shift_b","argument":"minecraft:offset"}}},"minecraft:overworld/depth":{"type":"add","argument1":{"type":"y_clamped_gradient","from_value":1.5,"from_y":-64,"to_value":-1.5,"to_y":320},"argument2":{"type":"ref","name":"minecraft:overworld/offset"}},"minecraft:overworld/offset":{"type":"flat_cache","argument":{"type":"cache_2d","argument":{"type":"add","argument1":{"type":"mul","argument1":{"type":"blend_offset"},"argument2":{"type":"add","argument1":{"type":"constant","argument":1.0},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-1.0},"argument2":{"type":"cache_once","argument":{"type":"blend_alpha"}}}}},"argument2":{"type":"mul","argument1":{"type":"add","argument1":{"type":"constant","argument":-0.5037500262260437},"argument2":{"type":"spline","spline":{"coordinate":{"type":"ref","name":"minecraft:overworld/continents"},"points":[{"location":-1.1,"derivative":0.0,"value":0.044},{"location":-1.02,"derivative":0.0,"value":-0.2222},{"location":-0.51,"derivative":0.0,"value":-0.2222},{"location":-0.44,"derivative":0.0,"value":-0.12},{"location":-0.18,"derivative":0.0,"value":-0.12},{"location":-0.16,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.85,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.38940096,"value":-0.08880186},{"location":1.0,"derivative":0.38940096,"value":0.69000006}]}},{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.37788022,"value":-0.115760356},{"location":1.0,"derivative":0.37788022,"value":0.6400001}]}},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.2222},{"location":-0.75,"derivative":0.0,"value":-0.2222},{"location":-0.65,"derivative":0.0,"value":0.0},{"location":0.5954547,"derivative":0.0,"value":2.9802322e-08},{"location":0.6054547,"derivative":0.2534563,"value":2.9802322e-08},{"location":1.0,"derivative":0.2534563,"value":0.100000024}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.3},{"location":-0.4,"derivative":0.0,"value":0.05},{"location":0.0,"derivative":0.0,"value":0.05},{"location":0.4,"derivative":0.0,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.15},{"location":-0.4,"derivative":0.0,"value":0.0},{"location":0.0,"derivative":0.0,"value":0.0},{"location":0.4,"derivative":0.1,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":0.2,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.15},{"location":-0.4,"derivative":0.0,"value":0.0},{"location":0.0,"derivative":0.0,"value":0.0},{"location":0.4,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":0.0}]}},{"location":0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.02},{"location":-0.4,"derivative":0.0,"value":-0.03},{"location":0.0,"derivative":0.0,"value":-0.03},{"location":0.4,"derivative":0.06,"value":0.0},{"location":1.0,"derivative":0.0,"value":0.0}]}}]}},{"location":-0.15,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.85,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.38940096,"value":-0.08880186},{"location":1.0,"derivative":0.38940096,"value":0.69000006}]}},{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.37788022,"value":-0.115760356},{"location":1.0,"derivative":0.37788022,"value":0.6400001}]}},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.2222},{"location":-0.75,"derivative":0.0,"value":-0.2222},{"location":-0.65,"derivative":0.0,"value":0.0},{"location":0.5954547,"derivative":0.0,"value":2.9802322e-08},{"location":0.6054547,"derivative":0.2534563,"value":2.9802322e-08},{"location":1.0,"derivative":0.2534563,"value":0.100000024}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.3},{"location":-0.4,"derivative":0.0,"value":0.05},{"location":0.0,"derivative":0.0,"value":0.05},{"location":0.4,"derivative":0.0,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.15},{"location":-0.4,"derivative":0.0,"value":0.0},{"location":0.0,"derivative":0.0,"value":0.0},{"location":0.4,"derivative":0.1,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":0.2,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.15},{"location":-0.4,"derivative":0.0,"value":0.0},{"location":0.0,"derivative":0.0,"value":0.0},{"location":0.4,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":0.0}]}},{"location":0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.02},{"location":-0.4,"derivative":0.0,"value":-0.03},{"location":0.0,"derivative":0.0,"value":-0.03},{"location":0.4,"derivative":0.06,"value":0.0},{"location":1.0,"derivative":0.0,"value":0.0}]}}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.85,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.38940096,"value":-0.08880186},{"location":1.0,"derivative":0.38940096,"value":0.69000006}]}},{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.37788022,"value":-0.115760356},{"location":1.0,"derivative":0.37788022,"value":0.6400001}]}},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.2222},{"location":-0.75,"derivative":0.0,"value":-0.2222},{"location":-0.65,"derivative":0.0,"value":0.0},{"location":0.5954547,"derivative":0.0,"value":2.9802322e-08},{"location":0.6054547,"derivative":0.2534563,"value":2.9802322e-08},{"location":1.0,"derivative":0.2534563,"value":0.100000024}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.25},{"location":-0.4,"derivative":0.0,"value":0.05},{"location":0.0,"derivative":0.0,"value":0.05},{"location":0.4,"derivative":0.0,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.01,"value":0.001},{"location":0.0,"derivative":0.01,"value":0.003},{"location":0.4,"derivative":0.094000004,"value":0.05},{"location":1.0,"derivative":0.007000001,"value":0.060000002}]}},{"location":0.2,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.02},{"location":-0.4,"derivative":0.0,"value":-0.03},{"location":0.0,"derivative":0.0,"value":-0.03},{"location":0.4,"derivative":0.12,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}}]}},{"location":0.25,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.85,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.20235021},{"location":0.0,"derivative":0.5138249,"value":0.7161751},{"location":1.0,"derivative":0.5138249,"value":1.23}]}},{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.2},{"location":0.0,"derivative":0.43317974,"value":0.44682026},{"location":1.0,"derivative":0.43317974,"value":0.88}]}},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.2},{"location":0.0,"derivative":0.3917051,"value":0.30829495},{"location":1.0,"derivative":0.3917051,"value":0.70000005}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.25},{"location":-0.4,"derivative":0.0,"value":0.35},{"location":0.0,"derivative":0.0,"value":0.35},{"location":0.4,"derivative":0.0,"value":0.35},{"location":1.0,"derivative":0.049000014,"value":0.42000002}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.07,"value":0.0069999998},{"location":0.0,"derivative":0.07,"value":0.021},{"location":0.4,"derivative":0.658,"value":0.35},{"location":1.0,"derivative":0.049000014,"value":0.42000002}]}},{"location":0.2,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.0,"derivative":0.0,"value":0.17}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.0,"derivative":0.0,"value":0.17}]}},{"location":0.58,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.1},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.02},{"location":-0.4,"derivative":0.0,"value":-0.03},{"location":0.0,"derivative":0.0,"value":-0.03},{"location":0.4,"derivative":0.12,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}}]}},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.85,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.34792626},{"location":0.0,"derivative":0.5760369,"value":0.9239631},{"location":1.0,"derivative":0.5760369,"value":1.5}]}},{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.2},{"location":0.0,"derivative":0.4608295,"value":0.5391705},{"location":1.0,"derivative":0.4608295,"value":1.0}]}},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":0.2},{"location":0.0,"derivative":0.4608295,"value":0.5391705},{"location":1.0,"derivative":0.4608295,"value":1.0}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.2},{"location":-0.4,"derivative":0.0,"value":0.5},{"location":0.0,"derivative":0.0,"value":0.5},{"location":0.4,"derivative":0.0,"value":0.5},{"location":1.0,"derivative":0.070000015,"value":0.6}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.099999994,"value":0.01},{"location":0.0,"derivative":0.099999994,"value":0.03},{"location":0.4,"derivative":0.94,"value":0.5},{"location":1.0,"derivative":0.070000015,"value":0.6}]}},{"location":0.2,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.0,"derivative":0.0,"value":0.17}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.0,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.0,"derivative":0.0,"value":0.17}]}},{"location":0.58,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.5,"value":-0.05},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}},{"location":0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-1.0,"derivative":0.015,"value":-0.02},{"location":-0.4,"derivative":0.0,"value":0.01},{"location":0.0,"derivative":0.0,"value":0.01},{"location":0.4,"derivative":0.04,"value":0.03},{"location":1.0,"derivative":0.049,"value":0.1}]}}]}}]}}},"argument2":{"type":"cache_once","argument":{"type":"blend_alpha"}}}}}},"minecraft:overworld/erosion":{"type":"flat_cache","argument":{"type":"shifted_noise","noise":"minecraft:erosion","shift_x":{"type":"ref","name":"minecraft:shift_x"},"shift_y":{"type":"constant","argument":0.0},"shift_z":{"type":"ref","name":"minecraft:shift_z"},"xz_scale":0.25,"y_scale":0.0}},"minecraft:overworld/ridges_folded":{"type":"mul","argument1":{"type":"constant","argument":-3.0},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.3333333333333333},"argument2":{"type":"abs","argument":{"type":"add","argument1":{"type":"constant","argument":-0.6666666666666666},"argument2":{"type":"abs","argument":{"type":"ref","name":"minecraft:overworld/ridges"}}}}}},"minecraft:overworld/ridges":{"type":"flat_cache","argument":{"type":"shifted_noise","noise":"minecraft:ridge","shift_x":{"type":"ref","name":"minecraft:shift_x"},"shift_y":{"type":"constant","argument":0.0},"shift_z":{"type":"ref","name":"minecraft:shift_z"},"xz_scale":0.25,"y_scale":0.0}},"minecraft:overworld/sloped_cheese":{"type":"add","argument1":{"type":"mul","argument1":{"type":"constant","argument":4.0},"argument2":{"type":"quarter_negative","argument":{"type":"mul","argument1":{"type":"add","argument1":{"type":"ref","name":"minecraft:overworld/depth"},"argument2":{"type":"mul","argument1":{"type":"ref","name":"minecraft:overworld/jaggedness"},"argument2":{"type":"half_negative","argument":{"type":"noise","noise":"minecraft:jagged","xz_scale":1500.0,"y_scale":0.0}}}},"argument2":{"type":"ref","name":"minecraft:overworld/factor"}}}},"argument2":{"type":"ref","name":"minecraft:overworld/base_3d_noise"}},"minecraft:overworld/jaggedness":{"type":"flat_cache","argument":{"type":"cache_2d","argument":{"type":"add","argument1":{"type":"constant","argument":0.0},"argument2":{"type":"mul","argument1":{"type":"blend_alpha"},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.0},"argument2":{"type":"spline","spline":{"coordinate":{"type":"ref","name":"minecraft:overworld/continents"},"points":[{"location":-0.11,"derivative":0.0,"value":0.0},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.63},{"location":0.01,"derivative":0.0,"value":0.3}]}}]}},{"location":-0.78,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.315},{"location":0.01,"derivative":0.0,"value":0.15}]}}]}},{"location":-0.5775,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.315},{"location":0.01,"derivative":0.0,"value":0.15}]}}]}},{"location":-0.375,"derivative":0.0,"value":0.0}]}},{"location":0.65,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.63},{"location":0.01,"derivative":0.0,"value":0.3}]}},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.63},{"location":0.01,"derivative":0.0,"value":0.3}]}}]}},{"location":-0.78,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.63},{"location":0.01,"derivative":0.0,"value":0.3}]}}]}},{"location":-0.5775,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.19999999,"derivative":0.0,"value":0.0},{"location":0.44999996,"derivative":0.0,"value":0.0},{"location":1.0,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.01,"derivative":0.0,"value":0.63},{"location":0.01,"derivative":0.0,"value":0.3}]}}]}},{"location":-0.375,"derivative":0.0,"value":0.0}]}}]}}}}}}},"minecraft:overworld/factor":{"type":"flat_cache","argument":{"type":"cache_2d","argument":{"type":"add","argument1":{"type":"constant","argument":10.0},"argument2":{"type":"mul","argument1":{"type":"blend_alpha"},"argument2":{"type":"add","argument1":{"type":"constant","argument":-10.0},"argument2":{"type":"spline","spline":{"coordinate":{"type":"ref","name":"minecraft:overworld/continents"},"points":[{"location":-0.19,"derivative":0.0,"value":3.95},{"location":-0.15,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.6,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":6.25}]}},{"location":-0.5,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":6.3},{"location":0.05,"derivative":0.0,"value":2.67}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":6.25}]}},{"location":-0.25,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":6.25}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":2.67},{"location":0.05,"derivative":0.0,"value":6.3}]}},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":6.25}]}},{"location":0.35,"derivative":0.0,"value":6.25},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":6.25},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":6.25},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":6.25},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":6.25},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.62,"derivative":0.0,"value":6.25}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.6,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.47}]}},{"location":-0.5,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":6.3},{"location":0.05,"derivative":0.0,"value":2.67}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.47}]}},{"location":-0.25,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.47}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":2.67},{"location":0.05,"derivative":0.0,"value":6.3}]}},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.47}]}},{"location":0.35,"derivative":0.0,"value":5.47},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":5.47},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":5.47},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":5.47},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":5.47},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.62,"derivative":0.0,"value":5.47}]}},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.6,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.08}]}},{"location":-0.5,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":6.3},{"location":0.05,"derivative":0.0,"value":2.67}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.08}]}},{"location":-0.25,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.08}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":2.67},{"location":0.05,"derivative":0.0,"value":6.3}]}},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":5.08}]}},{"location":0.35,"derivative":0.0,"value":5.08},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":5.08},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":5.08},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.9,"derivative":0.0,"value":5.08},{"location":-0.69,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":0.0,"derivative":0.0,"value":5.08},{"location":0.1,"derivative":0.0,"value":0.625}]}}]}},{"location":0.62,"derivative":0.0,"value":5.08}]}},{"location":0.06,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/erosion"},"points":[{"location":-0.6,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":-0.5,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":6.3},{"location":0.05,"derivative":0.0,"value":2.67}]}},{"location":-0.35,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":-0.25,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":-0.1,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.05,"derivative":0.0,"value":2.67},{"location":0.05,"derivative":0.0,"value":6.3}]}},{"location":0.03,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":0.05,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":0.7,"derivative":0.0,"value":1.56}]}},{"location":0.4,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":0.7,"derivative":0.0,"value":1.56}]}},{"location":0.45,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":-0.15,"derivative":0.0,"value":1.37}]}},{"location":0.55,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges_folded"},"points":[{"location":-0.7,"derivative":0.0,"value":{"coordinate":{"type":"ref","name":"minecraft:overworld/ridges"},"points":[{"location":-0.2,"derivative":0.0,"value":6.3},{"location":0.2,"derivative":0.0,"value":4.69}]}},{"location":-0.15,"derivative":0.0,"value":1.37}]}},{"location":0.58,"derivative":0.0,"value":4.69}]}}]}}}}}}},"minecraft:overworld/base_3d_noise":{"type":"old_blended_noise","smear_scale_multiplier":8.0,"xz_factor":80.0,"xz_scale":0.25,"y_factor":160.0,"y_scale":0.125},"minecraft:overworld/caves/entrances":{"type":"cache_once","argument":{"type":"min","argument1":{"type":"add","argument1":{"type":"add","argument1":{"type":"constant","argument":0.37},"argument2":{"type":"noise","noise":"minecraft:cave_entrance","xz_scale":0.75,"y_scale":0.5}},"argument2":{"type":"y_clamped_gradient","from_value":0.3,"from_y":-10,"to_value":0.0,"to_y":30}},"argument2":{"type":"add","argument1":{"type":"ref","name":"minecraft:overworld/caves/spaghetti_roughness_function"},"argument2":{"type":"clamp","input":{"type":"add","argument1":{"type":"max","argument1":{"type":"weird_scaled_sampler","input":{"type":"cache_once","argument":{"type":"noise","noise":"minecraft:spaghetti_3d_rarity","xz_scale":2.0,"y_scale":1.0}},"noise":"minecraft:spaghetti_3d_1","rarity_value_mapper":"type_1"},"argument2":{"type":"weird_scaled_sampler","input":{"type":"cache_once","argument":{"type":"noise","noise":"minecraft:spaghetti_3d_rarity","xz_scale":2.0,"y_scale":1.0}},"noise":"minecraft:spaghetti_3d_2","rarity_value_mapper":"type_1"}},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.0765},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-0.011499999999999996},"argument2":{"type":"noise","noise":"minecraft:spaghetti_3d_thickness","xz_scale":1.0,"y_scale":1.0}}}},"max":1.0,"min":-1.0}}}},"minecraft:overworld/caves/spaghetti_roughness_function":{"type":"cache_once","argument":{"type":"mul","argument1":{"type":"add","argument1":{"type":"constant","argument":-0.05},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-0.05},"argument2":{"type":"noise","noise":"minecraft:spaghetti_roughness_modulator","xz_scale":1.0,"y_scale":1.0}}},"argument2":{"type":"add","argument1":{"type":"constant","argument":-0.4},"argument2":{"type":"abs","argument":{"type":"noise","noise":"minecraft:spaghetti_roughness","xz_scale":1.0,"y_scale":1.0}}}}},"minecraft:overworld/caves/spaghetti_2d":{"type":"clamp","input":{"type":"max","argument1":{"type":"add","argument1":{"type":"weird_scaled_sampler","input":{"type":"noise","noise":"minecraft:spaghetti_2d_modulator","xz_scale":2.0,"y_scale":1.0},"noise":"minecraft:spaghetti_2d","rarity_value_mapper":"type_2"},"argument2":{"type":"mul","argument1":{"type":"constant","argument":0.083},"argument2":{"type":"ref","name":"minecraft:overworld/caves/spaghetti_2d_thickness_modulator"}}},"argument2":{"type":"cube","argument":{"type":"add","argument1":{"type":"abs","argument":{"type":"add","argument1":{"type":"add","argument1":{"type":"constant","argument":0.0},"argument2":{"type":"mul","argument1":{"type":"constant","argument":8.0},"argument2":{"type":"noise","noise":"minecraft:spaghetti_2d_elevation","xz_scale":1.0,"y_scale":0.0}}},"argument2":{"type":"y_clamped_gradient","from_value":8.0,"from_y":-64,"to_value":-40.0,"to_y":320}}},"argument2":{"type":"ref","name":"minecraft:overworld/caves/spaghetti_2d_thickness_modulator"}}}},"max":1.0,"min":-1.0},"minecraft:overworld/caves/spaghetti_2d_thickness_modulator":{"type":"cache_once","argument":{"type":"add","argument1":{"type":"constant","argument":-0.95},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-0.35000000000000003},"argument2":{"type":"noise","noise":"minecraft:spaghetti_2d_thickness","xz_scale":2.0,"y_scale":1.0}}}},"minecraft:overworld/caves/pillars":{"type":"cache_once","argument":{"type":"mul","argument1":{"type":"add","argument1":{"type":"mul","argument1":{"type":"constant","argument":2.0},"argument2":{"type":"noise","noise":"minecraft:pillar","xz_scale":25.0,"y_scale":0.3}},"argument2":{"type":"add","argument1":{"type":"constant","argument":-1.0},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-1.0},"argument2":{"type":"noise","noise":"minecraft:pillar_rareness","xz_scale":1.0,"y_scale":1.0}}}},"argument2":{"type":"cube","argument":{"type":"add","argument1":{"type":"constant","argument":0.55},"argument2":{"type":"mul","argument1":{"type":"constant","argument":0.55},"argument2":{"type":"noise","noise":"minecraft:pillar_thickness","xz_scale":1.0,"y_scale":1.0}}}}}},"minecraft:overworld/caves/noodle":{"type":"range_choice","input":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":321.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:noodle","xz_scale":1.0,"y_scale":1.0},"when_out_of_range":{"type":"constant","argument":-1.0}}},"max_exclusive":0.0,"min_inclusive":-1000000.0,"when_in_range":{"type":"constant","argument":64.0},"when_out_of_range":{"type":"add","argument1":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":321.0,"min_inclusive":-60.0,"when_in_range":{"type":"add","argument1":{"type":"constant","argument":-0.07500000000000001},"argument2":{"type":"mul","argument1":{"type":"constant","argument":-0.025},"argument2":{"type":"noise","noise":"minecraft:noodle_thickness","xz_scale":1.0,"y_scale":1.0}}},"when_out_of_range":{"type":"constant","argument":0.0}}},"argument2":{"type":"mul","argument1":{"type":"constant","argument":1.5},"argument2":{"type":"max","argument1":{"type":"abs","argument":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":321.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:noodle_ridge_a","xz_scale":2.6666666666666665,"y_scale":2.6666666666666665},"when_out_of_range":{"type":"constant","argument":0.0}}}},"argument2":{"type":"abs","argument":{"type":"interpolated","argument":{"type":"range_choice","input":{"type":"ref","name":"minecraft:y"},"max_exclusive":321.0,"min_inclusive":-60.0,"when_in_range":{"type":"noise","noise":"minecraft:noodle_ridge_b","xz_scale":2.6666666666666665,"y_scale":2.6666666666666665},"when_out_of_range":{"type":"constant","argument":0.0}}}}}}}},"minecraft:y":{"type":"y_clamped_gradient","from_value":-4064.0,"from_y":-4064,"to_value":4062.0,"to_y":4062}},"noises":{"minecraft:aquifer_barrier":{"firstOctave":-3,"amplitudes":[1.0]},"minecraft:offset":{"firstOctave":-3,"amplitudes":[1.0,1.0,1.0,0.0]},"minecraft:continentalness":{"firstOctave":-9,"amplitudes":[1.0,1.0,2.0,2.0,2.0,1.0,1.0,1.0,1.0]},"minecraft:erosion":{"firstOctave":-9,"amplitudes":[1.0,1.0,0.0,1.0,1.0]},"minecraft:ridge":{"firstOctave":-7,"amplitudes":[1.0,2.0,1.0,0.0,0.0,0.0]},"minecraft:jagged":{"firstOctave":-16,"amplitudes":[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]},"minecraft:cave_entrance":{"firstOctave":-7,"amplitudes":[0.4,0.5,1.0]},"minecraft:spaghetti_roughness_modulator":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:spaghetti_roughness":{"firstOctave":-5,"amplitudes":[1.0]},"minecraft:spaghetti_3d_rarity":{"firstOctave":-11,"amplitudes":[1.0]},"minecraft:spaghetti_3d_1":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:spaghetti_3d_2":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:spaghetti_3d_thickness":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:cave_layer":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:cave_cheese":{"firstOctave":-8,"amplitudes":[0.5,1.0,2.0,1.0,2.0,1.0,0.0,2.0,0.0]},"minecraft:spaghetti_2d_modulator":{"firstOctave":-11,"amplitudes":[1.0]},"minecraft:spaghetti_2d":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:spaghetti_2d_thickness":{"firstOctave":-11,"amplitudes":[1.0]},"minecraft:spaghetti_2d_elevation":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:pillar":{"firstOctave":-7,"amplitudes":[1.0,1.0]},"minecraft:pillar_rareness":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:pillar_thickness":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:noodle":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:noodle_thickness":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:noodle_ridge_a":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:noodle_ridge_b":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:aquifer_fluid_level_floodedness":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:aquifer_fluid_level_spread":{"firstOctave":-5,"amplitudes":[1.0]},"minecraft:aquifer_lava":{"firstOctave":-1,"amplitudes":[1.0]},"minecraft:temperature":{"firstOctave":-10,"amplitudes":[1.5,0.0,1.0,0.0,0.0,0.0]},"minecraft:vegetation":{"firstOctave":-8,"amplitudes":[1.0,1.0,0.0,0.0,0.0,0.0]},"minecraft:ore_gap":{"firstOctave":-5,"amplitudes":[1.0]},"minecraft:ore_vein_a":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:ore_vein_b":{"firstOctave":-7,"amplitudes":[1.0]},"minecraft:ore_veininess":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:surface":{"firstOctave":-6,"amplitudes":[1.0,1.0,1.0]},"minecraft:surface_swamp":{"firstOctave":-2,"amplitudes":[1.0]},"minecraft:packed_ice":{"firstOctave":-7,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:ice":{"firstOctave":-4,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:powder_snow":{"firstOctave":-6,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:calcite":{"firstOctave":-9,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:gravel":{"firstOctave":-8,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:surface_secondary":{"firstOctave":-6,"amplitudes":[1.0,1.0,0.0,1.0]},"minecraft:clay_bands_offset":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:badlands_pillar":{"firstOctave":-2,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:badlands_pillar_roof":{"firstOctave":-8,"amplitudes":[1.0]},"minecraft:badlands_surface":{"firstOctave":-6,"amplitudes":[1.0,1.0,1.0]},"minecraft:iceberg_pillar":{"firstOctave":-6,"amplitudes":[1.0,1.0,1.0,1.0]},"minecraft:iceberg_pillar_roof":{"firstOctave":-3,"amplitudes":[1.0]},"minecraft:iceberg_surface":{"firstOctave":-6,"amplitudes":[1.0,1.0,1.0]}},"surface_rule":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"vertical_gradient","false_at_and_above":{"above_bottom":5},"random_name":"minecraft:bedrock_floor","true_at_and_below":{"above_bottom":0}},"then_run":{"type":"block","result_state":79}},{"type":"condition","if_true":{"type":"above_preliminary_surface"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[63]},"then_run":{"type":"condition","if_true":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":97},"surface_depth_multiplier":2},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":-0.5454,"min_threshold":-0.909,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":11}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.1818,"min_threshold":-0.1818,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":11}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.909,"min_threshold":0.5454,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":11}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":9}},{"type":"block","result_state":10}]}]}}},{"type":"condition","if_true":{"type":"biome","biome_is":[53]},"then_run":{"type":"condition","if_true":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":62},"surface_depth_multiplier":0},"then_run":{"type":"condition","if_true":{"type":"not","invert":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":63},"surface_depth_multiplier":0}},"then_run":{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.0,"noise":"minecraft:surface_swamp"},"then_run":{"type":"block","result_state":80}}}}},{"type":"condition","if_true":{"type":"biome","biome_is":[31]},"then_run":{"type":"condition","if_true":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":60},"surface_depth_multiplier":0},"then_run":{"type":"condition","if_true":{"type":"not","invert":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":63},"surface_depth_multiplier":0}},"then_run":{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.0,"noise":"minecraft:surface_swamp"},"then_run":{"type":"block","result_state":80}}}}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[0,19,63]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":256},"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":9357}},{"type":"condition","if_true":{"type":"y_above","add_stone_depth":true,"anchor":{"absolute":74},"surface_depth_multiplier":1},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":-0.5454,"min_threshold":-0.909,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":10744}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.1818,"min_threshold":-0.1818,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":10744}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.909,"min_threshold":0.5454,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":10744}},{"type":"bandlands"}]}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":-1,"surface_depth_multiplier":0},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":11079}},{"type":"block","result_state":117}]}},{"type":"condition","if_true":{"type":"not","invert":{"type":"hole"}},"then_run":{"type":"block","result_state":9357}},{"type":"condition","if_true":{"type":"water","add_stone_depth":true,"offset":-6,"surface_depth_multiplier":-1},"then_run":{"type":"block","result_state":9356}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}]}},{"type":"condition","if_true":{"type":"y_above","add_stone_depth":true,"anchor":{"absolute":63},"surface_depth_multiplier":-1},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"y_above","add_stone_depth":false,"anchor":{"absolute":63},"surface_depth_multiplier":0},"then_run":{"type":"condition","if_true":{"type":"not","invert":{"type":"y_above","add_stone_depth":true,"anchor":{"absolute":74},"surface_depth_multiplier":1}},"then_run":{"type":"block","result_state":9357}}},{"type":"bandlands"}]}},{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":true,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":true,"offset":-6,"surface_depth_multiplier":-1},"then_run":{"type":"block","result_state":9356}}}]}},{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":-1,"surface_depth_multiplier":0},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[22,11]},"then_run":{"type":"condition","if_true":{"type":"hole"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":0}},{"type":"condition","if_true":{"type":"temperature"},"then_run":{"type":"block","result_state":5780}},{"type":"block","result_state":80}]}}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[23]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"steep"},"then_run":{"type":"block","result_state":10746}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.2,"min_threshold":0.0,"noise":"minecraft:packed_ice"},"then_run":{"type":"block","result_state":10746}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.025,"min_threshold":0.0,"noise":"minecraft:ice"},"then_run":{"type":"block","result_state":5780}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[46]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"steep"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.6,"min_threshold":0.35,"noise":"minecraft:powder_snow"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":22318}}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[27]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"steep"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[25]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.6,"min_threshold":0.35,"noise":"minecraft:powder_snow"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":22318}}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[50]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.0125,"min_threshold":-0.0125,"noise":"minecraft:calcite"},"then_run":{"type":"block","result_state":22316}},{"type":"block","result_state":1}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[51]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.05,"min_threshold":-0.05,"noise":"minecraft:gravel"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}},{"type":"block","result_state":1}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[61]},"then_run":{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}}},{"type":"condition","if_true":{"type":"biome","biome_is":[57,3,44]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":535}},{"type":"block","result_state":112}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[14]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":535}},{"type":"block","result_state":112}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[15]},"then_run":{"type":"block","result_state":1}}]},{"type":"condition","if_true":{"type":"biome","biome_is":[62]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.21212121212121213,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":-0.06060606060606061,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":11}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[60]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.24242424242424243,"noise":"minecraft:surface"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":-0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":9}},{"type":"block","result_state":10}]}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[37,38]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.21212121212121213,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":11}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":-0.11515151515151514,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":13}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[26]},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}},{"type":"condition","if_true":{"type":"biome","biome_is":[31]},"then_run":{"type":"block","result_state":24903}},{"type":"condition","if_true":{"type":"biome","biome_is":[33]},"then_run":{"type":"block","result_state":7270}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":9}},{"type":"block","result_state":10}]}]}]}}},{"type":"condition","if_true":{"type":"water","add_stone_depth":true,"offset":-6,"surface_depth_multiplier":-1},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"condition","if_true":{"type":"biome","biome_is":[22,11]},"then_run":{"type":"condition","if_true":{"type":"hole"},"then_run":{"type":"block","result_state":80}}}},{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":true,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[23]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"steep"},"then_run":{"type":"block","result_state":10746}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.2,"min_threshold":-0.5,"noise":"minecraft:packed_ice"},"then_run":{"type":"block","result_state":10746}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.025,"min_threshold":-0.0625,"noise":"minecraft:ice"},"then_run":{"type":"block","result_state":5780}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[46]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"steep"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.58,"min_threshold":0.45,"noise":"minecraft:powder_snow"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":22318}}},{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":5781}}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[27]},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"biome","biome_is":[25]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.58,"min_threshold":0.45,"noise":"minecraft:powder_snow"},"then_run":{"type":"condition","if_true":{"type":"water","add_stone_depth":false,"offset":0,"surface_depth_multiplier":0},"then_run":{"type":"block","result_state":22318}}},{"type":"block","result_state":10}]}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[50]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.0125,"min_threshold":-0.0125,"noise":"minecraft:calcite"},"then_run":{"type":"block","result_state":22316}},{"type":"block","result_state":1}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[51]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":0.05,"min_threshold":-0.05,"noise":"minecraft:gravel"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}},{"type":"block","result_state":1}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[61]},"then_run":{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}}},{"type":"condition","if_true":{"type":"biome","biome_is":[57,3,44]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":535}},{"type":"block","result_state":112}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[14]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":535}},{"type":"block","result_state":112}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[15]},"then_run":{"type":"block","result_state":1}}]},{"type":"condition","if_true":{"type":"biome","biome_is":[62]},"then_run":{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.21212121212121213,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}}},{"type":"condition","if_true":{"type":"biome","biome_is":[60]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.24242424242424243,"noise":"minecraft:surface"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"noise_threshold","max_threshold":1.7976931348623157e+308,"min_threshold":-0.12121212121212122,"noise":"minecraft:surface"},"then_run":{"type":"block","result_state":10}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[31]},"then_run":{"type":"block","result_state":24903}},{"type":"block","result_state":10}]}},{"type":"condition","if_true":{"type":"biome","biome_is":[57,3,44]},"then_run":{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":true,"offset":0,"secondary_depth_range":6,"surface_type":"floor"},"then_run":{"type":"block","result_state":535}}},{"type":"condition","if_true":{"type":"biome","biome_is":[14]},"then_run":{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":true,"offset":0,"secondary_depth_range":30,"surface_type":"floor"},"then_run":{"type":"block","result_state":535}}}]}},{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"floor"},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"biome","biome_is":[23,27]},"then_run":{"type":"block","result_state":1}},{"type":"condition","if_true":{"type":"biome","biome_is":[57,29,12]},"then_run":{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":535}},{"type":"block","result_state":112}]}},{"type":"sequence","sequence":[{"type":"condition","if_true":{"type":"stone_depth","add_surface_depth":false,"offset":0,"secondary_depth_range":0,"surface_type":"ceiling"},"then_run":{"type":"block","result_state":1}},{"type":"block","result_state":118}]}]}}]}},{"type":"condition","if_true":{"type":"vertical_gradient","false_at_and_above":{"absolute":8},"random_name":"minecraft:deepslate","true_at_and_below":{"absolute":0}},"then_run":{"type":"block","result_state":24905}}]},"biome_tree":{"order":6,"steps":[1555,259,43,7,1,0],"params":[[-12000,-10500],[-12000,-4550],[-12000,10000],[-10500,-4550],[-10500,-1900],[-10500,10000],[-10000,-9333],[-10000,-7799],[-10000,-7666],[-10000,-5666],[-10000,-4500],[-10000,-4000],[-10000,-3750],[-10000,-3500],[-10000,-2666],[-10000,-2225],[-10000,-1500],[-10000,-1000],[-10000,-500],[-10000,500],[-10000,1000],[-10000,2000],[-10000,2666],[-10000,3000],[-10000,4000],[-10000,5500],[-10000,5666],[-10000,9333],[-10000,10000],[-9333,-7666],[-9333,-5666],[-9333,-4000],[-9333,-2666],[-9333,2666],[-9333,4000],[-9333,5666],[-9333,10000],[-7799,-3750],[-7799,-2225],[-7666,-5666],[-7666,-4000],[-7666,-2666],[-7666,-500],[-7666,500],[-7666,4000],[-7666,5666],[-5666,-4000],[-5666,-2666],[-5666,-500],[-5666,500],[-5666,2666],[-5666,4000],[-5666,5666],[-5666,7666],[-4550,-1900],[-4500,-1500],[-4500,2000],[-4500,5500],[-4500,10000],[-4000,-2666],[-4000,-500],[-4000,2666],[-4000,4000],[-4000,5666],[-4000,9333],[-4000,10000],[-3750,-2225],[-3750,500],[-3750,5500],[-3500,-1000],[-3500,1000],[-3500,3000],[-3500,10000],[-2666,-500],[-2666,500],[-2666,2666],[-2666,4000],[-2666,5666],[-2666,9333],[-2666,10000],[-2225,500],[-2225,4500],[-1900,-1100],[-1900,300],[-1900,3000],[-1900,10000],[-1500,2000],[-1500,5500],[-1500,10000],[-1100,300],[-1100,3000],[-1100,10000],[-1000,1000],[-1000,3000],[-1000,10000],[-500,500],[-500,2666],[0,0],[0,10000],[0,11000],[300,3000],[300,10000],[500,2666],[500,4000],[500,4500],[500,5500],[500,5666],[500,7666],[500,9333],[500,10000],[1000,3000],[1000,10000],[2000,5500],[2000,9000],[2000,10000],[2666,4000],[2666,5666],[2666,7666],[2666,9333],[2666,10000],[3000,10000],[4000,5666],[4000,7666],[4000,9333],[4000,10000],[4500,5500],[4500,10000],[5500,10000],[5666,7666],[5666,9333],[5666,10000],[7000,10000],[7666,9333],[7666,10000],[8000,10000],[9333,10000],[10000,10000],[10000,11000],[11000,11000]],"nodes":["388545850204513","594157655694364","875632632405020","1157107609312284","1488061503509590","18375611586926763094","18375611586926757206","18375611586926742870","18375611754430487638","18375611754430481750","18375611754430467414","3458386340486231","18375611586926767702","18375611586926770262","18375611586926742896","18375611754430492246","18375611754430494806","18375611754430467440","5428711177471856","18375611586926763120","18375611586926767728","18375611586926757232","18375611754430487664","18375611754430492272","18375611754430481776","7349557096946704","18380910132569971722","18381546750475574282","18377813907822812170","18380910300073696266","18375611754430494775","18377814075326536714","9369360851410034","18378707811670574463","18375611586926770288","18378707811670560127","18378707979174299007","18375611754430494832","18378707979174284671","11339685688401535","18378707811670580351","18378707811670584959","18378707811670587519","18378707979174304895","18378707979174309503","18378707979174312063","13260531607673884","13542006586088476","18386050350102944826","18383162001101456156","18378939876457716764","18386050517606669370","18381546917979298826","18375643640267672887","15593691881282576","18387183946809105418","18387183946809110026","18387183946809099530","18375643472763948343","18387183946809112586","18387183946809085194","17564021013224464","18375643472763962679","18387184114312829962","18387184114312834570","18387184114312824074","18387184114312837130","18387184114312809738","19452981098716218","18382880457406946416","18390761756754844799","18384569474770934870","18376406700446325815","18382880624910670960","18390761924258569343","21423305932414010","18384569307267210326","18376406532942601271","18378377025279958102","18377251125373115447","18378095550303247472","18390761924255227007","23393630769191964","18378376857776233558","18377250957869390903","18384006357310250012","18378095382799522928","18390761756751502463","18384006524813974556","25445320361122874","25726791042866232","18375643472763968598","18375643472763962710","18375643472763968567","18375643472763973175","18375643472763948374","18375643472763975735","27697115879840855","18375643472763973206","18375643472763968624","18375643472763973232","18375643472763962736","18375643472763975766","18375643472763948400","29667440716815474","18378739697507785855","18378739697507790463","18378739697507779967","18375643472763975792","18378739697507793023","18378739697507765631","31637933057514552","18375643640267687254","18375643640267693111","18375643640267697719","18375643640267687223","18375643640267672918","18375643640267700279","33608257894489175","18375643640267693142","18375643640267697750","18375643640267693168","18375643640267687280","18375643640267700310","18375643640267672944","35578582731463794","18375643640267697776","18378739865011510399","18378739865011515007","18378739865011504511","18375643640267700336","18378739865011490175","37456385383144476","37798333499197495","18375611586926763063","18375611586926767671","18375611586926770231","18375611754430487607","18375611754430492215","18375611754430481719","39768658336160784","18375611586926757175","18375611586926742839","18387152060971907082","18387152228475629066","18375611754430467383","18387152228475631626","41738983173134090","18387152060971899914","18387152060971904522","18387152060971894026","18387152228475624458","18387152228475618570","18387152228475604234","43648830575811612","18387152060971879690","18387385157823061002","18387385157823055114","18378634144777402495","18387385157823040778","18378634144777992319","45605961659128946","18375537920033582704","18382574794451938928","18375537920033585264","18382574794451941488","18378634144777375103","18378634144777964927","47576286496114559","18378634144777395327","18378634144777399935","18378634144777389439","18378634144777985151","18378634144777989759","18378634144777979263","49660028148587578","49970090410859578","18380746473715489878","18385813023296281712","18380746473716669526","18380746473716669495","18378776148878515327","18385813023297461360","51940415247834426","18384968598366154326","18390035147946946103","18388627773063392880","18390035147948125751","18378776148878519935","18374835499205745791","53910740084802904","18385813023296275798","18386375973249697136","18385813023297455446","18378776148878509439","18386375973250876784","18380183523763242367","55852477636243258","18384968598367333974","18377087299018258518","18378739865011517567","18385250073342867511","18388627773064572528","18392568422738521727","57851389758765114","18375116974181283952","18377087299019438166","18385250073344047159","18378776148878522495","18375116974182463600","18392568422738524287","59821714595712344","18389472197993499990","18386375973249682800","18389472197994679638","18378776148878495103","18386375973250862448","18380183523763228031","61650035331636249","61931510308363862","18375537920033578070","18375537920033582678","18380604469614959702","18375819395010883158","18375537920033585238","18376945294917728342","63901835145321528","18375537920033572182","18385671019195745622","18375537920033557846","18375537920033585207","18380322994638228822","18385389544219047991","65872159982307127","18375537920033578039","18375537920033582647","18375537920033572151","18380604469614959671","18389893143846415927","18385671019195745591","67842484819268720","18375537920033578096","18375537920033572208","18380604469614959728","18386233969149166960","18375537920033557872","18386233969149152624","69812809656245264","18387078394078719498","18375537920033557815","18387922819009441290","18385671019195731255","18387078394078722058","18389893143846418442","71783134493217802","18387078394078714890","18387078394078709002","18387359869056015370","18387359869056009482","18387078394078694666","18387359869055995146","73777652478319644","74056928431774745","74316576384685910","18380604636715506774","18375819562111430230","18385671186296292694","18380604636716686422","18385671186297472342","18380323161739955542","76308728245460024","18385234512677468215","18383827137795223095","18385234512678778935","18380323161738775894","18385389711319595063","18385389711320774711","78257226058636375","18386234136249714032","18375819562112609878","18376945462018275414","18386234136249699696","18376945462019455062","18386234136250879344","80227550895621943","18380604636715506743","18389893310946962999","18385671186296292663","18380604636716686391","18389893310948142647","18385671186297472311","82197875732585488","18387922986109988362","18385671186296278327","18387922986111168010","18389893310946965514","18385671186297457975","18389893310948145162","84168200569558026","18387360036156562442","18387360036156556554","18387360036157742090","18387360036157736202","18387360036156542218","18387360036157721866","86265901252680732","86546276717761622","18380730913050090582","18385797462630876502","18380730913051401302","18389456637328100694","18376227313424024918","18376227313424010582","88516601554738263","18384953037700755030","18377071738352859222","18375945838447324758","18386360412584283504","18377071738354169942","18386641887562304880","90486926391723888","18385797462630882416","18388612212397993584","18386360412584297840","18380730913051401328","18380730913051405936","18386641887562319216","92457251228687474","18380167963096663423","18375101413515884656","18380167963096649087","18380167963097974143","18382701237888383088","18380167963097959807","94435272647054346","18388056959025961994","18387494009072534794","18387494009073851402","18382145984515017994","18387494009073845514","18382145984516328714","96397900902653567","18374819938539166847","18392552862071942783","18374819938540477567","18392552862071945343","18392552862073253503","18392552862073256063","98375922321005596","98657397297733206","18380738609631485014","18384960734282149462","18380738609632795734","18377079434934253654","18375953535028719190","18377079434935564374","100627722134690872","18385805159212270934","18389464333909495126","18376235010005419350","18385242209258862647","18376235010005405014","18385242209260173367","102598046971676471","18380738609631484983","18390027283862941239","18385805159212270903","18383834834376612919","18383834834376617527","18383834834376607031","104568371808638064","18385805159212276848","18386368109165692272","18380738609632795760","18386368109165677936","18386649584143713648","18386649584143699312","106538696645614608","18388056959025966602","18385805159212256567","18390027283862943754","18388056959027277322","18376235010005404983","18388056959027279882","108509021482589298","18388619908979388016","18375109110097279088","18380738609632800368","18380175659678043519","18382708934469777520","18380175659679354239","110480445831191580","110765219342785592","18385809557258782038","18389468731956006230","18376239408051930454","18385246607305373751","18376239408051916118","18385246607306684471","112735544179771191","18380743007677996087","18390031681909452343","18385809557258782007","18383839232423124023","18383839232423128631","18383839232423118135","114702570481862488","18380743007677996118","18384965132328660566","18380743007679306838","18375957933075230294","18380175659678057855","18380175659679368575","116676193853709328","18388061357072477706","18385809557258767671","18390031681909454858","18388061357073788426","18376239408051916087","18388061357073790986","118646518690681866","18388061357072473098","18387498407119045898","18387498407120362506","18382150382561529098","18387498407120356618","18382150382562839818","120612445481164415","18374827635120561279","18392560558653337215","18374827635121871999","18392560558653339775","18392560558654647935","18392560558654650495","122588267875212316","122869742851923001","18385812855792551223","18377083832980764758","18385812855793730871","18386372507212189040","18377083832982075478","18386653982190210416","124838968178329456","18385809557258787952","18388624307025899120","18386372507212203376","18380743007679306864","18380743007679311472","18386653982190224752","126812591549127696","18388064655606246922","18385812855792536887","18388064655607426570","18390034980443224074","18385812855793716535","18390034980444403722","128779617852267634","18380180057724568959","18375113508143790192","18380180057724554623","18380180057725879679","18382713332516288624","18380180057725865343","130753241223074826","18388064655606242314","18387501705652815114","18388064655607421962","18387501705653994762","18382153681095298314","18382153681096477962","132720267526233727","18374832033167072383","18392564956699848319","18374832033168383103","18392564956699850879","18392564956701159039","18392564956701161599","134693890897026106","134975365873734742","18380746306211765334","18385812855792551254","18380746306212944982","18385812855793730902","18389472030489775446","18389472030490955094","136945690710711383","18384968430862429782","18384968430863609430","18377087131514533974","18386375805745958256","18377087131515713622","18386375805747137904","138916015547702839","18380746306211765303","18390034980443221559","18380746306212944951","18390034980444401207","18385249905839142967","18385249905840322615","140886340384671600","18385812855792557168","18388627605559668336","18386375805745972592","18385812855793736816","18388627605560847984","18386375805747152240","142856665221635186","18378775981374784895","18375116806677559408","18380183356259517823","18378775981374770559","18375116806678739056","18380183356259503487","144826990058626687","18378775981374790783","18378775981374795391","18374835331702021247","18392568255234797183","18378775981374797951","18392568255234799743","146720516585364508","147060265678347320","147341740655074615","18390013157714390583","18390019754785271351","18390027451366665783","18390031849413176887","18383835001880337463","18383839399926848567","149312065493091896","18380731080553815095","18385791033064899926","18380738777135209527","18380724483484113975","18380743175181720631","18383827305298943031","151282390329004374","18385791033063720278","18385797630134601046","18385805326715995478","18385809724762506582","18376235177509129558","18376239575555640662","153252715166002999","18390013157715570231","18385228083110311991","18385234680181192759","18383827305298947639","18383835001880342071","18383839399926853175","155223040004028471","18385242376762587191","18385228083111491639","18385246774809098295","18385234680182503479","18385242376763897911","18385246774810409015","157193364839927126","18389450207760944470","18389456804831825238","18389464501413219670","18389450207762124118","18389468899459730774","18376227480927735126","159163689676905559","159445164653632598","18380724483482934358","18380731080553815126","18380738777135209558","18380724483484114006","18380743175181720662","18380731080555125846","161415489490607446","18384946608133598806","18384953205204479574","18384960901785874006","18384965299832385110","18380738777136520278","18380743175183031382","163385814327586646","18384946608134778454","18377065308785702998","18377071905856583766","18375946005951049302","18375953702532443734","18375958100578954838","165356139164537175","18386353983017141616","18376227480927749462","18376235177509143894","18376239575555654998","18386649751647423856","18386654149693934960","167326464002586710","18377079602437978198","18377065308786882646","18377084000484489302","18377071905857894486","18377079602439288918","18377084000485800022","169296788838485360","18386353983017127280","18386360580088008048","18386368276669402480","18386353983018306928","18386372674715913584","18386642055066029424","171268213187091472","171549688163813136","18380724483482934327","18380746473715489847","18383835001880331575","18383839399926842679","18388049429949607434","18388064823111151114","173520013001835831","18385797630134601015","18385805326715995447","18385791033064899895","18385809724762506551","18383827305298937143","18385813023297455415","175490337837748535","18385791033063720247","18385813023296275767","18376227480927735095","18376235177509129527","18385813023297441079","18376239575555640631","177460662674747146","18390013157714393098","18390019754785273866","18390027451366668298","18388057126531001866","18390035147946948618","18388061524577512970","179430987512772618","18390013157715572746","18390031849413179402","18388049429949609994","18388057126531004426","18390035147948128266","18388061524577515530","181401312348671287","18385791033063705911","18385797630134586679","18385805326715981111","18385791033064885559","18385809724762492215","18385813023296261431","183370537674022002","183652012650749040","18385791033063726192","18385797630134606960","18385805326716001392","18385791033064905840","18385809724762512496","18380731080555125872","185622337487723888","18388605782830837360","18388612379901718128","18388620076483112560","18388624474529623664","18380738777136520304","18380743175183031408","187592662325740912","18386368276669416816","18386353983018321264","18386372674715927920","18386642055066043760","18386649751647438192","18386654149693949296","189562987161677680","18388605782832017008","18375094983948728432","18375101581019609200","18380731080555130480","18380738777136524912","18380743175183036016","191533311998628210","18386360580088022384","18378754158645939583","18380168130600373631","18380175827181768063","18380161533530672511","18380180225228279167","193503636836677744","18375109277601003632","18375094983949908080","18375113675647514736","18382701405392107632","18382709101973502064","18382713500020013168","195475061184206602","195756536161983498","18388042832878590986","18388061524576197642","18387486479996181514","18387494176577575946","18388064823111146506","18387498574624087050","197726860997903882","18388042832877411338","18388049429948292106","18388057126529686538","18388064823109966858","18387494176577570058","18387498574624081162","199697185834888714","18388042832877415946","18388049429948296714","18388057126529691146","18388042832878595594","18388061524576202250","18388064823109971466","201667510672901386","18387486479994864906","18387494176576259338","18387479882925163786","18387498574622770442","18387486479996175626","18387501873157719306","203637835508814090","18387479882923984138","18387501873156539658","18382138455438658826","18382146152020053258","18382153848600202506","18382150550066564362","205608160345787658","18382131858366467338","18382138455437348106","18382146152018742538","18382131858367646986","18382150550065253642","18382153848599022858","207518012043238527","207858860648914047","18374820106042891391","18374827802624285823","18374813508973190271","18374832200670796927","18374820106044202111","18374827802625596543","209829185484840319","18378754158645964415","18392553029575667327","18392560726157061759","18392546432505966207","18392565124203572863","18374832200672107647","211799510321809023","18378754158645959807","18380161533530686847","18380180225228293503","18380168130601698687","18380175827183093119","18380180225229604223","213769835158770047","18378754158645953919","18380168130600387967","18380175827181782399","18380168130601684351","18380175827183078783","18380180225229589887","215740159995768703","18378754158645966975","18392553029575669887","18392553029576978047","18392560726157064319","18392560726158372479","18392565124204883583","217651111205894271","18392484859854813311","18392546432505968767","18392565124203575423","18392553029576980607","18392560726158375039","18392565124204886143","219566460460407836","219867726646418488","220149201624194134","18380648617181731926","18380640920600337494","18380662910832958550","18383744841926859862","18383737145345465430","18383726150229187670","222119526460114518","18380662910831778902","18380629925484059734","18385729460413744470","18383744841926853974","18383737145345459542","18383726150229181782","224089851297034040","18375877836227702358","18375863542577655382","18375855845996260950","18375844850879983190","18385447985435867191","18385415000088148023","226060176134050134","18385729460412564822","18385715166762517846","18385707470181123414","18385696475064845654","18383744841926839638","18383737145345445206","228030500972099639","18385433691785820215","18385425995204425783","18385447985437046839","18385433691787130935","18385425995205736503","18385415000089458743","230000825807998294","18380381435855048022","18380367142205001046","18380359445623606614","18380381435856227670","18380348450507328854","18383726150229167446","231951359435676759","232252625621708630","18375877836228882006","18377003736134547542","18383744841926864470","18383737145345470038","18376970750786828374","18383726150229192278","234222950459734102","18376989442484500566","18376981745903106134","18377003736135727190","18376989442485811286","18376981745904416854","18376970750788139094","236173484086353008","18380662910831778928","18380648617181731952","18380640920600337520","18380662910832958576","18380629925484059760","18380604636716686448","238143808923321968","18380604636715506800","18386292410367165808","18386559591693960560","18386551895112566128","18386234136250893680","18386540899996288368","240133924969582960","18386292410365986160","18386278116715939184","18386270420134544752","18386259425018266992","18386559591693946224","18386551895112551792","242104249806556528","18386292410365971824","18386278116715924848","18386270420134530416","18386292410367151472","18386259425018252656","18386540899996274032","244074574643534864","244356049621310519","18380648617181731895","18380640920600337463","18380662910832958519","18380648617183042615","18380640920601648183","18380629925485370423","246326374457230903","18380662910831778871","18380629925484059703","18385729460413744439","18383744841926853943","18383737145345459511","18383726150229181751","248296699294215735","18389951585063235127","18389937291413188151","18389929594831793719","18389951585064414775","18389918599715515959","18389918599716826679","250267024131166519","18385729460412564791","18385715166762517815","18385707470181123383","18385696475064845623","18383744841926839607","18383737145345445175","252237348969213712","18389937291414498871","18389929594833104439","18389951585064417290","18387966966577526794","18387959269996132362","18387948274879854602","254207673805114679","18385729460412550455","18385715166762503479","18385707470181109047","18385729460413730103","18385696475064831287","18383726150229167415","256158207432793202","256439682409514866","18382633235668758128","18380648617183042672","18382574961552486000","18380640920601648240","18380629925485370480","18374718950973130111","258410007247548016","18382618942018711152","18382611245437316720","18382633235669937776","18382600250321038960","18382574961553665648","18380629925485375088","260380332083474288","18382633235668760688","18380648617183047280","18382611245437319280","18380640920601652848","18382600250321041520","18382574961552488560","262350656920424831","18378692585994798463","18378634311878526335","18374751936322014591","18374737642672098687","18374729946090704255","18374718950974426495","264320981758474352","18382618942018713712","18382633235669940336","18382618942020024432","18382611245438630000","18382574961553668208","18382600250322352240","266291306594372991","18378692585994784127","18374737642670787967","18374729946089393535","18374718950973115775","18378634311878511999","18374693662205742463","268281422640651274","268562897618426890","18387404016622787594","18387396320041393162","18387418310274014218","18387404016624098314","18387396320042703882","18387385324926426122","270533222454347274","18387418310272834570","18387385324925115402","18387418310274008330","18387404016624092426","18387396320042697994","18387385324926420234","272503547291332106","18387981260226260490","18387966966576213514","18387959269994819082","18387981260227440138","18387948274878541322","18387948274879852042","274473872128282890","18387418310272828682","18387404016622781706","18387396320041387274","18387385324925109514","18387404016624078090","18387396320042683658","276444196965281546","18389951585063237642","18389937291413190666","18387966966577524234","18389929594831796234","18387959269996129802","18389918599715518474","278414521802231050","18387418310272814346","18387404016622767370","18387396320041372938","18387418310273993994","18387385324925095178","18387385324926405898","280365055429920895","280646530406636927","18374751936322034815","18374737642672118911","18378634311878536831","18374729946090724479","18374693662205762687","18374718950974446719","282616855243605631","18378692585994804351","18374737642670808191","18374729946089413759","18374718950973135999","18378634311878532223","18374737642672113023","284587180080590463","18378692585994808959","18392470566203584127","18392462869622189695","18392484859854810751","18392451874505911935","18392426585738538623","286557504918603135","18374737642670802303","18374729946089407871","18374751936322028927","18374729946090718591","18374693662205756799","18374718950974440831","288527829754539903","18378692585994811519","18392470566204894847","18392462869623500415","18392451874505914495","18378634311878539391","18392451874507222655","290494856057682047","18392470566203586687","18392462869622192255","18392470566204897407","18392462869623502975","18392426585738541183","18392451874507225215","292491402071579676","292772877048290360","293054352025017656","18375596194149850198","18380640753498283094","18390012990613450295","18380629758382005334","18389937124311133751","18390019587683216951","295043368559658326","18385744686474806614","18385776572312012118","18385790865962779990","18385729293312017750","18385714999660463446","18385797463032546646","296992802675691862","18375596194149844310","18380396661917289814","18389435747009236310","18385707303079069014","18380381268754500950","18385696307962791254","298963127512690487","18389966811125476919","18389998696962682423","18389951417962688055","18375596194149857335","18385425828102371383","18385414832986093623","300954343070595127","18385463211498108983","18385213622358603831","18385227916009371703","18385447818335320119","18385433524683765815","18385234513079138359","302905976209870166","18375596194149829974","18389450040660004182","18380366975102946646","18389456637729770838","18380359278521552214","18380348283405274454","304876301046848599","305176467721247830","18380678136894020694","18380710022731226198","18380724316381994070","18380662743731231830","18380648450079677526","18380730913451760726","307128100860554838","18375596194149854806","18384946441032658518","18375863375475600982","18384953038102425174","18375855678894206550","18375844683777928790","309096226674274134","18375893062289944150","18384932147381890646","18375877669127155286","18375596194149857366","18376981578801051734","18376970583684773974","311087442232178774","18377018962196789334","18377050848033994838","18377065141684762710","18377003569034000470","18376989275382446166","18377071738754529366","313036876348199280","18375596194149844336","18386307636428213616","18386339522265419120","18386270253032490352","18386292243265424752","18386259257916212592","315009400208428400","18375596194149830000","18386353815916186992","18386277949613870448","18386360412985953648","18386270253032476016","18386259257916198256","316979725045406736","317261200022133815","18375596194149850167","18380724316381994039","18380648450079677495","18380730913451760695","18380640753498283063","18380629758382005303","319229325835853111","18380678136894020663","18380710022731226167","18375596194149854775","18380662743731231799","18389929427729739319","18389918432613461559","321220541393749303","18385744686474806583","18385776572312012087","18385790865962779959","18385729293312017719","18385714999660463415","18385797463032546615","323169975509782839","18375596194149844279","18385744686474792247","18385776572311997751","18385707303079068983","18385729293312003383","18385696307962791223","325142499370011959","18375596194149829943","18385790865962765623","18385714999660449079","18385797463032532279","18385707303079054647","18385696307962776887","327131515904686090","18389966811125479434","18389998696962684938","18390012990613452810","18389951417962690570","18389937124311136266","18390019587683219466","329083149043965042","329364624020692080","18375596194149850224","18385790865962785904","18380648450079677552","18385797463032552560","18380640753498283120","18380629758382005360","331332749834411376","18380678136894020720","18385776572312018032","18375596194149854832","18380662743731231856","18382611078335262320","18382600083218984560","333323965392318064","18382648461730999920","18388591322079129200","18388605615729897072","18382633068568211056","18382618774916656752","18388612212799663728","335294290229282160","18386307636428227952","18386339522265433456","18386353815916201328","18386292243265439088","18386277949613884784","18386360412985967984","337244823856969840","18375596194149857392","18375094816847788144","18382633068568213616","18382618774916659312","18382611078335264880","18382600083218987120","339214049182293106","18382648461731002480","18375080523197020272","18378692418893647231","18378678125242682751","18378670428661288319","18378659433545010559","341186573042523146","341486739716922378","18387433536335076362","18388028372125703178","18388042665776471050","18387418143172287498","18387403849520733194","18388049262846237706","343449367972496906","18387136668194987018","18387433536335070474","18387465422172275978","18387418143172281610","18387396152939338762","18387486312892810506","345408697693203978","18387136668194991626","18388042665776475658","18387966799474159114","18388049262846242314","18387959102892764682","18387948107776486922","347388918134804746","18387136668194981130","18387479715823043850","18387403849520727306","18387433536335056138","18382117397614759178","18387396152939332874","349347148343897866","18387996486288502282","18388028372125707786","18387981093125713418","18387136668194994186","18389929427729741834","18389918432613464074","351330667320380682","18387136668194966794","18382131691265527050","18387418143172267274","18387403849520712970","18382138288335293706","18387396152939318538","353288897529453695","353570372506180735","18378692418893667455","18378753991545019519","18378692418894257279","18378678125242702975","18378670428661308543","18378659433545030783","355539597831527807","18378707812057046143","18378739697894251647","18378692418893672063","18378678125242707583","18378670428661313151","18378659433545035391","357522017296401791","18378707812057040255","18378739697894245759","18378753991545013631","18378692418894251391","18378678125242697087","18378670428661302655","359481347017085311","18378692418893661567","18378707812057025919","18378739697894231423","18378753991544999295","18378692418894237055","18378659433545024895","361451671854083967","18378707812057050751","18378739697894256255","18378753991545024127","18378692418894261887","18378692418893674623","18378659433545037951","363432991807338623","18378707812057053311","18378739697894258815","18378753991545026687","18378692418894264447","18378678125242710143","18378670428661315711","365385728753212444","365694691520617500","366050928993049714","18378760588614786175","18378760588614790783","18378760588614780287","18375101413917554800","18378760588614793343","18378760588614765951","367946491334302741","18388056959427632138","18387494009474204938","18389937291814858295","18382145984916688138","18380367142606671190","18385433692187490359","369923576449818122","18387136835698711562","18387136835698716170","18387418310676012042","18387981260629437962","18387136835698718730","18389951585466415114","371880707147242524","18387136835698705674","18387418310676006154","18378678292746432127","18387136835698691338","18387418310675991818","18378678292746434687","373849932472589399","18380648617583402070","18375863542979325526","18385715167164187990","18386278117117609328","18376989442886170710","18386278117117594992","375820257309564018","18380648617583402096","18382618942420381296","18378678292746427519","18378678292746421631","18382618942420383856","18378678292746407295","377774089472121884","378064360541854807","18380640921002007638","18375855846397931094","18385707470582793558","18376981746304776278","18380359446025276758","18386270420536200560","380035784890468407","18380648617583402039","18380640921002007607","18385715167164187959","18389929595233463863","18385707470582793527","18385425995606095927","382006109727431696","18387966966977883658","18385715167164173623","18387959270396489226","18385707470582779191","18389937291814860810","18389929595233466378","383975335052778610","18380640921002007664","18382611245838986864","18386270420536214896","18378670596165027199","18382611245838989424","18378670596165012863","385946759401378826","18387404017024457738","18387396320443063306","18387404017024451850","18387396320443057418","18387404017024437514","18387396320443043082","387906089122094719","18378670596165033087","18378659601048755327","18378670596165037695","18378659601048759935","18378670596165040255","18378659601048762495","389985098106477596","390266573083204885","18380743008079666262","18384960734683819606","18380743008079666231","18390027284264611383","18388061357474143242","18388056959427636746","392236897920173626","18380738610033155158","18380738610033155127","18385805159613946992","18385809557660452182","18385809557660452151","18378768285196180607","394207222757134620","18385805159613941078","18385805159613941047","18386368109567362416","18389468732357676374","18378768285196174719","18387498407520716042","396177547594133276","18384965132730330710","18388619909381058160","18390031682311122487","18378768285196185215","18388061357474147850","18390027284264613898","398147872431110172","18377079435335923798","18385242209660532791","18375109110498949232","18385246607707043895","18378768285196187775","18390031682311125002","400118197268057372","18389464334311165270","18385805159613926711","18386368109567348080","18385809557660437815","18378768285196160383","18382150382963199242","402092920151546908","402376594151513144","18385812856195335510","18380746306614549559","18390034980846005815","18385812856195335479","18389472030892559702","18385249906241927223","404344719965232215","18380746306614549590","18384968431265214038","18377083833382434902","18377087131917318230","18386372507613859184","18386375806148742512","406315044802217840","18385809557660458096","18385812856195341424","18388624307427569264","18386372507613873520","18388627605962452592","18386375806148756848","408287568662436880","18388064656009026570","18388064656009031178","18387501706055599370","18385812856195321143","18390034980846008330","18382153681498082570","410255694476156018","18378772683242685823","18375113508545460336","18378775981777569151","18375116807080343664","18378772683242671487","18378775981777554815","412226019313147519","18378772683242691711","18378775981777575039","18378772683242696319","18378775981777579647","18378772683242698879","18378775981777582207","414059072700357660","414363637421251640","18385696475466515798","18380629925885729847","18389918600117186103","18385696475466515767","18380348450908998998","18385415000489818167","416333962258226263","18380629925885729878","18375844851281653334","18380629925885729904","18386259425419937136","18376970751188498518","18386259425419922800","418281197351038832","18375538087537307248","18382600250722709104","18382574961955663472","18375538087537309808","18382600250722711664","18382574961955666032","420274611932175376","18387385325326785546","18387948275280211466","18387385325326779658","18385696475466501431","18389918600117188618","18387385325326765322","422219648001728127","18378634312281119871","18378634312281124479","18378634312281709695","18378634312281714303","18378634312281127039","18378634312281716863","424192171861938559","18378634312281113983","18378659601048749439","18378634312281703807","18378634312281099647","18378659601048735103","18378634312281689471","426160297675660313","426441772652387926","18375538087537302614","18375538087537307222","18380604637118684246","18375819562514607702","18375538087537309782","18376945462421452886","428412097489345592","18375538087537296726","18385671186699470166","18375538087537282390","18375538087537309751","18380323162141953366","18385389711722772535","430382422326331191","18375538087537302583","18375538087537307191","18375538087537296695","18380604637118684215","18389893311350140471","18385671186699470135","432352747163292784","18375538087537302640","18375538087537296752","18380604637118684272","18386234136652891504","18375538087537282416","18386234136652877168","434323072000269328","18387078561582444042","18375538087537282359","18387922986513165834","18385671186699455799","18387078561582446602","18389893311350142986","436293396837241866","18387078561582439434","18387078561582433546","18387360036559739914","18387360036559734026","18387078561582419210","18387360036559719690","438287747100515356","438594506549697564","438874882014780472","439156356991507542","18380678136273132630","18380710022110338134","18380662743328054358","18380648449458789462","18380648449678007382","18380678136273919062","441126681828869462","18385776571691124054","18385714999258793302","18385744685854704982","18385776571691910486","18385729292910019926","18383744674423129430","443097006665457208","18380710022111124566","18380662743329234006","18383744674423135318","18385463210877220919","18385447817932142647","18385433524062877751","445067331502412118","18385744685853918550","18385729292908840278","18385714999039575382","18389435746389134678","18380381268352503126","18383744674423115094","447037656339806263","18385213621737715767","18385433524282095671","18385463210878007351","18385213621738502199","18385447817933322295","18385433524283406391","449007981176360278","18380396661296401750","18389435746388348246","18380381268351323478","18380366974482058582","18380366974701276502","18380396661297188182","450978306013338711","451259780990070358","18375893061669056086","18384932146761002582","18375877668723977814","18375863374854712918","18375863375073930838","18375893061669842518","453230105827045206","18377018961575901270","18384932146761789014","18375877668725157462","18377003568630822998","18376989274761558102","18383744674423139926","455200430664415318","18377050847413106774","18376989274980776022","18377018961576687702","18377050847413893206","18377003568632002646","18376989274982086742","457170755501376880","18386339521644545392","18386277949212214640","18386307635808126320","18386339521645331824","18386292242863441264","18386559424190236016","459141080337944944","18386307635807339888","18386292242862261616","18386277948992996720","18386339521645317488","18386292242863426928","18386559424190221680","461111405174918512","18386307635807325552","18386339521644531056","18386292242862247280","18386277948992982384","18386277949212200304","18386307635808111984","463081730011896848","463390692779693879","18380678136273132599","18389966810504588855","18380678136273919031","18389966810505375287","18385776571691109687","18385776571691896119","465390704430630711","18380710022110338103","18389998696341794359","18385776571691124023","18380710022111124535","18389998696342580791","18385776571691910455","467314849778833207","18385744685853918519","18389951417559510583","18385744685853904183","18385744685854704951","18389951417560690231","18385744685854690615","469284075322283063","18380662743328054327","18385729292908840247","18380662743329233975","18385729292910019895","18385729292908825911","18385729292910005559","471241205801639440","18380648449678007351","18389937123690245687","18389937123909463607","18380648449679318071","18389937123910774327","18389951417560692746","473210431126967351","18380648449458789431","18385714999039575351","18385714999258793271","18385714999258778935","18383744674423129399","18383744674423115063","475185154010455154","475466628987575408","18385776571691129968","18380648449678007408","18380678136273919088","18385776571691916400","18380662743329234032","18380648449679318128","477436953824161392","18382648461110111856","18388591321458241136","18382633068165033584","18382618774295768688","18382618774514986608","18382648461110898288","479407278661112946","18380678136273132656","18380662743328054384","18380648449458789488","18380147072157683071","18374751768818290047","18374737475168374143","481377603498110832","18382648461110114416","18388591321459027568","18382633068166213232","18382633068165036144","18382618774295771248","18380648449679322736","483347928335480944","18375080522576132208","18382618774514989168","18382648461110900848","18375080522576918640","18382633068166215792","18382618774516299888","485318253172034943","18378707811436137855","18378739697273343359","18378692418491059583","18378678124621794687","18374737475167063423","18374767161762975103","487301772148546570","487583247125666826","18387433535714188298","18388028371504815114","18387433535714974730","18388028371505601546","18387418142770289674","18388042665374866442","489553571962242570","18387418142769110026","18388042665373686794","18387433535714968842","18387465421552174346","18387418142770283786","18387479715421439242","491523896799227402","18387996485667614218","18388028371504819722","18387981092722535946","18388042665373691402","18387996485668400650","18388028371505606154","493494221636178186","18387433535714182410","18387465421551387914","18387418142769104138","18387479715420259594","18387418142770269450","18382131690863922442","495463446961549066","18389966810504591370","18389998696341796874","18387981092723715594","18389951417559513098","18389966810505377802","18389998696342583306","497434871310126346","18387433535714168074","18382117396993871114","18387418142769089802","18382131690862742794","18387433535714954506","18382117396994657546","499392002007582847","499700964775381119","18378707811436162687","18378739697273357695","18378707811436165247","18392500085295771263","18380147072157697407","18392500085295773823","501700976426311295","18378739697273363583","18378739697273368191","18374799047600200831","18378739697273370751","18392531971132976767","18392531971132979327","503625121774520447","18378707811436158079","18378707811436152191","18374767161762995327","18374767161762989439","18378692418491086975","18392484692351088767","505594347317970815","18378692418491079807","18378692418491084415","18378692418491073919","18374751768818310271","18392484692351086207","18374751768818304383","507550378285680255","18378678124621814911","18374737475167083647","18378678124621809023","18374737475167077759","18374737475168394367","18374737475168388479","509520703122665343","18378678124621819519","18392470398699859583","18378678124621822079","18392470398699862143","18392470398701170303","18392470398701172863","511452545052646428","511731821006101560","512013295982809430","18385707302458180950","18385696307341903190","18385696307561121110","18385671018792568150","18383736977841720662","18383725982725442902","513983620819782998","18380359277900664150","18380359278119882070","18380348282784386390","18380348283003604310","18380322994235051350","18380322994236230998","515953945656777783","18380640752877394999","18380640753096612919","18380629757761117239","18380629757980335159","18380604469211782199","18380604469212961847","517924270493752631","18389929427108851255","18389918431992573495","18389918432211791415","18389893143443238455","18380640753097923639","18380629757981645879","519894595330731831","18389929427328069175","18385425827481483319","18389929427329379895","18385414832365205559","18389893143444418103","18389918432213102135","521864920385812535","18385425827700701239","18385414832584423479","18385389543815870519","18385425827702011959","18385389543817050167","18385414832585734199","523835245004659799","524116719981386838","18380640752877395030","18380640753096612950","18380629757761117270","18380629757980335190","18380604469211782230","18380604469212961878","526087044818361686","18375855678273318486","18375844683157040726","18375844683376258646","18375819394607705686","18383736977841740886","18383725982725463126","528057369655340886","18375855678492536406","18376981578180163670","18383736977841745494","18376970583063885910","18375819394608885334","18383725982725467734","530027694711443799","18385707302677398870","18383736977841734998","18385671018793747798","18383725982725457238","18386551727608827248","18386540732492549488","531998019547396182","18376981578399381590","18376970583283103830","18376945294514550870","18376981578400692310","18376945294515730518","18376970583284414550","533968344166239600","18386270252411587952","18386270252630805872","18386259257295310192","18386259257514528112","18386233968745975152","18386233968747154800","535940868026473488","536220144198043408","18385707302677398839","18385696307561121079","18383736977841734967","18387922818606263818","18385671018793747767","18383725982725457207","538192668059332106","18387966799072488970","18387959102491094538","18387948107374816778","18387959102492405258","18387922818607443466","18387948107376127498","540162992677154570","18389937123690248202","18387966799073799690","18389929427108853770","18389918431992576010","18389918432211793930","18389893143443240970","542131118490849591","18385707302458180919","18385696307341903159","18385671018792568119","18383736977841720631","18385671018793733431","18383725982725442871","544103642570258442","18389937123909466122","18389929427328071690","18387966799073802250","18387959102492407818","18389893143444420618","18387948107376130058","546073967187987767","18385714999039561015","18385707302458166583","18385707302677384503","18385696307341888823","18385696307561106743","18385671018792553783","548042093001776242","548323567978503280","18380640752877395056","18380640753096612976","18380629757761117296","18380629757980335216","18380604469211782256","18380604469212961904","550293892815478128","18382611077714374256","18382600082598096496","18382600082817314416","18382574794048761456","18380640753097923696","18380629757981645936","552264217870550384","18386270252630820208","18386259257514542448","18386233968745989488","18386551727608841584","18386233968747169136","18386540732492563824","554234542489342322","18386270252411602288","18386259257295324528","18378670428040400255","18378659432924122495","18374718783469391231","18378634144374787455","556204867326406512","18382611077933592176","18382611077714376816","18380640753097928304","18382600082598099056","18382574794049941104","18380629757981650544","558175192381487216","18382611077933594736","18382600082817316976","18382574794048764016","18382611077934905456","18382574794049943664","18382600082818627696","560147716023588618","560425892683453450","18387385157421390858","18387359868652837898","18387385157421384970","18387359868652832010","18387385157421370634","18387359868652817674","562431401674348298","18387403848899845130","18387396152318450698","18387966798853271050","18387403848899839242","18387959102271876618","18387403848899824906","564390731395045130","18387385157202172938","18387396152318444810","18387948107155598858","18387385157202167050","18387396152318430474","18387385157202152714","566372051567514634","18387403849119063050","18387396152537668618","18387403849119057162","18387396152537662730","18387403849119042826","18387396152537648394","568307192032465930","18387359868654017546","18387385157422701578","18387359868654011658","18387385157422695690","18387359868653997322","18387385157422681354","570312701242774538","18387403849120373770","18387396152538979338","18387403849120367882","18387396152538973450","18387403849120353546","18387396152538959114","572248940998892671","572530415975619711","18378670428040420479","18374729778585689215","18378659432924142719","18374718783469411455","18378634144374807679","18374693494702038143","574500740812594559","18378670428040425087","18378659432924147327","18392451707002187391","18378634144374812287","18374729778586999935","18374718783470722175","576471065867666815","18374729778585683327","18374718783469405567","18378634144374801791","18374729778586994047","18374693494702032255","18374718783470716287","578441390486524287","18378670428040414591","18378659432924136831","18374729778585668991","18374729778586979711","18374693494702017919","18374718783470701951","580411715323522943","18392462702118465151","18378670428040427647","18392462702119775871","18378659432924149887","18392426418234814079","18392451707003498111","582382040378603647","18392462702118467711","18392451707002189951","18378634144374814847","18392462702119778431","18392426418234816639","18392451707003500671","584373260013345820","584650336943545369","584931811920272726","18384946440629874262","18380724315980389462","18380604636481018966","18380604636481739862","18375819561876942422","18383700861226867798","587002188238494776","18380724315979209814","18385790865559995734","18385790865561175382","18389450040257219926","18389450040258399574","18385227915607767095","588852833577278551","18375819561877663318","18376945461783787606","18376945461784508502","18383700861226872406","18386234136015211888","18376945461785819222","590942837912455223","18380724315979209783","18390012990210666039","18380724315980389431","18390012990211845687","18385227915606587447","18385790865561175351","592793483251225712","18380604636481018992","18386234136015226224","18386234136015947120","18386234136015932784","18386515610993968496","18386515610993954160","594883487586393104","18385790865559995703","18385790865559981367","18388042665374871050","18390012990210668554","18385790865561161015","18390012990211848202","596854911716891676","597136386693602329","18384946440631053910","18377065141281978454","18386353815513402736","18377065141283158102","18386353815514582384","18390019587062331402","599105612237064048","18385790865560001648","18388605615327112816","18386353815513417072","18385790865561181296","18388605615328292464","18386353815514596720","601075937074027634","18378753991142229375","18375094816445003888","18380161366026962303","18378753991142215039","18375094816446183536","18380161366026947967","603052858762681610","18388049262225349642","18388049262444567562","18388049262225354250","18388049262444572170","18387486312492456970","18388049262445882890","605023183599636746","18387486312271922442","18387486312491140362","18382138287714405642","18382138287933623562","18387486312492451082","18382138287934934282","606986911584968319","18378753991142235263","18378753991142239871","18374813341469465727","18392546265002241663","18378753991142242431","18392546265002244223","608964932785216540","609245308250233912","18380730912830872662","18385797462411658582","18390019587062328887","18390019587281546807","18389456637108882774","18385234512458250295","611215633087142999","18384953037481537110","18385797462411664496","18388612212178775664","18386360412365079920","18377071738133641302","18386360412365065584","613187057435887159","18380730912830872631","18380730913050090551","18385797462630876471","18385805158993052983","18383827137795218487","18383827137795212599","615157382272850960","18385797462411658551","18385797462411644215","18385797462630862135","18385805158993038647","18376227313424010551","18388049262445885450","617126607598066802","18378760587993898111","18378760587993902719","18378760587993892223","18375101413296666736","18378760587993905279","18378760587993877887","619098031946734602","18388056958806744074","18388056958806748682","18387494008853316874","18390019587281549322","18390027283643725834","18382145984295800074","621076053365038108","621357528341748792","18380738609412267094","18385805158993053014","18385809557039564118","18389464333690277206","18389468731736788310","18385246607086155831","623327853178723415","18380743007458778198","18384960734062931542","18384965132109442646","18377079434715035734","18377083832761546838","18386368108946460016","625298178015709239","18380738609412267063","18380743007458778167","18390027283643723319","18390031681690234423","18385809557039564087","18385242209039644727","627268502852671344","18385805158993058928","18385809557039570032","18388619908760170096","18386368108946474352","18386372506992985456","18386372506992971120","629242126224530448","18388061356853255178","18388061356853259786","18387498406899827978","18385809557039549751","18390031681690236938","18382150382342311178","631208053014994034","18378768284575292543","18378768284575297151","18378768284575286655","18375109109878061168","18378768284575299711","18378768284575272319","633183875410238578","633465350386965874","18388624306806681200","18388627605325180528","18378772682621808255","18378775981140307583","18380746305979309168","18374835331468385407","635435675223934578","18385812855558069360","18385812855558790256","18378772682621803647","18378775981140302975","18374835331467074687","18380183356025881983","637406000060908914","18386375805511484784","18386375805512205680","18378772682621797759","18378775981140297087","18380183356024571263","18386657280490227056","639376324897894258","18388627605325901424","18375113507924572272","18392568254999850623","18380746305979313776","18378772682621810815","18392568255001161343","641348848741742706","18375116806443071600","18375116806443792496","18378775981140310143","18392568254999853183","18382716630816290928","18392568255001163903","643316974571818354","18386375805512191344","18378772682621783423","18378775981140282751","18380183356024556927","18386657280490212720","18380183356025867647","645147828919409685","645429303896136720","18380604636481018935","18380604636481739831","18387360035922074634","18387360035922795530","18380604636483050551","18387360035924106250","647399628733115920","18389893310712475191","18389893310713196087","18387922985875500554","18387922985876221450","18389893310714506807","18387922985877532170","649369953570735381","18385671186062525782","18385671186062525751","18383700861226861910","18387360035922789642","18383700861226861879","18387360035924100362","651340278407041301","18385671186061804886","18385671186061804855","18387360035922068746","18383700861226847574","18383700861226847543","18387360035924086026","653310603244042256","18385389711085107255","18385389711085828151","18389893310712477706","18389893310713198602","18385389711087138871","18387922985877534730","655280928080923925","18380323161504288086","18380323161505008982","18385671186061790519","18385671186062511415","18387360035922054410","18387360035922775306","657313925097135132","657609693725400120","657891168702127446","18375893229172780630","18384932314264727126","18380678303777643606","18380710189614849110","18384946607899110998","18380724483250478166","659861493539096150","18380678303776857174","18380710189614062678","18380724483248446550","18380724483249167446","18385776739195635030","18376220883623101782","661831818376057174","18385744853357643094","18385776739194848598","18385791032829232470","18385791032829953366","18385744853358429526","18376220883623087446","663802143213055800","18384946607899831894","18375893229173567062","18384932314265513558","18377065308551215190","18375939408646401622","18385228082875824183","665772468050032695","18385463378380945463","18385213789241440311","18385228082876545079","18385463378381731895","18385213789242226743","18385228082877855799","667742792886979926","18380396828800126294","18389435913892072790","18389450207526456662","18389450207527177558","18380396828800912726","18389435913892859222","669697724561169495","669979199537890928","18380678303776857200","18385776739194854512","18380662910597291120","18385791032829238384","18386573885110240624","18386635457761396080","671949524374865264","18386307803311064432","18386339689148269936","18386292410132219248","18386353982783374704","18386307803311850864","18386339689149056368","673919849211846231","18377019129079625814","18377051014916831318","18380662910598012016","18385791032829959280","18380678303777643632","18385776739195640944","675890174048801136","18386292410131498352","18386353982782653808","18386307803311836528","18386339689149042032","18386573885110226288","18386635457761381744","677860498886457430","18377003735900780630","18377065308551936086","18377019129080412246","18377051014917617750","18377003735902091350","18377065308553246806","679830823722683760","18386307803311050096","18386339689148255600","18386292410131484016","18386353982782639472","18386292410132204912","18386353982783360368","681817641233751056","682098016699243831","18389966978008313399","18389998863845518903","18380678303777643575","18380710189614849079","18390013157479902775","18383820707994295351","684068341536212535","18380678303776857143","18380710189614062647","18380724483248446519","18380724483249167415","18385776739195634999","18383820707994289463","686039765884432144","18390013157480623671","18389966978009099831","18389998863846305335","18383820707994299959","18390013157479905290","18390019754566055946","688008991210148151","18385744853357643063","18385776739194848567","18385791032829232439","18385791032829953335","18385744853358429495","18376220883623087415","689979316047149066","18389966978008315914","18389998863845521418","18390013157480626186","18389966978009102346","18389998863846307850","18388042832644962314","691949640884096311","18385744853357628727","18385776739194834231","18385791032829218103","18385791032829938999","18385744853358415159","18385776739195620663","693904572558285938","694186047535007602","18382633235434270320","18388605782596349552","18378707978939876735","18378739864777082239","18380662910599322736","18380724483250478192","696156372371992176","18382648628613836400","18388591488961965680","18382633235434991216","18388605782597070448","18382648628614622832","18388591488962752112","698126697208967024","18382648628613838960","18375080690079856752","18382633235434272880","18375094983714240624","18380662910599327344","18380724483250482800","700097022045917567","18378692585760310655","18378754158411466111","18374767329266699647","18380147239661407615","18374751936088378751","18380161533297036671","702067346883573872","18382633235434993776","18375094983714961520","18382648628614625392","18375080690080643184","18382633235436304496","18382694808087459952","704037671719800191","18378707978939862399","18378739864777067903","18378692585760296319","18378754158411451775","18374751936087068031","18380161533295725951","706024489230866186","706304864696211210","18387433703217912842","18387996653171338762","18387433703217906954","18388042832642923530","18388042832642928138","18387433703217892618","708319169997903626","18388049429729074186","18387479882689496330","18388049429729078794","18387486479775646986","18382131858131979530","18382138455218130186","710275201184175882","18388028539008539658","18388028539008544266","18387465589055112458","18387479882690217226","18382117564497595658","18382131858132700426","712214739696293642","18387433703218699274","18387996653172125194","18387433703218693386","18387465589055898890","18387433703218679050","18382117564498382090","714215850858845962","18388028539009326090","18388028539009330698","18387479882691533834","18388042832644959754","18387479882691527946","18382131858134011146","716200469330204426","18388042832643644426","18388042832643649034","18387486479760055306","18388049429713481226","18387486479760049418","18382138455202532618","718111420555413631","718392895532063871","18378707978939882623","18378739864777088127","18378692585760316543","18378754158411471999","18374751936087088255","18374813508738243711","720363220369104255","18374767329266719871","18374799215103925375","18378692585760321151","18378754158411476607","18374751936088398975","18374813508739554431","722333545206083199","18378707978939887231","18378739864777092735","18392484859619864191","18392546432271019647","18392500252799495807","18392532138636701311","724303870043702655","18374751936087082367","18380161533295740287","18374767329266713983","18380147239661421951","18374751936088393087","18380161533297051007","726274194880032639","18378707978939889791","18378739864777095295","18378692585760323711","18378754158411479167","18392484859621174911","18392546432272330367","728244519717664895","18392484859619866751","18392546432271022207","18392500252799498367","18392532138636703871","18392484859621177471","18392546432272332927","730162067995434012","730463334181444664","730744809141781846","18385729460178077014","18385729460178797910","18383759135343134038","18383744841690727766","18383737145109333334","18383726149993055574","732715133995127126","18385715166543299926","18385707469961905494","18385696474845627734","18383759135343119702","18383744841690713430","18383737145109318998","734685458832100694","18380381435620560214","18380367141985783126","18380381435621281110","18380359445404388694","18380348450288110934","18383726149993041238","736655783669100087","18389951584828747319","18389937291193970231","18389951584829468215","18389929594612575799","18389918599496298039","18389918599480700471","738626108506074935","18385433691566602295","18389951584830778935","18389937291178372663","18385425994985207863","18389929594596978231","18385414999868930103","740596433326667831","18385447985201379383","18385447985202100279","18385447985203410999","18385433691551004727","18385425994969610295","18385414999853332535","742566758180002903","742848233156729942","18380662910597291094","18380648616962514006","18380662910598011990","18380640920381119574","18383737145109339222","18383726149993061462","744818557993704790","18375877835993214550","18375863542358437462","18375855845777043030","18383759135343139926","18375844850660765270","18383744841690733654","746787783319045719","18380629925264841814","18386278116496721264","18386270419915326832","18386259424799049072","18386551894876439920","18386540899760162160","748759207667658582","18375877835993935446","18383759135343144534","18383744841690738262","18383737145109343830","18376970750567610454","18383726149993066070","750729532504635478","18377003735900059734","18376989442265282646","18376981745683888214","18376989442249685078","18376981745668290646","18376970750552012886","752698757829954928","18386278116496706928","18386270419915312496","18386259424799034736","18386559591457820016","18386551894876425584","18386540899760147824","754670182178561040","754951657155288119","18380662910597291063","18380648616962513975","18380662910598011959","18380640920381119543","18380629925264841783","18380629925249244215","756921981975872823","18385729460178076983","18385729460178797879","18383759135343134007","18383744841690727735","18383737145109333303","18383726149993055543","758892306829237776","18380662910599322679","18380648616946916407","18380640920365521975","18389937291193972746","18389929594612578314","18389918599496300554","760862631666192695","18385715166543299895","18385707469961905463","18385696474845627703","18383759135343119671","18383744841690713399","18383737145109318967","762832956486809610","18389951584828749834","18389951584829470730","18387981259993806858","18387966966341400586","18387959269760006154","18387948274643728394","764803281340140855","18385729460178062647","18385715166543285559","18385729460178783543","18385707469961891127","18385696474845613367","18383726149993041207","766750516432936050","767031991409663088","18380648616962514032","18380648616946916464","18380604636481739888","18380640920365522032","18380629925249244272","18380604636483050608","769002316246642288","18382618941799493232","18382611245218098800","18382600250101821040","18382574961317998192","18382574961318719088","18380629925249248880","770972641083593842","18380640920381119600","18380629925264841840","18386559591457834352","18374737642435972479","18374729945854578047","18374693661972106623","772942965920591728","18382618941799495792","18380648616946921072","18382611245218101360","18380640920365526640","18382600250101823600","18380604636483055216","774913290741184624","18382618941783898224","18382574961318000752","18382574961318721648","18382611245202503792","18382600250086226032","18382574961320032368","776883615594515839","18378678292125519231","18378670595544124799","18378659600427847039","18378634311644024191","18374693661970795903","18374718950738300287","778877030175676170","779167301245277962","18387404016403569674","18387396319822175242","18387966966356995594","18387404016403563786","18387959269775601162","18387404016403549450","781126630965974794","18387385324705897482","18387396319822169354","18387948274659323402","18387385324705891594","18387396319822155018","18387385324705877258","783128841623919882","18387418310038346762","18387418310039067658","18387981259991772682","18387981259992493578","18387418310040378378","18387981259993804298","785099166460875018","18387418310038340874","18387418310039061770","18387418310038326538","18387418310039047434","18387418310040372490","18387418310040358154","787048600577578762","18387404016387972106","18387396319806577674","18387966966341398026","18387404016387966218","18387959269760003594","18387404016387951882","789007930298275594","18387385324690299914","18387396319806571786","18387948274643725834","18387385324690294026","18387396319806557450","18387385324690279690","790957364430063743","791270725243848831","18378678292125539455","18378678292125544063","18378678292125533567","18378670595544149631","18378678292125546623","18378670595544152191","793230054964545663","18378670595544145023","18378659600427867263","18378670595544139135","18378659600427871871","18378659600427861375","18378659600427874431","795211374902200447","18374737642435992703","18392470565968768639","18374737642435986815","18392462869387374207","18392470565968771199","18392462869387376767","797170704622897279","18374729945854598271","18374718950738320511","18374729945854592383","18392451874271096447","18374718950738314623","18392451874271099007","799114641180149375","18378634311644044415","18374693661970816127","18378634311644038527","18374693661970810239","18374693661972126847","18374693661972120959","801084966017134463","18378634311644049023","18392426585503592063","18378634311644051583","18392426585503594623","18392426585504902783","18392426585504905343","803185033242549276","803466508219259960","803747983195987030","18380731080334597206","18380738776915991638","18380743174962502742","18380731080318999638","18380746473481002070","18380746473481722966","805718308016571734","18376227480691623254","18385813023061787990","18385813023062508886","18376235177273017686","18376239575319528790","18376242873855657302","807688632869936696","18380738776900394070","18385234679961974839","18380743174946905174","18385242376543369271","18380746473483033686","18385246774589880375","809658957706891606","18385797629915383126","18385805326496777558","18385809724543288662","18376235177273003350","18376239575319514454","18376242873855642966","811629282527508535","18385234679946377271","18385250073108379703","18385250073109100599","18385242376527771703","18385246774574282807","18385250073110411319","813599607380839766","18389456804612607318","18389464501194001750","18389468899240512854","18376227480691608918","18389472197759012182","18389472197759733078","815569932217818199","815851407194549846","18384953204985261654","18384960901566656086","18384965299613167190","18375946005714923094","18384968598131666518","18384968598132387414","817821732031524694","18377071905637365846","18377079602218760278","18375953702296317526","18377084000265271382","18375958100342828630","18375961398878957142","819792056852117590","18377071905621768278","18377087298783770710","18377087298784491606","18377079602203162710","18377084000249673814","18377087298785802326","821762381689079152","18386642054829917552","18386375973015209328","18386375973015930224","18386649751411311984","18386654149457823088","18386657447993951600","823732706542424432","18386360579868804464","18386368276450198896","18386372674496710000","18386649751411297648","18386654149457808752","18386657447993937264","825703031379398000","18386360579868790128","18386368276450184560","18386372674496695664","18386642054829903216","18386375973015194992","18386375973015915888","827673356216375095","827952632169699127","18380731080334597175","18390019754566053431","18385797629915383095","18385805326496777527","18385797629915368759","18385805326496763191","829930653588068151","18380738776915991607","18380743174962502711","18390027451147447863","18390031849193958967","18385809724543288631","18385809724543274295","831893281828050743","18383827305062816823","18383827305062821431","18383827305062810935","18383835001644205367","18376227480691608887","18376235177273003319","833871303246419767","18383835001644211255","18383839399690722359","18383835001644215863","18383839399690726967","18383839399690716471","18376239575319514423","835848225152523575","18380746473481002039","18380746473481722935","18390035147712458295","18390035147713179191","18383842698226850871","18383842698226855479","837818549989478711","18385813023061787959","18385813023062508855","18385813023061773623","18385813023062494519","18383842698226844983","18376242873855642935","839776780214934642","840058255175277680","18380731080318999664","18385813023061793904","18385813023062514800","18380738776900394096","18380743174946905200","18380746473483033712","842028580028640880","18388612379682500208","18388620076263894640","18388624474310405744","18380731080319004272","18388627772828905072","18388627772829625968","843998904865592434","18385797629915389040","18385805326496783472","18385809724543294576","18380175826946952575","18380180224993463679","18380183523529592191","845969229702590320","18375101580800391280","18375109277381785712","18380738776900398704","18375113675428296816","18380743174946909808","18380746473483038320","847939554523183216","18382701405155981424","18375116973946796144","18375116973947517040","18382709101737375856","18382713499783886960","18382716798320015472","849909879376514431","18378760755497602431","18378768452078996863","18378772850125507967","18380168130365558143","18378776148644007295","18380183523528281471","851880204213492746","852168276259986698","18388057126310473226","18388061524356984330","18387494176341449738","18388064822875483658","18387498574387960842","18387501872924089354","854138601096955402","18388057126310468618","18388061524356979722","18388064822875479050","18388064822876199946","18387498574387954954","18387501872924083466","856108925933916426","18387494176357041418","18387498574403552522","18387501872922051850","18387501872922772746","18387494176341443850","18382153848366566666","858079250770915082","18390027451147450378","18388064822876204554","18388057126294875658","18390031849193961482","18388061524341386762","18388064822877515274","860042978521741322","18388049429713483786","18390035147712460810","18390035147713181706","18388057126294878218","18388061524341389322","18388064822877517834","862019900444839178","18382146151799524618","18382150549846035722","18382153848364535050","18382153848365255946","18382146151783927050","18382150549830438154","863983628212062335","864262904165386367","18378760755497622655","18378768452079017087","18378760755497627263","18378760755497616767","18378768452079011199","18378760755497629823","866240925583755391","18378772850125528191","18378768452079021695","18378772850125532799","18378772850125522303","18378768452079024255","18378772850125535359","868203553823737983","18374820105808075903","18374827802389470335","18392553029340851839","18380168130365572479","18380175826946966911","18392553029340854399","870181575242107007","18374832200435981439","18392560725922246271","18392565123968757375","18380180224993478015","18392560725922248831","18392565123968759935","872158497148192383","18378776148644027519","18374835498970799231","18378776148644021631","18380183523528295807","18374835498972109951","18380183523529606527","874128821985177471","18378776148644032127","18392568422503575167","18378776148644034687","18392568422503577727","18392568422504885887","18392568422504888447","875981336523119644","876286996796218396","876580566400834616","876862041377949014","18385744686826997078","18392250497128547670","18385729293664208214","18385744686827783510","18385776572664989014","18391921743152629078","878832366214517078","18375611587664954710","18392250497128088918","18375596194502165846","18380396662270266710","18389435747362213206","18391921743152614742","880802691051359574","18380396662269480278","18392250497128533334","18375611587664940374","18392250497128074582","18380381269106691414","18375596194502151510","882773015888358967","18389966811477667383","18389998697314872887","18375611587664965175","18389998697314414135","18389951418314878519","18375596194502176311","884743340725464887","18389966811478453815","18389998697315659319","18375611587664967735","18385213622710335543","18391358793199218231","18375596194502178871","886713665562834999","18385463211850299447","18385213622710794295","18385447818687510583","18385463211851085879","18385213622711580727","18391358793199220791","888683990399392855","888965465376513110","18380678137246211158","18392250497128553558","18380662744083422294","18380678137246997590","18380710023084203094","18391921743152634966","890935790212968022","18375893062642134614","18392250497128558166","18375611587664965206","18392250497128099414","18375877669479345750","18375596194502176342","892906115050050647","18375611587664960598","18392250497128094806","18375596194502171734","18386307636781190512","18386339522618396016","18386292243618401648","894876439887048534","18375893062642921046","18384932147734867542","18375611587664967766","18377050848385726550","18391358793199218262","18375596194502178902","896846764724418646","18377018962548979798","18377050848386185302","18377003569386190934","18377018962549766230","18377050848386971734","18391358793199220822","898817089560841584","18386307636780404080","18392250497128533360","18375611587664940400","18392250497128074608","18386292243617615216","18375596194502151536","900787414397950992","901068889374546999","18380678137246211127","18380710023083416631","18375611587664960567","18380710023082957879","18380662744083422263","18375596194502171703","903039214212039991","18385744686826997047","18385776572664202551","18385729293664208183","18385744686827783479","18385776572664988983","18391640268175918391","905009539048627728","18380678137246997559","18380710023084203063","18391921743152634935","18387152061710104586","18389998697314416650","18387136668547315722","906979863885582647","18375611587664954679","18385776572663743799","18375596194502165815","18385744686827769143","18385776572664974647","18391640268175904055","908950188722976778","18389966811477669898","18389998697314875402","18389951418314881034","18389966811478456330","18389998697315661834","18391358793199220746","910920513559399735","18385744686826982711","18385776572664188215","18375611587664940343","18385776572663729463","18385729293664193847","18375596194502151479","912890838396509298","913172313373105264","18380678137246211184","18392250497128553584","18375611587664960624","18392250497128094832","18380662744083422320","18375596194502171760","915142638210211184","18375611587664965232","18392250497128099440","18380678137246997616","18385776572664994928","18375596194502176368","18380662744084208752","917112963047583344","18382648462083190384","18392250497128558192","18382633068920401520","18382648462083976816","18388591322432106096","18382633068921187952","919083287884547440","18386307636780418416","18392250497128547696","18386292243617629552","18386307636781204848","18386339522618410352","18386292243618415984","921053612720984434","18375611587664954736","18392250497128088944","18375596194502165872","18378707812408757631","18378692419246427519","18378692419245968767","923022838046488688","18382648462083192944","18375611587664967792","18382633068920404080","18375596194502178928","18382648462083979376","18382633068921190512","924994262395066122","925275737371663370","18387433536687266826","18388028372477893642","18387152061710097418","18388028372477434890","18387418143524477962","18387136668547308554","927246062208769290","18387152061710102026","18388028372477439498","18387433536688053258","18388028372478680074","18387136668547313162","18391921743152634890","929216387046141450","18387996486640692746","18388028372477898250","18387981093477903882","18387996486641479178","18388028372478684682","18391358793199218186","931186711883105546","18387433536687260938","18387465422524466442","18387418143524472074","18387433536688047370","18387465422525252874","18391640268175918346","933157036719673610","18387152061710091530","18387465422524007690","18387136668547302666","18387433536688033034","18382117397967736074","18391640268175904010","935127361556516106","18387433536687246602","18382117397966949642","18387152061710077194","18382117397966490890","18387418143524457738","18387136668547288330","937083392742464639","937364867719191679","18378707812409236607","18378707812408777855","18378692419246447743","18378692419245988991","18378678125594893439","18378678125596073087","939335192556166527","18378707812408782463","18378692419246452351","18378707812410023039","18378692419245993599","18378678125594898047","18378692419247234175","941305517393134975","18378707812409230719","18378692419246441855","18378678125594887551","18378707812410017151","18378692419247228287","18378678125596067199","943275842230096255","18378707812408771967","18378692419245983103","18378707812409216383","18378707812410002815","18378692419247213951","18378678125596052863","945246167067094911","18378707812409241215","18378707812410027647","18378707812408785023","18378692419247238783","18378692419245996159","18378678125596077695","947216491904071807","18378707812409243775","18378692419246454911","18378678125594900607","18378707812410030207","18378692419247241343","18378678125596080255","949252787438689308","949545257531677752","949826732508399190","18392264790779255894","18392264790779708758","18391983315803784534","18392283482476987734","18391989912873551190","18391997609454945622","951797057345360214","18392264790779250006","18392271387849082198","18392279084430476630","18391989912873536854","18391997609454931286","18392002007501442390","953767382182333782","18392264790779694422","18392264790779235670","18392271387849067862","18392279084430462294","18391983315803770198","18392283482476973398","955737707019333175","18390012990966033975","18390012990965575223","18390019588035407415","18391434659500355127","18391420365850373687","18390031682663312951","957708031856308023","18385227916361496631","18391426962920140343","18385234513431328823","18391434659501534775","18391434659500357687","18391439057548045879","959678356693284919","18385227916361955383","18391420365850376247","18385246608059234359","18391426962920142903","18391434659501537335","18391439057548048439","961647582018608215","961929056995335510","18392264790779714646","18392264790779260502","18392271387849092694","18391983315803790422","18391989912873557078","18391997609454951510","963899381832304215","18392271387849088086","18392279084430482518","18392264790779255920","18392271387849088112","18386360413339338096","18386368109920732528","965869706669289302","18392264790779719254","18392279084430487126","18391420365850373718","18377065142036887638","18391426962920140374","18391434659501534806","967840031506239856","18392264790779708784","18392264790779250032","18392271387849082224","18392279084430476656","18386353816269571440","18386368109920718192","969810356343240790","18377065142037346390","18377071739106719830","18391434659500357718","18391420365850376278","18391426962920142934","18391434659501537366","971780681180188016","18392264790779694448","18392264790779235696","18392271387849067888","18392279084430462320","18386353816269557104","18386360413339323760","973752105528794128","974033580505521207","18380724316734577719","18380724316734118967","18380730913803951159","18391997609453771831","18391983315803790391","18380743008431856695","976003905342489911","18385790866315363639","18391701840827073847","18385809558012642615","18391708437896840503","18391716134478234935","18391720532524746039","977974230179470864","18391989912873557047","18391997609454951479","18392002007501462583","18390012990965577738","18390019588035409930","18391434659500357642","979944555016425783","18385790866314904887","18385797463384737079","18391716134477055287","18391708437896826167","18391716134478220599","18391720532524731703","981914879853426698","18390012990966036490","18391420365850376202","18390031682663315466","18391426962920142858","18391434659501537290","18391439057548048394","983885204690373943","18385790866315349303","18385790866314890551","18385797463384722743","18391716134477040951","18391701840827059511","18385809558012628279","985843434899446898","986135904992451952","18392264790779719280","18392264790779260528","18392271387849092720","18392279084430487152","18388605616083267184","18385805159967317104","988106229829420658","18392264790779714672","18392279084430482544","18385790866316156016","18385797463385922672","18392271387849082239","18392279084430476671","990065559550127984","18375080523548751984","18375094817199913072","18388612213153033840","18375101414269745264","18388619909734428272","18375109110851139696","992035884387078527","18392250497128088959","18392264790779250047","18378739698247208319","18378753991898369407","18378760588968136063","18378768285549530495","994006209224472688","18375080523549210736","18375094817200371824","18375080523549997168","18375094817201158256","18375101414270924912","18375109110852319344","995976534060895615","18392250497128533375","18392250497128074623","18392264790779694463","18392264790779235711","18392271387849067903","18392279084430462335","997958953525909258","998238229479233290","18388042666128595978","18388042666128600586","18387479716175168778","18387486313245000970","18382131691617651978","18382138288687484170","1000215151385974538","18388049263198428170","18391997609453771786","18388049263198432778","18391434659500355082","18391716134477055242","18391716134477040906","1002181078176438026","18387479716175627530","18388061357826333706","18382131691618110730","18388061357826338314","18387498407872906506","18382150383315389706","1004148104479053578","18388042666129054730","18388042666129059338","18391983315803790346","18391420365850373642","18391701840827073802","18391701840827059466","1006126125898077962","18391989912873557002","18391426962920140298","18391708437896840458","18391716134478234890","18391708437896826122","18391716134478220554","1008104147316446986","18391997609454951434","18392002007501462538","18391434659501534730","18391439057548045834","18391720532524745994","18391720532524731658","1010050282896574591","1010331757873159295","18392250497128553599","18392250497128094847","18392264790779714687","18392264790779255935","18392271387849088127","18392279084430482559","1012302082710265215","18392250497128099455","18378739698247228543","18392264790779260543","18378753991898389631","18378760588968156287","18378768285549550719","1014272407547244159","18392250497128558207","18392264790779719295","18392271387849092735","18378739698247233151","18392279084430487167","18378753991898394239","1016242732384601471","18392250497128547711","18392264790779708799","18378739698247222655","18378753991898383743","18378760588968150399","18378768285549544831","1018213057221193599","18378739698245990527","18378753991897151615","18378760588968160895","18378760588966983807","18378768285549555327","18378768285548378239","1020183382058563711","18378739698246449279","18378753991897610367","18378739698247235711","18378753991898396799","18378760588968163455","18378768285549557887","1022048153778854940","1022329628755565624","1022611103732286806","18385715000012653910","18391907449501467990","18385671019547936086","18391899752920073558","18391888757803795798","18391863469036356950","1024581428569248086","18391899752918893910","18385696308314981718","18375537920385893718","18391907449501453654","18391899752920059222","18391888757803781462","1026551753406221654","18380366975455137110","18391899752918879574","18380348283757464918","18380322994990419286","18375537920385879382","18391863469036342614","1028522078243221047","18389937124663324215","18391336802965483063","18389918432965652023","18389893144198606391","18375537920385904183","18391300519082946103","1030492403080195895","18391344499548057143","18391336802966662711","18391336802965485623","18391325807850384951","18385414833338284087","18375537920385906743","1032462727917172791","18385433525035956279","18391344499548059703","18385389544571238455","18391336802966665271","18391325807850387511","18391300519082948663","1034433052754123863","1034714527730850902","18380648450431867990","18391907449501473878","18380604469967150166","18391899752920079446","18391888757803801686","18391863469036362838","1036684852567830102","18375863375827791446","18391336802965483094","18375844684130119254","18375819395363073622","18375537920385904214","18391300519082946134","1038655177404781655","18391899752918899798","18380629758734195798","18375537920385899606","18386277949967240560","18386270253385846128","18386259258269568368","1040625502241779542","18391344499548057174","18391336802966662742","18391336802965485654","18391325807850384982","18376970584036964438","18375537920385906774","1042595827078756438","18376989275734636630","18391344499548059734","18376945295269918806","18391336802966665302","18391325807850387542","18391300519082948694","1044566151915703664","18386277949966060912","18386270253384666480","18386259258268388720","18386233969501343088","18375537920385879408","18386233969502129520","1046536476752693360","1046817951729409136","18380648450431868016","18380648450433047664","18380604469967150192","18380640753851653232","18380629758735375472","18380604469967936624","1048788276566378096","18380640753850473584","18380629758734195824","18375537920385899632","18386277949967254896","18386270253385860464","18386259258269582704","1050758601403362928","18382618775268847216","18382611078687452784","18382600083571175024","18382574794804129392","18375537920385904240","18382574794804915824","1052728926240327024","18386277949966075248","18386270253384680816","18386259258268403056","18386233969501357424","18375537920385893744","18386233969502143856","1054699251077312368","18382618775270026864","18382611078688632432","18382611078687455344","18382600083572354672","18382600083571177584","18375537920385906800","1056669575914289264","18382618775268849776","18382618775270029424","18382574794804131952","18382611078688634992","18382600083572357232","18382574794804918384","1058639900751240208","1058921375727967287","18380648450431867959","18391899752918899767","18380629758734195767","18380604469967150135","18375537920385899575","18391863469036362807","1060891700564935991","18385715000012653879","18391625974524757303","18385671019547936055","18391618277943362871","18391607282827085111","18391581994059646263","1062862025401916944","18391907449501473847","18391899752920079415","18391888757803801655","18391336802965485578","18389918432965654538","18387078394431043594","1064832350238871863","18391618277942183223","18385696308314981687","18375537920385893687","18391625974524742967","18391618277943348535","18391607282827070775","1066802675075872778","18389937124663326730","18391344499548059658","18389893144198608906","18391336802966665226","18391325807850387466","18391300519082948618","1068772999912820023","18385715000012639543","18391618277942168887","18385696308314967351","18385671019547921719","18375537920385879351","18391581994059631927","1070743324749797130","1071024799726525450","18387403849872923658","18391899752918899722","18387385158175251466","18387359869408205834","18387078394431036426","18391863469036362762","1072995124563500298","18391336802965483018","18391907449501473802","18387948108128677386","18391899752920079370","18387078394431041034","18391888757803801610","1074965449400479242","18387966799826349578","18391344499548057098","18387922819361631754","18391336802966662666","18391325807850384906","18391300519082946058","1076935774237443338","18387403849872917770","18391625974524757258","18387359869408199946","18391618277943362826","18391607282827085066","18391581994059646218","1078906099074404618","18391618277942183178","18387385158175245578","18387078394431030538","18391625974524742922","18391618277943348490","18391607282827070730","1080876423911378186","18387403849872903434","18391618277942168842","18387385158175231242","18387359869408185610","18387078394431016202","18391581994059631882","1082846748748356735","1083126024701828479","18378634145130175615","18378659433897225855","18378670429014678655","18378634145129721471","18378659433898400895","18378634145130962047","1085096349538797183","18378670429013499007","18378659433897221247","18378634145129716863","18378670429014672767","18378659433898395007","18378634145130956159","1087066674375758207","18378670429013493119","18378659433897215359","18378634145130169727","18378634145129710975","18378670429014658431","18378659433898380671","1089036999212756863","18378670429013503615","18378634145130180223","18378670429014683263","18378659433898405503","18378634145130966655","18378634145129724031","1091007324049733759","18378670429013506175","18378659433897228415","18378634145130182783","18378670429014685823","18378659433898408063","18378634145130969215","1092979847909936511","18378678125594873215","18378670429013478783","18378659433897201023","18378634145130155391","18378634145129696639","18378634145130941823","1094968868739554332","1095259139809287196","1095646163607308374","18392283482476993622","18392283482476998230","18392002007501462614","18391439057548045910","18377083833734625366","18392002007501456726","1097616488444271703","18392283482476993648","18392283482476987760","18386372507967243632","18392283482476973424","18391439057548048470","18386372507967229296","1099586813281246322","18392283482476998256","18385809558013828208","18388624307780939376","18375113508897650800","18392283482476973439","18375113508898830448","1101557138118219647","18392283482476993663","18392283482476998271","18392283482476987775","18378772683596061823","18378772683596055935","18378772683596041599","1103528562466823196","18378772683596066431","18378772683594889343","18382153681850666250","18382153681850207498","18378772683596068991","18391723831059614986","1105384705598244976","18380629926237920368","18382600251074899568","18380629926239100016","18382600251076079216","18382600251074902128","18386259425773307248","1107331940691024924","1107636505411935830","18380629926237920342","18375844851633843798","18391888925307526230","18391325975354109526","18376970751540688982","18391325975354112086","1109606830248893496","18385696475818706262","18391888925307520342","18380348451261189462","18385415000842008631","18391888925307506006","18391325975354112055","1111577155085879095","18380629926237920311","18389918600469376567","18385696475818706231","18391888925307526199","18391325975354109495","18391607450330809655","1113547479922842640","18387948275632401930","18385696475818691895","18391325975354109450","18389918600469379082","18391607450330795319","18391325975354112010","1115494715015634034","18386259425772127600","18386259425772113264","18386259425773292912","18378634312633907327","18378634312633448575","18378634312634693759","1117488129596789770","18387385325678976010","18387385325678970122","18391888925307526154","18391607450330809610","18387385325678955786","18391607450330795274","1119574835162586133","1119856310139706389","18392286781012270166","18380746306967133239","18392005306036345942","18388064656361610250","18392005306036345911","18392005306036345866","1121826634976282133","18392286781011811414","18380746306966674487","18392005306036340054","18388064656361151498","18391723831059629367","18391723831059629322","1123796959813266960","18390034981198589495","18390034981198130743","18388064656361614858","18391442356082929207","18388064656361156106","18391442356082929162","1125767284650099989","18392286781012264278","18392286781011805526","18385812856547919159","18385812856547460407","18387501706408183050","18387501706407724298","1127737609487218704","18385249906594510903","18385249906594052151","18390034981198592010","18391442356082931767","18390034981198133258","18391442356082931722","1129707934324165944","18392286781012249942","18392286781011791190","18385812856547904823","18385812856547446071","18392005306036325718","18391723831059615031","1131536589664885781","1131818064641612816","18380604637470874679","18375538087889624119","18387360036911930378","18391863636540087351","18387078561934760970","18391863636540087306","1133788389478592016","18389893311702330935","18375538087889628727","18387922986865356298","18391300686586670647","18387078561934765578","18391300686586670602","1135758714315949333","18385671187051660630","18385671187051660599","18391863636540081494","18387360036911924490","18391582161563370807","18391582161563370762","1137729039152517397","18375538087889618262","18375538087889618231","18387078561934755082","18391863636540067158","18391582161563356471","18391582161563356426","1139699363989518352","18385389712074962999","18375538087889631287","18389893311702333450","18391300686586673207","18387078561934768138","18391300686586673162","1141669688826334485","18380323162494143830","18375538087889603926","18385671187051646263","18375538087889603895","18387360036911910154","18387078561934740746","1143781683159702616","1144063158136429682","18392286781012270192","18392286781011811440","18392286781012270207","18385812856548711536","18392286781011811455","18378775982130945151","1146033482973277784","18392286781012274774","18392286781011816022","18392286781012274800","18392286781011816048","18392286781012274815","18392286781011816063","1148003807810372978","18392286781012264304","18392286781011805552","18392286781012264319","18386375806502126960","18392286781011805567","18378775982130939263","1149974132647358296","18391442356082929238","18377087132269443158","18388627606315822704","18375116807432468592","18378775982130949759","18378775982129707135","1151944457484728408","18377087132269901910","18375116807432927344","18391442356082931798","18378775982130165887","18375116807433713776","18378775982130952319","1153914782321282418","18392286781012249968","18392286781011791216","18392286781012249983","18386375806502112624","18392286781011791231","18378775982130924927","1155743437662002264","1156024912638598232","18380604637470874710","18375538087889624150","18380604637470874736","18375538087889624176","18378634312633900159","18378634312633441407","1157995237475704152","18375538087889628758","18391863636540087382","18375538087889628784","18380604637471661168","18378634312633446015","18378634312634686591","1159965562313076312","18375819562866798166","18382574962307853936","18391300686586670678","18378634312633904767","18382574962308640368","18378634312634691199","1161935887149647218","18386234137005081968","18375538087889618288","18378634312633894271","18386234137005868400","18378634312633435519","18378634312634680703","1163906211986634839","18376945462773643350","18375538087889631318","18382574962307856496","18375538087889631344","18391300686586673238","18382574962308642928","1165876536823582066","18386234137005067632","18375538087889603952","18378634312633879935","18386234137005854064","18378634312633421183","18378634312634666367","1167911732511054876","1168208600650554424","1168490075627281719","18380678304397745207","18380710190234950711","18389966978981391927","18375611755168689719","18380678304750722103","18380746474118274103","1170460400447483447","18389966978629201463","18390013158117174839","18390019755186941495","18390027451768335927","18390031849814847031","18390035148349730359","1172429625772807224","18380724483885718583","18380731080955485239","18380396829421014358","18389435914512960854","18380738777536879671","18380743175583390775","1174398851114954551","18389998864466406967","18385463379354023991","18389966978982178359","18375611755168692279","18385228083513096247","18385234680582862903","1176371374975186999","18385463379001833527","18385213789862328375","18385463379354810423","18385242377164257335","18385246775210768439","18385250073745651767","1178341699812134230","18375611755168664918","18389450208163728726","18389456805233495382","18389464501814889814","18389468899861400918","18389472198396284246","1180312024632335447","1180593499609062742","18380678304397745238","18380710190234950742","18384946608536383062","18384953205606149718","18380743175583390806","18380746474118274134","1182563824446031446","18380724483885718614","18385744853978531158","18385776739815736662","18380731080955485270","18380738777536879702","18385813023699060054","1184534149283016534","18375893229793668694","18384932314885615190","18384960902187544150","18377065309188487254","18384965300234055254","18384968598768938582","1186536359957172567","18385791033466504534","18385797630536271190","18385805327117665622","18386353983419925872","18385809725164176726","18386339689769143664","1188474798956968022","18377019129700513878","18377051015537719382","18377071906258253910","18377079602839648342","18377084000886159446","18377087299421042774","1190445123793915248","18386307803931938160","18386353983419911536","18386360580489678192","18386368277071072624","18386372675117583728","18386375973652467056","1192415448647670800","1192696923624392464","18380678304749935671","18375611755168685111","18385776739815736631","18385744854331508023","18387996653792226826","18388064823512755722","1194667248444589367","18385744853978531127","18385791033466504503","18385797630536271159","18385805327117665591","18385809725164176695","18385813023699060023","1196635374275096330","18388028539629432330","18389966978981394442","18387996654145203722","18387152229213829130","18390013158117177354","18390019755186944010","1198607898135302455","18385744854330721591","18375611755168679223","18385744853978516791","18385776739815722295","18385744854331493687","18385813023699045687","1200578222972303370","18389966978629203978","18389998864466409482","18389966978982180874","18390027451768338442","18390031849814849546","18390035148349732874","1202547448297622839","18385744854330707255","18375611755168664887","18385791033466490167","18385797630536256823","18385805327117651255","18385809725164162359","1204518872629451890","1204800347606179184","18380678304397745264","18385776739815742576","18388605783233621616","18388612380303388272","18385809725164182640","18385813023699065968","1206770672443147888","18385791033466510448","18386307803931952496","18386339689769158000","18385797630536277104","18385805327117671536","18386375973652481392","1208740997280132976","18382648629234724464","18388591489582853744","18388620076884782704","18375094984351512688","18388624474931293808","18388627773466177136","1210743207954289010","18386360580489692528","18386368277071086960","18378754159048738175","18386372675117598064","18378760756118504831","18378739865397955967","1212681646954084464","18382648629234727024","18375080690700744816","18375101581421279344","18375109278002673776","18375113676049184880","18375116974584068208","1214651971791031679","18378707979560750463","18378754159048723839","18378760756118490495","18378768452699884927","18378772850746396031","18378776149281279359","1216622296644785930","1216900473086613258","18388028539629427722","18387996654144417290","18387152229213826570","18387465589676000522","18382117565118483722","18382131858769251594","1218867499388716554","18387433704190991370","18387152229213821962","18387433703838800906","18387433703838795018","18387433704191777802","18387433704191771914","1220837824225677578","18387433704190985482","18387152229213816074","18387433704190971146","18387152229213801738","18387433703838780682","18387433704191757578","1222855428045870858","18388042833280195594","18388049430349962250","18388042833280200202","18387479883326768394","18387486480396535050","18382138455839018250","1224833449464239882","18388057126931356682","18388049430349966858","18388057126931361290","18387494176977929482","18382146152420412682","18382150550466923786","1226814769417492234","18388061524977867786","18388064823512751114","18388061524977872394","18387498575024440586","18387501873559323914","18382153849001807114","1228710327480567935","1228985205387390847","18378692586397396607","18378692586750176895","18378692586749718143","18378692586397399167","18378692586750179455","18378692586749720703","1231018202370498175","18378754159048744063","18378760756118510719","18378754159048748671","18378760756118515327","18378754159048751231","18378760756118517887","1233002820858628223","18378768452699905151","18378772850746416255","18378768452699909759","18378768452699899263","18378772850746410367","18378768452699912319","1234977543742113919","18378776149281299583","18378772850746420863","18378776149281304191","18378776149281293695","18378772850746423423","18378776149281306751","1236867604230654079","18378707979560770687","18378707979560775295","18378707979560764799","18378692586397986431","18378707979560777855","18378692586397988991","1238839028596033663","18378739865397976191","18378739865397980799","18378739865397970303","18378739865397983359","18378692586750963327","18378692586750965887","1240777467595398172","1241068838176758840","1241350313153485910","18375596361653574742","18380662911587146838","18375596362005896278","18380662911234956374","18380648617935592534","18391899920422624342","1243320637990454614","18385729461167932758","18385729460815742294","18385715167516378454","18391921910656353622","18391907617005192534","18391899920423798102","1245290962827435576","18375596361653579350","18391921910656359510","18391907617005198422","18391899920423803990","18375596362005903415","18391336970469210167","1247261287664390486","18375596361653568854","18375596362005890390","18391899920422618454","18391921910656339286","18391907617005178198","18391899920423783766","1249231612501391415","18385447986191235127","18385447985839044663","18385433692539680823","18391358960702945335","18391344667051784247","18391336970470389815","1251201937338338646","18375596361653554518","18380381436610415958","18375596362005876054","18380381436258225494","18380367142958861654","18391899920422604118","1253172262175317079","1253453737152044375","18375877836983070294","18375596361653574768","18375596362005900886","18375877836630879830","18375863543331515990","18391336970469207638","1255424061989012848","18386292411121354096","18386292410769163632","18386278117469799792","18386292411122140528","18386278117470979440","18386270420889585008","1257394386825998166","18375596361653581910","18391358960702942806","18375596362005903446","18391344667051781718","18391336970470387286","18391336970469210198","1259364711662948720","18375596361653568880","18375596362005890416","18386270420888405360","18386292411122126192","18386278117470965104","18386270420889570672","1261335036499949654","18377003736889915478","18377003736537725014","18376989443238361174","18391358960702945366","18391344667051784278","18391336970470389846","1263305361336896880","18375596361653554544","18386292411121339760","18375596362005876080","18386292410769149296","18386278117469785456","18386270420888391024","1265275686173875255","1265563758555764535","18380648617935592503","18385729461167932727","18389937292167048759","18385715167516378423","18385729461167918391","18385715167516364087","1267527486322972471","18375596362005896247","18375596362005900855","18391899920422624311","18391336970469207607","18391618445445907767","18391618445445893431","1269517602033638455","18375596361653574711","18375596361653579319","18375596361653568823","18375596362005890359","18375596361653581879","18375596362005876023","1271487926871201591","18380662911587146807","18380662911234956343","18389951585818603063","18389951585466412599","18385729460815742263","18385729460815727927","1273445057904842551","18391921910656359479","18391907617005198391","18391358960702942775","18391640435679642935","18391344667051781687","18391640435679628599","1275407686160422711","18391899920423803959","18391626142028481847","18391336970470387255","18391618445447087415","18391626142028467511","18391618445447073079","1277379110172433424","1277660585484705034","18387418311028202506","18387136836051037706","18391921910656359434","18391336970469207562","18391907617005198346","18391899920423803914","1279630910321673738","18387136836051033098","18387404017376648202","18391899920422624266","18391640435679642890","18391626142028481802","18391618445447087370","1281601235158634762","18387418311028196618","18387136836051027210","18387404017376642314","18391618445445907722","18391640435679628554","18391626142028467466","1283571559995633418","18387981260981628426","18387966967330074122","18391358960702942730","18387136836051040266","18391344667051781642","18391336970470387210","1285541884832610314","18389951585818605578","18389937292167051274","18391336970469210122","18391358960702945290","18391344667051784202","18391336970470389770","1287512209334013200","18375596361653554487","18387418311028182282","18387136836051012874","18387404017376627978","18391618445445893386","18391618445447073034","1289472638566341746","1289764009147719024","18380662911587146864","18375596361653579376","18380662911234956400","18380662911587933296","18380648617936772208","18380640921355377776","1291734333984697968","18382633236424126064","18375596362005900912","18382633236071935600","18382618942772571760","18382611246191177328","18382611246192356976","1293694763216999538","18375596362005896304","18380648617935592560","18380640921354198128","18378692586397961599","18378670596518382975","18378659601402105215","1295674983658647408","18375596361653581936","18382633236424912496","18375596362005903472","18382618942773751408","18382618942772574320","18382611246191179888","1297635412891367536","18382633236424128624","18382633236071938160","18382633236424915056","18382618942773753968","18382611246192359536","18382600251076081776","1299605737727790463","18378692586397371775","18378692586750152063","18378692586749693311","18378678293098597759","18378670596517203327","18378659601400925567","1301576062564899967","1301857537542020223","18378692586750172287","18378692586397981823","18378692586750958719","18378678293099797631","18378670596518403199","18378659601402125439","1303827862378595967","18378692586397391999","18378692586749713535","18378678293098617983","18378670596517223551","18378659601400945791","18378692586750952831","1305797088039497343","18378678293098622591","18378670596517228159","18378659601400950399","18378678293099802239","18378670596518407807","18378659601402130047","1307768512052544895","18378692586750166399","18378692586397975935","18378678293098612095","18378678293099791743","18378670596518397311","18378659601402119551","1309738836889506175","18378692586397386111","18378692586749707647","18378670596517217663","18378659601400939903","18378692586750938495","18378678293099777407","1311708062550423679","18378678293098625151","18378670596517230719","18378659601400952959","18378678293099804799","18378670596518410367","18378659601402132607","1313674924184116252","1313981683633691676","1314275253238307926","1314553429680151894","18380662743093566550","18380662743094287446","18375877668489490006","18380662742607092822","18383758967839415382","18383758967352876118","1316585327168281942","18380724315744722006","18380724315745442902","18384946440395386454","18380724315258248278","18380724315746753622","18380724315260214358","1318494079354081622","18385729292674352470","18385729292675073366","18385729292187878742","18383758967839409494","18383758967352870230","18383758967839395158","1320464404191080278","18375877668490210902","18375877668003016278","18377003568396335190","18383758967839419990","18377003567909861462","18383758967352880726","1322496301679186262","18385790865325507926","18385790865326228822","18385790864839034198","18376220716119377238","18376220715632837974","18376220716119362902","1324466626516184918","18384946440396107350","18384946439908912726","18377065141047490646","18375939241142677078","18377065140561016918","18375939240656137814","1326378677236866104","1326656853678693432","18380381268116835670","18380381268117556566","18380381267630361942","18385447817699686455","18383758967352855894","18385447817213147191","1328688751166823480","18389450040022732118","18389450040023453014","18389450039536258390","18385227915374131255","18376220715632823638","18385227914887591991","1330597503352659255","18380662743094287415","18389951417325022775","18380662742607092791","18389951416838549047","18380662743095598135","18380662742609058871","1332629400840789303","18380724315745442871","18390012989976178231","18380724315258248247","18390012989489704503","18383820540490570807","18383820540004031543","1334538153026613047","18389951417325743671","18385447817697654839","18385447817698375735","18389951417327054391","18385447817211181111","18389951416840515127","1336570050514743095","18390012989976899127","18385227915372099639","18385227915372820535","18383820540490575415","18385227914885625911","18383820540004036151","1338482101235424343","1338763576212813910","18377003568397056086","18377065141048211542","18377003568398366806","18377065141049522262","18377003567911827542","18377065140562982998","1340730602514242928","18380662743094287472","18382633067930545776","18380662742607092848","18382633067444072048","18380662743095598192","18380662742609058928","1342704225886094960","18380662743093566576","18386292242628494704","18386292242141300080","18386353814792455536","18386573717606516080","18386573717119976816","1344674550723055984","18386292242627773808","18386353815278929264","18386573717606501744","18386635290257657200","18386573717119962480","18386635289771117936","1346641577025171312","18382633067931266672","18382633067930548336","18382633067931269232","18380662743095602800","18382633067444074608","18380662742609063536","1348615200396938608","18386292242627759472","18386353815278914928","18386292242628480368","18386353815279635824","18386292242141285744","18386353814792441200","1350585525233982480","1350867000210704144","18380662743093566519","18380724315744721975","18383758967839409463","18383820540490564919","18381788642515906058","18381850215167061514","1352837325047678263","18385729292675073335","18385790865326228791","18385729292187878711","18385790864839034167","18383758967352870199","18383820540004025655","1354807649884639543","18385729292674352439","18385790865325507895","18383758967839395127","18376220716119362871","18383758967352855863","18376220715632823607","1356777974721638154","18389951417325025290","18390012989976180746","18387981092490079754","18388042665141235210","18381788642513942538","18381850215165097994","1358748299559270410","18389951417325746186","18390012989976901642","18387981092490082314","18388042665141237770","18381788642515908618","18381850215167064074","1360718624395496759","18385729292674338103","18385790865325493559","18385729292675058999","18385790865326214455","18385729292187864375","18385790864839019831","1362672456558124146","1362953931534851199","18374751768583363711","18374751768096169087","18374751768584674431","18374737474932268159","18374751768098135167","18374737474445728895","1364924256371820159","18378692418256591999","18374751768583357823","18374737474444942463","18374751768096163199","18374751768584668543","18374751768098129279","1366894581208804991","18378692418256596607","18392484692116139647","18392484691628945023","18392470397977718399","18392470398465044095","18392470397978504831","1368878100185289087","18378692418256586111","18378692418256571775","18374751768583343487","18374751768096148863","18374751768584654207","18374751768098114943","1370835230882754431","18378692418256599167","18392484692116142207","18392484692117450367","18392484691628947583","18392470397977720959","18392484691630911103","1372805555720386674","18382633067932579952","18382633067446040688","18392484692117452927","18392470398465046655","18392484691630913663","18392470397978507391","1374792373231097610","1375070549672942858","18387418142535343114","18387981092488048138","18387981092488769034","18381788642513939978","18387418142536653834","18381788642515901450","1377102447161072906","18388042665139919882","18388042665139203594","18388042665139924490","18381850215165095434","18387479715187809290","18381850215167056906","1379011199346886154","18387418142534622218","18381788642513935370","18387418142535337226","18387699617024853258","18387418142536647946","18387699617026819338","1381043096835016202","18388042665139198986","18381850215165090826","18387479715186492682","18387761189676008714","18387479715187803402","18387761189677974794","1382951849020821770","18387418142534616330","18387418142534601994","18387418142535322890","18387699617024838922","18387418142536633610","18387699617026805002","1384983746508951818","18387479715185771786","18382131690628254986","18382131690628975882","18387761189675994378","18382131690630286602","18387761189677960458","1386957369880419356","1387243242903641144","1387524717880368214","18380730912327949398","18380730912815275094","18380738608908950614","18380738609396669526","18381856812235578454","18381301558863551574","1389495042700570168","18384953036978613846","18384960733559615062","18390019586559405623","18381856812235583062","18381856812235583031","18381301558863556151","1391465367554311510","18385797461908735318","18376227313187898710","18385805158489736534","18376235009769293142","18387767786746496342","18381301558863545686","1393435692391296824","18375945838211198550","18375953534792592982","18383827137559096887","18383834834140491319","18381301558863556182","18385242208536328247","1395406017228273720","18377079434211719254","18385234511955327031","18385234512442652727","18385242209024047159","18381856812235585591","18381301558863558711","1397376342065220950","18389456636605959510","18376227313187884374","18389464333186960726","18376235009769278806","18387767786746482006","18381301558863531350","1399341169344060503","1399622644321180784","18385790865326234736","18385790864839040112","18380730912815275120","18380738609396669552","18380730912328735856","18388901383234739312","1401592969157762416","18388605615092625008","18388605614606151280","18380724315746753648","18388612211675852400","18388619908256853616","18380724315260214384","1403563293994731120","18385790865325513840","18385797461908741232","18385805158489742448","18386635290257671536","18386649583907587440","18386635289771132272","1405533618831705456","18386353815279650160","18386360411862156656","18386641887326193008","18386368108443157872","18386641886839653744","18388901383234733424","1407503943669083991","18388605615093345904","18377071737630718038","18377071738118043734","18377079434699438166","18381856812235585622","18381301558863558742","1409479766063779184","18386360411862142320","18386641887326178672","18386368108443143536","18386649583907573104","18386641886839639408","18388901383234719088","1411451190412385296","1411732665372335159","18380730912327949367","18380738608908950583","18380743006955854903","18381856812235578423","18381301558863551543","18381868906863483959","1413702990227129655","18383827137559086391","18383834834140480823","18387767786746496311","18383839232186991927","18381301558863545655","18387779881374401847","1415673315063062032","18383827137559092279","18383834834140486711","18390027283140406839","18381856812234799114","18381864508815800330","18381868906862704650","1417643639900016951","18385797461908735287","18385805158489736503","18385809556536640823","18376227313187884343","18376235009769278775","18376239407815789879","1419613964738066442","18388049262209759242","18388056958791153674","18381856812235585546","18388061356837664778","18381301558863558666","18381868906863491082","1421584289557187895","18385797461908720951","18385805158489722167","18385809556536626487","18387767786746481975","18381301558863531319","18387779881374387511","1423548017341176946","1423829492318947186","18380730912815279728","18380738609396674160","18380724315260218992","18380730912328740464","18380167962861847935","18388901383234743920","1425799817155265919","18378753990907741567","18380161365792015743","18380161365304821119","18380167962374522239","18380167962375308671","18380175658956703103","1427770141991858032","18375094816210516080","18375094816211236976","18380724315746758256","18375094815724042352","18375101412793743472","18375109109374744688","1429740466828808575","18380175658955523455","18380161365793312127","18380167962861833599","18380175659443228031","18380161365306772863","18380175658956688767","1431710791666858096","18382694640583735408","18382701237652256880","18382708934233651312","18382694640097196144","18382701237165717616","18388901383234746480","1433681116502756735","18378753990907727231","18380161365792001407","18380161365304806783","18380167962374507903","18380175658955509119","18380167962375294335","1435658038409500426","1435937314363366666","18381856812234791946","18387486312256330762","18381856812234796554","18388049262209756682","18381856812235578378","18381856812235582986","1437907639200321802","18387767786745709834","18387486312256324874","18387767786745695498","18387767786746496266","18382138287698808074","18387767786746481930","1439885660618317066","18381864508815793162","18387494008837725194","18381864508815797770","18388056958791151114","18381301558863551498","18381301558863556106","1441855985455272202","18387775483326711050","18387494008837719306","18381301558863545610","18387775483326696714","18382145984280202506","18381301558863531274","1443830708339170570","18381868906862697482","18387498406884236298","18381868906862702090","18388061356837662218","18381868906863483914","18381868906863488522","1445801033176125706","18387779881373615370","18387498406884230410","18387779881373601034","18387779881374401802","18382150382326713610","18387779881374387466","1447754865338304639","1448036340315413631","18374813341234519167","18374813340747324543","18374819938304351359","18374827634885745791","18374819937817812095","18374827634399206527","1450006665151995263","18378753990907752063","18392546264280100479","18374813341235829887","18392552861349801599","18392560557930802815","18374813340749290623","1451976989988963967","18378753990907747455","18374819937817025663","18374827634398026879","18380161365793326463","18380175659443242367","18380161365306787199","1453947314826997375","18392546264767295103","18392552861837127295","18392560558418521727","18392546264282066559","18392552861350588031","18392560557931982463","1455917639662923647","18378753990907754623","18392546264767297663","18392546264768605823","18392546264280103039","18392552861349804159","18392560557930805375","1457887964500949119","18392546264768608383","18392552861837129855","18392560558418524287","18392546264282069119","18392552861350590591","18392560557931985023","1459741741104307228","1460023216081017912","1460304691058793558","18383744674187009110","18380604468978015318","18383736977605614678","18381774348863495254","18383725982489336918","18382329602235522134","1462275015895107158","18380648448955866198","18380604468977294422","18383744674187003222","18383736977605608790","18383725982489331030","18383700693723137366","1464245340731694648","18375863374351789654","18375819394373217878","18375855677770002006","18383700693723143254","18385433523559954487","18385389543581382711","1466215665569042774","18385714998536652118","18385671018558080342","18385671018558801238","18387685323374413142","18383744674186988886","18383700693723123030","1468185990406699063","18385433524047280183","18385389543582103607","18385425827465885751","18381774348863502391","18385414832349607991","18385389543583414327","1470156315242990934","18380366973979135318","18380322994000563542","18380322994001284438","18383736977605594454","18387685323374398806","18383725982489316694","1472126640079576151","1472408115057346391","18375819394373938774","18383736977605619286","18381774348863499862","18383725982489341526","18386559423954109808","18382329602235526742","1474378439893665136","18386233968511501680","18386233968512222576","18386551727372715376","18386559423467570544","18386540732256437616","18388803526699861360","1476348764730257238","18383744674187013718","18376989274258634838","18376945294280063062","18376981577676847190","18376945294280783958","18383700693723147862","1478319089567207792","18386277948490073456","18386270251908285808","18386559423954095472","18386551727372701040","18386540732256423280","18386515443490229616","1480289414405257302","18376989274745960534","18376981578164566102","18381774348863502422","18376970583048288342","18382329602235529302","18376945294282094678","1482259739241155952","18386277948490059120","18386233968511487344","18386270251908271472","18386233968512208240","18386559423467556208","18388803526699847024","1484230064078527504","1484511539055909943","18380648449443191863","18380604468978015287","18380640752861797431","18381774348863495223","18380629757745519671","18380604468979326007","1486481863892223543","18380648448955866167","18380604468977294391","18383744674187003191","18383736977605608759","18383725982489330999","18383700693723137335","1488452188729208375","18389937123187322423","18389893143208750647","18389893143209471543","18389929427093253687","18381774348863499831","18389918431976975927","1490422513566159159","18385714998536652087","18385671018558080311","18385671018558801207","18387685323374413111","18383744674186988855","18383700693723122999","1492392838873575184","18389937123674648119","18389893143210782263","18387966798837676042","18387959102256281610","18387948107140003850","18387922818373810186","1494363163240107319","18385714998536637751","18385671018558065975","18385671018558786871","18383736977605594423","18387685323374398775","18383725982489316663","1496333488076692594","1496614963053419632","18380648448955866224","18380604468977294448","18380640752374078576","18380604468978015344","18380648448956652656","18388803526699867248","1498585287890394480","18380648449443191920","18382618773792845424","18380640752861797488","18382611077211057776","18380629757745519728","18380604468979326064","1500555612727766640","18382574793814273648","18382574793814994544","18380640752861802096","18380648448956657264","18380629757745524336","18388803526699871856","1502525937564348272","18380648449443196528","18382618773792847984","18382574793814276208","18382611077211060336","18382574793814997104","18380604468979330672","1504496262401298802","18386515443490243952","18374737474444922239","18378634144140299647","18374729777863134591","18374693494467071359","18374729777864314239","1506466587239348336","18382618774280173680","18382611077698779248","18382618773793634416","18382600082582501488","18388803526699874416","18382574793816307824","1508436912075643914","1508756869959324682","18381774348862708746","18387685323373626634","18387403848884241674","18381774348863495178","18387685323374413066","18387403848884227338","1510727194796318218","18387403848884247562","18381774348862713354","18387966798837673482","18381774348862715914","18381774348863499786","18381774348863502346","1512690922563507978","18387396152302853130","18387959102256279050","18387396152302847242","18387685323373612298","18387396152302832906","18387685323374398730","1514626063498157066","18387385157186575370","18387948107140001290","18387385157186569482","18389893143208753162","18389893143209474058","18387385157186555146","1516594189311892746","18387359868418350090","18387359868419070986","18387922818371776010","18387922818372496906","18387359868420381706","18387922818373807626","1518564514148847882","18387359868418344202","18387359868419065098","18387359868418329866","18387359868419050762","18387359868420375818","18387359868420361482","1520540336073809023","1520819612027280767","18374729778350873727","18378634144140324479","18392462701395930751","18374718783234595967","18374729777864334463","18374693494468402303","1522792135887505023","18378634144140319871","18374729777863154815","18374693494467091583","18374737474932262271","18374729778350867839","18374693494468396415","1524762460724872575","18374737474444936575","18378634144140313983","18374693494467085695","18374737474445723007","18374718783234590079","18374729777864328575","1526732785561440639","18374729777863148927","18374737474932247935","18374729778350853503","18374737474445708671","18374718783234575743","18374693494468382079","1528700911375183743","18392426417999867519","18392462701883649663","18392451706767371903","18392462701397110399","18392462701395933311","18392426418001178239","1530671236212553855","18378634144140327039","18392426417999870079","18392462701883652223","18392451706767374463","18392462701397112959","18392426418001180799","1532662456065399836","1532942831530482716","1533224306507210041","18383839232186997815","18390031681187311159","18383839232187002423","18381868906863488567","18382574960831524464","18380604635996515952","1535196993559414583","18380629924761918519","18389918598993374775","18385696474342704439","18381755824669547575","18381755824669552183","18387666799180465463","1537167318396378128","18381755824668765706","18385696474342690103","18381755824668768266","18381755824669552138","18387666799180451127","18381755824669554698","1539137643233350666","18381755824668761098","18387666799179678986","18381755824669547530","18387666799179664650","18387666799180465418","18387666799180451082","1541082679302888562","18374693661483615615","18382574960831527024","18374693661483601279","18374693661485581695","18382574960833493104","18374693661485567359","1543053004139880063","18374693661483621503","18392426585016397439","18374693661485587583","18392426585016399999","18392426585018363519","18392426585018366079","1545161699954990138","1545443174931717463","18380743007443180630","18384965131606519382","18380743007443180656","18388624306303757936","18381868906863488598","18380743006956641392","1547413499768686167","18380743006955854934","18385809556536646768","18376239407815804246","18381868906863483990","18386653981954098544","18386653981467559280","1549383824605671225","18375957932839104086","18377083832258623574","18380743007443185264","18385246606583232567","18375113507421649008","18380743006956646000","1551354149442621784","18385809556536640854","18386372506490062192","18387779881374401878","18376239407815789910","18386653981954084208","18380180057489739135","1553324474280278073","18377083832745949270","18385246607070558263","18381868906863491158","18382713332280162416","18381868906863491127","18382713331793623152","1555294799099792728","18389468731233865046","18386372506490047856","18387779881374387542","18380180057002413439","18386653981467544944","18380180057003199871","1557266223465176092","1557549897465158922","18388064655372475402","18388064655371759114","18388064655372480010","18381872205397650954","18387501705420364810","18381872205399612426","1559520222302127626","18388064655371754506","18381872205397646346","18387501705419048202","18387783179908564234","18387501705420358922","18387783179910530314","1561490547139088650","18387501705418327306","18382153680860810506","18382153680861531402","18387783179908549898","18382153680862842122","18387783179910515978","1563460871976087306","18390034980208736266","18390034980209457162","18388064655373790730","18381872205397653514","18381872205399617034","18381872205399619594","1565427898278168191","18374832032444931199","18374832032932256895","18380180057002427775","18380180057489753471","18374832032445717631","18380180057003214207","1567398223115153279","18392564955977707135","18392564956465032831","18392564955977709695","18392564955978493567","18392564956465035391","18392564955978496127","1569230176973954073","1569511651950681686","18380604635994545238","18375819561390468694","18383700860740328534","18376945461297313878","18383700860740333142","18376945461299279958","1571481976787639352","18385671185575331158","18380323161017814358","18383700860740322646","18385389710598633527","18383700860740308310","18385389710600599607","1573452301624624951","18380604635994545207","18389893310226001463","18385671185575331127","18380604635996511287","18389893310227967543","18383700860740322615","1575422626461586544","18380604635994545264","18386234135528752496","18380604635996511344","18386234135528738160","18386515610507429232","18386515610507414896","1577392951298563088","18381730535901392394","18385671185575316791","18381730535901394954","18381730535903358474","18383700860740308279","18381730535903361034","1579363276135535626","18381730535901387786","18387641510412305674","18381730535903353866","18387641510412291338","18387641510414271754","18387641510414257418","1581475270485548053","1581756745462275383","18390034980208733751","18390034980209454647","18390034979722260023","18383842530723126327","18383842530723130935","18383842530236591671","1583727070299244088","18380746305977277495","18380746305977998391","18380746305490803767","18376242706351932758","18383842530723120439","18383842530236587063","1585697395136218424","18385812855558784342","18385812855071589718","18385812855558784311","18385812855071589687","18376242705865393494","18383842530236581175","1587667719973179704","18385812855558063446","18385812855558063415","18376242706351918422","18376242706351918391","18376242705865379158","18376242705865379127","1589638044810180624","18385249905604655159","18385249905605376055","18385249905118181431","18385249905606686775","18385249905120147511","18388064655373793290","1591608369647062328","18389472030255287638","18389472030256008534","18385812855558049079","18389472029768813910","18385812855558769975","18385812855071575351","1593578694484106328","1593860169460833622","18380746305977277526","18380746305977998422","18384968430627941974","18380746305490803798","18380746305979309142","18380746305492769878","1595830494297812822","18384968430628662870","18384968430141468246","18377087131280046166","18375961231375232598","18377087130793572438","18375961230888693334","1597800819134766167","18377087131280767062","18386375805511470448","18377087131282077782","18386375805024996720","18377087130795538518","18386657280003673456","1599771143954974576","18385812855071595632","18388627604838706800","18386375805025011056","18380746305492769904","18380746305492774512","18386657280003687792","1601741468791938162","18380183355537376639","18375116805956597872","18380183355537362303","18380183355539342719","18382716630329751664","18380183355539328383","1603711793628929663","18374835330979880063","18392568254512655999","18374835330981846143","18392568254512658559","18392568254514622079","18392568254514624639","1605571235294813212","1605852710271523896","1606134185248245334","18380662910110817366","18380648616459590742","18380640919877803094","18380629924761918550","18383759134856594774","18376220883136562518","1608104510085612886","18385729459691603286","18385791032342758742","18385715166040376662","18387685490878137686","18382329769739240790","18387666799180465494","1610074834922200632","18380724482761972822","18385447984714905655","18381755824669547606","18385433691063679031","18385425994481891383","18385414999366006839","1612045159759155542","18385707469458589014","18385696474342704470","18383759134856580438","18376220883136548182","18387685490878123350","18382329769739226454","1614015484596549687","18385228082389350455","18385447984716871735","18385228082391316535","18381774516367226935","18382329769739253815","18381755824669554743","1615985809433103702","18380381435134086486","18389450207039982934","18380367141482859862","18380359444901072214","18380348449785187670","18387666799180451158","1617956134270082135","1618237609246809430","18375855845273726550","18383759134856600662","18380724482763938902","18381774516367219798","18375844850157842006","18382329769739246678","1620207934084181590","18375877835506740822","18384946607412637270","18375863541855514198","18381774516367224406","18382329769739251286","18381755824669552214","1622178258920763222","18377003735413586006","18376989441762359382","18383759134856605270","18375939408159862358","18376981745180571734","18376970750064687190","1624148583758133334","18377065308064741462","18377003735415552086","18377065308066707542","18381774516367226966","18382329769739253846","18381755824669554774","1626118908594688368","18386270419412010352","18386259424296125808","18386573884623687024","18386635457274842480","18386559590971280752","18388803694203571568","1628089233431661936","18386292409645010288","18386353982296165744","18386278115993783664","18386270419411996016","18386259424296111472","18386540899273608560","1630070553384918032","1630352028362038327","18380662910110817335","18380724482761972791","18380662910112783415","18383820707507756087","18381774516367219767","18382329769739246647","1632322353198614071","18380648616459590711","18380640919877803063","18383759134856594743","18383820707507750199","18387685490878137655","18382329769739240759","1634292678035598903","18389951584342273591","18390013156993429047","18389937290691046967","18389929594109259319","18381774516367224375","18382329769739251255","1636263002872549687","18385729459691603255","18385791032342758711","18385715166040376631","18385707469458588983","18383759134856580407","18376220883136548151","1638233327710596880","18389951584344239671","18383820707507760695","18381788810019633162","18381850382670788618","18381774516367226890","18382329769739253770","1640203652546497847","18385729459691588919","18385791032342744375","18385715166040362295","18385707469458574647","18387685490878123319","18382329769739226423","1642162982267198578","1642442258220670064","18380662910110817392","18380648616459590768","18380640919877803120","18380629924761918576","18388803694203591792","18380629924762705008","1644412583057644912","18382633234947796592","18382618941296569968","18382611244714782320","18380662910112783472","18380648616460377200","18382600249598897776","1646385106918262128","18386353982296180080","18386573884623701360","18386635457274856816","18386559590971295088","18388803694203585904","18386540899273622896","1648353232731509106","18386292409645024624","18386278115993798000","18374751935599873407","18374737641948646783","18374729945366859135","18374718950250974591","1650323557568573296","18380662910112788080","18380648616460381808","18388803694203596400","18382611244714784880","18382600249598900336","18380629924762709616","1652293882405943408","18382633234947799152","18382618941296572528","18382633234949765232","18382618941297358960","18388803694203598960","18382600249599686768","1654277401382034442","1654558876359154698","18381788810017659914","18381850382668815370","18381788810019625994","18381850382670781450","18381774516367219722","18382329769739246602","1656529201195730442","18381774516366433290","18381766819784645642","18387699784530543882","18387761357181699338","18387685490878137610","18382329769739240714","1658499526032715274","18381788810017664522","18381850382668819978","18381774516366437898","18381766819784650250","18381774516367224330","18382329769739251210","1660469850869666058","18387699784528577802","18387761357179733258","18387685490877351178","18387677794295563530","18387699784530529546","18387761357181685002","1662440175706664714","18381788810017667082","18381850382668822538","18381774516366440458","18381788810019630602","18381850382670786058","18381766819784652810","1664410500543614218","18387699784528563466","18387761357179718922","18387685490877336842","18387677794295549194","18387685490878123274","18382329769739226378","1666367631241059455","1666649106217786495","18374751935599893631","18374737641948667007","18374729945366879359","18374718950250994815","18374729945368059007","18374718950251781247","1668619431054761343","18392484859132669567","18392470565481442943","18392462868899655295","18374751935601859711","18374737641949453439","18392451873783770751","1670589755892123007","18374751935599887743","18374737641948661119","18374751935601853823","18374737641949447551","18374729945368053119","18374718950251775359","1672560080728691071","18374729945366873471","18374718950250988927","18374751935601839487","18374737641949433215","18374729945368038783","18374718950251761023","1674530405565689727","18392484859134635647","18392470565482229375","18392462868900834943","18392462868899657855","18392451873783773311","18392451873784557183","1676500730403059839","18392484859132672127","18392470565481445503","18392484859134638207","18392470565482231935","18392462868900837503","18392451873784559743","1678566712751234076","1678853685286083640","1679135160263203926","18380743174459579478","18381856979739302998","18380746472994528342","18381301726367276118","18381869074367208534","18380746472996494422","1681105485099779670","18380731079831673942","18380738776412675158","18387767954250220886","18381301726367270230","18387780048878126422","18376242873369118038","1683075809936699192","18384953204482338390","18384960901063339606","18384965299110243926","18384968597645192790","18385234679459051575","18385242376040052791","1685046134773715286","18385797629412459862","18385805325993461078","18385809724040365398","18385813022575314262","18387780048878112086","18376242873369103702","1687016459611109431","18385246774086957111","18381856979739310135","18385250072621905975","18381301726367283255","18381869074367215671","18385250072623872055","1688986784447663446","18389456804109684054","18389464500690685270","18389468898737589590","18387767954250206550","18389472197272538454","18381301726367255894","1690951611726502999","1691238584261373782","18377071905134442582","18381856979739307606","18381301726367280726","18377079601715443798","18381869074367213142","18375961398392417878","1693208909098743894","18377083999762348118","18381856979739310166","18377087298297296982","18381301726367283286","18381869074367215702","18377087298299263062","1695173736377572464","18385791032342764656","18385809724040371312","18380731079832460400","18385813022575320176","18388901550738463856","18380743174460365936","1697149558772287088","18385797629412465776","18385805325993466992","18386642054343378288","18388901550738457968","18386654148971283824","18386657447507412336","1699119883609248112","18386360579365881200","18386368275946882416","18386372673993786736","18386375972528735600","18386654148971269488","18386657447507398000","1701090208446221680","18386360579365866864","18386368275946868080","18386372673993772400","18386642054343363952","18386375972528721264","18388901550738443632","1703060533283200016","1703342008260320311","18380743174459579447","18381856979739302967","18380746472994528311","18381301726367276087","18381869074367208503","18383842697740311607","1705312333096896055","18380731079831673911","18380738776412675127","18387767954250220855","18381301726367270199","18387780048878126391","18383842697740305719","1707282657933880887","18390019754063130167","18390027450644131383","18390031848691035703","18381856979739307575","18390035147225984567","18381301726367280695","1709252982770831671","18385797629412459831","18385805325993461047","18385809724040365367","18385813022575314231","18387780048878112055","18376242873369103671","1711223307608878864","18381869074367213111","18383842697740316215","18381856979739310090","18381301726367283210","18381869074367215626","18381872372903344138","1713193632444779831","18385797629412445495","18385805325993446711","18385809724040351031","18387767954250206519","18385813022575299895","18381301726367255863","1715158459723619442","1715439934700341106","18388612379179576944","18388620075760578160","18380724482763938928","18380161532808545663","18380180224506152319","18380746472996494448","1717410259537718896","18388605782109875824","18388624473807482480","18380731079832465008","18388627772342431344","18388901550738468464","18380743174460370544","1719380584374300528","18375094983227766896","18375101580297468016","18380724482763943536","18375109276878469232","18375113674925373552","18380746472996499056","1721350909211251071","18380168129878246783","18380175826459247999","18380161532810497407","18380175826460413311","18380180224506924415","18380183523043052927","1723321234048645232","18382694807600920688","18382701404669442160","18375116973460322416","18388901550738471024","18382713499297347696","18382716797833476208","1725291558885199231","18380161532808531327","18380168129878232447","18380175826459233663","18380180224506137983","18380168129879018879","18380183523041086847","1727267381280316426","1727548856257436682","18381869074366422026","18381856979739302922","18381872372901370890","18381301726367276042","18381869074367208458","18381872372903336970","1729519181094012426","18381856979738516490","18381864676319517706","18387767954250220810","18381301726367270154","18387780048878126346","18387783347414254858","1731489505930997258","18381856979738521098","18381864676319522314","18381869074366426634","18381856979739307530","18381872372901375498","18381301726367280650","1733459830767948042","18387767954249434378","18387775650830435594","18387780048877339914","18387783347412288778","18387780048878112010","18387783347414240522","1735430155604946698","18381856979738523658","18381864676319524874","18381869074366429194","18381869074367213066","18381872372901378058","18381872372903341578","1737400480441896202","18387767954249420042","18387775650830421258","18387780048877325578","18387767954250206474","18387783347412274442","18381301726367255818","1739365307720747135","1739646782697462911","18374813508251049087","18374820105320750207","18374827801901751423","18374832199948655743","18374820105321536639","18374835498483604607","1741617107534437759","18392553028853526143","18392560725434527359","18374813508253015167","18374827801902931071","18374832199949442175","18374835498485570687","1743587432371809919","18392546431783825023","18392565123481431679","18392553028854312575","18392568422016380543","18392560725435707007","18392565123482218111","1745557757208774015","18380161532810511743","18380168129879033215","18380183523041101183","18380175826460427647","18380180224506938751","18380183523043067263","1747528082045366143","18392546431783827583","18392553028853528703","18392546431785791103","18392560725434529919","18392565123481434239","18392568422018346623","1749498406882736255","18392546431785793663","18392553028854315135","18392568422016383103","18392560725435709567","18392565123482220671","18392568422018349183","1751368516874542108","1751666475939470364","1751947950916181020","1752236022962658332","18389122384701561884","18389106991538773020","18385768874187769174","18389966809582628407","18381788642010689079","18382337298313604663","1754198651167917398","18385744684931171670","18385744684931958102","18387685322870310230","18387699616521602390","18382337298313594198","18382329601731151190","1756170075516506454","18385714998116762966","18385707301954864470","18389428048884993366","18380396660374441302","18382329602235501910","18382337298313579862","1758140400353505079","18389990998838439479","18385463209954474039","18382329602235526711","18385433523140065335","18385425826978166839","18381774348359399479","1760110725190481975","18385205924234360887","18385463209955260471","18381788642010691639","18382329602235529271","18382337298313607223","18382329601731164215","1762079950515801430","18380396660373654870","18380366973559246166","18380359277397347670","18387685322870295894","18387699616521588054","18382329601731136854","1764051374864407610","1764339446910901590","18380702324606983254","18380678135351172182","18375863373931900502","18381774348359396950","18381788642010684502","18382337298313600086","1766302075166475862","18380678135350385750","18380648448535977046","18380640752374078550","18381774348359392342","18382329601731157078","18382329602235516246","1768273499515088470","18375893060746309206","18384924449257647702","18375893060747095638","18381788642010689110","18382337298313604694","18382329601731161686","1770242724840437846","18377018960653154390","18376989273838745686","18381774348359399510","18381788642010691670","18382337298313607254","18382329601731164246","1772220746258783290","18386050349163682874","18386050349163224122","18377043149909751894","18377018960653940822","18386277948070169968","18386559422963453296","1774184474025987440","18386307634884578672","18386331824141176176","18386307634885365104","18386573716614745456","18388811222777924976","18388803526195481968","1776154798862965776","1776436273839692855","18380702324606983223","18380678135351172151","18381788642010684471","18382329602235522103","18382337298313600055","18382329601731157047","1778406598676661815","18380678135350385719","18380648448535977015","18380640752374078519","18381774348359392311","18385768874187769143","18382329602235516215","1780375824002008375","18385744684931171639","18385744684931958071","18387685322870310199","18387699616521602359","18382337298313594167","18382329601731151159","1782347248350597431","18385714998116762935","18385707301954864439","18385768874187754807","18385744684931943735","18382329602235501879","18382337298313579831","1784317573187596048","18389966809581841975","18389937122767433271","18389929426605534775","18381774348359396919","18382329601731161655","18389990998838441994","1786286798512917815","18385744684931157303","18385714998116748599","18385707301954850103","18387685322870295863","18387699616521588023","18382329601731136823","1788258222861524082","1788538598326623344","18380678135350385776","18380648448535977072","18380648448452549744","18380662742103841904","18388811222777945200","18388803526195502192","1790510022675225968","18382648460187364976","18385768874187775088","18380678135351172208","18382618773372956272","18380648448452554352","18388803526195506800","1792480347512194416","18386307634884593008","18386331824141190512","18386307634885379440","18386573716614759792","18388811222777939312","18388803526195496304","1794457269418946416","18388583623954886256","18382648460188151408","18380662742103846512","18382618773372958832","18382618773289531504","18388811222777949808","1796419897674502514","18386277948070184304","18386559422963467632","18374767160839441791","18378678123698982271","18374737473941605759","18374729777359949183","1798391322023131248","18382648460187367536","18375072825072777328","18382648460188153968","18382633066940823664","18388811222777952368","18388803526195509360","1800368243929848842","1800700296441437194","18381546749536312330","18381546749535853578","18388020674001460234","18388020674001464842","18387457724048033034","18382109699490516234","1802646432023010826","18387433534791441418","18387996484744867338","18381804035258014730","18389966809581844490","18381804035258019338","18381804035258021898","1804602463208807434","18387433534791435530","18387433534791421194","18387715009768932618","18381788642010689034","18387715009768918282","18381788642010691594","1806558494394227722","18381788642010684426","18387699616521602314","18389937122767435786","18381774348359399434","18387699616521587978","18382337298313607178","1808527719719591178","18387403847977032714","18381774348359392266","18387966797930458634","18381774348359396874","18382337298313600010","18382337298313604618","1810498044556546314","18387403847977026826","18387685322870310154","18387403847977012490","18387685322870295818","18382337298313594122","18382337298313579786","1812465070858640511","1812745446323739775","18374767160839462015","18378678123699002495","18374737473941625983","18374751767592918143","18374737473942412415","18374729777359969407","1814716870672342399","18392500084372237951","18374791350096059519","18374767160840248447","18378678123699007103","18392470397474401919","18392462700892745343","1816687195509310847","18374767160839456127","18380139374653556095","18374767160840242559","18374751767592912255","18374737473942406527","18374729777359963519","1818664117416038783","18378678123698996607","18374737473941620095","18380139374653541759","18374767160840228223","18374751767592897919","18374737473942392191","1820634442253037439","18392524273628835455","18392500084373024383","18392484691125694079","18378678123699009663","18392470397474404479","18392470397475188351","1822598170020247679","18392500084372240511","18392524273628838015","18392500084373026943","18392484691125696639","18392470397475190911","18392462700892747903","1824639963163335708","1824921438140046364","1825202913116757020","18389154270538767388","18389168564189928476","18385213620815755319","18381850214661847095","18381293861778847799","18381305956406753335","1827173237903396182","18389435745465601366","18389456636186070358","18387767786242379094","18389468730813975894","18387779880870284630","18381301558359166294","1829143562740390967","18380710021187591223","18381856811731475511","18381850214661839927","18381868906359381047","18381293861778840631","18381301558359186487","1831113887577365815","18380710021188377655","18390019586139516471","18381856811731480119","18390031680767422007","18381868906359385655","18381305956406746167","1833084212414344759","18389998695419047479","18389998695419833911","18381850214661844535","18381293861778845239","18381301558359191095","18381305956406750775","1835054537251321911","18385213620814968887","18385234511535437879","18381856811731482679","18385246606163343415","18381868906359388215","18381301558359193655","1837024862088272982","1837306337065000022","18380710021187591254","18380710021188377686","18381850214661839958","18381293861778840662","18381301558359186518","18381305956406746198","1839276661901968982","18380730911908060246","18381856811731475542","18385776570769163606","18380743006535965782","18381868906359381078","18381305956406740310","1841245887227326038","18384932145838255702","18384953036558724694","18381856811731480150","18381850214661844566","18381293861778845270","18381301558359191126","1843217311575917910","18385776570768377174","18387767786242393430","18387761189172757846","18387779880870298966","18381293861778834774","18381301558359180630","1845186536901275478","18377050846490359894","18384932145839042134","18377071737210828886","18381856811731482710","18381850214661847126","18381301558359193686","1847157961249853782","18385797461488846166","18385809556116751702","18389435745466387798","18387761189172743510","18381293861778820438","18381305956406725974","1849127186575203415","1849407562040302960","18388591320535494256","18385776570769169520","18388612211255963248","18380730911824637552","18380724314754997360","18388893686150028400","1851378986388899440","18385776570768383088","18385797461488852080","18380730911824632944","18386339520722584944","18388901382730374256","18388893686150022512","1853349311225860464","18386339520721798512","18386360411442267504","18386641886335550832","18386635289265915248","18386339520722570608","18388901382730368368","1855319636062859120","18388591320536280688","18380724314755001968","18375101412373854320","18382701236661614704","18388893686150033008","18388901382730378864","1857289960899835991","18375080521653385328","18377050846491146326","18381293861778847830","18382694639591979120","18388893686150035568","18388901382730381424","1859260285736783216","18386339520721784176","18386360411442253168","18386641886335536496","18386635289265900912","18388893686150008176","18388901382730354032","1861231710085389328","1861513185062110992","18380730911908060215","18385776570769163575","18380743006535965751","18381850214661844490","18381305956406740279","18381293861778845194","1863483509899085111","18385776570768377143","18387767786242393399","18387761189172757815","18387779880870298935","18381293861778834743","18381301558359180599","1865453834736046391","18385797461488846135","18385809556116751671","18385776570769149239","18387761189172743479","18381293861778820407","18381305956406725943","1867424159573045002","18381835921095224842","18390019586139518986","18381856811731482634","18390031680767424522","18381868906359388170","18381305956406750730","1869394484410021898","18389998695419049994","18381835921095227402","18381850214661847050","18381293861778847754","18381301558359193610","18381305956406753290","1871364809246969143","18385776570768362807","18385797461488831799","18387767786242379063","18385809556116737335","18387779880870284599","18381301558359166263","1873334034572319858","1873614410037419391","18392531970209443455","18374799046677453951","18378760587071090303","18392552860846485119","18374813340244073599","18374819937314495615","1875585834386015871","18374799046676667519","18378760587071085695","18374819937313709183","18380147071234950527","18374827633894841471","18380167961871992191","1877556159222976895","18380147071234164095","18378760587071079807","18380167961871205759","18380161364801570175","18380147071234936191","18380175658452338047","1879526484059975551","18392531970210229887","18392546263776849535","18378760587071092863","18392552860846487679","18392552860847271551","18392560557427617407","1881496808896952434","18392531970209446015","18375080521654171760","18392531970210232447","18392546263776852095","18392552860847274111","18392560557427619967","1883467133733899647","18380147071234149759","18378760587071065471","18380167961871191423","18380161364801555839","18380167961871977855","18380175658452323711","1885438558082504458","1885720033059477258","18387465420628641034","18382117396071124234","18381868906359381002","18381868906359385610","18387779880870298890","18387779880870284554","1887706850570475274","18381856811731475466","18381856811731480074","18387767786242393354","18388061355930442762","18388061355930447370","18387767786242379018","1889677175407384330","18388049261302537226","18388049261302541834","18387486311349110026","18387498405977015562","18382138286791593226","18382150381419498762","1891629908058511114","18388028370582068234","18388028370582072842","18381301558359186442","18381301558359191050","18381301558359180554","18381301558359166218","1893610128416642058","18381850214661839882","18381293861778840586","18387761189172757770","18381293861778834698","18387761189172743434","18381293861778820362","1895571657245135882","18381835921095220234","18387746895606138122","18387746895606123786","18381305956406746122","18381305956406740234","18381305956406725898","1897433130480245788","1897713505945328668","1897994980922039324","18389048717422500892","18385389543094908983","18381755657165830199","18385389543096875063","18382318606615935031","18381730367894419511","1899965305708679510","18385696306838979926","18385671018071606614","18385696306419090774","18387666631172638038","18387666631676726614","18383700693236583766","1901935630545653078","18380348282281463126","18380322993514089814","18380348281861573974","18387666631172623702","18382318606615907670","18387641342405315926","1903905955383041079","18380629757258193975","18380604468490820663","18381755656661720119","18381755657165823031","18382318606615927863","18381730367894412343","1905876280219622711","18389918431489650231","18389893142722276919","18389918431069761079","18381755656661724727","18380604468492786743","18381730367894416951","1907846605056601911","18385414831862282295","18381755657165827639","18385414831442393143","18389893142724242999","18381755656661727287","18382318606615932471","1909816929893555287","1910098404870282326","18380629757258194006","18380604468490820694","18380629756838304854","18381755656661720150","18382318606615927894","18381730367894412374","1912068729707257174","18375844682654117462","18375819393886744150","18375844682234228310","18381755657165823062","18381755656661724758","18383700693236603990","1914039054544236374","18381755657165827670","18376970582141073494","18383700693236608598","18381755656661727318","18382318606615932502","18381730367894416982","1916009379381580119","18387666631676740950","18383700693236598102","18382318606615922006","18387641342405330262","18386540731769884016","18386515443003690352","1917979704218581078","18376970582560962646","18376945293793589334","18381755657165830230","18376945293795555414","18382318606615935062","18381730367894419542","1919950029055135088","18386259256792386928","18386233968025013616","18386259256372497776","18386540731265781104","18388792531080252784","18386515442498473328","1921921453403741200","1922201828868835088","18380629756838304823","18381755657165041162","18387666631676740919","18383700693236598071","18382318606615921975","18387641342405330231","1924173253217447434","18381730368397667850","18382329602235526666","18381755657165827594","18382329601731161610","18382318606615932426","18381730367894416906","1926143578054422282","18381766652280928266","18381755657165043722","18381730368397670410","18389918431069763594","18381730368399633930","18381755656661727242","1928112803379745079","18385696306838979895","18385671018071606583","18385696306419090743","18387666631172638007","18387666631676726583","18383700693236583735","1930084227728373770","18382329602235529226","18381755657165830154","18382329601731164170","18381730368399636490","18382318606615934986","18381730367894419466","1932053453053693239","18385696306838965559","18385671018071592247","18385696306419076407","18387666631172623671","18382318606615907639","18387641342405315895","1934023777890671730","1934305252867398768","18380629757258194032","18380604468490820720","18380629756838304880","18380629756754877552","18388792531080273008","18380604467987569776","1936275577704373616","18382600082095173232","18382574793327799920","18382600081675284080","18380629757258980464","18380629756754882160","18380604468492786800","1938245902541735280","18386259256792401264","18386233968025027952","18386540731769898352","18386515443003704688","18388792531080267120","18386515442498487664","1940216227378237810","18386259256372512112","18386540731265795440","18374718782747250047","18374693493979876735","18378659432001310079","18374718782243933567","1942186552215302000","18380629757258985072","18382600081675286640","18380604468492791408","18382600081591859312","18388792531080277616","18380604467987574384","1944156877052672112","18382600082095175792","18382574793327802480","18382600082095962224","18382574793329768560","18388792531080280176","18382574792824551536","1946128301400856330","1946432866121619210","18387677626791838986","18387385156279360522","18387948106232786442","18387385156279354634","18387677626791824650","18387385156279340298","1948403190958593802","18381766652280921098","18381766652280925706","18381755656661720074","18381755656661724682","18387666631172637962","18387666631172623626","1950349326959645706","18381755657165036554","18381730368397663242","18387666631675954442","18387641342908581130","18387666631675940106","18387641342908566794","1952320750804603914","18382329601731157002","18382329601731151114","18381730367894412298","18387641342405330186","18382329601731136778","18387641342405315850","1954291076145943562","18382329602235522058","18382329602235516170","18381730368399629322","18387641342910547210","18382329602235501834","18387641342910532874","1956283390796043274","18381755657165822986","18387666631676740874","18382318606615927818","18382318606615921930","18387666631676726538","18382318606615907594","1958230625887788159","1958512100864515199","18374718782747270271","18374693493979896959","18378659432001330303","18374718782243953791","18374718782244740223","18374693493476646015","1960482425701490047","18392451706280046207","18392426417512672895","18378659432001334911","18374718782748056703","18392451705776729727","18374693493981863039","1962452750538851711","18374718782747264383","18374693493979891071","18374718782748050815","18374693493981857151","18374718782244734335","18374693493476640127","1964423075375419775","18378659432001324415","18374718782243947903","18374718782748036479","18374693493981842815","18374718782244719999","18374693493476625791","1966393400212418431","18392451706280832639","18378659432001337471","18392426417514638975","18392451705776732287","18392451705777516159","18392426417009421951","1968363725049788543","18392451706280048767","18392426417512675455","18392451706280835199","18392426417514641535","18392451705777518719","18392426417009424511","1970356044464200732","1970751864304901208","1971033339281628274","18385809556116757616","18380743006452538480","18378772681698991231","18374832031941614719","18388905780777933936","18374832031942401151","1973003664118476376","18384965131186630230","18381868906359385686","18388624305883868784","18380743006452543088","18378772681698995839","18392564955474390655","1974973988955571570","18386372506070173040","18386653980963456368","18378772681698985343","18380180056499111295","18388905780777928048","18380180056499897727","1976944313792556888","18377083831838734422","18381305956406750806","18375113507001759856","18388905780777938544","18378772681698998399","18392564955475177087","1978914638546040920","18381868906359388246","18382713331289520240","18381305956406753366","18392564955474393215","18388905780777941104","18392564955475179647","1980884963466481010","18386372506070158704","18386653980963442032","18378772681698971007","18380180056499096959","18388905780777913712","18380180056499883391","1982740943439469596","1983022418282355728","18387783179405313290","18381730535398136887","18387783179405298954","18381730535398141495","18387641509909054775","18381730535398144055","1985110386702359580","18389190554422483996","18381872204894395478","18387783179405313366","18381872204894400055","18387783179405299030","18381872204894402615","1987080711405509719","18381872204894400086","18380746304987552880","18380746304987557488","18386657279498470768","18381872204894402646","18386657279498456432","1989051036242484240","18381872204894395447","18387783179405313335","18381872204894395402","18381872204894400010","18387783179405298999","18381872204894402570","1990879691583200272","18381730535398136842","18381730535398141450","18387641509909054730","18387641509909040439","18381730535398144010","18387641509909040394","1992991685916433522","18374835330476629119","18392568254009405055","18380183355034125695","18382716629824534640","18392568254009407615","18380183355034111359","1994857724735986716","1995139199712714297","18389937290271157815","18381774515863121463","18385433690643789879","18388803693699226736","18382337465817329207","18388803693699231344","1997116121619449399","18380648616039701559","18381774515863116855","18385715165620487479","18387685490374034743","18382337465817324599","18382337465817318711","1999086446456413200","18385715165620473143","18387685490374020407","18389937290271160330","18381774515863123978","18382337465817304375","18382337465817331722","2001049074628107378","18374729944863693951","18392462868396469887","18374729944863688063","18388803693699233904","18392462868396472447","18374729944863673727","2003027096130379018","18387404015480757258","18381774515863116810","18387966965434183178","18381774515863121418","18382337465817324554","18382337465817329162","2004997420967334154","18387404015480751370","18387685490374034698","18387404015480737034","18387685490374020362","18382337465817318666","18382337465817304330","2006950153618267164","2007241524115741752","18382329769234875734","18382329769234881591","18382329769234886199","18382329769234875703","18382329769234861398","18382329769234888759","2009201953348066391","18382329769234881622","18382329769234886230","18388803693699220848","18382329769234888790","18388792698584002160","18388803693699206512","2011182173789690896","18382329769234881546","18382329769234886154","18382329769234875658","18382329769234861367","18382329769234888714","18382329769234861322","2013141503594273906","18382600249179011184","18382600249095583856","18378659599505034623","18374718949747658111","18388792698584004720","18374718949748444543","2015111828431259263","18378659599505054847","18374718949747678335","18378659599505048959","18374718949747672447","18374718949748464767","18374718949748458879","2017082153268244351","18378659599505059455","18392451873280454271","18378659599505062015","18392451873280456831","18392451873281240703","18392451873281243263","2019052478105197625","2019333953081924921","18375844849737952854","18380629924258602096","18389918598573485623","18382318774119652438","18382318774119652407","18388792698583997552","2021304277918893625","18380629924342029398","18381755824165444694","18380629924342029367","18380629924342029424","18381755824165444663","18388792698583991664","2023274602755878457","18381755824165449302","18382600249179008624","18381755824165449271","18380629924258606704","18382318774119657046","18382318774119657015","2025244927592842553","18385696473922815318","18387666798676362582","18386259423876236656","18386540898769519984","18382318774119646550","18382318774119646519","2027215252429830200","18376970749644798038","18381755824165451862","18385414998946117687","18381755824165451831","18382318774119659606","18382318774119659575","2029185577266777431","18380348449365298518","18387666798676348246","18386259423876222320","18386540898769505648","18382318774119632214","18388792698583977328","2031132812409904156","2031414287386614812","18389048884926225436","18385696473922815287","18387666798676362551","18381730535398136918","18387641509909054806","18387641509909040470","2033382413066509399","18381730535398141526","18380604635491294320","18380604635491298928","18386515610002212208","18381730535398144086","18386515610002197872","2035378026754415632","18385696473922800951","18387666798676348215","18389918598573488138","18381755824165451786","18382318774119632183","18382318774119659530","2037323062740458610","18374693660980370559","18392426584513146495","18374693660980364671","18382574960328276080","18392426584513149055","18374693660980350335","2039318676428381450","18387385323783085066","18381755824165444618","18387948273736510986","18381755824165449226","18382318774119652362","18382318774119656970","2041289001265336586","18387385323783079178","18387666798676362506","18387385323783064842","18387666798676348170","18382318774119646474","18382318774119632138","2043283515408456732","2043564990385167388","2043858559989783580","18389122552205286428","18389154438042491932","18389107159042497564","18389168731693653020","18385206091738085431","18385213788319479863","2045815690636909910","18380702492110707798","18380678302854896726","18380710188692102230","18375863541435625046","18381774515863121494","18382337465817324630","2047786015473878614","18380678302854110294","18380710188691315798","18380648616039701590","18381774515863116886","18385776738272888150","18381788809514409046","2049756340311246166","18385744852434896214","18385776738272101718","18385769041691493718","18385744852435682646","18387699784025326934","18382337465817318742","2051726665147814230","18385715165620487510","18387685490374034774","18389428216388717910","18380396827878165846","18389435912970112342","18382337465817304406","2053698089496415574","18380396827877379414","18389435912969325910","18380367141062970710","18387685490374020438","18387699784025312598","18387761356676468054","2055667314821766202","2055948789798891094","18375893228250033750","18384932313341980246","18384924616761372246","18375893228250820182","18381788809514413654","18382337465817329238","2057919114635472726","18377019128156878934","18377051013994084438","18384932313342766678","18376989441342470230","18381774515863124054","18381788809514416214","2059889439472426042","18386050516667407418","18386050516666948666","18377043317413476438","18377019128157665366","18377051013994870870","18382337465817331798","2061859764309804400","18386339688225523056","18386331991644915056","18386307802389103984","18386339688226309488","18386573884118484336","18388811390281663856","2063830089146372464","18386307802388317552","18386278115573908848","18386559590467192176","18386331991644900720","18386307802389089648","18386339688226295152","2065800413983346032","18386307802388303216","18386339688225508720","18386278115573894512","18386559590467177840","18386573884118470000","18388811390281649520","2067771838332345360","2068064308425350455","18389966977085566519","18389998862922772023","18380702492110707767","18380678302854896695","18380710188692102199","18381788809514413623","2070035732773946935","18380678302854110263","18380710188691315767","18385769041691493687","18385776738272888119","18381788809514409015","18381850382165564471","2072006057610907959","18385744852434896183","18385776738272101687","18385744852435682615","18387699784025326903","18387761356676482359","18385776738272873783","2073964287820001079","18389991166342164023","18385463377458198583","18389966977086352951","18389998862923558455","18381850382165569079","18381774515863124023","2075934612656977936","18385213788318693431","18385463377458985015","18381788809514416183","18381850382165571639","18381836088598951946","18382337465817331767","2077917032121830711","18385744852434881847","18385776738272087351","18385769041691479351","18385744852435668279","18387699784025312567","18387761356676468023","2079874162818882674","2080155637796002928","18385776738272107632","18385769041691499632","18380678302854896752","18385776738272894064","18380662909607566448","18388811390281669744","2082125962632588912","18382648627691089520","18388591488039218800","18382618940876680816","18380648615956278896","18380662909607571056","18388811390281674352","2084096287469540466","18380678302854110320","18380648616039701616","18380648615956274288","18380139542157266303","18374767328343952767","18380147238738660735","2086066612306538352","18388583791458610800","18382648627691092080","18382648627691875952","18388591488040005232","18382618940876683376","18382618940793256048","2088036937143908464","18375080689157109872","18375072992576501872","18382648627691878512","18375080689157896304","18382633234444548208","18388811390281676912","2090007261980462463","18374767328343166335","18380147238737874303","18378678291202706815","18374737641445330303","18374751935096622463","18374737641446116735","2091990780956974090","2092286549584845834","18381546917040036874","18381546917039578122","18387433702295165962","18388028538085792778","18387457891551757578","18387747063109862666","2094242580771069194","18387996652248591882","18388020841505184778","18381804202761739274","18381836088598944778","18381788809514408970","18381850382165564426","2096212905608048138","18388028538085797386","18388020841505189386","18381804202761743882","18381836088598949386","18381788809514413578","18381850382165569034","2098183230444998922","18387433702295160074","18387465588132365578","18387715177272657162","18387699784025326858","18387761356676482314","18387747063109848330","2100153555281999882","18389966977085569034","18389998862922774538","18389991166342166538","18381804202761746442","18381788809514416138","18381850382165571594","2102123880118947082","18387433702295145738","18382117563574848778","18382109866994240778","18387715177272642826","18387699784025312522","18387761356676467978","2104081010816010367","2104360286769727615","18374767328343186559","18392500251875962495","18374767328343180671","18392500251875965055","18392470564978126463","18392470564978129023","2106328412583053439","18378678291202727039","18374737641445350527","18378678291202731647","18378678291202721151","18374737641445344639","18378678291202734207","2108315230094968959","18374799214180392063","18392532137713167999","18380147238737888639","18392532137713170559","18374751935096642687","18374751935096636799","2110270161685268607","18392484858629418623","18374737641446136959","18392470564978912895","18374737641446131071","18392484858629421183","18392470564978915455","2112270173420734591","18374791517599784063","18374767328343972991","18380139542157280639","18392500251876748927","18374767328343967103","18392500251876751487","2114264687513520255","18374799214181178495","18392524441132559999","18392532137713954431","18380147238738675071","18392524441132562559","18392532137713956991","2116160249900309532","2116441724877020188","2116723199853730844","18377532608672963612","18389190721926208540","18389456803689794902","18389468898317700438","18381294029282572343","18381306123910477879","2118793575823400022","18381850382165564502","18381869073863105622","18381294029282565206","18381301725862911062","18381306123910470742","18381872372398120022","2120769398302393942","18380731079411784790","18381856979235200086","18380743174039690326","18381294029282559318","18381306123910464854","18387783346909037910","2122733126069601622","18385797628992570710","18387767953746117974","18387761356676482390","18385809723620476246","18387780048374023510","18381301725862905174","2124710047892442454","18387767953746103638","18387780048374009174","18381294029282544982","18381301725862890838","18381306123910450518","18387783346909023574","2126680372813330487","18385234679039162423","18381856979235207223","18385246773667067959","18381869073863112759","18381301725862918199","18381872372398127159","2128645200092142679","2128925575557246550","18384953204062449238","18381856979235204694","18381850382165569110","18384965298690354774","18381869073863110230","18381301725862915670","2130902497463988054","18377071904714553430","18381856979235207254","18381294029282569814","18377083999342458966","18381306123910475350","18381872372398124630","2132867324658939990","18381850382165571670","18381869073863112790","18381294029282572374","18381301725862918230","18381306123910477910","18381872372398127190","2134837649495901552","18386635456769639792","18386654148467180912","18388893853653747056","18388901550234092912","18388905948281652592","18386657447002195312","2136813471974887792","18386360578945992048","18386642053839275376","18386372673573897584","18388893853653732720","18388905948281638256","18386657447002180976","2138777199742094704","18386360578945977712","18386642053839261040","18386635456769625456","18386372673573883248","18386654148467166576","18388901550234078576","2140754121648839696","2141035596541680695","18381856979235200055","18381869073863105591","18381294029282565175","18381301725862911031","18381306123910470711","18381872372398119991","2143005921462535735","18380731079411784759","18380743174039690295","18381294029282559287","18381301725862905143","18381306123910464823","18387783346909037879","2144976246299520567","18390019753643241015","18381856979235204663","18390031848271146551","18381869073863110199","18381301725862915639","18381872372398124599","2146945471624843575","18385797628992570679","18387767953746117943","18385809723620476215","18387780048374023479","18381294029282544951","18381306123910450487","2148916895889583888","18381294029282569783","18381306123910475319","18381294029282572298","18381301725862918154","18381306123910477834","18381872372398127114","2150887220810419511","18385797628992556343","18387767953746103607","18385809723620461879","18387780048374009143","18381301725862890807","18387783346909023543","2152852048089259122","2153133522982100080","18380724482258721904","18380743173956263024","18388893853653752944","18388901550234098800","18388905948281658480","18380746472491277424","2155102748391337584","18388612378759687792","18380731079328362096","18380724482258726512","18388624473387593328","18380743173956267632","18388901550234103408","2157079670298055794","18385797628992576624","18380731079328357488","18385809723620482160","18380168129375702399","18380180224003607935","18380183522537835903","2159049995135053680","18375101579877578864","18382701404165339248","18388893853653757552","18375113674505484400","18388905948281663088","18380746472491282032","2161014822330005616","18382694807095703664","18382713498793244784","18388893853653760112","18388901550234105968","18388905948281665648","18382716797328259184","2162984047739211135","18378760754574790015","18380168129374915967","18380161532305280383","18378772849202695551","18380180224002821503","18380175825956048255","2164960969645956106","2165242444538797066","18381856979235200010","18381869073863105546","18381294029282565130","18381301725862910986","18381306123910470666","18381872372398119946","2167212769459652106","18388049428806261770","18388061523434167306","18381294029282559242","18381301725862905098","18381306123910464778","18387783346909037834","2169183094296636938","18388049428806266378","18381856979235204618","18388061523434171914","18381869073863110154","18381301725862915594","18381872372398124554","2171152319621959946","18387486478852834570","18387767953746117898","18387498573480740106","18387780048374023434","18381294029282544906","18381306123910450442","2173122644458958602","18390019753643243530","18381856979235207178","18381294029282569738","18390031848271149066","18381869073863112714","18381306123910475274","2175094068807535882","18382138454295317770","18387767953746103562","18382150548923223306","18387780048374009098","18381301725862890762","18387783346909023498","2177058896086386815","2177340370979216511","18374813507747798143","18374832199445339263","18374820104818220159","18374827801398566015","18374832199446125695","18374835497980353663","2179316193458210431","18378760754574810239","18374820104817433727","18378772849202715775","18380168129375716735","18380180224003622271","18380183522537850239","2181279921225428607","18378760754574814847","18392553028350209663","18392546431280574079","18378772849202720383","18392565122978115199","18392560724931341951","2183250246062392703","18378760754574804351","18380168129374930303","18380161532305294719","18378772849202709887","18380180224002835839","18380175825956062591","2185227167969144703","18378760754574817407","18392553028350212223","18392553028350996095","18378772849202722943","18392565122978901631","18392568421513129599","2187191995164096639","18392546431280576639","18392565122978117759","18392553028350998655","18392560724931344511","18392565122978904191","18392568421513132159","2189062103230651420","2189339175882660892","2189618451836116024","2189958200928902200","18375643473535720503","18375611587698519607","18375643473535725111","18375643473535714615","18375611587698494806","18375611587698522167","2191912033091460152","18375611587698514999","18375596194535726135","18375611587698509111","18375596194535730743","18375596194535705942","18375596194535733303","2193831780393557048","18375596194535720247","18375537920419454007","18375537920419458615","18375537920419448119","18375537920419433814","18375537920419461175","2195822995951667255","18375643473535727671","18380629758767881271","18385707303464944951","18389918432999337527","18385696308348667191","18385414833371969591","2197781226160725048","18389709525790432312","18389685336534621240","18389717222371826744","18389669943371832376","18389611669255560248","18385433525069641783","2199771342207010871","18380648450465553463","18380640753884159031","18389937124697009719","18385715000046339383","18389929428115615287","18385425828488247351","2201721875834674234","2202084714671643706","18375643473535720534","18386050351092603962","18375643473535725142","18375643473535714646","18375643473535727702","18375643473535700310","2204015457090018391","18375611587698515030","18375611587698519638","18375611587698509142","18375611587698522198","18375611587698494832","18375596194535705968","2205971488276039766","18375596194535726166","18375596194535730774","18375596194535720278","18375863375861476950","18375596194535733334","18376989275768322134","2207934116531608662","18380648450465553494","18380640753884159062","18385715000046339414","18375855679280082518","18380366975488822614","18376981579186927702","2209893446252305494","18380629758767881302","18385707303464944982","18375844684163804758","18385696308348667222","18380359278907428182","18376970584070649942","2211839581833469015","18375537920419454038","18375537920419458646","18375537920419448150","18375537920419461206","18380348283791150422","18375537920419433840","2213827498856487952","2214138660647148560","18381546751465823242","18387433536720952330","18388028372511579146","18387418143558163466","18388042666162740234","18385715000046325047","2216079298670194186","18387152061743656458","18387183947580861962","18387136668580867594","18388042666162155018","18387078394464595466","18387948108162362890","2218047424483913226","18387996486674378250","18388028372511583754","18387981093511589386","18387966799860035082","18387959103278640650","18387922819395317258","2220019948344143626","18387152061743659018","18387183947580864522","18388042666162744842","18387136668580870154","18387078394464598026","18389918432999340042","2221988074157864970","18389966811511355402","18389998697348560906","18389951418348566538","18389937124697012234","18389929428115617802","18389893144232294410","2223958398994812215","18375611587698494775","18375643473535700279","18375596194535705911","18385707303464930615","18375537920419433783","18385696308348652855","2225928723831790706","2226222293436423280","18375611587698515056","18375643473535720560","18375596194535726192","18380648450465553520","18380640753884159088","18380629758767881328","2228180523645486704","18375611587698509168","18375643473535714672","18386277949999760752","18375537920419454064","18386270253418366320","18386259258302088560","2230150848482471536","18375611587698519664","18375643473535725168","18375596194535730800","18382611078721138288","18375537920419458672","18382600083604860528","2232121173319422320","18375596194535720304","18375643473535700336","18375537920419448176","18386277949999746416","18386270253418351984","18386259258302074224","2234091498156420976","18375611587698522224","18375643473535727728","18382618775302532720","18375596194535733360","18375537920419461232","18382600083604863088","2236058524458490994","18383517076302797938","18383492887046986866","18383477493884198002","18382618775302535280","18383419219767925874","18382611078721140848","2238032147830348914","2238313622807059570","18383524772884192370","18378707812442312063","18378739698279517567","18378692419279523199","18378634145163251071","18378659433930886527","2240283947644050815","18378739698279537791","18378692419279548031","18378678125628578943","18378670429047184511","18378659433930906751","18378634145163275903","2242249874434508415","18378707812442332287","18378692419279543423","18378678125628573055","18378634145163271295","18378670429047178623","18378659433930900863","2244224597317980543","18378707812442326399","18378739698279531903","18378692419279537535","18378634145163265407","18378678125628558719","18378670429047164287","2246194922154979199","18378707812442336895","18378739698279542399","18378678125628583551","18378670429047189119","18378659433930911359","18378634145163278463","2248177341619861631","18378707812442339455","18378739698279544959","18378692419279550591","18378678125628586111","18378670429047191679","18378659433930913919","2250137770852162570","2250475320921889802","18381546751465233418","18387152061743651850","18387183947580851466","18387465422558151946","18387183947580837130","18382117398000635146","2252429153084445706","18387136668580862986","18387152061743645962","18387433536720946442","18387152061743631626","18387418143558157578","18387433536720932106","2254446756921414666","18387183947580857354","18388042666162150410","18387479716208723210","18387479716209313034","18382131691651206410","18382131691651796234","2256355509107233802","18387136668580857098","18387403849906609162","18387403849906603274","18387136668580842762","18387418143558143242","18387403849906588938","2258307142246536202","18387396153325214730","18387385158208936970","18387396153325208842","18387385158208931082","18387396153325194506","18387385158208916746","2260251078804444170","18387078394464590858","18387078394464584970","18387359869441891338","18387359869441885450","18387078394464570634","18387359869441871114","2262245597192199196","2262544664354954268","2262904200362073175","18380724316767673430","18384946441418337878","18385790866348459350","18377065142070442070","18389450041045683542","18386353816301866352","2264874525199047696","18380724316767673399","18390012990999129655","18385790866348459319","18385227916395051063","18385790866348444983","18390012990999132170","2266844850036022386","18385790866348465264","18388605616115576432","18386353816301880688","18378753991930692991","18375094817233467504","18378753991930678655","2268744810423983132","18389731516022987832","18383539066535353458","18390012990999721994","18387404017410333706","18387404017410327818","18387404017410313482","2270707438679562098","18378753991930698879","18378753991930703487","18380640921387883632","18382611246224862832","18386270420922090864","18386270420922076528","2272672429167156338","18378670596550909055","18378670596550913663","18378670596550903167","18382611246224865392","18378670596550916223","18378670596550888831","2274728348407372828","2275015320942222392","18380730913837636694","18384953038488301142","18385797463418422614","18389456638115646806","18385234513465014327","18385242210046408759","2276984546267569239","18385797463418428528","18388612213185539696","18386360413371843952","18377071739140405334","18375101414303430768","18386360413371829616","2278955970616182583","18380730913837636663","18380738610419031095","18390019588069092919","18385797463418422583","18390027284650487351","18385805159999817015","2280926295453146128","18388049263232118282","18385797463418408247","18388056959813512714","18385805159999802679","18390019588069095434","18390027284650489866","2282896620290118666","18388049263232113674","18388056959813508106","18387486313278686474","18387494009860080906","18382138288721169674","18382145985302564106","2284860348057328767","18378760589000662143","18378760589000666751","18378760589000656255","18378753991930706047","18378760589000669311","18378760589000641919","2286844966545464348","2287126441522186070","18380738610419031126","18380743008465542230","18384960735069695574","18385805159999817046","18384965133116206678","18385809558046328150","2289096766359149624","18380743008465542199","18390031682696998455","18389464334697041238","18385809558046328119","18389468732743552342","18385246608092919863","2291067091196124247","18386368109953238384","18377079435721799766","18386372507999749488","18377083833768310870","18386368109953224048","18386372507999735152","2293037416033115760","18385805159999822960","18385809558046334064","18388619909766934128","18388624307813445232","18375109110884825200","18375113508931336304","2295011039404956688","18388061357860019210","18388061357860023818","18387498407906592010","18385809558046313783","18390031682697000970","18382150383349075210","2296978065707048063","18378768285582056575","18378768285582061183","18378768285582050687","18378768285582063743","18378768285582036351","18378772683628547455","2298839706396597276","2299121181373318998","18380640921387883606","18380629926271605846","18375855846783807062","18385707470968669526","18375844851667529302","18385696475852391766","2301091506210282552","18389929595619339831","18389918600503062071","18380359446411152726","18380348451294874966","18385425995991971895","18385415000875694135","2303061831047257175","18380629926271605872","18376981746690652246","18382600251108585072","18386259425805813104","18376970751574374486","18386259425805798768","2305032155884229687","18380640921387883575","18380629926271605815","18385707470968669495","18385696475852391735","18385707470968655159","18385696475852377399","2307001381209578610","18378659601434631295","18378659601434635903","18378659601434625407","18382600251108587632","18378659601434638463","18378659601434611071","2308972805558180874","18387396320828939274","18387959270782365194","18387396320828933386","18389929595619342346","18387396320828919050","18389918600503064586","2311056212589091868","2311339886589058104","18385812856581014870","18380746307000228919","18389753506255543352","18390034981231685175","18389472031278239062","18385249906627606583","2313310211425836119","18380746307000228950","18384968431650893398","18385812856581020784","18386375806534436208","18377087132302997590","18386375806534421872","2315280536263007248","18385812856581014839","18388064656394710538","18385812856581000503","18388064656395300362","18390034981231687690","18390034981232277514","2317248662076726386","18388627606348131952","18383561056767908978","18378775982163248511","18375116807466023024","18378772683628561791","18378775982163234175","2319221185936954378","18388064656394705930","18387501706441278730","18388064656395295754","18387501706441868554","18382153681883761930","18382153681884351754","2321189311750692479","18378775982163254399","18378772683628567679","18378775982163259007","18378772683628572287","18378775982163261567","18378772683628574847","2323022365137902620","2323301641091357752","18375538087923178582","18375538087923183190","18375538087923172694","18389611836759284792","18375538087923158358","18375538087923185719","2325271965928135767","18375538087923178608","18375538087923183216","18375538087923172720","18375538087923185750","18375538087923185776","18375538087923158384","2327242290765306896","18375538087923178551","18375538087923183159","18375538087923172663","18375538087923158327","18387078561968322570","18389893311736018954","2329212615602281586","18378634312666995839","18383419387271650418","18378634312667000447","18378634312666989951","18378634312667003007","18378634312666975615","2331185139462528266","18387078561968315402","18387385325712661514","18387078561968320010","18387360036945615882","18387948275666087434","18387922986899041802","2333155464299483402","18387078561968309514","18387385325712655626","18387360036945609994","18387078561968295178","18387385325712641290","18387360036945595658","2335171968608050204","2335453443584760888","2335747013189377080","18375611755168685142","18389709693294156856","18385776740168713558","18389685504038345784","18389717389875551288","18389670110875556920","2337705243398456662","18385744854330721622","18392250664632272214","18375611755202233686","18375643641039439190","18385744854331508054","18385715167550063958","2339675568235417942","18375611755168679254","18392250664631813462","18375596362039444822","18380396829773991254","18389435914865937750","18380367142992547158","2341645893072416567","18389998864818597431","18375611755202244151","18375643641039449655","18389998864819383863","18385213790214060087","18389937292200734263","2343616217909393463","18385213790214518839","18375611755202246711","18375643641039452215","18385213790215305271","18375596362039457847","18385433692573366327","2345598637374115158","18380396829773204822","18392250664632257878","18392250664631799126","18375611755202219350","18375643641039424854","18375596362039430486","2347556867583319098","2347850437187820630","18380678304749935702","18392250664632278102","18392250664631819350","18375611755202239574","18375643641039445078","18375596362039450710","2349808667397021014","18375611755168689750","18392250664631823958","18380678304750722134","18380710190587927638","18375596362039455318","18380648617969278038","2351778992233999958","18375893230145859158","18392250664632282710","18375611755202244182","18375643641039449686","18375893230146645590","18375863543365201494","2353761411698880342","18384932315238592086","18375611755168692310","18377051015889451094","18375611755202246742","18375643641039452246","18375596362039457878","2355719641907928122","18386050518596328506","18377019130052704342","18377051015889909846","18377019130053490774","18377051015890696278","18376989443272046678","2357702061372673392","18386307804284128624","18375611755168664944","18392250664631799152","18375611755202219376","18375643641039424880","18375596362039430512","2359660291581877360","2359969254332766064","18380678304749935728","18392250664632278128","18382648629586914928","18386307804284142960","18392250664632272240","18392250664632257904","2361939579169294448","18375611755168685168","18392250664631819376","18375611755168689776","18375611755168679280","18392250664631813488","18375611755168692336","2363894510860257392","18392250664631823984","18375596362039450736","18375611755202233712","18375596362039455344","18375596362039444848","18375596362039457904","2365880228876798064","18375611755202239600","18375643641039445104","18375611755202244208","18375643641039449712","18375643641039439216","18375611755202246768","2367823065906485104","18392250664632282736","18380648617969278064","18386307804284915056","18382618942806257264","18386278117503485296","18386278117503470960","2369820878518425456","18380678304750722160","18385776740168719472","18382648629587701360","18386307804284929392","18386339690122134896","18386339690122120560","2371763715580435472","2372045190557162768","18380710190587141175","18389998864818138679","18380710190587927607","18375596362039455287","18380648617969278007","18387996654178102794","2374015515394131511","18380710190586682423","18375611755202239543","18375643641039445047","18375596362039450679","18385776740168713527","18385715167550063927","2375997934858998071","18385776740167927095","18385776740167468343","18375611755202233655","18375643641039439159","18375596362039444791","18385776740168699191","2377968259695996682","18388028539982409226","18389998864818141194","18388028540015308298","18387152229247383562","18387184115084589066","18387136836084594698","2379926489905068042","18389998864818599946","18389998864819386378","18389966979015079946","18389998864852285450","18389951585852291082","18389937292200736778","2381896814742015287","18385776740167912759","18385776740167454007","18375611755202219319","18375643641039424823","18375596362039430455","18385715167550049591","2383866040067366002","2384147515044076658","18382648629586917488","18383517243806522482","18383493054550711410","18383477661387922546","18382648629587703920","18382618942806259824","2386116740369439871","18378707979912961151","18378707979912502399","18378707979946056831","18378707979913747583","18378692586783267967","18378678293132303487","2388087065206419071","18378707979912965759","18378707979912507007","18378707979946061439","18378707979913752191","18378692586783272575","18378678293132308095","2390057390043383167","18378707979912955263","18378707979912496511","18378707979946050943","18378707979913741695","18378692586783262079","18378678293132297599","2392027714880370815","18378707979912968319","18378707979912509567","18378707979946063999","18378707979913754751","18378692586783275135","18378678293132310655","2393998039717318015","18378707979912940927","18378707979912482175","18378707979946036607","18378707979913727359","18378692586783247743","18378678293132283263","2395970563577551882","2396278426850106378","18381546918968957962","18387152229247376394","18381546918969547786","18387152229247381002","18387433704224676874","18387433704224670986","2398279537995898122","18388028539981618186","18388028539981622794","18388028539981164042","18388028539982404618","18387184115084586506","18388028540015303690","2400249862832866826","18388028539981159434","18387465590028190986","18387184115084581898","18387184115084576010","18387465590028977418","18387465590061876490","2402220187669827850","18387465590027732234","18382117565470674186","18382117565470215434","18387184115084561674","18382117565471460618","18382117565504359690","2404144333035214602","18387152229247370506","18387136836084592138","18387418311061888010","18387981261015313930","18387152229247356170","18387433704224656650","2406100364221028106","18387136836084587530","18387136836084581642","18387418311061882122","18387966967363759626","18387136836084567306","18387418311061867786","2408136659738893340","2408428030320254008","2408709505296981334","18392264958282985046","18392271555352817238","18391983483307514966","18384946608922062422","18391990080377281622","18380731081341361238","2410679830133950038","18392264958283439190","18392264958282980438","18392271555352812630","18380724484271397974","18391983483307509078","18391990080377275734","2412650154970911062","18392264958283433302","18392264958282974550","18392271555352806742","18385791033852183894","18385797630922147158","18391990080377261398","2414620479807884630","18392264958283418966","18392264958282960214","18392271555352792406","18389450208549408086","18391983483307494742","18389456805619371350","2416590804644863032","18389731683526712376","18385228083865679927","18385234680935053367","18391420533354100791","18391427130423867447","18385234680968738871","2418561129481858871","18390013158469758519","18391420533354098231","18385228083865221175","18391427130423864887","18390019755572817463","18385228083898775607","2420531454318812247","2420812929295539568","18392264958282985072","18392271555352817264","18385791033819880560","18388605783619300976","18385797630889647216","18385797630922153072","2422783254132508272","18392264958283439216","18392264958282980464","18392271555352812656","18385791033852189808","18386353983773295984","18386360580843062640","2424753578969493335","18392264958283443798","18392264958283443824","18391420533354098262","18377065309540612182","18391427130423864918","18384953205992025686","2426723903806443888","18392264958283433328","18392264958282974576","18392271555352806768","18386353983805605232","18386360580875568496","18386360580843048304","2428694228643444822","18377065309541070934","18377071906610444374","18377065309574166614","18391420533354100822","18391427130423867478","18377071906644129878","2430664553480392048","18392264958283418992","18392264958282960240","18392271555352792432","18386353983805590896","18386353983773281648","18386360580875554160","2432634878317370384","2432916353294097719","18390013158469299767","18390019755539131959","18391983483307514935","18390013158502854199","18391990080377281591","18380731081341361207","2434886678131066423","18380724484238302263","18380724484237843511","18380731081307675703","18380724484271397943","18391702008330798391","18391708605400565047","2436857002968027447","18385791033819088183","18385791033818629431","18385797630888461623","18385791033852183863","18385797630922147127","18391708605400550711","2438827327805001015","18385791033819073847","18385791033818615095","18385797630888447287","18385791033852169527","18391702008330784055","18385797630922132791","2440797652642000650","18391420533354098186","18390013158469302282","18391427130423864842","18388042833666469386","18388049430735842826","18390013158502856714","2442767977478977546","18390013158469761034","18390019755539134474","18391420533354100746","18391427130423867402","18390013158503446538","18390019755572819978","2444727307199650930","2445008782176361586","18388591489935830640","18388605783586991728","18383524940387916914","18383539234039078002","18388612380689264240","18378760756504380799","2446979107013215615","18392250664632272255","18392264958283433343","18392264958282974591","18392271555352806783","18378739865783256447","18378754159434417535","2448949431850332016","18375080691052476528","18375094984703637616","18388612380656758384","18375101581773469808","18375643641039452272","18375094984737192048","2450919756687282559","18392250664631813503","18392264958283419007","18378739865750932863","18378754159402093951","18378760756471860607","18378760756504366463","2452890081524283504","18375080691052935280","18375094984704096368","18375080691053721712","18375094984704882800","18375101581774649456","18375101581807155312","2454860406361099647","18392250664632257919","18392250664631799167","18392264958282960255","18392271555352792447","18378739865783242111","18378754159434403199","2456842825826113290","2457124300785914890","18388042833632779274","18387479883679352074","18391997776957496330","18391716301980779786","18382131859121835274","18391716301980765450","2459093526128039690","18388049430702152714","18388042833665874954","18388049430702157322","18387486480748725514","18388042833665879562","18382138456191208714","2461062751453320970","18388042833632320522","18388042833632325130","18387479883678893322","18387479883712447754","18382131859121376522","18382131859154930954","2463035275313747722","18388042833632783882","18388049430735838218","18387486480782411018","18387494177363805450","18382138456224894218","18382146152806288650","2465005600150721546","18388042833666464778","18391702008330798346","18387479883713037578","18388057127317232650","18391702008330784010","18382131859155520778","2466975924971967498","18391983483307514890","18391990080377281546","18391708605400565002","18391716301981959434","18391708605400550666","18391716301981945098","2468934155196778623","2469215630156586623","18392250664632278143","18392250664632282751","18392271555352812671","18392271555352817279","18378739865750173823","18378760756470708351","2471182656458612351","18392250664631819391","18392264958282980479","18392250664631823999","18392264958282985087","18378739865749715071","18378754159400876159","2473152981329141375","18378739865783262335","18378754159434423423","18378739865783266943","18378754159434428031","18378739865783269503","18378754159434430591","2475137599800696447","18392264958283439231","18392264958283443839","18378754159401334911","18378760756504386687","18378760756504391295","18378760756504393855","2477093630970775679","18378739865750953087","18378754159402114175","18378739865750957695","18378739865750947199","18378754159402108287","18378739865750960255","2479078249458911359","18378760756471880831","18378754159402118783","18378760756471885439","18378760756471874943","18378754159402121343","18378760756471887999","2481063967474392092","2481345442451114070","2481630215945799766","18392283649980718166","18392286948515994710","18392283649980722774","18392283649980712278","18392286948515988822","18377084001238349910","2483597242264668246","18392279251934207062","18392279251934211670","18392279251934201174","18391434827004082262","18384968599154617942","18377087299806722134","2485573064659716182","18392286948515535958","18392286948515540566","18392286948515530070","18380746474503953494","18385813024084739414","18377087299773167702","2487536792427120470","18391997776958676054","18391434827005259350","18391997776958670166","18380743175969266774","18384965300619931222","18385809725550052694","2489508216775723094","18392286948515999318","18380738777922755670","18384960902573420118","18385805327503541590","18377087299773626454","18377079603225524310","2491481840131852118","18392002175005187158","18392005473540070486","18391439225051770454","18392002175005181270","18391442523586653782","18392005473540064598","2493448866449660984","2493730341426367830","18392286948515974486","18391997776958655830","18389464502200765782","18392002175005166934","18392005473540050262","18389468900247276886","2495700666263346232","18392279251934186838","18392283649980697942","18389753673759267896","18392286948515515734","18389472198781963606","18391442523586656311","2497670991100337463","18391997776958676023","18390035148701855287","18380738777922755639","18392002175005187127","18392005473540070455","18380743175969266743","2499641315937316407","18391434827004079671","18390031850167037495","18390035148702314039","18390027452154211895","18390035148735409719","18390031850200722999","2501611640774291255","18391434827005259319","18391434827004082231","18391439225051770423","18391442523586653751","18385250074097776695","18385250074131331127","2503581965611268151","18385246775562958903","18385250074098235447","18391434827005261879","18385242377550133303","18391439225051772983","18385246775596644407","2505552290448219223","2505832665913318768","18392279251934211696","18392283649980722800","18385805327471041648","18385809725517552752","18388620077270658672","18388624475317169776","2507804090261915248","18392279251934207088","18392283649980718192","18385805327503547504","18385809725550058608","18386372675470968176","18386375974005851504","2509774415098889584","18392279251934201200","18392283649980712304","18392286948515988848","18386368277424457072","18386368277456962928","18386372675503474032","2511744739935874903","18388620077238152816","18391434827005261910","18388624475284663920","18391439225051773014","18391442523586656342","18377084001272035414","2513715064772825456","18392286948515530096","18386375974038160752","18386368277424442736","18386372675470953840","18386375974005837168","18386372675503459696","2515685389609799024","18392279251934186864","18392283649980697968","18392286948515974512","18392286948515515760","18386368277456948592","18386375974038146416","2517655714446777360","2517937189423498807","18391997776957496375","18380743175935581239","18380746474470399031","18380746474503953463","18391720700028470583","18391723998563353911","2519907514260473143","18391716301980779831","18385809725516367159","18385813024051643703","18391716301981959479","18385805327503541559","18385809725550052663","2521877839097323024","18380746474470857783","18391434827004082186","18390031850167040010","18390035148702316554","18390035148701857802","18390035148735412234","2523848163934409015","18385813024051184951","18385813024084739383","18391716301981945143","18391720700028456247","18391723998563339575","18385809725550038327","2525818488771409930","18391434827005261834","18390027452154214410","18391439225051772938","18391442523586656266","18390031850200725514","18390035148736002058","2527788813608357175","18391716301980765495","18385809725516352823","18385813024051629367","18385813024051170615","18385805327503527223","18385813024084725047","2529758038933707890","2530039513910442096","18375109278354864240","18375113676401375344","18375109278356043888","18375109278388549744","18375113676402554992","18375113676435060848","2532009838747409535","18392279251934207103","18392283649980718207","18378768453053275263","18378768453085781119","18378772851099786367","18378772851132292223","2533980163584388735","18392279251934211711","18392283649980722815","18378768453053279871","18378768453085785727","18378772851099790975","18378772851132296831","2535950488421352831","18392279251934201215","18392283649980712319","18378768453053269375","18378768453085775231","18378772851099780479","18378772851132286335","2537920813258340479","18378768453052102783","18378772851098613887","18378768453053282431","18378768453085788287","18378772851099793535","18378772851132299391","2539891138095287679","18392279251934186879","18392283649980697983","18378768453053255039","18378768453085760895","18378772851099766143","18378772851132271999","2541862562443892490","2542144037420620810","18388061525330058250","18388064823865334794","18391997776958675978","18392002175005187082","18388061525363743754","18388064823899020298","2544114362257595658","18391434827004079626","18388061525330062858","18388064823865339402","18388064823864880650","18392005473540070410","18388064823898435082","2546087985629447690","18388064823864876042","18388064823898430474","18391720700028470538","18391723998563353866","18387498575410316554","18387501873945593098","2548055011931549194","18391434827005259274","18388057127317237258","18391439225051770378","18391442523586653706","18388061525363748362","18388064823899024906","2550028635303383306","18387498575376631050","18387501873911907594","18387501873911448842","18387501873945003274","18391720700028456202","18391723998563339530","2551998960140356874","18382150550819114250","18382153849354390794","18382153849353932042","18382153849387486474","18382150550852799754","18382153849388076298","2553971484000590962","2554252958960541040","18392286948515994736","18392286948515535984","18392286948515999344","18392286948515540592","18385813024052436080","18388627773819547248","2556223283797498994","18375116974936651888","18375116974936193136","18392286948515974527","18375116974937438320","18392286948515515775","18378776149634649471","2558193608634484351","18392286948515994751","18392286948515535999","18392286948515988863","18392286948515530111","18378776149634669695","18378776149634663807","2560163933471469439","18392286948515999359","18392286948515540607","18378776149633890431","18378776149634674303","18378776149633431679","18378776149634676863","2562134258341977202","18385813024084745328","18388627773851856496","18383561224271633522","18378776149666973055","18375116974969747568","18378776149666958719","2564104583178772095","18378776149666978943","18378776149666983551","18378776149666986111"],"biomes":["minecraft:badlands","minecraft:bamboo_jungle","minecraft:beach","minecraft:birch_forest","minecraft:cherry_grove","minecraft:cold_ocean","minecraft:dark_forest","minecraft:deep_cold_ocean","minecraft:deep_dark","minecraft:deep_frozen_ocean","minecraft:deep_lukewarm_ocean","minecraft:deep_ocean","minecraft:desert","minecraft:dripstone_caves","minecraft:eroded_badlands","minecraft:flower_forest","minecraft:forest","minecraft:frozen_ocean","minecraft:frozen_peaks","minecraft:frozen_river","minecraft:grove","minecraft:ice_spikes","minecraft:jagged_peaks","minecraft:jungle","minecraft:lukewarm_ocean","minecraft:lush_caves","minecraft:mangrove_swamp","minecraft:meadow","minecraft:mushroom_fields","minecraft:ocean","minecraft:old_growth_birch_forest","minecraft:old_growth_pine_taiga","minecraft:old_growth_spruce_taiga","minecraft:plains","minecraft:river","minecraft:savanna","minecraft:savanna_plateau","minecraft:snowy_beach","minecraft:snowy_plains","minecraft:snowy_slopes","minecraft:snowy_taiga","minecraft:sparse_jungle","minecraft:stony_peaks","minecraft:stony_shore","minecraft:sunflower_plains","minecraft:swamp","minecraft:taiga","minecraft:warm_ocean","minecraft:windswept_forest","minecraft:windswept_gravelly_hills","minecraft:windswept_hills","minecraft:windswept_savanna","minecraft:wooded_badlands"]},"biomes":{"0":{"temperature":2.0,"frozen":false,"precipitation":false},"1":{"temperature":0.95,"frozen":false,"precipitation":true},"2":{"temperature":2.0,"frozen":false,"precipitation":false},"3":{"temperature":0.8,"frozen":false,"precipitation":true},"4":{"temperature":0.6,"frozen":false,"precipitation":true},"5":{"temperature":0.5,"frozen":false,"precipitation":true},"6":{"temperature":0.5,"frozen":false,"precipitation":true},"7":{"temperature":2.0,"frozen":false,"precipitation":false},"8":{"temperature":0.7,"frozen":false,"precipitation":true},"9":{"temperature":0.5,"frozen":false,"precipitation":true},"10":{"temperature":0.8,"frozen":false,"precipitation":true},"11":{"temperature":0.5,"frozen":true,"precipitation":true},"12":{"temperature":0.5,"frozen":false,"precipitation":true},"13":{"temperature":0.5,"frozen":false,"precipitation":true},"14":{"temperature":2.0,"frozen":false,"precipitation":false},"15":{"temperature":0.8,"frozen":false,"precipitation":true},"16":{"temperature":0.5,"frozen":false,"precipitation":false},"17":{"temperature":0.5,"frozen":false,"precipitation":false},"18":{"temperature":0.5,"frozen":false,"precipitation":false},"19":{"temperature":2.0,"frozen":false,"precipitation":false},"20":{"temperature":0.7,"frozen":false,"precipitation":true},"21":{"temperature":0.7,"frozen":false,"precipitation":true},"22":{"temperature":0.0,"frozen":true,"precipitation":true},"23":{"temperature":-0.7,"frozen":false,"precipitation":true},"24":{"temperature":0.0,"frozen":false,"precipitation":true},"25":{"temperature":-0.2,"frozen":false,"precipitation":true},"26":{"temperature":0.0,"frozen":false,"precipitation":true},"27":{"temperature":-0.7,"frozen":false,"precipitation":true},"28":{"temperature":0.95,"frozen":false,"precipitation":true},"29":{"temperature":0.5,"frozen":false,"precipitation":true},"30":{"temperature":0.5,"frozen":false,"precipitation":true},"31":{"temperature":0.8,"frozen":false,"precipitation":true},"32":{"temperature":0.5,"frozen":false,"precipitation":true},"33":{"temperature":0.9,"frozen":false,"precipitation":true},"34":{"temperature":2.0,"frozen":false,"precipitation":false},"35":{"temperature":0.5,"frozen":false,"precipitation":true},"36":{"temperature":0.6,"frozen":false,"precipitation":true},"37":{"temperature":0.3,"frozen":false,"precipitation":true},"38":{"temperature":0.25,"frozen":false,"precipitation":true},"39":{"temperature":0.8,"frozen":false,"precipitation":true},"40":{"temperature":0.5,"frozen":false,"precipitation":true},"41":{"temperature":2.0,"frozen":false,"precipitation":false},"42":{"temperature":2.0,"frozen":false,"precipitation":false},"43":{"temperature":0.5,"frozen":false,"precipitation":false},"44":{"temperature":0.05,"frozen":false,"precipitation":true},"45":{"temperature":0.0,"frozen":false,"precipitation":true},"46":{"temperature":-0.3,"frozen":false,"precipitation":true},"47":{"temperature":-0.5,"frozen":false,"precipitation":true},"48":{"temperature":2.0,"frozen":false,"precipitation":false},"49":{"temperature":0.95,"frozen":false,"precipitation":true},"50":{"temperature":1.0,"frozen":false,"precipitation":true},"51":{"temperature":0.2,"frozen":false,"precipitation":true},"52":{"temperature":0.8,"frozen":false,"precipitation":true},"53":{"temperature":0.8,"frozen":false,"precipitation":true},"54":{"temperature":0.25,"frozen":false,"precipitation":true},"55":{"temperature":0.5,"frozen":false,"precipitation":false},"56":{"temperature":0.5,"frozen":false,"precipitation":false},"57":{"temperature":0.5,"frozen":false,"precipitation":true},"58":{"temperature":2.0,"frozen":false,"precipitation":false},"59":{"temperature":0.2,"frozen":false,"precipitation":true},"60":{"temperature":0.2,"frozen":false,"precipitation":true},"61":{"temperature":0.2,"frozen":false,"precipitation":true},"62":{"temperature":2.0,"frozen":false,"precipitation":false},"63":{"temperature":2.0,"frozen":false,"precipitation":false}},"biome_ids":{"minecraft:badlands":0,"minecraft:bamboo_jungle":1,"minecraft:basalt_deltas":2,"minecraft:beach":3,"minecraft:birch_forest":4,"minecraft:cherry_grove":5,"minecraft:cold_ocean":6,"minecraft:crimson_forest":7,"minecraft:dark_forest":8,"minecraft:deep_cold_ocean":9,"minecraft:deep_dark":10,"minecraft:deep_frozen_ocean":11,"minecraft:deep_lukewarm_ocean":12,"minecraft:deep_ocean":13,"minecraft:desert":14,"minecraft:dripstone_caves":15,"minecraft:end_barrens":16,"minecraft:end_highlands":17,"minecraft:end_midlands":18,"minecraft:eroded_badlands":19,"minecraft:flower_forest":20,"minecraft:forest":21,"minecraft:frozen_ocean":22,"minecraft:frozen_peaks":23,"minecraft:frozen_river":24,"minecraft:grove":25,"minecraft:ice_spikes":26,"minecraft:jagged_peaks":27,"minecraft:jungle":28,"minecraft:lukewarm_ocean":29,"minecraft:lush_caves":30,"minecraft:mangrove_swamp":31,"minecraft:meadow":32,"minecraft:mushroom_fields":33,"minecraft:nether_wastes":34,"minecraft:ocean":35,"minecraft:old_growth_birch_forest":36,"minecraft:old_growth_pine_taiga":37,"minecraft:old_growth_spruce_taiga":38,"minecraft:plains":39,"minecraft:river":40,"minecraft:savanna":41,"minecraft:savanna_plateau":42,"minecraft:small_end_islands":43,"minecraft:snowy_beach":44,"minecraft:snowy_plains":45,"minecraft:snowy_slopes":46,"minecraft:snowy_taiga":47,"minecraft:soul_sand_valley":48,"minecraft:sparse_jungle":49,"minecraft:stony_peaks":50,"minecraft:stony_shore":51,"minecraft:sunflower_plains":52,"minecraft:swamp":53,"minecraft:taiga":54,"minecraft:the_end":55,"minecraft:the_void":56,"minecraft:warm_ocean":57,"minecraft:warped_forest":58,"minecraft:windswept_forest":59,"minecraft:windswept_gravelly_hills":60,"minecraft:windswept_hills":61,"minecraft:windswept_savanna":62,"minecraft:wooded_badlands":63},"states":{"minecraft:oak_log[axis=x]":130,"minecraft:oak_log[axis=y]":131,"minecraft:oak_log[axis=z]":132,"minecraft:oak_leaves[distance=1,persistent=false,waterlogged=false]":240,"minecraft:oak_leaves[distance=2,persistent=false,waterlogged=false]":244,"minecraft:oak_leaves[distance=3,persistent=false,waterlogged=false]":248,"minecraft:oak_leaves[distance=4,persistent=false,waterlogged=false]":252,"minecraft:oak_leaves[distance=5,persistent=false,waterlogged=false]":256,"minecraft:oak_leaves[distance=6,persistent=false,waterlogged=false]":260,"minecraft:oak_leaves[distance=7,persistent=false,waterlogged=false]":264,"minecraft:spruce_log[axis=x]":133,"minecraft:spruce_log[axis=y]":134,"minecraft:spruce_log[axis=z]":135,"minecraft:spruce_leaves[distance=1,persistent=false,waterlogged=false]":268,"minecraft:spruce_leaves[distance=2,persistent=false,waterlogged=false]":272,"minecraft:spruce_leaves[distance=3,persistent=false,waterlogged=false]":276,"minecraft:spruce_leaves[distance=4,persistent=false,waterlogged=false]":280,"minecraft:spruce_leaves[distance=5,persistent=false,waterlogged=false]":284,"minecraft:spruce_leaves[distance=6,persistent=false,waterlogged=false]":288,"minecraft:spruce_leaves[distance=7,persistent=false,waterlogged=false]":292,"minecraft:birch_log[axis=x]":136,"minecraft:birch_log[axis=y]":137,"minecraft:birch_log[axis=z]":138,"minecraft:birch_leaves[distance=1,persistent=false,waterlogged=false]":296,"minecraft:birch_leaves[distance=2,persistent=false,waterlogged=false]":300,"minecraft:birch_leaves[distance=3,persistent=false,waterlogged=false]":304,"minecraft:birch_leaves[distance=4,persistent=false,waterlogged=false]":308,"minecraft:birch_leaves[distance=5,persistent=false,waterlogged=false]":312,"minecraft:birch_leaves[distance=6,persistent=false,waterlogged=false]":316,"minecraft:birch_leaves[distance=7,persistent=false,waterlogged=false]":320,"minecraft:jungle_log[axis=x]":139,"minecraft:jungle_log[axis=y]":140,"minecraft:jungle_log[axis=z]":141,"minecraft:jungle_leaves[distance=1,persistent=false,waterlogged=false]":324,"minecraft:jungle_leaves[distance=2,persistent=false,waterlogged=false]":328,"minecraft:jungle_leaves[distance=3,persistent=false,waterlogged=false]":332,"minecraft:jungle_leaves[distance=4,persistent=false,waterlogged=false]":336,"minecraft:jungle_leaves[distance=5,persistent=false,waterlogged=false]":340,"minecraft:jungle_leaves[distance=6,persistent=false,waterlogged=false]":344,"minecraft:jungle_leaves[distance=7,persistent=false,waterlogged=false]":348,"minecraft:acacia_log[axis=x]":142,"minecraft:acacia_log[axis=y]":143,"minecraft:acacia_log[axis=z]":144,"minecraft:acacia_leaves[distance=1,persistent=false,waterlogged=false]":352,"minecraft:acacia_leaves[distance=2,persistent=false,waterlogged=false]":356,"minecraft:acacia_leaves[distance=3,persistent=false,waterlogged=false]":360,"minecraft:acacia_leaves[distance=4,persistent=false,waterlogged=false]":364,"minecraft:acacia_leaves[distance=5,persistent=false,waterlogged=false]":368,"minecraft:acacia_leaves[distance=6,persistent=false,waterlogged=false]":372,"minecraft:acacia_leaves[distance=7,persistent=false,waterlogged=false]":376,"minecraft:dark_oak_log[axis=x]":148,"minecraft:dark_oak_log[axis=y]":149,"minecraft:dark_oak_log[axis=z]":150,"minecraft:dark_oak_leaves[distance=1,persistent=false,waterlogged=false]":408,"minecraft:dark_oak_leaves[distance=2,persistent=false,waterlogged=false]":412,"minecraft:dark_oak_leaves[distance=3,persistent=false,waterlogged=false]":416,"minecraft:dark_oak_leaves[distance=4,persistent=false,waterlogged=false]":420,"minecraft:dark_oak_leaves[distance=5,persistent=false,waterlogged=false]":424,"minecraft:dark_oak_leaves[distance=6,persistent=false,waterlogged=false]":428,"minecraft:dark_oak_leaves[distance=7,persistent=false,waterlogged=false]":432,"minecraft:cherry_log[axis=x]":145,"minecraft:cherry_log[axis=y]":146,"minecraft:cherry_log[axis=z]":147,"minecraft:cherry_leaves[distance=1,persistent=false,waterlogged=false]":380,"minecraft:cherry_leaves[distance=2,persistent=false,waterlogged=false]":384,"minecraft:cherry_leaves[distance=3,persistent=false,waterlogged=false]":388,"minecraft:cherry_leaves[distance=4,persistent=false,waterlogged=false]":392,"minecraft:cherry_leaves[distance=5,persistent=false,waterlogged=false]":396,"minecraft:cherry_leaves[distance=6,persistent=false,waterlogged=false]":400,"minecraft:cherry_leaves[distance=7,persistent=false,waterlogged=false]":404,"minecraft:mangrove_log[axis=x]":151,"minecraft:mangrove_log[axis=y]":152,"minecraft:mangrove_log[axis=z]":153,"minecraft:mangrove_leaves[distance=1,persistent=false,waterlogged=false]":436,"minecraft:mangrove_leaves[distance=2,persistent=false,waterlogged=false]":440,"minecraft:mangrove_leaves[distance=3,persistent=false,waterlogged=false]":444,"minecraft:mangrove_leaves[distance=4,persistent=false,waterlogged=false]":448,"minecraft:mangrove_leaves[distance=5,persistent=false,waterlogged=false]":452,"minecraft:mangrove_leaves[distance=6,persistent=false,waterlogged=false]":456,"minecraft:mangrove_leaves[distance=7,persistent=false,waterlogged=false]":460,"minecraft:short_grass":2005,"minecraft:fern":2006,"minecraft:dead_bush":2007,"minecraft:brown_mushroom":2089,"minecraft:red_mushroom":2090,"minecraft:pumpkin":6811,"minecraft:melon":6812,"minecraft:lily_pad":7271,"minecraft:seagrass":2008,"minecraft:kelp_plant":12786,"minecraft:mossy_cobblestone":2353,"minecraft:packed_ice":10746,"minecraft:ice":5780,"minecraft:blue_ice":12941,"minecraft:stone":1,"minecraft:deepslate":24905,"minecraft:granite":2,"minecraft:diorite":4,"minecraft:andesite":6,"minecraft:tuff":21081,"minecraft:dirt":10,"minecraft:gravel":118,"minecraft:clay":5798,"minecraft:sand":112,"minecraft:grass_block":9,"minecraft:podzol":13,"minecraft:mycelium":7270,"minecraft:coarse_dirt":11,"minecraft:rooted_dirt":24902,"minecraft:moss_block":24843,"minecraft:mud":24903,"minecraft:mangrove_roots":155,"minecraft:muddy_mangrove_roots":157,"minecraft:red_sand":117,"minecraft:snow_block":5781,"minecraft:water":80,"minecraft:air":0,"minecraft:moss_carpet":24826,"minecraft:cobblestone":14,"minecraft:terracotta":10744,"minecraft:bedrock":79,"minecraft:sandstone":535,"minecraft:calcite":22316,"minecraft:powder_snow":22318,"minecraft:smooth_basalt":26557,"minecraft:dripstone_block":24768,"minecraft:glow_lichen":6996,"minecraft:dandelion":2075,"minecraft:poppy":2077,"minecraft:blue_orchid":2078,"minecraft:allium":2079,"minecraft:azure_bluet":2080,"minecraft:red_tulip":2081,"minecraft:orange_tulip":2082,"minecraft:white_tulip":2083,"minecraft:pink_tulip":2084,"minecraft:oxeye_daisy":2085,"minecraft:cornflower":2086,"minecraft:lily_of_the_valley":2088,"minecraft:tall_grass[half=lower]":10756,"minecraft:large_fern[half=lower]":10758,"minecraft:sunflower[half=lower]":10748,"minecraft:lilac[half=lower]":10750,"minecraft:rose_bush[half=lower]":10752,"minecraft:peony[half=lower]":10754,"minecraft:tall_seagrass[half=lower]":2010,"minecraft:tall_grass[half=upper]":10755,"minecraft:large_fern[half=upper]":10757,"minecraft:sunflower[half=upper]":10747,"minecraft:lilac[half=upper]":10749,"minecraft:rose_bush[half=upper]":10751,"minecraft:peony[half=upper]":10753,"minecraft:tall_seagrass[half=upper]":2009,"minecraft:cactus[age=0]":5782,"minecraft:sugar_cane[age=0]":5799,"minecraft:kelp[age=20]":12780,"minecraft:sweet_berry_bush[age=3]":18578,"minecraft:snow[layers=1]":5772,"minecraft:grass_block[snowy=true]":8,"minecraft:podzol[snowy=true]":12,"minecraft:mycelium[snowy=true]":7269,"minecraft:pink_petals[facing=north,flower_amount=1]":24827,"minecraft:pink_petals[facing=east,flower_amount=1]":24839,"minecraft:pink_petals[facing=south,flower_amount=1]":24831,"minecraft:pink_petals[facing=west,flower_amount=1]":24835,"minecraft:pink_petals[facing=north,flower_amount=2]":24828,"minecraft:pink_petals[facing=east,flower_amount=2]":24840,"minecraft:pink_petals[facing=south,flower_amount=2]":24832,"minecraft:pink_petals[facing=west,flower_amount=2]":24836,"minecraft:pink_petals[facing=north,flower_amount=3]":24829,"minecraft:pink_petals[facing=east,flower_amount=3]":24841,"minecraft:pink_petals[facing=south,flower_amount=3]":24833,"minecraft:pink_petals[facing=west,flower_amount=3]":24837,"minecraft:pink_petals[facing=north,flower_amount=4]":24830,"minecraft:pink_petals[facing=east,flower_amount=4]":24842,"minecraft:pink_petals[facing=south,flower_amount=4]":24834,"minecraft:pink_petals[facing=west,flower_amount=4]":24838,"minecraft:bamboo[age=0,leaves=none,stage=0]":12945,"minecraft:bamboo[age=0,leaves=small,stage=0]":12947,"minecraft:bamboo[age=0,leaves=large,stage=0]":12949,"minecraft:bamboo_sapling":12944,"minecraft:brown_mushroom_block[down=true,east=true,north=true,south=true,up=true,west=true]":6549,"minecraft:brown_mushroom_block[down=false,east=true,north=true,south=true,up=true,west=true]":6581,"minecraft:red_mushroom_block[down=true,east=true,north=true,south=true,up=true,west=true]":6613,"minecraft:red_mushroom_block[down=false,east=true,north=true,south=true,up=true,west=true]":6645,"minecraft:mushroom_stem[down=true,east=true,north=true,south=true,up=true,west=true]":6677,"minecraft:mushroom_stem[down=false,east=true,north=true,south=true,up=true,west=true]":6709,"minecraft:vine[east=false,north=true,south=false,up=false,west=false]":6860,"minecraft:vine[east=true,north=false,south=false,up=false,west=false]":6852,"minecraft:vine[east=false,north=false,south=true,up=false,west=false]":6864,"minecraft:vine[east=false,north=false,south=false,up=false,west=true]":6867,"minecraft:coal_ore":127,"minecraft:deepslate_coal_ore":128,"minecraft:iron_ore":125,"minecraft:deepslate_iron_ore":126,"minecraft:copper_ore":22942,"minecraft:deepslate_copper_ore":22943,"minecraft:gold_ore":123,"minecraft:deepslate_gold_ore":124,"minecraft:redstone_ore[lit=false]":5735,"minecraft:deepslate_redstone_ore[lit=false]":5737,"minecraft:lapis_ore":520,"minecraft:deepslate_lapis_ore":521,"minecraft:diamond_ore":4274,"minecraft:deepslate_diamond_ore":4275,"minecraft:emerald_ore":7511,"minecraft:deepslate_emerald_ore":7512,"minecraft:sea_pickle[pickles=1,waterlogged=true]":12933,"minecraft:sea_pickle[pickles=3,waterlogged=true]":12937},"blocks":{"minecraft:air":0,"minecraft:water":80,"minecraft:lava":96,"minecraft:stone":1,"minecraft:bedrock":79,"minecraft:deepslate":24905,"minecraft:granite":2,"minecraft:tuff":21081,"minecraft:copper_ore":22942,"minecraft:deepslate_iron_ore":126,"minecraft:raw_copper_block":26559,"minecraft:raw_iron_block":26558,"minecraft:terracotta":10744,"minecraft:orange_terracotta":9357,"minecraft:yellow_terracotta":9360,"minecraft:brown_terracotta":9368,"minecraft:red_terracotta":9370,"minecraft:white_terracotta":9356,"minecraft:light_gray_terracotta":9364,"minecraft:ice":5780,"minecraft:packed_ice":10746,"minecraft:snow_block":5781,"minecraft:snow":5772}} diff --git a/world/entities.py b/world/entities.py index 0a00302..67c4a75 100755 --- a/world/entities.py +++ b/world/entities.py @@ -568,7 +568,17 @@ def spawn_natural_mobs(self, max_spawned: int = 2, cap: int = 32) -> int: if not _is_solid(self.server.get_block_at(x, y - 1, z)): continue - mob_type = rng.choice(["zombie", "skeleton", "creeper", "spider"]) if is_night else rng.choice(["pig", "cow", "sheep"]) + config = getattr(self.server, "config", {}) + if is_night: + # spawn-monsters=false 或和平难度下不生成敌对生物 + if (not config.get("spawn-monsters", True) + or str(config.get("difficulty", "easy")).lower() == "peaceful"): + continue + mob_type = rng.choice(["zombie", "skeleton", "creeper", "spider"]) + else: + if not config.get("spawn-animals", True): + continue + mob_type = rng.choice(["pig", "cow", "sheep"]) self.create_mob(x + 0.5, y, z + 0.5, mob_type=mob_type) spawned += 1 diff --git a/world/inventory.py b/world/inventory.py index 817daf3..7fd03e1 100755 --- a/world/inventory.py +++ b/world/inventory.py @@ -32,331 +32,36 @@ # Item ID to protocol numeric ID mapping # -------------------------------------------------- -_ITEM_PROTOCOL_IDS: dict[str, int] = { - # Blocks (as items) - "minecraft:stone": 1, - "minecraft:granite": 2, - "minecraft:polished_granite": 3, - "minecraft:diorite": 4, - "minecraft:polished_diorite": 5, - "minecraft:andesite": 6, - "minecraft:polished_andesite": 7, - "minecraft:grass_block": 8, - "minecraft:dirt": 9, - "minecraft:coarse_dirt": 10, - "minecraft:podzol": 12, - "minecraft:cobblestone": 11, - "minecraft:oak_planks": 12, - "minecraft:spruce_planks": 13, - "minecraft:birch_planks": 14, - "minecraft:jungle_planks": 15, - "minecraft:acacia_planks": 16, - "minecraft:dark_oak_planks": 17, - "minecraft:mangrove_planks": 18, - "minecraft:bamboo_planks": 19, - "minecraft:glass": 25, - "minecraft:sand": 28, - "minecraft:red_sand": 29, - "minecraft:gravel": 30, - "minecraft:oak_log": 36, - "minecraft:spruce_log": 37, - "minecraft:birch_log": 38, - "minecraft:jungle_log": 39, - "minecraft:acacia_log": 40, - "minecraft:dark_oak_log": 41, - "minecraft:mangrove_log": 42, - "minecraft:chest": 54, - "minecraft:crafting_table": 55, - "minecraft:furnace": 56, - "minecraft:oak_sign": 62, - "minecraft:oak_door": 66, - "minecraft:ladder": 87, - "minecraft:torch": 79, - "minecraft:snow": 80, - "minecraft:ice": 81, - "minecraft:cactus": 88, - "minecraft:clay": 94, - "minecraft:jukebox": 99, - "minecraft:oak_fence": 101, - "minecraft:pumpkin": 111, - "minecraft:netherrack": 115, - "minecraft:soul_sand": 116, - "minecraft:glowstone": 117, - "minecraft:anvil": 133, - "minecraft:trapped_chest": 134, - "minecraft:ender_chest": 135, - "minecraft:bed": 140, - # Ores / Materials - "minecraft:coal_ore": 43, - "minecraft:iron_ore": 44, - "minecraft:gold_ore": 45, - "minecraft:diamond_ore": 56, - "minecraft:lapis_ore": 46, - "minecraft:redstone_ore": 47, - "minecraft:emerald_ore": 129, - "minecraft:copper_ore": 130, - "minecraft:deepslate_coal_ore": 48, - "minecraft:deepslate_iron_ore": 49, - "minecraft:deepslate_gold_ore": 50, - "minecraft:deepslate_diamond_ore": 57, - "minecraft:deepslate_lapis_ore": 51, - "minecraft:deepslate_redstone_ore": 52, - "minecraft:deepslate_emerald_ore": 131, - "minecraft:deepslate_copper_ore": 132, - # Ingots / Gems - "minecraft:coal": 104, - "minecraft:diamond": 110, - "minecraft:iron_ingot": 112, - "minecraft:gold_ingot": 113, - "minecraft:emerald": 120, - "minecraft:lapis_lazuli": 121, - "minecraft:quartz": 122, - "minecraft:amethyst_shard": 123, - "minecraft:copper_ingot": 124, - "minecraft:netherite_ingot": 125, - "minecraft:netherite_scrap": 126, - # Tools - "minecraft:wooden_pickaxe": 200, - "minecraft:stone_pickaxe": 201, - "minecraft:iron_pickaxe": 202, - "minecraft:golden_pickaxe": 203, - "minecraft:diamond_pickaxe": 204, - "minecraft:netherite_pickaxe": 205, - "minecraft:wooden_axe": 206, - "minecraft:stone_axe": 207, - "minecraft:iron_axe": 208, - "minecraft:golden_axe": 209, - "minecraft:diamond_axe": 210, - "minecraft:netherite_axe": 211, - "minecraft:wooden_shovel": 212, - "minecraft:stone_shovel": 213, - "minecraft:iron_shovel": 214, - "minecraft:golden_shovel": 215, - "minecraft:diamond_shovel": 216, - "minecraft:netherite_shovel": 217, - "minecraft:wooden_sword": 218, - "minecraft:stone_sword": 219, - "minecraft:iron_sword": 220, - "minecraft:golden_sword": 221, - "minecraft:diamond_sword": 222, - "minecraft:netherite_sword": 223, - "minecraft:wooden_hoe": 224, - "minecraft:stone_hoe": 225, - "minecraft:iron_hoe": 226, - "minecraft:golden_hoe": 227, - "minecraft:diamond_hoe": 228, - "minecraft:netherite_hoe": 229, - # Armor - "minecraft:leather_helmet": 250, - "minecraft:leather_chestplate": 251, - "minecraft:leather_leggings": 252, - "minecraft:leather_boots": 253, - "minecraft:iron_helmet": 254, - "minecraft:iron_chestplate": 255, - "minecraft:iron_leggings": 256, - "minecraft:iron_boots": 257, - "minecraft:golden_helmet": 258, - "minecraft:golden_chestplate": 259, - "minecraft:golden_leggings": 260, - "minecraft:golden_boots": 261, - "minecraft:diamond_helmet": 262, - "minecraft:diamond_chestplate": 263, - "minecraft:diamond_leggings": 264, - "minecraft:diamond_boots": 265, - "minecraft:netherite_helmet": 266, - "minecraft:netherite_chestplate": 267, - "minecraft:netherite_leggings": 268, - "minecraft:netherite_boots": 269, - # Food - "minecraft:apple": 300, - "minecraft:bread": 301, - "minecraft:cooked_beef": 302, - "minecraft:cooked_porkchop": 303, - "minecraft:cooked_chicken": 304, - "minecraft:raw_beef": 305, - "minecraft:raw_porkchop": 306, - "minecraft:raw_chicken": 307, - "minecraft:wheat": 308, - "minecraft:melon_slice": 309, - "minecraft:golden_apple": 310, - "minecraft:enchanted_golden_apple": 311, - "minecraft:cooked_cod": 312, - "minecraft:cooked_salmon": 313, - "minecraft:raw_cod": 314, - "minecraft:raw_salmon": 315, - "minecraft:baked_potato": 316, - "minecraft:carrot": 317, - "minecraft:golden_carrot": 318, - "minecraft:potato": 319, - "minecraft:beetroot": 320, - "minecraft:sweet_berries": 321, - "minecraft:glow_berries": 322, - # Misc - "minecraft:stick": 114, - "minecraft:bucket": 350, - "minecraft:water_bucket": 351, - "minecraft:lava_bucket": 352, - "minecraft:milk_bucket": 353, - "minecraft:bow": 354, - "minecraft:arrow": 355, - "minecraft:crossbow": 356, - "minecraft:trident": 357, - "minecraft:shield": 358, - "minecraft:flint": 359, - "minecraft:flint_and_steel": 360, - "minecraft:iron_nugget": 361, - "minecraft:gold_nugget": 362, - "minecraft:string": 363, - "minecraft:feather": 364, - "minecraft:leather": 365, - "minecraft:paper": 366, - "minecraft:book": 367, - "minecraft:slime_ball": 368, - "minecraft:ender_pearl": 369, - "minecraft:blaze_rod": 370, - "minecraft:blaze_powder": 371, - "minecraft:magma_cream": 372, - "minecraft:bone": 373, - "minecraft:sugar": 374, - "minecraft:egg": 375, - "minecraft:glowstone_dust": 376, - "minecraft:redstone": 377, - "minecraft:gunpowder": 378, - "minecraft:spider_eye": 379, - "minecraft:ink_sac": 380, - "minecraft:glow_ink_sac": 381, - "minecraft:wheat_seeds": 382, - "minecraft:beetroot_seeds": 383, - "minecraft:melon_seeds": 384, - "minecraft:pumpkin_seeds": 385, - "minecraft:bone_meal": 386, - "minecraft:dye": 387, - # Redstone components - "minecraft:redstone_torch": 400, - "minecraft:repeater": 401, - "minecraft:comparator": 402, - "minecraft:piston": 403, - "minecraft:sticky_piston": 404, - "minecraft:observer": 405, - "minecraft:hopper": 406, - "minecraft:dropper": 407, - "minecraft:dispenser": 408, - "minecraft:tripwire_hook": 409, - "minecraft:daylight_detector": 410, - "minecraft:lever": 411, - "minecraft:button": 412, - "minecraft:pressure_plate": 413, - "minecraft:tnt": 414, - "minecraft:minecart": 415, - "minecraft:boat": 416, - "minecraft:compass": 417, - "minecraft:clock": 418, - "minecraft:spyglass": 419, - "minecraft:shears": 420, - "minecraft:writable_book": 421, - "minecraft:written_book": 422, - "minecraft:map": 423, - "minecraft:fire_charge": 424, - "minecraft:painting": 425, - "minecraft:item_frame": 426, - "minecraft:name_tag": 428, - "minecraft:lead": 429, - "minecraft:saddle": 430, - "minecraft:totem_of_undying": 431, - "minecraft:elytra": 432, - "minecraft:experience_bottle": 433, - "minecraft:debug_stick": 434, - "minecraft:knowledge_book": 435, - # Farmland / Agricultural - "minecraft:wheat": 308, - "minecraft:farmland": 440, - # Dyes - "minecraft:white_dye": 450, - "minecraft:orange_dye": 451, - "minecraft:magenta_dye": 452, - "minecraft:light_blue_dye": 453, - "minecraft:yellow_dye": 454, - "minecraft:lime_dye": 455, - "minecraft:pink_dye": 456, - "minecraft:gray_dye": 457, - "minecraft:light_gray_dye": 458, - "minecraft:cyan_dye": 459, - "minecraft:purple_dye": 460, - "minecraft:blue_dye": 461, - "minecraft:brown_dye": 462, - "minecraft:green_dye": 463, - "minecraft:red_dye": 464, - "minecraft:black_dye": 465, - # Additional blocks - "minecraft:oak_slab": 470, - "minecraft:spruce_slab": 471, - "minecraft:birch_slab": 472, - "minecraft:jungle_slab": 473, - "minecraft:acacia_slab": 474, - "minecraft:dark_oak_slab": 475, - "minecraft:mangrove_slab": 476, - "minecraft:bamboo_slab": 477, - "minecraft:stone_slab": 478, - "minecraft:cobblestone_slab": 479, - "minecraft:stone_brick_slab": 480, - "minecraft:brick_slab": 481, - "minecraft:smooth_stone_slab": 482, - "minecraft:granite_slab": 483, - "minecraft:polished_granite_slab": 484, - "minecraft:diorite_slab": 485, - "minecraft:polished_diorite_slab": 486, - "minecraft:andesite_slab": 487, - "minecraft:polished_andesite_slab": 488, - # Stone variants - "minecraft:stone_bricks": 490, - "minecraft:mossy_stone_bricks": 491, - "minecraft:cracked_stone_bricks": 492, - "minecraft:chiseled_stone_bricks": 493, - "minecraft:smooth_stone": 494, - "minecraft:bricks": 495, - # Additional - "minecraft:raw_iron": 500, - "minecraft:raw_gold": 501, - "minecraft:raw_copper": 502, - "minecraft:bowl": 503, - "minecraft:mushroom_stew": 504, - "minecraft:cocoa_beans": 505, - "minecraft:brown_mushroom": 506, - "minecraft:red_mushroom": 507, - "minecraft:pumpkin_pie": 508, - "minecraft:sugar_cane": 509, - "minecraft:white_wool": 510, - "minecraft:white_carpet": 511, - "minecraft:white_banner": 512, - "minecraft:brick": 513, - "minecraft:clay_ball": 514, - "minecraft:oak_sapling": 515, - "minecraft:iron_horse_armor": 520, - "minecraft:golden_horse_armor": 521, - "minecraft:diamond_horse_armor": 522, - "minecraft:enchanted_book": 530, - "minecraft:glass_bottle": 531, - "minecraft:potion": 532, - "minecraft:smithing_template": 540, - "minecraft:netherite_upgrade_smithing_template": 541, - "minecraft:armor_trim_smithing_template": 542, -} +# The full 1.21.1 item registry (1333 items) lives in +# protocol/data/items_767.json; list position is the protocol ID. + +def _item_ids() -> dict[str, int]: + from protocol.gamedata import item_ids + return item_ids() + + +def _normalize_item_name(item_name: str) -> str: + name = str(item_name or "minecraft:air") + return name if ":" in name else f"minecraft:{name}" -# Reverse mapping: protocol ID -> item name -_PROTOCOL_ID_TO_ITEM: dict[int, str] = {} -for _name, _pid in _ITEM_PROTOCOL_IDS.items(): - if _pid not in _PROTOCOL_ID_TO_ITEM: - _PROTOCOL_ID_TO_ITEM[_pid] = _name + +def is_known_item(item_name: str) -> bool: + """True if the identifier exists in the 1.21.1 item registry.""" + return _normalize_item_name(item_name) in _item_ids() def item_name_to_protocol_id(item_name: str) -> int: """Convert a Minecraft item namespace ID to its protocol numeric ID.""" - return _ITEM_PROTOCOL_IDS.get(item_name, 1) + return _item_ids().get(_normalize_item_name(item_name), 1) def protocol_id_to_item_name(protocol_id: int) -> str: """Convert a protocol numeric ID to a Minecraft item namespace ID.""" - return _PROTOCOL_ID_TO_ITEM.get(protocol_id, "minecraft:stone") + from protocol.gamedata import item_names + names = item_names() + if 0 <= protocol_id < len(names): + return names[protocol_id] + return "minecraft:stone" # -------------------------------------------------- @@ -479,37 +184,15 @@ def is_empty(self) -> bool: @property def max_stack_size(self) -> int: - """Get the maximum stack size for this item type.""" - MAX_STACK_OVERRIDES = { - "minecraft:ender_pearl": 16, "minecraft:snowball": 16, - "minecraft:egg": 16, "minecraft:honey_bottle": 16, - "minecraft:sign": 16, "minecraft:bucket": 16, - "minecraft:saddle": 1, "minecraft:totem_of_undying": 1, - "minecraft:writable_book": 1, "minecraft:written_book": 1, - } - if self.item_id in MAX_STACK_OVERRIDES: - return MAX_STACK_OVERRIDES[self.item_id] - # Tools, weapons, armor and other non-stackable equipment = 1. - # Match by suffix rather than material prefix so materials such as - # iron_ingot, golden_apple, diamond_block and netherite_scrap keep - # their normal 64-stack behaviour. - for suffix in ("_sword", "_pickaxe", "_axe", "_shovel", "_hoe", - "_helmet", "_chestplate", "_leggings", "_boots", - "_bow", "_crossbow", "_trident", "_shield", - "_fishing_rod", "_shears", "_horse_armor", - "_elytra"): - if self.item_id.endswith(suffix): - return 1 - # Additional single-item overrides - single_items = { - "minecraft:bow", "minecraft:crossbow", "minecraft:trident", - "minecraft:shield", "minecraft:shears", "minecraft:flint_and_steel", - "minecraft:spyglass", "minecraft:elytra", "minecraft:carrot_on_a_stick", - "minecraft:warped_fungus_on_a_stick", "minecraft:enchanted_book", - } - if self.item_id in single_items: - return 1 - return 64 + """Maximum stack size for this item type (vanilla 1.21.1 table).""" + from protocol.gamedata import item_stack_sizes + return item_stack_sizes().get(_normalize_item_name(self.item_id), 64) + + @property + def max_durability(self) -> int: + """Maximum durability (0 for items that cannot be damaged).""" + from protocol.gamedata import item_durability + return item_durability().get(_normalize_item_name(self.item_id), 0) def copy(self) -> 'ItemStack': """Create a deep copy of this item stack.""" @@ -652,24 +335,26 @@ def add_item(self, item: ItemStack) -> int: if item.is_empty: return 0 remaining = item.count - # First try to stack with existing items - for i in range(self.TOTAL_SLOTS): - if i == 41: - continue # Skip crafting result - slot = self.slots[i] - if slot and slot.item_id == item.item_id and slot.count < slot.max_stack_size: - space = slot.max_stack_size - slot.count - add = min(space, remaining) - slot.count += add - remaining -= add - if remaining <= 0: - self.state_id += 1 - return 0 - # Then try empty slots (hotbar last for convenience) - for i in list(range(9, 36)) + list(range(0, 9)) + [40]: - if self.slots[i] is None or (self.slots[i] is not None and self.slots[i].is_empty): - add = min(item.max_stack_size, remaining) - self.slots[i] = ItemStack(item.item_id, add, item.damage, dict(item.nbt) if item.nbt else {}) + max_stack = item.max_stack_size + # 原版顺序: 先堆叠到已有的同类物品 (手持 -> 副手 -> 快捷栏 -> 背包), + # 再放入空槽位 (快捷栏 0-8 -> 背包 9-35)。合成格/护甲栏不参与。 + storage = list(range(0, 36)) + if max_stack > 1: + for i in [40] + storage: + slot = self.slots[i] + if (slot and not slot.is_empty and slot.can_stack_with(item) + and slot.count < max_stack): + add = min(max_stack - slot.count, remaining) + slot.count += add + remaining -= add + if remaining <= 0: + self.state_id += 1 + return 0 + for i in storage: + if self.slots[i] is None or self.slots[i].is_empty: + add = min(max_stack, remaining) + self.slots[i] = ItemStack(item.item_id, add, item.damage, + dict(item.nbt) if item.nbt else {}) remaining -= add if remaining <= 0: self.state_id += 1 @@ -859,6 +544,9 @@ def to_legacy_tuple(self, slot: int) -> tuple[str, int] | None: # Protocol Encoding # -------------------------------------------------- +SLOT_COMPONENT_DAMAGE = 3 # minecraft:damage in the 1.21.1 data component registry + + def encode_slot_entry(item: ItemStack | None) -> bytes: """ Encode a single inventory slot for the Minecraft 1.20.5+ protocol. @@ -897,11 +585,19 @@ def encode_slot_entry(item: ItemStack | None) -> bytes: item_id = item_name_to_protocol_id(item.item_id) payload.extend(write_varint(item_id)) - # addedComponentCount = 0 (we send no component overrides) - payload.extend(write_varint(0)) + # Data components. Only the ones PyMC tracks are sent: + # 3 = minecraft:damage (VarInt) -> durability bar on tools/armor + components = bytearray() + component_count = 0 + damage = int(getattr(item, "damage", 0) or 0) + if damage > 0 and item.max_durability > 0: + components.extend(write_varint(SLOT_COMPONENT_DAMAGE)) + components.extend(write_varint(min(damage, item.max_durability))) + component_count += 1 - # removedComponentCount = 0 (we don't remove any default components) - payload.extend(write_varint(0)) + payload.extend(write_varint(component_count)) # addedComponentCount + payload.extend(write_varint(0)) # removedComponentCount + payload.extend(components) # NOTE: If we ever need to send custom NBT (custom_name, enchantments, # durability, etc.), it must be encoded as a SlotComponent with the @@ -932,26 +628,26 @@ def decode_slot_entry(data: bytes, offset: int = 0) -> tuple[ItemStack | None, i if item_name is None: item_name = f"minecraft:unknown_{item_id_raw}" - # addedComponentCount + SlotComponent[] + # addedComponentCount, removedComponentCount, then the component data added_count, offset = read_varint(data, offset) - for _ in range(added_count): - # Skip the component type VarInt - _component_type, offset = read_varint(data, offset) - # NOTE: Properly decoding the component payload requires a switch - # on component type (custom_data, custom_name, enchantments, etc.). - # For now we don't decode component payloads — they're rare in - # vanilla and the client usually only sends simple slots. - # This is a known limitation: complex slots with components - # will fail to decode. Returning the item without NBT is a - # reasonable fallback for now. - break # avoid consuming unknown bytes - - # removedComponentCount + VarInt[] removed_count, offset = read_varint(data, offset) + damage = 0 + for index in range(added_count): + component_type, offset = read_varint(data, offset) + if component_type == SLOT_COMPONENT_DAMAGE: + damage, offset = read_varint(data, offset) + elif component_type in (1, 2): # max_stack_size / max_damage: VarInt + _value, offset = read_varint(data, offset) + else: + # Other component payloads (names, enchantments, potion contents...) + # are not decoded; the rest of this slot cannot be parsed reliably. + offset = len(data) + removed_count = 0 + break for _ in range(removed_count): _removed_type, offset = read_varint(data, offset) - item = ItemStack(item_id=item_name, count=max(1, item_count)) + item = ItemStack(item_id=item_name, count=max(1, item_count), damage=damage) return (item, offset) @@ -966,7 +662,7 @@ def build_set_container_content_payload( Sends complete container contents. """ payload = bytearray() - payload.extend(write_varint(window_id)) # Window ID (VarInt in 1.21.1+) + payload.append(window_id & 0xFF) # Window ID (unsigned byte in 1.21.1) payload.extend(write_varint(state_id)) # State ID payload.extend(write_varint(len(slots))) # Slot count @@ -990,9 +686,9 @@ def build_set_slot_payload( Updates a single inventory slot. """ payload = bytearray() - payload.extend(write_varint(window_id)) # Window ID + payload.append(window_id & 0xFF) # Window ID (signed byte; -2 = player inventory) payload.extend(write_varint(state_id)) # State ID - payload.extend(write_varint(slot)) # Slot index (VarInt in 1.21.1+) + payload.extend(write_short(slot)) # Slot index (short in 1.21.1) payload.extend(encode_slot_entry(item)) # Slot data return bytes(payload) @@ -1001,6 +697,7 @@ def build_open_screen_payload( window_id: int, window_type: str, window_title: str, + protocol_version: int = 767, ) -> bytes: """ Build Open Screen packet payload (0x3F in 1.21.1). @@ -1009,31 +706,42 @@ def build_open_screen_payload( payload = bytearray() payload.extend(write_varint(window_id)) # Container ID # Window type as VarInt (inventory type registry) + # minecraft:menu registry (1.21.1 protocol order) _WINDOW_TYPE_IDS = { - "minecraft:container": 0, - "minecraft:chest": 0, - "minecraft:crafting": 1, - "minecraft:furnace": 2, - "minecraft:blast_furnace": 4, - "minecraft:smoker": 5, - "minecraft:anvil": 7, - "minecraft:hopper": 9, - "minecraft:generic_9x1": 10, - "minecraft:generic_9x2": 11, - "minecraft:generic_9x3": 12, - "minecraft:generic_9x4": 13, - "minecraft:generic_9x5": 14, - "minecraft:generic_9x6": 15, - "minecraft:generic_3x3": 16, + "minecraft:generic_9x1": 0, + "minecraft:generic_9x2": 1, + "minecraft:generic_9x3": 2, + "minecraft:container": 2, + "minecraft:chest": 2, + "minecraft:generic_9x4": 3, + "minecraft:generic_9x5": 4, + "minecraft:generic_9x6": 5, + "minecraft:generic_3x3": 6, + "minecraft:crafter_3x3": 7, + "minecraft:anvil": 8, + "minecraft:beacon": 9, + "minecraft:blast_furnace": 10, + "minecraft:brewing_stand": 11, + "minecraft:crafting": 12, + "minecraft:enchantment": 13, + "minecraft:furnace": 14, + "minecraft:grindstone": 15, + "minecraft:hopper": 16, + "minecraft:lectern": 17, + "minecraft:loom": 18, + "minecraft:merchant": 19, + "minecraft:shulker_box": 20, + "minecraft:smithing": 21, + "minecraft:smoker": 22, + "minecraft:cartography_table": 23, + "minecraft:stonecutter": 24, } - type_id = _WINDOW_TYPE_IDS.get(window_type, 0) + type_id = _WINDOW_TYPE_IDS.get(window_type, 2) payload.extend(write_varint(type_id)) - # Title as JSON chat component - import json - title_json = json.dumps({"text": window_title}) - from protocol.data_types import write_string - payload.extend(write_string(title_json)) + # Title: text component (NBT on 1.20.3+) + from protocol.text import encode_component + payload.extend(encode_component(window_title, protocol_version)) return bytes(payload) @@ -1042,10 +750,38 @@ def build_open_screen_payload( # Inventory sync functions # -------------------------------------------------- +def window_slot_to_inventory(slot: int) -> int | None: + """Player window (id 0) slot -> PlayerInventory index.""" + if slot == 0: # crafting output + return 45 + if 1 <= slot <= 4: # 2x2 crafting input + return 40 + slot + if 5 <= slot <= 8: # helmet, chestplate, leggings, boots + return 44 - slot + if 9 <= slot <= 35: # main inventory + return slot + if 36 <= slot <= 44: # hotbar + return slot - 36 + if slot == 45: # offhand + return 40 + return None + + +PLAYER_WINDOW_SLOTS = 46 + + +def player_window_slots(inv) -> list: + """PlayerInventory contents in the client's window-0 slot order.""" + return [inv.slots[window_slot_to_inventory(w)] for w in range(PLAYER_WINDOW_SLOTS)] + + async def send_inventory_sync(conn): """ - Send full inventory sync to the client. - Uses Set Container Content packet (0x11 in 1.21.1). + Send the full player inventory (Set Container Content, window 0). + + The client's inventory window has its own slot order (crafting 0-4, armor + 5-8, main 9-35, hotbar 36-44, offhand 45), which differs from + PlayerInventory's storage order, so slots are remapped here. """ inv = getattr(conn, 'inventory_obj', None) if inv is None: @@ -1053,50 +789,38 @@ async def send_inventory_sync(conn): from protocol.packet_map import get_clientbound_packet - # Build complete slot list (46 slots) - slot_list: list[ItemStack | None] = [] - for i in range(PlayerInventory.TOTAL_SLOTS): - slot_list.append(inv.slots[i] if i < len(inv.slots) else None) - payload = build_set_container_content_payload( - window_id=PlayerInventory.WINDOW_PLAYER if hasattr(PlayerInventory, 'WINDOW_PLAYER') else 0, + window_id=0, state_id=getattr(conn, 'inventory_state_id', 0), - slots=slot_list, + slots=player_window_slots(inv), carried_item=inv.carried_item, ) - from protocol.packet_map import get_clientbound_packet pid = get_clientbound_packet(conn.protocol_version, "window_items") - if pid is not None: - await conn.send_packet(pid, payload) - else: - # Fallback: use 1.21.1 native packet ID (0x13 = window_items) - await conn.send_packet(0x13, payload) + await conn.send_packet(pid if pid is not None else 0x13, payload) async def send_slot_update(conn, slot: int): """ - Send a single slot update to the client. - Uses Set Slot packet (0x15 in 1.21.1). + Update one PlayerInventory slot on the client (Set Slot). + + Uses window id -2, which addresses the player inventory by storage index + (0-8 hotbar, 9-35 main, 36-39 armor, 40 offhand) regardless of which + window is currently open. """ inv = getattr(conn, 'inventory_obj', None) if inv is None: return - item = inv.get_slot(slot) payload = build_set_slot_payload( - window_id=0, # Player inventory + window_id=-2, state_id=getattr(conn, 'inventory_state_id', 0), slot=slot, - item=item, + item=inv.get_slot(slot), ) - # Set Slot is 0x15 in 1.21.1 (was incorrectly hardcoded as 0x12 which is close_window) from protocol.packet_map import get_clientbound_packet set_slot_pid = get_clientbound_packet(conn.protocol_version, "set_slot") - if set_slot_pid is not None: - await conn.send_packet(set_slot_pid, payload) - else: - await conn.send_packet(0x15, payload) + await conn.send_packet(set_slot_pid if set_slot_pid is not None else 0x15, payload) async def send_hotbar_update(conn): @@ -1111,7 +835,8 @@ async def send_hotbar_update(conn): async def send_open_container(conn, window_id: int, window_type: str, window_title: str): """Send the Open Screen packet to open a container window.""" - payload = build_open_screen_payload(window_id, window_type, window_title) + payload = build_open_screen_payload(window_id, window_type, window_title, + getattr(conn, 'protocol_version', 767)) # Open Screen is 0x33 in 1.21.1 (was incorrectly hardcoded as 0x3F which is face_player) from protocol.packet_map import get_clientbound_packet open_screen_pid = get_clientbound_packet(conn.protocol_version, "open_screen") @@ -1142,22 +867,7 @@ async def send_container_content(conn, window_id: int, slots: list[ItemStack | N def initialize_player_inventory(conn): - """Initialize a player's inventory with default creative hotbar items.""" + """Give a first-time player an empty inventory, like the vanilla server.""" if not hasattr(conn, 'inventory_obj') or conn.inventory_obj is None: conn.inventory_obj = PlayerInventory() conn.inventory_state_id = 0 - - # Default creative hotbar - _DEFAULT_HOTBAR = [ - "minecraft:stone", - "minecraft:grass_block", - "minecraft:dirt", - "minecraft:cobblestone", - "minecraft:oak_planks", - "minecraft:glass", - "minecraft:sand", - "minecraft:oak_log", - "minecraft:torch", - ] - for i, item_name in enumerate(_DEFAULT_HOTBAR): - conn.inventory_obj.set_slot(i, ItemStack(item_name, 64)) diff --git a/world/inventory_interactions.py b/world/inventory_interactions.py index 3ab7642..98cc642 100644 --- a/world/inventory_interactions.py +++ b/world/inventory_interactions.py @@ -442,12 +442,8 @@ async def handle_container_click(conn, payload: bytes, server, player_slot_mappe if window_id != 0 and _open_container(conn, window_id) is None: return - if state_id != conn.inventory_state_id: - if window_id == 0: - await send_inventory_sync(conn) - else: - await _sync_open_container(conn, window_id) - return + # 与原版一致: 状态序号不一致时仍然处理点击, 之后发送完整状态纠正客户端 + # (本函数结尾总是发送完整同步)。 changed_count, offset = read_varint(payload, offset) if changed_count < 0 or changed_count > 128: diff --git a/world/item_properties.py b/world/item_properties.py index 07e0dee..db6ac3b 100644 --- a/world/item_properties.py +++ b/world/item_properties.py @@ -118,14 +118,19 @@ async def damage_held_item(conn, server, amount: int = 1) -> bool: if item is None or item.is_empty: return False + from world.inventory import send_slot_update if not damage_item(item, amount): + # 同步耐久条 + await send_slot_update(conn, slot) return False - # 物品损毁 + # 物品损毁: 清空槽位, 并让客户端播放工具损坏的音效/粒子 (Entity Event 47) inventory.set_slot(slot, None) - logger.info(f"{conn.username} 的 {item.item_id} 已损毁") - from handlers.play.chat import send_system_message - await send_system_message(conn, f"[PyMC] 你的 {item.item_id} 已损毁") - from world.inventory import send_inventory_sync - await send_inventory_sync(conn) + conn.inventory_state_id = getattr(conn, "inventory_state_id", 0) + 1 + await send_slot_update(conn, slot) + from protocol.packet_map import get_clientbound_packet + from protocol.data_types import write_int, write_byte + pid = get_clientbound_packet(conn.protocol_version, "entity_status") + if pid is not None: + await conn.send_packet(pid, write_int(conn.entity_id) + write_byte(47)) return True diff --git a/world/level_data.py b/world/level_data.py new file mode 100644 index 0000000..5c633bb --- /dev/null +++ b/world/level_data.py @@ -0,0 +1,235 @@ +# ============================================================ +# PyMC - level.dat / session.lock +# ============================================================ + +""" +World metadata persistence in the vanilla ``level.dat`` layout. + +``level.dat`` is a gzip-compressed NBT file whose root compound contains a +``Data`` compound. PyMC reads and writes the fields it actually tracks (spawn +point, world time, weather, game rules, seed, difficulty, default game mode), +using the same names and types as the vanilla 1.21.1 server so the file can be +inspected with any NBT editor. + +``session.lock`` guards the world directory against being opened by two +server processes at once, like the vanilla server does. +""" + +from __future__ import annotations + +import gzip +import logging +import os +import time +from pathlib import Path + +from protocol.nbt import NbtByte, NbtLong, NbtFloat, NbtDouble, decode_nbt, encode_nbt + +logger = logging.getLogger("pymc.level") + +DATA_VERSION = 3955 # 1.21.1 +LEVEL_STORAGE_VERSION = 19133 # Anvil +VERSION_NAME = "1.21.1" + +_GAMEMODE_IDS = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} +_GAMEMODE_NAMES = {v: k for k, v in _GAMEMODE_IDS.items()} +_DIFFICULTY_IDS = {"peaceful": 0, "easy": 1, "normal": 2, "hard": 3} +_DIFFICULTY_NAMES = {v: k for k, v in _DIFFICULTY_IDS.items()} + + +def _plain(value): + """Strip the decoder's NBT wrapper objects, recursively.""" + if isinstance(value, dict): + return {k: _plain(v) for k, v in value.items()} + if isinstance(value, list): + return [_plain(v) for v in value] + if hasattr(value, "value") and not isinstance(value, (str, bytes)): + return value.value + if hasattr(value, "values") and not isinstance(value, dict): + return list(value.values) + return value + + +class LevelData: + """In-memory view of the parts of level.dat that PyMC uses.""" + + def __init__(self): + self.level_name: str = "world" + self.seed: int = 0 + self.spawn: tuple[int, int, int] | None = None + self.spawn_angle: float = 0.0 + self.game_time: int = 0 + self.day_time: int = 0 + self.raining: bool = False + self.thundering: bool = False + self.rain_time: int = 0 + self.thunder_time: int = 0 + self.clear_weather_time: int = 0 + self.gamerules: dict[str, str] = {} + self.difficulty: str | None = None + self.gamemode: str | None = None + self.hardcore: bool = False + self.last_played: int = 0 + self.existed: bool = False + + # ------------------------------------------------------------------ + + @classmethod + def load(cls, world_dir: str | os.PathLike) -> "LevelData": + """Load ``/level.dat`` (falls back to ``level.dat_old``).""" + level = cls() + world_dir = Path(world_dir) + for name in ("level.dat", "level.dat_old"): + path = world_dir / name + if not path.exists(): + continue + try: + with gzip.open(path, "rb") as f: + raw = f.read() + root, _ = decode_nbt(raw, 0, with_type=True, with_name=True) + level._apply(_plain(root or {}).get("Data", {})) + level.existed = True + return level + except Exception as e: + logger.error(f"Exception reading {path}: {e}") + return level + + def _apply(self, data: dict) -> None: + self.level_name = str(data.get("LevelName", self.level_name)) + if all(k in data for k in ("SpawnX", "SpawnY", "SpawnZ")): + self.spawn = (int(data["SpawnX"]), int(data["SpawnY"]), int(data["SpawnZ"])) + self.spawn_angle = float(data.get("SpawnAngle", 0.0)) + self.game_time = int(data.get("Time", 0)) + self.day_time = int(data.get("DayTime", self.game_time)) + self.raining = bool(data.get("raining", 0)) + self.thundering = bool(data.get("thundering", 0)) + self.rain_time = int(data.get("rainTime", 0)) + self.thunder_time = int(data.get("thunderTime", 0)) + self.clear_weather_time = int(data.get("clearWeatherTime", 0)) + self.hardcore = bool(data.get("hardcore", 0)) + self.last_played = int(data.get("LastPlayed", 0)) + if "Difficulty" in data: + self.difficulty = _DIFFICULTY_NAMES.get(int(data["Difficulty"])) + if "GameType" in data: + self.gamemode = _GAMEMODE_NAMES.get(int(data["GameType"])) + rules = data.get("GameRules", {}) + if isinstance(rules, dict): + self.gamerules = {str(k): str(v) for k, v in rules.items()} + seed = (data.get("WorldGenSettings") or {}).get("seed") + if seed is None: + seed = data.get("RandomSeed") + if seed is not None: + self.seed = int(seed) + + # ------------------------------------------------------------------ + + def to_nbt(self) -> dict: + spawn = self.spawn or (0, 64, 0) + data = { + "DataVersion": DATA_VERSION, + "version": LEVEL_STORAGE_VERSION, + "Version": { + "Id": DATA_VERSION, + "Name": VERSION_NAME, + "Series": "main", + "Snapshot": NbtByte(0), + }, + "LevelName": self.level_name, + "ServerBrands": ["PyMC"], + "WasModded": NbtByte(1), + "initialized": NbtByte(1), + "allowCommands": NbtByte(1), + "hardcore": NbtByte(1 if self.hardcore else 0), + "Difficulty": NbtByte(_DIFFICULTY_IDS.get(self.difficulty or "easy", 1)), + "DifficultyLocked": NbtByte(0), + "GameType": _GAMEMODE_IDS.get(self.gamemode or "survival", 0), + "SpawnX": int(spawn[0]), + "SpawnY": int(spawn[1]), + "SpawnZ": int(spawn[2]), + "SpawnAngle": NbtFloat(self.spawn_angle), + "Time": NbtLong(int(self.game_time)), + "DayTime": NbtLong(int(self.day_time)), + "LastPlayed": NbtLong(int(time.time() * 1000)), + "raining": NbtByte(1 if self.raining else 0), + "thundering": NbtByte(1 if self.thundering else 0), + "rainTime": int(self.rain_time), + "thunderTime": int(self.thunder_time), + "clearWeatherTime": int(self.clear_weather_time), + "GameRules": {k: str(v) for k, v in sorted(self.gamerules.items())}, + "WorldGenSettings": { + "seed": NbtLong(int(self.seed)), + "generate_features": NbtByte(1), + "bonus_chest": NbtByte(0), + }, + "BorderCenterX": NbtDouble(0.0), + "BorderCenterZ": NbtDouble(0.0), + "BorderSize": NbtDouble(59999968.0), + } + return {"Data": data} + + def save(self, world_dir: str | os.PathLike) -> None: + """Atomically write level.dat, keeping the previous file as level.dat_old.""" + world_dir = Path(world_dir) + world_dir.mkdir(parents=True, exist_ok=True) + path = world_dir / "level.dat" + tmp = world_dir / "level.dat_new" + raw = encode_nbt(self.to_nbt(), with_type=True, root_name="") + with gzip.open(tmp, "wb") as f: + f.write(raw) + if path.exists(): + try: + path.replace(world_dir / "level.dat_old") + except OSError: + pass + tmp.replace(path) + + +class SessionLockError(RuntimeError): + pass + + +class SessionLock: + """``session.lock``: exclusive lock on a world directory.""" + + def __init__(self, world_dir: str | os.PathLike): + self.path = Path(world_dir) / "session.lock" + self._file = None + + def acquire(self) -> None: + self.path.parent.mkdir(parents=True, exist_ok=True) + handle = open(self.path, "a+b") + try: + if os.name == "nt": + import msvcrt + handle.seek(0) + msvcrt.locking(handle.fileno(), msvcrt.LK_NBLCK, 1) + else: + import fcntl + fcntl.flock(handle.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) + except OSError as e: + handle.close() + raise SessionLockError( + f"{self.path}: already locked (possibly by other Minecraft instance?)" + ) from e + handle.seek(0) + handle.truncate() + handle.write("☃".encode("utf-8")) # snowman, like vanilla + handle.flush() + self._file = handle + + def release(self) -> None: + handle, self._file = self._file, None + if handle is None: + return + try: + if os.name == "nt": + import msvcrt + handle.seek(0) + msvcrt.locking(handle.fileno(), msvcrt.LK_UNLCK, 1) + else: + import fcntl + fcntl.flock(handle.fileno(), fcntl.LOCK_UN) + except OSError: + pass + finally: + handle.close() diff --git a/world/lighting.py b/world/lighting.py new file mode 100644 index 0000000..47ec14b --- /dev/null +++ b/world/lighting.py @@ -0,0 +1,229 @@ +# ============================================================ +# PyMC - 区块光照 +# ============================================================ + +""" +Per-chunk sky light and block light. + +The client lights block *changes* itself, but the light it shows for freshly +loaded chunks is whatever the server sent, so wrong data here means black +patches under every tree, tuft of grass or pane of glass. + +Model (the same rules as the vanilla light engine, limited to one chunk +column, so light does not flow across chunk borders): + + * sky light is 15 straight down from the sky until it meets a block that + filters light; every block subtracts its opacity (leaves, water and ice + filter 1 level, glass and plants 0, solid blocks stop it); + * both light types spread to the six neighbours, losing + ``max(1, opacity)`` per step; + * block light starts at each emitting block (torch 14, lava 15, ...). + +Opacity and emission come from ``world/blocks.json`` (``filterLight`` / +``emitLight``). +""" + +from __future__ import annotations + +from collections import deque + +SECTION_VOLUME = 4096 +LAYER = 256 + +_tables: tuple[list[int], list[int], frozenset[int]] | None = None + + +def _light_tables() -> tuple[list[int], list[int], frozenset[int]]: + """(opacity by state id, emission by state id, set of emitting state ids).""" + global _tables + if _tables is not None: + return _tables + import json + from .chunk_io import _find_blocks_json + + with open(_find_blocks_json(), "r", encoding="utf-8") as f: + blocks = json.load(f) + size = max(block["maxStateId"] for block in blocks) + 1 + opacity = [15] * size + emission = [0] * size + for block in blocks: + filter_light = int(block.get("filterLight", 15)) + emit = int(block.get("emitLight", 0)) + for state in range(block["minStateId"], block["maxStateId"] + 1): + opacity[state] = filter_light + emission[state] = emit + emitting = frozenset(i for i, value in enumerate(emission) if value > 0) + _tables = (opacity, emission, emitting) + return _tables + + +def _spread(light: bytearray, queue: deque, blocks, opacity: list[int], height: int) -> None: + """Flood-fill light levels from the queued cells (x, y, z).""" + size = len(opacity) + while queue: + x, y, z = queue.popleft() + level = light[y * LAYER + z * 16 + x] + if level <= 1: + continue + for nx, ny, nz in ((x + 1, y, z), (x - 1, y, z), (x, y + 1, z), + (x, y - 1, z), (x, y, z + 1), (x, y, z - 1)): + if not (0 <= nx < 16 and 0 <= nz < 16 and 0 <= ny < height): + continue + state = blocks[ny][nz][nx] + cost = opacity[state] if state < size else 15 + new_level = level - (cost if cost > 1 else 1) + if new_level <= 0: + continue + index = ny * LAYER + nz * 16 + nx + if light[index] < new_level: + light[index] = new_level + queue.append((nx, ny, nz)) + + +def compute_light(blocks) -> tuple[bytearray, bytearray]: + """ + Compute light for one chunk column. + + ``blocks`` is the ``[y][z][x]`` state-id array. Returns flat + ``(sky, block)`` arrays indexed ``y * 256 + z * 16 + x`` with levels 0-15. + """ + opacity, emission, emitting = _light_tables() + table_size = len(opacity) + height = len(blocks) + sky = bytearray(height * LAYER) + block_light = bytearray(height * LAYER) + + # Highest layer that contains anything: everything above is open sky. + top = height - 1 + while top >= 0: + layer = blocks[top] + if any(any(row) for row in layer): + break + top -= 1 + if top < height - 1: + start = (top + 1) * LAYER + sky[start:] = b"\x0f" * (len(sky) - start) + + # --- direct sky light, column by column --- + floors = [[0] * 16 for _ in range(16)] # lowest layer still at level 15 + partial: list[tuple[int, int, int]] = [] + for z in range(16): + floor_row = floors[z] + for x in range(16): + level = 15 + y = top + offset = z * 16 + x + while y >= 0: + state = blocks[y][z][x] + cost = opacity[state] if state < table_size else 15 + if level == 15: + if cost: + level -= cost + floor_row[x] = y + 1 + if level <= 0: + break + sky[y * LAYER + offset] = level + partial.append((x, y, z)) + else: + sky[y * LAYER + offset] = 15 + else: + level -= cost if cost > 1 else 1 + if level <= 0: + break + sky[y * LAYER + offset] = level + partial.append((x, y, z)) + y -= 1 + else: + floor_row[x] = 0 + + # --- sideways spread: fully lit cells next to a column whose direct light + # stops higher up (overhangs, tree canopies, cliffs, cave mouths) --- + queue: deque = deque(partial) + for z in range(16): + for x in range(16): + floor = floors[z][x] + highest_neighbour = floor + if x > 0 and floors[z][x - 1] > highest_neighbour: + highest_neighbour = floors[z][x - 1] + if x < 15 and floors[z][x + 1] > highest_neighbour: + highest_neighbour = floors[z][x + 1] + if z > 0 and floors[z - 1][x] > highest_neighbour: + highest_neighbour = floors[z - 1][x] + if z < 15 and floors[z + 1][x] > highest_neighbour: + highest_neighbour = floors[z + 1][x] + for y in range(floor, min(highest_neighbour, top + 1)): + queue.append((x, y, z)) + _spread(sky, queue, blocks, opacity, height) + + # --- block light --- + queue = deque() + for y in range(top + 1): + layer = blocks[y] + for z in range(16): + row = layer[z] + if emitting.isdisjoint(row): + continue + for x in range(16): + state = row[x] + if state in emitting: + block_light[y * LAYER + z * 16 + x] = emission[state] + queue.append((x, y, z)) + if queue: + _spread(block_light, queue, blocks, opacity, height) + + return sky, block_light + + +_FULL = b"\x0f" * SECTION_VOLUME +_EMPTY = bytes(SECTION_VOLUME) +_FULL_NIBBLES = b"\xff" * 2048 + + +def _pack_section(levels) -> bytes | None: + """4096 light levels -> 2048 packed nibbles; None if the section is all dark.""" + if levels == _EMPTY: + return None + if levels == _FULL: + return _FULL_NIBBLES + low = int.from_bytes(levels[0::2], "little") + high = int.from_bytes(levels[1::2], "little") + return (low | (high << 4)).to_bytes(2048, "little") + + +def build_light_sections(blocks) -> tuple[int, int, int, int, list[bytes], list[bytes]]: + """ + Light data in the Chunk Data packet layout. + + Returns ``(sky_mask, block_mask, empty_sky_mask, empty_block_mask, + sky_arrays, block_arrays)``. Bit ``i`` of a mask refers to light section + ``i``: section 0 is the one below the world, 1..N are the world sections + and N+1 is the one above the world. + """ + sky, block_light = compute_light(blocks) + world_sections = len(blocks) // 16 + + sky_mask = block_mask = empty_sky_mask = empty_block_mask = 0 + sky_arrays: list[bytes] = [] + block_arrays: list[bytes] = [] + + def add(index: int, sky_data: bytes | None, block_data: bytes | None): + nonlocal sky_mask, block_mask, empty_sky_mask, empty_block_mask + if sky_data is None: + empty_sky_mask |= 1 << index + else: + sky_mask |= 1 << index + sky_arrays.append(sky_data) + if block_data is None: + empty_block_mask |= 1 << index + else: + block_mask |= 1 << index + block_arrays.append(block_data) + + add(0, None, None) # below the world: dark + for section in range(world_sections): + start = section * SECTION_VOLUME + end = start + SECTION_VOLUME + add(section + 1, _pack_section(sky[start:end]), _pack_section(block_light[start:end])) + add(world_sections + 1, _FULL_NIBBLES, None) # above the world: open sky + + return sky_mask, block_mask, empty_sky_mask, empty_block_mask, sky_arrays, block_arrays diff --git a/world/storage.py b/world/storage.py index 5a9d72b..21ab6d9 100755 --- a/world/storage.py +++ b/world/storage.py @@ -520,6 +520,49 @@ def write(self, filepath: str, compression_type: int = 2): raise +class AnvilRegion: + """ + Anvil (.mca) region with the same interface as LinearRegion. + + This is the vanilla on-disk format, so a world written by PyMC opens in + singleplayer, MCASelector, Amulet, NBT editors etc. + """ + + def __init__(self): + self.chunks: list[bytes | None] = [None] * 1024 + self.timestamps: list[int] = [0] * 1024 + self.compression_level: int = 6 + + @staticmethod + def read(filepath: str, verify_checksum: bool = True) -> 'AnvilRegion': + reader = AnvilReader(filepath) + region = AnvilRegion() + region.chunks = list(reader.chunks) + region.timestamps = list(reader.timestamps) + return region + + def write(self, filepath: str, compression_level: int | None = None, **_kwargs): + writer = AnvilWriter() + for i in range(1024): + if self.chunks[i] is not None: + writer.set_chunk(i, self.chunks[i], self.timestamps[i] or None) + writer.write(filepath, 2) + + @property + def chunk_count(self) -> int: + return sum(1 for c in self.chunks if c is not None) + + def get_chunk(self, index: int) -> bytes | None: + return self.chunks[index] + + def set_chunk(self, index: int, data: bytes, timestamp: int | None = None): + self.chunks[index] = data + self.timestamps[index] = timestamp or int(time.time()) + + def estimated_size(self) -> int: + return sum(len(c) for c in self.chunks if c is not None) + 8192 + + # ============================================================ # Anvil -> Linear 转换器 (增强版 + 并发支持) # ============================================================ @@ -931,11 +974,24 @@ class WorldStorage: def __init__(self, world_dir: str, max_cached_regions: int = DEFAULT_MAX_REGIONS, - max_memory_mb: int = DEFAULT_MAX_MEMORY_MB): + max_memory_mb: int = DEFAULT_MAX_MEMORY_MB, + region_format: str = "anvil"): self.world_dir = Path(world_dir) + self.region_format = "linear" if str(region_format).lower() == "linear" else "anvil" + if self.region_format == "linear" and not HAS_ZSTD: + logger.warning("zstandard is not installed; storing regions as Anvil (.mca) instead of Linear") + self.region_format = "anvil" + self._region_class = LinearRegion if self.region_format == "linear" else AnvilRegion + self._region_suffix = ".linear" if self.region_format == "linear" else ".mca" self.region_dir = self.world_dir / "region" self.playerdata_dir = self.world_dir / "playerdata" + # 已解码区块的 LRU 缓存 + self._decoded: OrderedDict = OrderedDict() + self._decoded_lock = threading.Lock() + # 已编码区块 (heightmaps + 区块段字节) 的 LRU 缓存, 加入/重生时免去重复编码 + self._built: OrderedDict = OrderedDict() + # LRU 缓存 self._cache = LRUCache(max_cached_regions, max_memory_mb) self._cache.set_flush_callback(self._flush_region_impl) @@ -945,8 +1001,30 @@ def __init__(self, world_dir: str, self.playerdata_dir.mkdir(parents=True, exist_ok=True) def initialize(self): - """初始化存储,执行必要的格式转换。""" - convert_world_anvil_to_linear(str(self.world_dir)) + """ + 初始化存储并统一区域文件格式。 + + Anvil 模式 (默认, 原版格式): 旧版 PyMC 写入的 .linear 区域会一次性转换 + 为 .mca, 原文件改名为 .linear.bak 保留。Linear 模式: .mca 转为 .linear。 + """ + if self.region_format == "linear": + convert_world_anvil_to_linear(str(self.world_dir)) + return + converted = 0 + for linear_file in sorted(self.region_dir.glob("*.linear")): + mca_file = linear_file.with_suffix(".mca") + if mca_file.exists(): + continue + if not HAS_ZSTD: + logger.error(f"Cannot convert {linear_file.name}: zstandard is not installed " + f"(pip install zstandard)") + continue + if convert_linear_to_anvil(str(linear_file), str(mca_file)) > 0: + linear_file.rename(linear_file.with_name(linear_file.name + ".bak")) + converted += 1 + if converted: + logger.info(f"Converted {converted} Linear region files to Anvil (.mca); " + f"originals kept as *.linear.bak") @staticmethod def _chunk_to_region(cx: int, cz: int) -> tuple[int, int, int]: @@ -962,7 +1040,7 @@ def _chunk_to_region(cx: int, cz: int) -> tuple[int, int, int]: def _get_region_path(self, rx: int, rz: int) -> Path: """获取区域文件路径。""" - return self.region_dir / f"r.{rx}.{rz}.linear" + return self.region_dir / f"r.{rx}.{rz}{self._region_suffix}" def _flush_region_impl(self, rx: int, rz: int, region: LinearRegion): """将区域写入磁盘 (由缓存回调调用)。""" @@ -984,7 +1062,7 @@ def _load_region(self, rx: int, rz: int) -> LinearRegion | None: return None try: - region = LinearRegion.read(str(path), verify_checksum=True) + region = self._region_class.read(str(path), verify_checksum=True) self._cache.put(key, region) return region except Exception as e: @@ -996,7 +1074,7 @@ def _get_or_create_region(self, rx: int, rz: int) -> LinearRegion: key = (rx, rz) region = self._load_region(rx, rz) if region is None: - region = LinearRegion() + region = self._region_class() self._cache.put(key, region) return region @@ -1016,6 +1094,54 @@ def load_chunk(self, cx: int, cz: int) -> bytes | None: return None return region.get_chunk(index) + # ---- 已解码区块缓存 ---- + # + # 游戏刻里的方块查询 (伤害判定、生物物理、红石、流体) 每刻要读很多次 + # 方块。每次都从序列化字节反序列化整个 16x384x16 区块需要几十毫秒, 会把 + # TPS 拖垮, 所以把解码后的数组按 LRU 缓存起来。缓存中的数组是共享对象: + # 修改后必须调用 save_generated_chunk() 写回 (世界编辑代码都是这么做的)。 + + DECODED_CACHE_SIZE = 192 + + def _decoded_cache_get(self, key): + with self._decoded_lock: + entry = self._decoded.get(key) + if entry is not None: + self._decoded.move_to_end(key) + return entry + + def _decoded_cache_put(self, key, blocks, biomes): + with self._decoded_lock: + self._decoded[key] = (blocks, biomes) + self._decoded.move_to_end(key) + while len(self._decoded) > self.DECODED_CACHE_SIZE: + self._decoded.popitem(last=False) + + BUILT_CACHE_SIZE = 1024 + + def lazy_chunk_blocks(self, cx: int, cz: int) -> "LazyChunkBlocks": + """Block array that is only decoded from disk when something reads it.""" + return LazyChunkBlocks(lambda: self.load_generated_chunk(cx, cz)) + + def get_built_chunk(self, cx: int, cz: int): + """(motion_blocking, world_surface, chunk_data) cached for an unmodified chunk, or None.""" + with self._decoded_lock: + entry = self._built.get((cx, cz)) + if entry is not None: + self._built.move_to_end((cx, cz)) + return entry + + def put_built_chunk(self, cx: int, cz: int, motion_blocking, world_surface, chunk_data: bytes): + with self._decoded_lock: + self._built[(cx, cz)] = (motion_blocking, world_surface, chunk_data) + self._built.move_to_end((cx, cz)) + while len(self._built) > self.BUILT_CACHE_SIZE: + self._built.popitem(last=False) + + def _invalidate_built(self, cx: int, cz: int): + with self._decoded_lock: + self._built.pop((cx, cz), None) + def load_generated_chunk(self, cx: int, cz: int): """ 加载区块方块数组。 @@ -1023,10 +1149,11 @@ def load_generated_chunk(self, cx: int, cz: int): 返回: [y][z][x] 方块数组,或 None(不存在 / 无法解析) """ - raw = self.load_chunk(cx, cz) - if raw is None: - return None - return deserialize_chunk(raw) + entry = self._decoded_cache_get((cx, cz)) + if entry is not None: + return entry[0] + loaded = self.load_generated_chunk_with_biomes(cx, cz) + return loaded[0] if loaded is not None else None def load_generated_chunk_with_biomes(self, cx: int, cz: int): """ @@ -1035,10 +1162,17 @@ def load_generated_chunk_with_biomes(self, cx: int, cz: int): 返回: (blocks, biomes) 或 None """ + entry = self._decoded_cache_get((cx, cz)) + if entry is not None: + return entry raw = self.load_chunk(cx, cz) if raw is None: return None - return deserialize_chunk_with_biomes(raw) + decoded = deserialize_chunk_with_biomes(raw) + if decoded is None or decoded[0] is None: + return None + self._decoded_cache_put((cx, cz), decoded[0], decoded[1]) + return decoded def save_chunk(self, cx: int, cz: int, nbt_data: bytes): """ @@ -1052,9 +1186,15 @@ def save_chunk(self, cx: int, cz: int, nbt_data: bytes): region = self._get_or_create_region(rx, rz) region.set_chunk(index, nbt_data) self._cache.mark_dirty((rx, rz)) + self._invalidate_built(cx, cz) def save_generated_chunk(self, cx: int, cz: int, chunk_blocks, chunk_biomes=None): """保存区块方块数组到 Linear V2 区域文件(内容为原版 Chunk NBT)。""" + if chunk_biomes is None: + previous = self._decoded_cache_get((cx, cz)) + if previous is not None: + chunk_biomes = previous[1] + self._decoded_cache_put((cx, cz), chunk_blocks, chunk_biomes) self.save_chunk( cx, cz, @@ -1108,33 +1248,53 @@ def close(self): self._cache.clear() def _get_playerdata_path(self, player_uuid: str) -> Path: - """获取玩家存档路径。""" + """玩家存档路径 (原版: playerdata/.dat, gzip NBT)。""" + return self.playerdata_dir / f"{player_uuid}.dat" + + def _legacy_playerdata_path(self, player_uuid: str) -> Path: return self.playerdata_dir / f"{player_uuid}.json" def load_player_data(self, player_uuid: str) -> dict | None: - """加载玩家存档。""" - path = self._get_playerdata_path(player_uuid) - if not path.exists(): - return None - try: - with open(path, "r", encoding="utf-8") as f: - data = json.load(f) - if isinstance(data, dict): - return data - except Exception as e: - logger.error(f"Failed to load player data ({player_uuid}): {e}") + """加载玩家存档: 优先原版 .dat (NBT), 其次旧版 PyMC .json。""" + for path in (self._get_playerdata_path(player_uuid), + self.playerdata_dir / f"{player_uuid}.dat_old"): + if not path.exists(): + continue + try: + with gzip.open(path, "rb") as f: + raw = f.read() + from protocol.nbt import decode_nbt + from .level_data import _plain + root, _ = decode_nbt(raw, 0, with_type=True, with_name=True) + return player_nbt_to_state(_plain(root or {})) + except Exception as e: + logger.error(f"Failed to load player data {path.name}: {e}") + legacy = self._legacy_playerdata_path(player_uuid) + if legacy.exists(): + try: + with open(legacy, "r", encoding="utf-8") as f: + data = json.load(f) + if isinstance(data, dict): + return data + except Exception as e: + logger.error(f"Failed to load player data ({player_uuid}): {e}") return None def save_player_data(self, player_uuid: str, data: dict): - """保存玩家存档。""" + """保存玩家存档 (原版 NBT 格式, 旧文件保留为 .dat_old)。""" path = self._get_playerdata_path(player_uuid) - tmp_path = path.with_suffix(".json.tmp") + tmp_path = path.with_name(path.name + ".tmp") try: - with open(tmp_path, "w", encoding="utf-8") as f: - json.dump(data, f, ensure_ascii=False, indent=2) - f.flush() - os.fsync(f.fileno()) + from protocol.nbt import encode_nbt + raw = encode_nbt(player_state_to_nbt(data), with_type=True, root_name="") + with gzip.open(tmp_path, "wb") as f: + f.write(raw) + if path.exists(): + os.replace(path, path.with_name(path.name.replace(".dat", ".dat_old"))) os.replace(tmp_path, path) + legacy = self._legacy_playerdata_path(player_uuid) + if legacy.exists(): + legacy.replace(legacy.with_name(legacy.name + ".bak")) except Exception as e: logger.error(f"Failed to save player data ({player_uuid}): {e}") try: @@ -1375,3 +1535,188 @@ def validate_spawn_point(self, spawn_x: int, spawn_y: int, preferred_x=spawn_x, preferred_z=spawn_z, ) + + +# ============================================================ +# 玩家存档 <-> 原版 NBT +# ============================================================ + +_GAMEMODE_IDS = {"survival": 0, "creative": 1, "adventure": 2, "spectator": 3} +_GAMEMODE_NAMES = {v: k for k, v in _GAMEMODE_IDS.items()} + + +def _inventory_slot_to_nbt(index: int) -> int | None: + """PlayerInventory index -> vanilla Inventory "Slot" byte.""" + if 0 <= index <= 35: + return index + if 36 <= index <= 39: # boots, leggings, chestplate, helmet + return 100 + (index - 36) + if index == 40: # offhand + return -106 + return None + + +def _nbt_slot_to_inventory(slot: int) -> int | None: + if 0 <= slot <= 35: + return slot + if 100 <= slot <= 103: + return 36 + (slot - 100) + if slot == -106: + return 40 + return None + + +def _item_to_nbt(slot: int, entry: dict) -> dict: + from protocol.nbt import NbtByte + item = {"Slot": NbtByte(slot), "id": str(entry.get("item", "minecraft:air")), + "count": int(entry.get("count", 1))} + components = {} + damage = int(entry.get("damage", 0) or 0) + if damage > 0: + components["minecraft:damage"] = damage + extra = entry.get("nbt") or {} + if extra: + components["minecraft:custom_data"] = {"pymc": json.dumps(extra, ensure_ascii=False)} + if components: + item["components"] = components + return item + + +def _item_from_nbt(item: dict) -> tuple[int | None, dict]: + components = item.get("components") or {} + extra = {} + custom = components.get("minecraft:custom_data") or {} + if isinstance(custom, dict) and "pymc" in custom: + try: + extra = json.loads(custom["pymc"]) + except ValueError: + extra = {} + entry = {"item": item.get("id", "minecraft:air"), "count": int(item.get("count", item.get("Count", 1))), + "damage": int(components.get("minecraft:damage", 0) or 0), "nbt": extra} + return item.get("Slot"), entry + + +def player_state_to_nbt(data: dict) -> dict: + """PyMC player state dict -> vanilla playerdata compound.""" + from protocol.nbt import NbtByte, NbtDouble, NbtFloat, NbtShort + inventory = data.get("inventory") or {} + slots = inventory.get("slots", {}) if isinstance(inventory, dict) else {} + ender = inventory.get("ender_chest", {}) if isinstance(inventory, dict) else {} + inv_list = [] + for key, entry in slots.items(): + slot = _inventory_slot_to_nbt(int(key)) + if slot is not None: + inv_list.append(_item_to_nbt(slot, entry)) + ender_list = [_item_to_nbt(int(k), v) for k, v in ender.items() if 0 <= int(k) < 27] + mode = _GAMEMODE_IDS.get(str(data.get("gamemode", "survival")), 0) + root = { + "DataVersion": 3955, + "Pos": [NbtDouble(float(data.get("x", 0.0))), NbtDouble(float(data.get("y", 64.0))), + NbtDouble(float(data.get("z", 0.0)))], + "Rotation": [NbtFloat(float(data.get("yaw", 0.0))), NbtFloat(float(data.get("pitch", 0.0)))], + "Motion": [NbtDouble(0.0), NbtDouble(0.0), NbtDouble(0.0)], + "Dimension": "minecraft:overworld", + "Health": NbtFloat(float(data.get("health", 20.0))), + "foodLevel": int(data.get("food", 20)), + "foodSaturationLevel": NbtFloat(float(data.get("saturation", 5.0))), + "foodExhaustionLevel": NbtFloat(0.0), + "XpLevel": int(data.get("experience_level", 0)), + "XpP": NbtFloat(float(data.get("experience_progress", 0.0))), + "XpTotal": int(data.get("experience_total", 0)), + "Score": int(data.get("experience_total", 0)), + "playerGameType": mode, + "Air": NbtShort(int(data.get("air_supply", 300))), + "Fire": NbtShort(int(data.get("fire_ticks", 0))), + "TicksFrozen": int(data.get("freeze_ticks", 0)), + "OnGround": NbtByte(1 if data.get("on_ground", True) else 0), + "SelectedItemSlot": int(data.get("selected_slot", 0)), + "Inventory": inv_list, + "EnderItems": ender_list, + "abilities": { + "flying": NbtByte(1 if data.get("flying") else 0), + "mayfly": NbtByte(1 if mode in (1, 3) else 0), + "instabuild": NbtByte(1 if mode == 1 else 0), + "invulnerable": NbtByte(1 if mode in (1, 3) else 0), + "mayBuild": NbtByte(0 if mode in (2, 3) else 1), + "flySpeed": NbtFloat(0.05), + "walkSpeed": NbtFloat(0.1), + }, + "bukkit": {"lastKnownName": str(data.get("username", ""))}, + } + spawn = data.get("personal_spawn") + if isinstance(spawn, (list, tuple)) and len(spawn) == 3: + root["SpawnX"], root["SpawnY"], root["SpawnZ"] = (int(v) for v in spawn) + root["SpawnDimension"] = "minecraft:overworld" + root["SpawnForced"] = NbtByte(1) + return root + + +def player_nbt_to_state(root: dict) -> dict: + """Vanilla playerdata compound -> PyMC player state dict.""" + pos = root.get("Pos") or [0.0, 64.0, 0.0] + rot = root.get("Rotation") or [0.0, 0.0] + slots, ender = {}, {} + for item in root.get("Inventory") or []: + slot, entry = _item_from_nbt(item) + index = _nbt_slot_to_inventory(int(slot)) if slot is not None else None + if index is not None: + slots[str(index)] = entry + for item in root.get("EnderItems") or []: + slot, entry = _item_from_nbt(item) + if slot is not None and 0 <= int(slot) < 27: + ender[str(int(slot))] = entry + abilities = root.get("abilities") or {} + state = { + "username": (root.get("bukkit") or {}).get("lastKnownName", ""), + "x": float(pos[0]), "y": float(pos[1]), "z": float(pos[2]), + "yaw": float(rot[0]), "pitch": float(rot[1]), + "health": float(root.get("Health", 20.0)), + "food": int(root.get("foodLevel", 20)), + "saturation": float(root.get("foodSaturationLevel", 5.0)), + "experience_total": int(root.get("XpTotal", 0)), + "experience_level": int(root.get("XpLevel", 0)), + "experience_progress": float(root.get("XpP", 0.0)), + "gamemode": _GAMEMODE_NAMES.get(int(root.get("playerGameType", 0)), "survival"), + "on_ground": bool(root.get("OnGround", 1)), + "air_supply": int(root.get("Air", 300)), + "fire_ticks": max(0, int(root.get("Fire", 0))), + "freeze_ticks": int(root.get("TicksFrozen", 0)), + "flying": bool(abilities.get("flying", 0)), + "selected_slot": int(root.get("SelectedItemSlot", 0)), + "inventory": {"slots": slots, "ender_chest": ender, + "selected_slot": int(root.get("SelectedItemSlot", 0)), "held_slot": 0}, + "personal_spawn": None, + } + if all(k in root for k in ("SpawnX", "SpawnY", "SpawnZ")): + state["personal_spawn"] = [int(root["SpawnX"]), int(root["SpawnY"]), int(root["SpawnZ"])] + return state + + +class LazyChunkBlocks: + """ + Read-only stand-in for a [y][z][x] chunk block array: decodes on first + access. Used when the encoded packet for a chunk is cached so callers + that never look at the blocks don't pay for decoding them. + """ + + __slots__ = ("_loader", "_blocks") + + def __init__(self, loader): + self._loader = loader + self._blocks = None + + def _get(self): + if self._blocks is None: + blocks = self._loader() + self._blocks = blocks if blocks is not None else [] + return self._blocks + + def __getitem__(self, index): + return self._get()[index] + + def __len__(self): + return len(self._get()) + + def __iter__(self): + return iter(self._get()) + diff --git a/world/terrain_native.py b/world/terrain_native.py index 5bccf65..802149f 100755 --- a/world/terrain_native.py +++ b/world/terrain_native.py @@ -28,7 +28,9 @@ import array import logging import subprocess +import threading import time +import functools from pathlib import Path from ._native_binary import is_runnable_native_binary @@ -56,17 +58,43 @@ BATCH_RESPONSE_HEADER_FORMAT = ' str | None: - """查找跨平台 terrain_gen 可执行文件路径。 +WORLDGEN_VERSION_PREFIX = "pymc-worldgen 2" - 查找顺序: - 1. 本地源码树 / build 目录 / 工作目录中已有的 terrain_gen(.exe) - 2. 如果本地没有,自动从 GitHub Release 下载最新版 - 所有候选项都通过 is_runnable_native_binary() 验证 magic bytes - 和架构匹配,避免在 Linux 上选到 .exe 或在 Windows 上选到 ELF。 - """ - # Pick binary name based on current OS +def _worldgen_data_path() -> str | None: + """Locate world/data/worldgen_overworld.json (source tree or packaged).""" + candidates = [ + Path(__file__).resolve().parent / "data" / "worldgen_overworld.json", + Path(sys.argv[0]).resolve().parent / "world" / "data" / "worldgen_overworld.json", + Path.cwd() / "world" / "data" / "worldgen_overworld.json", + ] + for candidate in candidates: + if candidate.exists(): + return str(candidate) + return None + + +def native_binary_version(path: str | Path) -> str | None: + """Return the generator's ``--version`` string, or None for old/broken binaries.""" + try: + result = subprocess.run( + [str(path), "--version"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, timeout=10, + ) + except (OSError, subprocess.SubprocessError): + return None + text = result.stdout.decode("utf-8", errors="replace").strip() + return text if text.startswith(WORLDGEN_VERSION_PREFIX) else None + + +def _is_current_binary(path: Path) -> bool: + try: + return is_runnable_native_binary(path) and native_binary_version(path) is not None + except Exception: + return False + + +def _candidate_binaries() -> list[Path]: if os.name == "nt": binary_names = ["terrain_gen.exe", "terrain_gen"] else: @@ -82,84 +110,55 @@ def _find_native_binary() -> str | None: else None, Path(sys.executable).resolve().parent, ] - - search_roots: list[Path] = [] + seen: set[Path] = set() + candidates: list[Path] = [] for root in base_roots: if root is None: continue - current = root - for _ in range(4): - if current not in search_roots: - search_roots.append(current) - parent = current.parent - if parent == current: - break - current = parent - - seen: set[Path] = set() - candidates: list[Path] = [] - - for root in search_roots: - # Prefer source-tree artifacts first, then CMake install/build trees. - for relative in ( - "native", - "build/stage/native", - "build/stage", - "build", - ".", - ): - base = root / relative + for relative in ("native", "build/stage/native", "build/stage", "build", "build/native", "."): for name in binary_names: - candidate = (base / name).resolve() + candidate = (root / relative / name).resolve() if candidate not in seen: seen.add(candidate) candidates.append(candidate) + from ._native_build import build_cache_dir + for name in binary_names: + candidate = build_cache_dir() / name + if candidate not in seen: + seen.add(candidate) + candidates.append(candidate) + return candidates - # 兼容 standalone / onefile 等不同打包布局,在根目录附近再做一次浅层扫描。 - for name in binary_names: - direct = root / name - if direct not in seen: - seen.add(direct) - candidates.append(direct) - try: - for pattern in ("terrain_gen*", "native/terrain_gen*"): - for candidate in root.glob(pattern): - resolved = candidate.resolve() - if resolved not in seen: - seen.add(resolved) - candidates.append(resolved) - for candidate in root.glob(f"*/{pattern}"): - resolved = candidate.resolve() - if resolved not in seen: - seen.add(resolved) - candidates.append(resolved) - for candidate in root.glob(f"*/*/{pattern}"): - resolved = candidate.resolve() - if resolved not in seen: - seen.add(resolved) - candidates.append(resolved) - except Exception: - pass - for path in candidates: - if is_runnable_native_binary(path): +def _find_native_binary() -> str | None: + """ + Find a terrain_gen binary that speaks the current protocol. + + Order: existing binaries (source tree, build dirs, packaged layout) whose + ``--version`` matches -> compile native/terrain_gen.cpp with a local C++ + compiler -> download from GitHub Releases (accepted only if the version + matches). Older binaries are ignored: they produce a different world. + """ + stale = [] + for path in _candidate_binaries(): + if not path.exists(): + continue + if _is_current_binary(path): return str(path) + stale.append(path) + if stale: + logger.info(f"Ignoring outdated terrain_gen binaries: {', '.join(str(p) for p in stale[:3])}") + + from ._native_build import build_native_generator + built = build_native_generator() + if built and _is_current_binary(Path(built)): + return built - # 本地未找到可用二进制 — 尝试从 GitHub Release 自动下载 - logger.info( - "本地未找到可用的 terrain_gen 二进制,尝试从 GitHub Release 自动下载..." - ) downloaded = ensure_native_binary("terrain_gen") + if downloaded and _is_current_binary(Path(downloaded)): + return downloaded if downloaded: - # 下载后再次验证 magic - try: - if is_runnable_native_binary(Path(downloaded)): - return downloaded - logger.warning( - f"下载的 {downloaded} 未通过 magic 校验,将使用纯 Python 回退" - ) - except Exception as e: - logger.warning(f"校验下载的二进制失败: {e}") + logger.info("The terrain_gen release on GitHub is outdated; not using it") return None @@ -216,6 +215,15 @@ def _decode_binary_biomes(data: bytes) -> list[list[int]] | None: return sections +def _serialized(method): + """Run one request/response exchange at a time (the pipe is shared by threads).""" + @functools.wraps(method) + def wrapper(self, *args, **kwargs): + with self._lock: + return method(self, *args, **kwargs) + return wrapper + + class NativeTerrainGenerator: """ 使用 C++ 子进程的高性能地形生成器。 @@ -228,20 +236,21 @@ class NativeTerrainGenerator: def __init__(self, seed: int, binary_path: str | None = None, worker_count: int | None = None): self.seed = seed + self._lock = threading.RLock() self._process: subprocess.Popen | None = None self._binary_path = binary_path or _find_native_binary() self.worker_count = max(1, int(worker_count or (os.cpu_count() or 1))) self._redownload_attempted = False if self._binary_path: - logger.info(f"找到原生地形生成器: {self._binary_path}") + logger.debug(f"找到原生地形生成器: {self._binary_path}") self._start_process() - # 启动后如果立即崩溃,可能是本地二进制版本不对(如缺 DLL), - # 尝试从 GitHub Release 重新下载最新版替换 - if not self.available and not self._redownload_attempted: - self._try_redownload_after_crash() else: - logger.warning("未找到 terrain_gen 原生生成器,将使用纯 Python 回退") + logger.warning( + "No native terrain generator available: build it with " + "'g++ -O2 -std=c++17 -ffp-contract=off -pthread -o native/terrain_gen native/terrain_gen.cpp' " + "(or install a C++ compiler and restart) to get vanilla terrain" + ) def _try_redownload_after_crash(self) -> None: """子进程启动崩溃后,自动从 GitHub Release 重新下载二进制。""" @@ -283,8 +292,12 @@ def _start_process(self): return try: + command = [self._binary_path, "--threads", str(self.worker_count)] + data_path = _worldgen_data_path() + if data_path: + command += ["--data", data_path] self._process = subprocess.Popen( - [self._binary_path, "--threads", str(self.worker_count)], + command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -306,7 +319,7 @@ def _start_process(self): ) self._process = None return - logger.info(f"原生地形生成器子进程已启动 (PID: {self._process.pid})") + logger.debug(f"原生地形生成器子进程已启动 (PID: {self._process.pid})") except Exception as e: logger.error(f"启动原生地形生成器失败: {e}") self._process = None @@ -423,6 +436,7 @@ def _recv_batch_response(self, expected_count: int) -> list[tuple[bytes, bytes, )) return chunks + @_serialized def generate_chunk(self, chunk_x: int, chunk_z: int) -> list[list[list[int]]]: """ 通过 C++ 子进程生成区块数据。 @@ -452,6 +466,7 @@ def generate_chunk(self, chunk_x: int, chunk_z: int) -> list[list[list[int]]]: self._start_process() raise + @_serialized def generate_chunk_with_heightmap(self, chunk_x: int, chunk_z: int): """ 生成区块数据和高度图。 @@ -482,6 +497,7 @@ def generate_chunk_with_heightmap(self, chunk_x: int, chunk_z: int): self._start_process() raise + @_serialized def generate_chunk_with_metadata(self, chunk_x: int, chunk_z: int): """生成区块、地形高度图和原生 biome section ids。""" if not self.available: @@ -504,6 +520,7 @@ def generate_chunk_with_metadata(self, chunk_x: int, chunk_z: int): self._start_process() raise + @_serialized def generate_chunks_with_heightmaps(self, chunk_coords: list[tuple[int, int]]): """ 批量生成多个区块数据和高度图。 @@ -533,6 +550,7 @@ def generate_chunks_with_heightmaps(self, chunk_coords: list[tuple[int, int]]): self._start_process() raise + @_serialized def generate_chunks_with_metadata(self, chunk_coords: list[tuple[int, int]]): """批量生成区块、地形高度图和 biome section ids。""" if not chunk_coords: @@ -561,6 +579,26 @@ def generate_chunks_with_metadata(self, chunk_coords: list[tuple[int, int]]): self._start_process() raise + @_serialized + def find_spawn(self) -> tuple[int, int] | None: + """ + Vanilla Climate.findSpawnPosition: the column near the origin whose + climate best matches the noise settings' spawn targets (land, not ocean). + """ + if not self.available: + self._start_process() + if not self.available: + return None + try: + self._process.stdin.write(b"S" + struct.pack(" int: """ 获取单个坐标的地形高度。 @@ -595,7 +633,7 @@ def shutdown(self): except Exception: pass self._process = None - logger.info("原生地形生成器子进程已关闭") + logger.debug("原生地形生成器子进程已关闭") def __del__(self): self.shutdown()