feat(modloader): pdb mapping, dynamic invoke, mixins

This commit is contained in:
Jacobwasbeast
2026-03-10 17:45:25 -05:00
parent 70dbff3fac
commit be327befa4
34 changed files with 2535 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ namespace ExampleMod;
Description = "A sample mod demonstrating the WeaveLoader API")]
public class ExampleMod : IMod
{
private static nint s_currentLevel;
private static bool s_hasLevel;
public static RegisteredBlock? RubyOre;
public static RegisteredBlock? RubyStone;
public static RegisteredBlock? RubyWoodPlanks;
@@ -189,6 +191,17 @@ public class ExampleMod : IMod
public void OnInitialize()
{
GameEvents.OnWorldLoaded += (_, e) =>
{
s_currentLevel = e.NativeLevelPointer;
s_hasLevel = s_currentLevel != 0;
};
GameEvents.OnWorldUnloaded += (_, __) =>
{
s_currentLevel = 0;
s_hasLevel = false;
};
RubyOre = Registry.Block.Register("examplemod:ruby_ore",
new BlockProperties()
.Material(MaterialType.Stone)
@@ -391,4 +404,10 @@ public class ExampleMod : IMod
{
Logger.Info("Example Mod shutting down.");
}
internal static bool TryGetCurrentLevel(out nint levelPtr)
{
levelPtr = s_currentLevel;
return s_hasLevel && levelPtr != 0;
}
}