mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-21 21:24:30 +00:00
44fd4416e58f38e560bbdbe4fcad3cc8e19fac16
- Inject items before Original_CreativeStaticCtor so TabSpec constructors include mod items when calculating m_staticItems and m_pages - Add UpdateTabPageCounts() to recalculate TabSpec page counts after staticCtor as safety measure (handles different binary layouts) - Resolve specs symbol for TabSpec array access - Add diagnostic logging for ItemInstance vtable, shared_ptr, vector sizes
Add main menu overlay, creative inventory injection, mod discovery, logging, and Wine/Proton support
LegacyForge
An SKSE-style mod loader for Minecraft Legacy Edition. LegacyForge injects into the game process at runtime, hooks key engine functions, and hosts the .NET runtime to load C# mods. Zero game source modifications required.
How It Works
- LegacyForge.exe launches the game in a suspended state and injects
LegacyForgeRuntime.dll - The runtime DLL uses PDB debug symbols to locate game functions (
MinecraftWorld_RunStaticCtors,Minecraft::tick, etc.) - MinHook detours those functions to insert mod lifecycle callbacks
- The .NET CoreCLR runtime is hosted inside the game process via hostfxr
LegacyForge.Corediscovers and loads C# mod assemblies from themods/folder- Mods use the
LegacyForge.APIto register blocks, items, entities, and subscribe to game events using Fabric-style namespaced string IDs
Project Structure
ModLoader/
├── LegacyForge.Launcher/ C# launcher (the exe users run)
├── LegacyForgeRuntime/ C++ DLL (injected into game process)
├── LegacyForge.Core/ C# mod management (loaded inside game)
├── LegacyForge.API/ C# mod API (what mod authors reference)
└── ExampleMod/ Sample mod for reference
Building
Prerequisites
- Visual Studio 2022 or later (with C++ and .NET workloads)
- .NET 8.0 SDK or later
- CMake 3.24 or later
- The game must be compiled with PDB generation
Build Steps
C++ Runtime DLL:
cd LegacyForgeRuntime
cmake -B build -A x64
cmake --build build --config Release
C# Projects:
dotnet build LegacyForge.sln
Usage
- Build LegacyForge (see above)
- Copy the output files to a folder:
LegacyForge.exeLegacyForgeRuntime.dllLegacyForge.Core.dllLegacyForge.API.dll
- Create a
mods/folder and drop mod DLLs in it - Run
LegacyForge.exe-- it will ask for the game exe path on first launch - The game starts with mods loaded
Writing a Mod
Create a new .NET 8 class library and reference LegacyForge.API:
using LegacyForge.API;
[Mod("mymod", Name = "My Mod", Version = "1.0.0", Author = "You")]
public class MyMod : IMod
{
public void OnInitialize()
{
var myBlock = Registry.Block.Register("mymod:cool_block",
new BlockProperties()
.Material(MaterialType.Stone)
.Hardness(2.0f)
.Resistance(10f));
Logger.Info("My Mod loaded!");
}
}
Build it, copy the DLL to mods/, and launch via LegacyForge.
License
Languages
C++
72.6%
C#
26.8%
CMake
0.6%