mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-07 21:43:09 +00:00
- Add GameObjectFactory: create actual Tile/TileItem/Item objects via PDB symbols
- Fix IdRegistry ID ranges: BLOCK_MOD_START=174, ITEM_MOD_START=3000
- Add icon parameter to item registration (API, NativeInterop, NativeExports)
- Use protected (IEAA/MEAA) decorated names for Tile/Item constructors
- Lazy-dereference Material/SoundType pointers (NULL until staticCtor runs)
- CrashHandler: skip __debugbreak() from game exe so missing texture fallback runs
- ExampleMod: add .Icon("ruby") to item registration
69 lines
2.7 KiB
C#
69 lines
2.7 KiB
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace LegacyForge.API;
|
|
|
|
/// <summary>
|
|
/// Internal P/Invoke bindings to LegacyForgeRuntime.dll native exports.
|
|
/// Mod authors should use the Registry and Logger classes instead of calling these directly.
|
|
/// </summary>
|
|
internal static class NativeInterop
|
|
{
|
|
private const string RuntimeDll = "LegacyForgeRuntime";
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_register_block(
|
|
string namespacedId,
|
|
int materialId,
|
|
float hardness,
|
|
float resistance,
|
|
int soundType,
|
|
string iconName,
|
|
float lightEmission,
|
|
int lightBlock);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_register_item(
|
|
string namespacedId,
|
|
int maxStackSize,
|
|
int maxDamage,
|
|
string iconName);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_register_entity(
|
|
string namespacedId,
|
|
float width,
|
|
float height,
|
|
int trackingRange);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern void native_add_shaped_recipe(
|
|
string resultId,
|
|
int resultCount,
|
|
string pattern,
|
|
string ingredientIds);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern void native_add_furnace_recipe(
|
|
string inputId,
|
|
string outputId,
|
|
float xp);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern void native_log(string message, int level);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_get_block_id(string namespacedId);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_get_item_id(string namespacedId);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern int native_get_entity_id(string namespacedId);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
|
internal static extern void native_subscribe_event(string eventName, IntPtr managedFnPtr);
|
|
|
|
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
|
|
internal static extern void native_add_to_creative(int numericId, int count, int auxValue, int groupIndex);
|
|
}
|