mirror of
https://github.com/BluTac10/Xbox-Neo.git
synced 2026-05-26 21:04:38 +00:00
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
82 lines
4.6 KiB
C++
82 lines
4.6 KiB
C++
#pragma once
|
|
|
|
|
|
namespace FourKitBridge
|
|
{
|
|
// core
|
|
void __cdecl NativeDamagePlayer(int entityId, float amount);
|
|
void __cdecl NativeSetPlayerHealth(int entityId, float health);
|
|
void __cdecl NativeTeleportPlayer(int entityId, double x, double y, double z);
|
|
void __cdecl NativeSetPlayerGameMode(int entityId, int gameMode);
|
|
void __cdecl NativeBroadcastMessage(const char *utf8, int len);
|
|
void __cdecl NativeSetFallDistance(int entityId, float distance);
|
|
void __cdecl NativeGetPlayerSnapshot(int entityId, double *outData);
|
|
void __cdecl NativeSendMessage(int entityId, const char *utf8, int len);
|
|
void __cdecl NativeSetWalkSpeed(int entityId, float speed);
|
|
void __cdecl NativeTeleportEntity(int entityId, int dimId, double x, double y, double z);
|
|
|
|
// World
|
|
int __cdecl NativeGetTileId(int dimId, int x, int y, int z);
|
|
int __cdecl NativeGetTileData(int dimId, int x, int y, int z);
|
|
void __cdecl NativeSetTile(int dimId, int x, int y, int z, int tileId, int data);
|
|
void __cdecl NativeSetTileData(int dimId, int x, int y, int z, int data);
|
|
int __cdecl NativeBreakBlock(int dimId, int x, int y, int z);
|
|
int __cdecl NativeGetHighestBlockY(int dimId, int x, int z);
|
|
void __cdecl NativeGetWorldInfo(int dimId, double *outBuf);
|
|
void __cdecl NativeSetWorldTime(int dimId, int64_t time);
|
|
void __cdecl NativeSetWeather(int dimId, int storm, int thundering, int thunderDuration);
|
|
int __cdecl NativeCreateExplosion(int dimId, double x, double y, double z, float power, int setFire, int breakBlocks);
|
|
int __cdecl NativeStrikeLightning(int dimId, double x, double y, double z, int effectOnly);
|
|
int __cdecl NativeSetSpawnLocation(int dimId, int x, int y, int z);
|
|
void __cdecl NativeDropItem(int dimId, double x, double y, double z, int itemId, int count, int auxValue, int naturally);
|
|
|
|
// plr
|
|
void __cdecl NativeKickPlayer(int entityId, int reason);
|
|
int __cdecl NativeBanPlayer(int entityId, const char *reasonUtf8, int reasonByteLen);
|
|
int __cdecl NativeBanPlayerIp(int entityId, const char *reasonUtf8, int reasonByteLen);
|
|
int __cdecl NativeGetPlayerAddress(int entityId, char* outIpBuf, int outIpBufSize, int* outPort);
|
|
int __cdecl NativeGetPlayerLatency(int entityId);
|
|
|
|
//plr connection
|
|
int __cdecl NativeSendRaw(int entityId, unsigned char* dataBuf, int dataBufSize);
|
|
|
|
// inv
|
|
void __cdecl NativeGetPlayerInventory(int entityId, int *outData);
|
|
void __cdecl NativeSetPlayerInventorySlot(int entityId, int slot, int itemId, int count, int aux);
|
|
void __cdecl NativeGetContainerContents(int entityId, int *outData, int maxSlots);
|
|
void __cdecl NativeSetContainerSlot(int entityId, int slot, int itemId, int count, int aux);
|
|
void __cdecl NativeGetContainerViewerEntityIds(int entityId, int *outIds, int maxCount, int *outCount);
|
|
void __cdecl NativeCloseContainer(int entityId);
|
|
void __cdecl NativeOpenVirtualContainer(int entityId, int nativeType, const char *titleUtf8, int titleByteLen, int slotCount, int *itemsBuf);
|
|
int __cdecl NativeGetItemMeta(int entityId, int slot, char *outBuf, int bufSize);
|
|
void __cdecl NativeSetItemMeta(int entityId, int slot, const char *inBuf, int bufSize);
|
|
void __cdecl NativeSetHeldItemSlot(int entityId, int slot);
|
|
|
|
// ent
|
|
void __cdecl NativeSetSneaking(int entityId, int sneak);
|
|
void __cdecl NativeSetVelocity(int entityId, double x, double y, double z);
|
|
void __cdecl NativeSetAllowFlight(int entityId, int allowFlight);
|
|
void __cdecl NativePlaySound(int entityId, int soundId, double x, double y, double z, float volume, float pitch);
|
|
void __cdecl NativeSetSleepingIgnored(int entityId, int ignored);
|
|
|
|
// x[p&food
|
|
void __cdecl NativeSetLevel(int entityId, int level);
|
|
void __cdecl NativeSetExp(int entityId, float exp);
|
|
void __cdecl NativeGiveExp(int entityId, int amount);
|
|
void __cdecl NativeGiveExpLevels(int entityId, int amount);
|
|
void __cdecl NativeSetFoodLevel(int entityId, int foodLevel);
|
|
void __cdecl NativeSetSaturation(int entityId, float saturation);
|
|
void __cdecl NativeSetExhaustion(int entityId, float exhaustion);
|
|
|
|
// particle
|
|
void __cdecl NativeSpawnParticle(int entityId, int particleId, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float speed, int count);
|
|
|
|
// vehicle
|
|
int __cdecl NativeSetPassenger(int entityId, int passengerEntityId);
|
|
int __cdecl NativeLeaveVehicle(int entityId);
|
|
int __cdecl NativeEject(int entityId);
|
|
int __cdecl NativeGetVehicleId(int entityId);
|
|
int __cdecl NativeGetPassengerId(int entityId);
|
|
void __cdecl NativeGetEntityInfo(int entityId, double *outData);
|
|
}
|