Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 68 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build PYMC
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/*
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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/<uuid>.dat`:位置、生命、饥饿、经验、游戏模式、物品栏、末影箱和个人出生点;旧 `.json` 自动迁移。
- 新增配置项 `region-file-format`(`anvil` / `linear`)。

### 出生点
- 世界出生点采用原版逻辑:按气候寻找陆地,再搜索周围安全地表。
- 新玩家在 `spawnRadius` 范围内随机选择安全地面,不会出生在水里、岩浆、树顶或方块里;老玩家回到下线位置(被埋住时才挪到附近安全处)。

### 其他
- 重生从 3 秒多降到约 0.1 秒:缓存已编码的区块和数据包,并且像原版一样先发送位置和血量、再推送区块。玩家进服也因此变快。
- 点击草、蕨、单层雪等可替换方块时,新方块直接替换它(原版行为)。
- 修复 Windows (MSVC) 下地形生成器无法编译的问题。
- GitHub Actions:推送 `v*` tag 时自动构建三平台并发布正式版本。

### 已知限制
- 还没有结构(村庄等)和 carver(峡谷);树木等地物的位置与原版不同。
- 旧版本生成过的区块保持不变,与新生成区块的交界处会有断层,建议新开世界。
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading
Loading