hypermcpe/package-windows.ps1
Kirill Sokolov 110cb2a896 Infinite world, LuaJIT mod API, WorldEdit port, skins and music
- Infinite world: streamed chunk cache, multi-region storage (old chunks.dat
  still loads), per-chunk entity/tile entity persistence, client chunk
  streaming, protocol version 10, view-distance server property
- LuaJIT mod host (mods/, lua/prelude.lua) with events, commands, world and
  player API; WorldEdit command set ported to it (mods/worldedit)
- /skin command, SetSkinPacket and bundled skins
- OGG music player (data/music is ignored, tools/convert-music.ps1)
- package-windows.ps1 builds client and dedicated server for Windows

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 21:08:09 +03:00

76 lines
2.7 KiB
PowerShell

<#
Builds the Windows client and dedicated server (Release, x64) and assembles
ready to run folders:
dist\MinecraftPE-win64\ client (MinecraftPE.exe, data\, lua\, mods\)
dist\MinecraftPE-server-win64\ server (MinecraftPE-server.exe, lua\, mods\)
Requirements: Visual Studio 2022 (C++ workload) and CMake. The first run downloads
the dependencies (zlib, libpng, glfw, OpenAL Soft, LuaJIT, stb) with git.
.\package-windows.ps1 full build + package
.\package-windows.ps1 -NoBuild only (re)assemble dist from an existing build
.\package-windows.ps1 -Jobs 2 fewer parallel compiler jobs (low memory machines)
#>
param(
[switch]$NoBuild,
[int]$Jobs = 4
)
$ErrorActionPreference = 'Stop'
$root = $PSScriptRoot
$build = Join-Path $root 'build'
$dist = Join-Path $root 'dist'
# The dependencies are cloned with git; drives that do not record file ownership make git refuse
# that ("dubious ownership"). Tell git to trust directories for this process only.
$env:GIT_CONFIG_COUNT = '1'
$env:GIT_CONFIG_KEY_0 = 'safe.directory'
$env:GIT_CONFIG_VALUE_0 = '*'
if (-not $NoBuild) {
cmake -S $root -B $build -G 'Visual Studio 17 2022' -A x64
if ($LASTEXITCODE -ne 0) { throw 'CMake configure failed' }
# OpenAL Soft needs a lot of memory per compiler process, so the compiler parallelism is limited
cmake --build $build --config Release --parallel $Jobs -- /p:CL_MPCount=2
if ($LASTEXITCODE -ne 0) { throw 'Build failed' }
}
$rel = Join-Path $build 'Release'
foreach ($f in 'MinecraftPE.exe', 'MinecraftPE-server.exe') {
if (-not (Test-Path (Join-Path $rel $f))) { throw "$f not found in $rel" }
}
if (Test-Path $dist) { Remove-Item $dist -Recurse -Force }
# ---- client
$client = Join-Path $dist 'MinecraftPE-win64'
New-Item -ItemType Directory -Force $client | Out-Null
Copy-Item (Join-Path $rel 'MinecraftPE.exe') $client
Get-ChildItem $rel -Filter *.dll | Copy-Item -Destination $client
Copy-Item (Join-Path $root 'data') $client -Recurse
Copy-Item (Join-Path $root 'lua') $client -Recurse
Copy-Item (Join-Path $root 'mods') $client -Recurse
# ---- server
$server = Join-Path $dist 'MinecraftPE-server-win64'
New-Item -ItemType Directory -Force $server | Out-Null
Copy-Item (Join-Path $rel 'MinecraftPE-server.exe') $server
Copy-Item (Join-Path $root 'lua') $server -Recurse
Copy-Item (Join-Path $root 'mods') $server -Recurse
@"
port=19132
level-dir=level
level-cachepath=.
level-externalpath=.
gamemode=creative
level-name=level
view-distance=10
"@ | Set-Content (Join-Path $server 'server.properties') -Encoding ascii
Set-Content (Join-Path $server 'start-server.bat') "@echo off`r`nMinecraftPE-server.exe`r`npause" -Encoding ascii
Write-Host ''
Write-Host 'Done:'
Write-Host " $client"
Write-Host " $server"