feat: add FourKit plugin host with dual server build
Adds the FourKit .NET 10 plugin host as a second dedicated server
build flavour alongside the existing vanilla server. Both flavours
build from the same source tree, with FourKit gated by the
MINECRAFT_SERVER_FOURKIT_BUILD preprocessor define.
Build layout:
Minecraft.Server vanilla, no plugin support, no .NET dep
Minecraft.Server.FourKit FourKit-enabled, ships with bundled
.NET 10 self-contained runtime in runtime/
and an empty plugins/ folder
Both produce a Minecraft.Server.exe in their own per-target output
dir. The variant identity lives in the directory name, not the
binary name, so either flavour can be shipped as a drop-in.
Native bridge (Minecraft.Server/FourKit*.{cpp,h}):
* FourKitRuntime: hosts CoreCLR via hostfxr's command-line init API
(the runtime-config API does not support self-contained components)
* FourKitBridge: ~50 Fire* event entry points, with inline no-op
stubs for the standalone build so gameplay code can call them
unconditionally
* FourKitNatives: ~80 native callbacks the managed side invokes
for player/world/inventory mutations
* FourKitMappers: type and enum mapping helpers
Managed plugin host (Minecraft.Server.FourKit/):
* Bukkit-style API: Player, World, Block, Inventory, Command,
Listener, EventHandler attribute, ~54 event classes
* PluginLoader with per-plugin AssemblyLoadContext
* FourKitHost as the [UnmanagedCallersOnly] entry point table
* Runtime resolves plugins relative to the host process so they
always live next to Minecraft.Server.exe regardless of where the
managed assembly itself is loaded from
Engine hooks (Minecraft.Client/, Minecraft.World/):
* Player lifecycle (PreLogin, Login, Join, Quit, Kick, Move,
Teleport, Portal, Death) wired into PendingConnection and
PlayerConnection without disturbing the cipher handshake or
identity-token security flow
* Inventory open/click/drop hooks across every container menu type
* Block place/break/grow/burn/spread/from-to hooks across the
full tile family
* Bed enter/leave, sign change, entity damage/death, ender pearl
teleport hooks
Regression fixes preserved while applying donor diffs:
* ServerPlayer::die() retains the LCE-Revelations hardcore branch
(setGameMode(ADVENTURE) + banPlayerForHardcoreDeath) in both the
FourKit and non-FourKit code paths
* ServerLevel::entityAdded() retains the sub-entity ID reassignment
loop required by the client's handleAddMob offset, fixing Ender
Dragon and Wither boss multi-part hit detection
* LivingEntity::travel() retains the raw Player* cast and the
cached frictionTile, both Revelations perf wins that the donor
silently reverted
* ServerLogger.cpp keeps the file-logging code donor stripped
* PlayerList.cpp end portal transition fix and UIScene_EndPoem
bounds-check are intact
Build system:
* Top-level CMakeLists.txt adds the Minecraft.Server.FourKit
subdirectory and pulls in the new shared cmake/ServerTarget.cmake
helper
* Minecraft.Server/cmake/sources/Common.cmake is now location
independent (uses CMAKE_CURRENT_LIST_DIR) so the source list
can be consumed from either server target's CMakeLists.txt
* The seven FourKit*.cpp/h files live in their own
_MINECRAFT_SERVER_COMMON_SERVER_FOURKIT variable so the
standalone target omits them
* configure-time .NET 10 SDK check fails fast with a clear
download link if the SDK is missing
* global.json pins the SDK to 10.0.100 with latestFeature
rollforward
Sample plugin (samples/HelloPlugin/) demonstrates the loader and
the PlayerJoinEvent listener pattern.
CI:
* nightly.yml builds both server flavours, ships
LCE-Revelations-Server-Win64.zip and
LCE-Revelations-Server-Win64-FourKit.zip, attests both, and
updates release notes for the dual-flavour layout
* pull-request.yml pulls in actions/setup-dotnet so the FourKit
publish step works in PR validation
* All zip artifacts and the client zip are renamed from
LCREWindows64 to LCE-Revelations-{Client,Server}-Win64
Documentation:
* COMPILE.md gets a VS 2022 quick start, .NET 10 prereq section,
server flavours explanation, and a troubleshooting section
* docs/FOURKIT_PORT_RECON.md captures the file-by-file recon that
drove the port
* docs/FOURKIT_PARITY.md is the canonical reference for which
events FourKit fires
Docker:
* docker-compose.dedicated-server.yml MC_RUNTIME_DIR default points
at the vanilla CMake output. The FourKit Docker image is
intentionally NOT shipped yet because hosting .NET 10 self
contained inside Wine has not been smoke-tested
This commit is contained in:
@@ -40,8 +40,8 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
$source = "./build/windows64/Minecraft.Client/Release"
|
||||
$zip = "LCREWindows64.zip"
|
||||
$topLevel = "LCREWindows64"
|
||||
$zip = "LCE-Revelations-Client-Win64.zip"
|
||||
$topLevel = "LCE-Revelations-Client-Win64"
|
||||
|
||||
# Collect files, excluding unwanted extensions
|
||||
$files = Get-ChildItem -Path $source -Recurse -File |
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path staging
|
||||
Copy-Item LCREWindows64.zip staging/
|
||||
Copy-Item LCE-Revelations-Client-Win64.zip staging/
|
||||
Copy-Item ./build/windows64/Minecraft.Client/Release/Minecraft.Client.exe staging/
|
||||
|
||||
- name: Upload artifacts
|
||||
@@ -101,6 +101,11 @@ jobs:
|
||||
- name: Setup CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Run CMake
|
||||
uses: lukka/run-cmake@v10
|
||||
env:
|
||||
@@ -108,14 +113,49 @@ jobs:
|
||||
with:
|
||||
configurePreset: windows64
|
||||
buildPreset: windows64-release
|
||||
buildPresetAdditionalArgs: "['--target', 'Minecraft.Server']"
|
||||
buildPresetAdditionalArgs: "['--target', 'Minecraft.Server', '--target', 'Minecraft.Server.FourKit']"
|
||||
|
||||
- name: Zip Build
|
||||
- name: Zip Build (vanilla)
|
||||
shell: pwsh
|
||||
run: |
|
||||
$source = "./build/windows64/Minecraft.Server/Release"
|
||||
$zip = "LCREServerWindows64.zip"
|
||||
$topLevel = "LCREServerWindows64"
|
||||
$zip = "LCE-Revelations-Server-Win64.zip"
|
||||
$topLevel = "LCE-Revelations-Server-Win64"
|
||||
|
||||
$files = Get-ChildItem -Path $source -Recurse -File |
|
||||
Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' }
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
$basePath = (Resolve-Path $source).Path
|
||||
$fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create)
|
||||
try {
|
||||
$archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create)
|
||||
try {
|
||||
Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object {
|
||||
$rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
||||
$archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null
|
||||
}
|
||||
foreach ($file in $files) {
|
||||
$rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
||||
$entryName = "$topLevel/$($rel -replace '\\','/')"
|
||||
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
|
||||
$archive, $file.FullName, $entryName,
|
||||
[System.IO.Compression.CompressionLevel]::Optimal
|
||||
) | Out-Null
|
||||
}
|
||||
} finally { $archive.Dispose() }
|
||||
} finally { $fs.Dispose() }
|
||||
|
||||
Write-Host "Created $zip"
|
||||
|
||||
- name: Zip Build (FourKit)
|
||||
shell: pwsh
|
||||
run: |
|
||||
$source = "./build/windows64/Minecraft.Server.FourKit/Release"
|
||||
$zip = "LCE-Revelations-Server-Win64-FourKit.zip"
|
||||
$topLevel = "LCE-Revelations-Server-Win64-FourKit"
|
||||
|
||||
$files = Get-ChildItem -Path $source -Recurse -File |
|
||||
Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' }
|
||||
@@ -149,7 +189,8 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path staging
|
||||
Copy-Item LCREServerWindows64.zip staging/
|
||||
Copy-Item LCE-Revelations-Server-Win64.zip staging/
|
||||
Copy-Item LCE-Revelations-Server-Win64-FourKit.zip staging/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v6
|
||||
@@ -176,7 +217,8 @@ jobs:
|
||||
uses: actions/attest-build-provenance@v2
|
||||
with:
|
||||
subject-path: |
|
||||
artifacts/LCREServerWindows64.zip
|
||||
artifacts/LCE-Revelations-Server-Win64.zip
|
||||
artifacts/LCE-Revelations-Server-Win64-FourKit.zip
|
||||
|
||||
- name: Get short SHA
|
||||
id: sha
|
||||
@@ -213,7 +255,11 @@ jobs:
|
||||
--title "Server: ${{ steps.sha.outputs.short }}" \
|
||||
--notes "Dedicated Server runtime for Windows64.
|
||||
|
||||
Download \`LCREServerWindows64.zip\` and extract it to a folder where you'd like to keep the server runtime." \
|
||||
Two flavours are attached:
|
||||
- \`LCE-Revelations-Server-Win64.zip\`: vanilla server, no plugin support, smallest download.
|
||||
- \`LCE-Revelations-Server-Win64-FourKit.zip\`: server with the FourKit plugin host, bundled .NET 10 runtime, and an empty \`plugins/\` folder ready for plugin authors to drop DLLs into.
|
||||
|
||||
Pick the flavour you want and extract it to a folder where you'd like to keep the server runtime." \
|
||||
--latest=false
|
||||
|
||||
release-client:
|
||||
@@ -235,7 +281,7 @@ jobs:
|
||||
uses: actions/attest-build-provenance@v2
|
||||
with:
|
||||
subject-path: |
|
||||
artifacts/LCREWindows64.zip
|
||||
artifacts/LCE-Revelations-Client-Win64.zip
|
||||
artifacts/Minecraft.Client.exe
|
||||
|
||||
- name: Get short SHA
|
||||
@@ -270,15 +316,15 @@ jobs:
|
||||
cat > notes.md <<'NOTES'
|
||||
# Instructions:
|
||||
**Newcomers:**
|
||||
- If this is your first time, download `LCREWindows64.zip` and extract it wherever you would like to keep it.
|
||||
- If this is your first time, download `LCE-Revelations-Client-Win64.zip` and extract it wherever you would like to keep it.
|
||||
- I would recommend to set your username prior to launch (create a file called `username.txt`, put your desired username into the file, and save).
|
||||
- To play, simply run `Minecraft.Client.exe`.
|
||||
|
||||
**For those that wish to update their existing installation with the latest build:**
|
||||
- Download `Minecraft.Client.exe` and `Minecraft.Client.pdb` and copy them over to your existing LCREWindows64 build (overwrite your old version of Minecraft.Client.exe and Minecraft.Client.pdb).
|
||||
- Download `Minecraft.Client.exe` and `Minecraft.Client.pdb` and copy them over to your existing LCE-Revelations-Client-Win64 build (overwrite your old version of Minecraft.Client.exe and Minecraft.Client.pdb).
|
||||
|
||||
**Steam Deck & Linux:**
|
||||
- Y'all know the drill. Download the `LCREWindows64.zip`, extract it, add the `Minecraft.Client.exe` as a "Non-Steam Game" within the Steam library, turn on compatibility mode with Proton Experimental, and then run it!
|
||||
- Y'all know the drill. Download the `LCE-Revelations-Client-Win64.zip`, extract it, add the `Minecraft.Client.exe` as a "Non-Steam Game" within the Steam library, turn on compatibility mode with Proton Experimental, and then run it!
|
||||
|
||||
# Multiplayer instructions:
|
||||
LAN games are natively supported, and any LAN games will appear automatically on the right. However, if you'd like to play with your friends online (and if you don't want to require them to setup a vpn, and/or if you don't want to port forward), I would recommend the following setup. Please keep in mind, you do NOT need to do this to enjoy the game. This is just how I have it setup for me so my friends can join without any hassle:
|
||||
@@ -289,7 +335,7 @@ jobs:
|
||||
|
||||
How-to:
|
||||
- Ensure your playit.gg agent is connected to your playit.gg account
|
||||
- On the playit.gg website, setup a new tunnel (choose TCP). Ensure the configurable settings are set to the below values, assuming your agent is installed on the same computer as your online LCREMinecraft game is hosted from.
|
||||
- On the playit.gg website, setup a new tunnel (choose TCP). Ensure the configurable settings are set to the below values, assuming your agent is installed on the same computer as your online LCE Revelations game is hosted from.
|
||||
- Configurable settings:
|
||||
- Local IP: `127.0.0.1`
|
||||
- Local Port: `25565`
|
||||
|
||||
@@ -22,7 +22,12 @@ jobs:
|
||||
|
||||
- name: Setup CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Run CMake
|
||||
uses: lukka/run-cmake@v10
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user